Skip to content

Commit

Permalink
Update example plots
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Sep 5, 2024
1 parent e6d7d63 commit 60d9b09
Show file tree
Hide file tree
Showing 13 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion docs/user_guide/fit_predict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,4 @@ The predictions of a standard random forest can also be recovered from a quantil
User-Specified Functions
~~~~~~~~~~~~~~~~~~~~~~~~

While a QRF is designed to estimate quantiles from the empirical distribution calculated for each sample, in many cases it may be useful to use the empirical distribution to calculate other quantities of interest. For more details, see :ref:`gallery_plot_predict_custom`.
While a QRF is designed to estimate quantiles from the empirical distribution calculated for each sample, in many cases it may be useful to use the empirical distribution to calculate other quantities of interest. For more details, see :ref:`gallery_plot_custom_functions`.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def plot_interpolation_predictions(df, legend):
"""Plot predictions by quantile interpolation methods."""
# Slider for varying the prediction interval that determines the quantiles being interpolated.
slider = alt.binding_range(name="Prediction Interval: ", min=0, max=1, step=0.01)
interval_val = alt.param(name="interval", value=0.9, bind=slider)
interval_val = alt.param(name="interval", value=0.8, bind=slider)

click = alt.selection_point(bind="legend", fields=["method"], on="click")

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from quantile_forest import RandomForestQuantileRegressor

random_state = np.random.RandomState(0)
n_test_samples = 25
n_test_samples = 50
noise_std = 0.1

pixel_dim = (8, 8) # pixel dimensions (width and height)
Expand Down Expand Up @@ -76,7 +76,12 @@ def extract_floats(combined_df, scale=1000):
# We set `max_samples_leaf=None` to ensure that every sample in the training
# data is stored in the leaf nodes. By doing this, we allow the model to
# consider all samples as potential candidates for proximity calculations.
qrf = RandomForestQuantileRegressor(max_samples_leaf=None, random_state=random_state)
qrf = RandomForestQuantileRegressor(
n_estimators=500,
max_features=1 / 3,
max_samples_leaf=None,
random_state=random_state,
)

# Fit the model to predict the non-noisy pixels from noisy pixels (i.e., to denoise).
# We fit a single multi-target model, with each pixel treated as a distinct target.
Expand Down Expand Up @@ -126,6 +131,8 @@ def plot_digits_proximities(
width=225,
):
"""Plot Digits dataset proximities for test samples."""
df = df[df["prox_idx"] < n_prox].copy()

dim_x, dim_y = pixel_dim[0], pixel_dim[1]
dgt_x, dgt_y = len(str(dim_x)), len(str(dim_y))

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 60d9b09

Please sign in to comment.