Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Apr 10, 2024
1 parent 2132641 commit 9100b59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions docs/user_guide/fit_predict.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ The predictions of a standard random forest can also be recovered from a quantil
>>> np.allclose(y_pred_rf, y_pred_qrf)
True

Predicting with User-Specified Functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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`.
16 changes: 10 additions & 6 deletions examples/plot_predict_custom.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
Calculating User-Specified Functions with QRFs
==============================================
Computing User-Specified Functions with QRFs
============================================
An example that demonstrates a way of extracting the empirical distribution
from a quantile regression forest (QRF) for one or more samples in order to
Expand Down Expand Up @@ -46,7 +46,7 @@ def predict(reg, X, quantiles=0.5, what=None):
if what is None:
return reg.predict(X, quantiles=quantiles)

# Get the complete set of proximities for each sample.
# Get the complete set of proximities (training indices) for each sample.
proximities = reg.proximity_counts(X)

# Retrieve the unsorted training responses from the model (stored in sorted order).
Expand Down Expand Up @@ -95,7 +95,7 @@ def plot_ecdf(df):

circles = (
alt.Chart(df)
.mark_circle(color="#006aff")
.mark_circle(color="#006aff", opacity=1, size=50)
.encode(
x=alt.X("y_value", title="Response Value"),
y=alt.Y("probability", title="Probability"),
Expand All @@ -105,7 +105,7 @@ def plot_ecdf(df):

lines = (
alt.Chart(df)
.mark_line(color="#006aff")
.mark_line(color="#006aff", size=2)
.encode(
x=alt.X("y_value", title="Response Value"),
x2=alt.X2("y_value2"),
Expand All @@ -114,7 +114,11 @@ def plot_ecdf(df):
)
)

chart = (circles + lines).properties(height=400, width=650)
chart = (circles + lines).properties(
height=400,
width=650,
title="Empirical Cumulative Distribution Function (ECDF) Plot",
)
return chart


Expand Down

0 comments on commit 9100b59

Please sign in to comment.