Skip to content

Commit

Permalink
Update plot_huggingface_model.py
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Jul 27, 2024
1 parent 3c55854 commit f43d842
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions examples/plot_huggingface_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def plot_quantiles_by_latlon(df, quantiles):
slider = alt.binding_range(
min=0,
max=1,
step=1 / (len(quantiles) - 1),
step=0.5 if len(quantiles) == 1 else 1 / (len(quantiles) - 1),
name="Quantile:",
)

Expand Down Expand Up @@ -178,7 +178,7 @@ def plot_quantiles_by_latlon(df, quantiles):
alt.Tooltip("index:N", title="Row ID"),
alt.Tooltip("Latitude:Q", format=".2f", title="Latitude"),
alt.Tooltip("Longitude:Q", format=".2f", title="Longitude"),
alt.Tooltip("value:Q", format=",.0f", title="Predicted Value"),
alt.Tooltip("value:Q", format="$,.0f", title="Predicted Value"),
],
)
.properties(
Expand Down Expand Up @@ -206,8 +206,7 @@ def plot_quantiles_by_latlon(df, quantiles):
shutil.rmtree(local_dir)

# Estimate quantiles.
n_quantiles = 11
quantiles = list((np.arange(n_quantiles) * 10) / 100)
quantiles = list((np.arange(11) * 10) / 100)
X, y = datasets.fetch_california_housing(as_frame=True, return_X_y=True)
y_pred = qrf.predict(X, quantiles=quantiles) * 100_000 # predict in dollars

Expand Down

0 comments on commit f43d842

Please sign in to comment.