Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Feb 18, 2024
1 parent 82376fc commit 18cf5ef
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 10 deletions.
5 changes: 3 additions & 2 deletions quantile_forest/tests/examples/plot_quantile_extrapolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
An example on a toy dataset that demonstrates that the prediction intervals
produced by a quantile regression forest do not extrapolate outside of the
bounds of the data in the training set, an important limitation of the
approach.
approach. Notice that the extrapolated median and interval values fail to
accurately predict values outside of those observed in the training set.
"""

import altair as alt
Expand Down Expand Up @@ -164,7 +165,7 @@ def plot_extrapolations(df, title="", legend=False, x_domain=None, y_domain=None
"y_pred_line": {"type": "line", "color": "#006aff", "name": "Predicted Median"},
"y_pred_area": {"type": "area", "color": "#e0f2ff", "name": "Predicted 95% Interval"},
"y_extrp_line": {"type": "line", "color": "red", "name": "Extrapolated Median"},
"y_extrp_area": {"type": "area", "color": "red", "name": "Extrapolated Interval"},
"y_extrp_area": {"type": "area", "color": "red", "name": "Extrapolated 95% Interval"},
}
for k, v in data.items():
blank = alt.Chart(pd.DataFrame({k: [v["name"]]}))
Expand Down
9 changes: 7 additions & 2 deletions quantile_forest/tests/examples/plot_quantile_interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@
Comparing Quantile Interpolation Methods
========================================
An example comparison of interpolation methods that can be applied during
prediction when the desired quantile lies between two data points.
An example illustration of the interpolation methods that can be applied
during prediction when the desired quantile lies between two data points. In
this toy example, the forest estimator creates a single split that separates
samples 1–3 and samples 4–5, with quantiles calculated separately for these
two groups based on the actual sample values. The interpolation methods are
used when a calculated quantile does not precisely correspond to one of the
actual values.
"""

import altair as alt
Expand Down
4 changes: 3 additions & 1 deletion quantile_forest/tests/examples/plot_quantile_multioutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
An example on a toy dataset that demonstrates fitting a single quantile
regressor for multiple target variables. For each target, multiple quantiles
can be estimated simultaneously.
can be estimated simultaneously. In this example, the target variable has
two output values for each sample, with a single regressor used to estimate
three quantiles (the median and interval) for each target output.
"""

import altair as alt
Expand Down
9 changes: 6 additions & 3 deletions quantile_forest/tests/examples/plot_quantile_vs_standard.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
Quantile Regression Forests vs. Random Forests
==============================================
An example comparison between a quantile regression forest and a standard
random forest regressor on a synthetic, right-skewed dataset. In a right-
skewed distribution, the mean is to the right of the median.
An example comparison between the estimates generated by a quantile regression
forest and a standard random forest regressor on a synthetic, right-skewed
dataset. In a right-skewed distribution, the mean is to the right of the
median. As illustrated by a greater overlap in the frequencies of the actual
and predicted values, the median estimated by a quantile regressor can be a
more reliable estimator of a skewed distribution than the mean.
"""

import altair as alt
Expand Down
6 changes: 4 additions & 2 deletions quantile_forest/tests/examples/plot_quantile_weighting.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
An example comparison of the prediction runtime when using a quantile
regression forest with weighted and unweighted quantiles to compute the
predicted output values. A standard random forest regressor is included for
comparison.
predicted output values. While weighted and unweighted quantiles produce
identical outputs, the relative runtime of the methods depends on the number
of training samples and the total number of leaf samples used to calculate the
quantiles. A standard random forest regressor is included for comparison.
"""

import time
Expand Down

0 comments on commit 18cf5ef

Please sign in to comment.