Skip to content

Commit

Permalink
naming
Browse files Browse the repository at this point in the history
  • Loading branch information
pgasawa committed Oct 29, 2024
1 parent 51952b0 commit 15a8718
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lotus/sem_ops/cascade_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def importance_sampling(
"""Uses importance sampling and returns the list of indices from which to learn cascade thresholds."""

w = np.sqrt(proxy_scores)
is_weight = lotus.settings.is_weight
is_weight = lotus.settings.cascade_is_weight
w = is_weight * w / np.sum(w) + (1 - is_weight) * np.ones((len(proxy_scores))) / len(proxy_scores)
indices = np.arange(len(proxy_scores))
sample_size = (int) (sample_percentage * len(proxy_scores))
Expand All @@ -21,7 +21,7 @@ def importance_sampling(

def calibrate_llm_logprobs(true_probs: list[float]) -> list[float]:
"""Transforms true probabilities to calibrate LLM proxies."""
num_quantiles = lotus.settings.num_helper_lm_calibration_quantiles
num_quantiles = lotus.settings.cascade_num_calibration_quantiles
quantile_values = np.percentile(true_probs, np.linspace(0, 100, num_quantiles + 1))
true_probs = ((np.digitize(true_probs, quantile_values) - 1) / num_quantiles)
true_probs = np.clip(true_probs, 0, 1)
Expand Down
2 changes: 1 addition & 1 deletion lotus/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,4 @@ def __repr__(self) -> str:

# set defaults
settings = Settings()
settings.configure(is_weight=0.5, num_helper_lm_calibration_quantiles=50)
settings.configure(cascade_is_weight=0.5, cascade_num_calibration_quantiles=50)

0 comments on commit 15a8718

Please sign in to comment.