Skip to content

Commit

Permalink
deploy: 830f492
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Aug 17, 2024
1 parent deafa73 commit 30a3d13
Show file tree
Hide file tree
Showing 32 changed files with 126 additions and 131 deletions.
14 changes: 6 additions & 8 deletions _sources/gallery/plot_huggingface_model.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ of each sample. The model used is available on Hugging Face Hub
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.utils.validation import check_random_state
from skops import hub_utils

import quantile_forest
Expand All @@ -46,7 +45,7 @@ of each sample. The model used is available on Hugging Face Hub
repo_id = "quantile-forest/california-housing-example"
load_existing = True

random_state = check_random_state(0)
random_state = np.random.RandomState(0)
quantiles = np.linspace(0, 1, num=5, endpoint=True).round(2).tolist()
sample_frac = 1

Expand Down Expand Up @@ -190,13 +189,13 @@ of each sample. The model used is available on Hugging Face Hub
def plot_quantiles_by_latlon(df, quantiles, color_scheme="cividis"):
# Slider for varying the displayed quantile estimates.
slider = alt.binding_range(
name="Predicted Quantile: ",
min=0,
max=1,
step=0.5 if len(quantiles) == 1 else 1 / (len(quantiles) - 1),
name="Predicted Quantile: ",
)

quantile_val = alt.param(value=0.5, bind=slider, name="quantile")
quantile_val = alt.param(name="quantile", value=0.5, bind=slider)

chart = (
alt.Chart(df)
Expand Down Expand Up @@ -250,7 +249,6 @@ of each sample. The model used is available on Hugging Face Hub
import numpy as np
import pandas as pd
from sklearn import datasets
from sklearn.utils.validation import check_random_state
from skops import hub_utils
import quantile_forest
Expand All @@ -262,7 +260,7 @@ of each sample. The model used is available on Hugging Face Hub
repo_id = "quantile-forest/california-housing-example"
load_existing = True
random_state = check_random_state(0)
random_state = np.random.RandomState(0)
quantiles = np.linspace(0, 1, num=5, endpoint=True).round(2).tolist()
sample_frac = 1
Expand Down Expand Up @@ -406,13 +404,13 @@ of each sample. The model used is available on Hugging Face Hub
def plot_quantiles_by_latlon(df, quantiles, color_scheme="cividis"):
# Slider for varying the displayed quantile estimates.
slider = alt.binding_range(
name="Predicted Quantile: ",
min=0,
max=1,
step=0.5 if len(quantiles) == 1 else 1 / (len(quantiles) - 1),
name="Predicted Quantile: ",
)
quantile_val = alt.param(value=0.5, bind=slider, name="quantile")
quantile_val = alt.param(name="quantile", value=0.5, bind=slider)
chart = (
alt.Chart(df)
Expand Down
10 changes: 4 additions & 6 deletions _sources/gallery/plot_predict_custom.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,10 @@ this scenario, we compute the empirical cumulative distribution function
import scipy as sp
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.utils.validation import check_random_state

from quantile_forest import RandomForestQuantileRegressor

random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_test_samples = 100


Expand Down Expand Up @@ -118,7 +117,7 @@ this scenario, we compute the empirical cumulative distribution function
max_idx = df["index"].max()

# Slider for determining the sample index for which the custom function is being visualized.
slider = alt.binding_range(min=min_idx, max=max_idx, step=1, name="Test Sample Index: ")
slider = alt.binding_range(name="Test Sample Index: ", min=min_idx, max=max_idx, step=1)
index_selection = alt.selection_point(
value=0,
bind=slider,
Expand Down Expand Up @@ -192,11 +191,10 @@ this scenario, we compute the empirical cumulative distribution function
import scipy as sp
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.utils.validation import check_random_state
from quantile_forest import RandomForestQuantileRegressor
random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_test_samples = 100
Expand Down Expand Up @@ -279,7 +277,7 @@ this scenario, we compute the empirical cumulative distribution function
max_idx = df["index"].max()
# Slider for determining the sample index for which the custom function is being visualized.
slider = alt.binding_range(min=min_idx, max=max_idx, step=1, name="Test Sample Index: ")
slider = alt.binding_range(name="Test Sample Index: ", min=min_idx, max=max_idx, step=1)
index_selection = alt.selection_point(
value=0,
bind=slider,
Expand Down
8 changes: 4 additions & 4 deletions _sources/gallery/plot_proximity_counts.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ conditions.

from quantile_forest import RandomForestQuantileRegressor

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

Expand Down Expand Up @@ -144,7 +144,7 @@ conditions.
subplot_dim = (width - subplot_spacing * (n_subplot_rows - 1)) / n_subplot_rows

# Slider for determining the test index for which the data is being visualized.
slider = alt.binding_range(min=0, max=n_samples - 1, step=1, name="Test Sample Index: ")
slider = alt.binding_range(name="Test Sample Index: ", min=0, max=n_samples - 1, step=1)
index_selection = alt.selection_point(value=0, bind=slider, fields=["index"])

scale = alt.Scale(domain=[x_min, x_max], scheme="greys")
Expand Down Expand Up @@ -257,7 +257,7 @@ conditions.
from quantile_forest import RandomForestQuantileRegressor
random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_test_samples = 25
noise_std = 0.1
Expand Down Expand Up @@ -364,7 +364,7 @@ conditions.
subplot_dim = (width - subplot_spacing * (n_subplot_rows - 1)) / n_subplot_rows
# Slider for determining the test index for which the data is being visualized.
slider = alt.binding_range(min=0, max=n_samples - 1, step=1, name="Test Sample Index: ")
slider = alt.binding_range(name="Test Sample Index: ", min=0, max=n_samples - 1, step=1)
index_selection = alt.selection_point(value=0, bind=slider, fields=["index"])
scale = alt.Scale(domain=[x_min, x_max], scheme="greys")
Expand Down
18 changes: 8 additions & 10 deletions _sources/gallery/plot_quantile_conformalized.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ by Carl McBride Ellis.
import pandas as pd
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.utils.validation import check_random_state

from quantile_forest import RandomForestQuantileRegressor

random_seed = 0
random_state = check_random_state(random_seed)
random_state = np.random.RandomState(random_seed)

n_samples = 900
coverages = np.linspace(0, 1, num=11, endpoint=True).round(1).tolist() # the "coverage level"
Expand Down Expand Up @@ -173,10 +172,10 @@ by Carl McBride Ellis.
def plot_prediction_intervals_by_strategy(df):
def plot_prediction_intervals(df, domain):
# Slider for varying the target coverage level.
slider = alt.binding_range(min=0, max=1, step=0.1, name="Coverage Target: ")
coverage_val = alt.param(value=0.9, bind=slider, name="coverage")
slider = alt.binding_range(name="Coverage Target: ", min=0, max=1, step=0.1)
coverage_val = alt.param(name="coverage", value=0.9, bind=slider)

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

tooltip = [
alt.Tooltip("y_test:Q", format="$,d", title="True Price"),
Expand Down Expand Up @@ -312,12 +311,11 @@ by Carl McBride Ellis.
import pandas as pd
from sklearn import datasets
from sklearn.model_selection import train_test_split
from sklearn.utils.validation import check_random_state
from quantile_forest import RandomForestQuantileRegressor
random_seed = 0
random_state = check_random_state(random_seed)
random_state = np.random.RandomState(random_seed)
n_samples = 900
coverages = np.linspace(0, 1, num=11, endpoint=True).round(1).tolist() # the "coverage level"
Expand Down Expand Up @@ -452,10 +450,10 @@ by Carl McBride Ellis.
def plot_prediction_intervals_by_strategy(df):
def plot_prediction_intervals(df, domain):
# Slider for varying the target coverage level.
slider = alt.binding_range(min=0, max=1, step=0.1, name="Coverage Target: ")
coverage_val = alt.param(value=0.9, bind=slider, name="coverage")
slider = alt.binding_range(name="Coverage Target: ", min=0, max=1, step=0.1)
coverage_val = alt.param(name="coverage", value=0.9, bind=slider)
click = alt.selection_point(fields=["y_label"], bind="legend")
click = alt.selection_point(bind="legend", fields=["y_label"])
tooltip = [
alt.Tooltip("y_test:Q", format="$,d", title="True Price"),
Expand Down
4 changes: 2 additions & 2 deletions _sources/gallery/plot_quantile_example.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ samples.

from quantile_forest import RandomForestQuantileRegressor

random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_samples = 1000
bounds = [0, 10]
quantiles = [0.025, 0.5, 0.975]
Expand Down Expand Up @@ -170,7 +170,7 @@ samples.
from quantile_forest import RandomForestQuantileRegressor
random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_samples = 1000
bounds = [0, 10]
quantiles = [0.025, 0.5, 0.975]
Expand Down
4 changes: 2 additions & 2 deletions _sources/gallery/plot_quantile_extrapolation.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ adapted from `"Extrapolation-Aware Nonparametric Statistical Inference"

from quantile_forest import RandomForestQuantileRegressor

random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_samples = 500
bounds = [0, 15]
extrap_frac = 0.25
Expand Down Expand Up @@ -584,7 +584,7 @@ adapted from `"Extrapolation-Aware Nonparametric Statistical Inference"
from quantile_forest import RandomForestQuantileRegressor
random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_samples = 500
bounds = [0, 15]
extrap_frac = 0.25
Expand Down
22 changes: 10 additions & 12 deletions _sources/gallery/plot_quantile_interpolation.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ handled when a quantile does not exactly match a data point.
import altair as alt
import numpy as np
import pandas as pd
from sklearn.utils.validation import check_random_state

from quantile_forest import RandomForestQuantileRegressor

random_state = check_random_state(0)
random_state = np.random.RandomState(0)
intervals = np.linspace(0, 1, num=101, endpoint=True).round(2).tolist()

# Create toy dataset.
Expand Down Expand Up @@ -95,10 +94,10 @@ handled when a quantile does not exactly match a data point.

def plot_interpolations(df, legend):
# Slider for varying the prediction interval that determines the quantiles being interpolated.
slider = alt.binding_range(min=0, max=1, step=0.01, name="Prediction Interval: ")
interval_val = alt.param(value=0.9, bind=slider, name="interval")
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)

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

color = alt.condition(
click,
Expand Down Expand Up @@ -164,7 +163,7 @@ handled when a quantile does not exactly match a data point.
header=alt.Header(labelOrient="bottom", titleOrient="bottom"),
title="Samples (Feature Values)",
),
title="QRF Prediction Intervals by Quantile Interpolation on Toy Dataset",
title="QRF Predictions by Quantile Interpolation on Toy Dataset",
)
.configure_facet(spacing=15)
.configure_range(category=alt.RangeScheme(list(legend.values())))
Expand All @@ -186,11 +185,10 @@ handled when a quantile does not exactly match a data point.
import altair as alt
import numpy as np
import pandas as pd
from sklearn.utils.validation import check_random_state
from quantile_forest import RandomForestQuantileRegressor
random_state = check_random_state(0)
random_state = np.random.RandomState(0)
intervals = np.linspace(0, 1, num=101, endpoint=True).round(2).tolist()
# Create toy dataset.
Expand Down Expand Up @@ -253,10 +251,10 @@ handled when a quantile does not exactly match a data point.
def plot_interpolations(df, legend):
# Slider for varying the prediction interval that determines the quantiles being interpolated.
slider = alt.binding_range(min=0, max=1, step=0.01, name="Prediction Interval: ")
interval_val = alt.param(value=0.9, bind=slider, name="interval")
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)
click = alt.selection_point(fields=["method"], bind="legend")
click = alt.selection_point(bind="legend", fields=["method"], on="click")
color = alt.condition(
click,
Expand Down Expand Up @@ -322,7 +320,7 @@ handled when a quantile does not exactly match a data point.
header=alt.Header(labelOrient="bottom", titleOrient="bottom"),
title="Samples (Feature Values)",
),
title="QRF Prediction Intervals by Quantile Interpolation on Toy Dataset",
title="QRF Predictions by Quantile Interpolation on Toy Dataset",
)
.configure_facet(spacing=15)
.configure_range(category=alt.RangeScheme(list(legend.values())))
Expand Down
6 changes: 2 additions & 4 deletions _sources/gallery/plot_quantile_intervals.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ visualization is inspired by Figure 3 of `"Quantile Regression Forests"
import pandas as pd
from sklearn import datasets
from sklearn.model_selection import KFold
from sklearn.utils.validation import check_random_state

from quantile_forest import RandomForestQuantileRegressor

random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_samples = 1000

# Load the California Housing Prices dataset.
Expand Down Expand Up @@ -208,11 +207,10 @@ visualization is inspired by Figure 3 of `"Quantile Regression Forests"
import pandas as pd
from sklearn import datasets
from sklearn.model_selection import KFold
from sklearn.utils.validation import check_random_state
from quantile_forest import RandomForestQuantileRegressor
random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_samples = 1000
# Load the California Housing Prices dataset.
Expand Down
18 changes: 8 additions & 10 deletions _sources/gallery/plot_quantile_multioutput.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ for each target: the median line and the area defined by the interval points.
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.utils.validation import check_random_state

from quantile_forest import RandomForestQuantileRegressor

random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_samples = 2500
bounds = [0, 100]
quantiles = np.linspace(0, 1, num=41, endpoint=True).round(3).tolist()
Expand Down Expand Up @@ -91,10 +90,10 @@ for each target: the median line and the area defined by the interval points.

def plot_multitargets(df, legend):
# Slider for varying the displayed prediction intervals.
slider = alt.binding_range(min=0, max=1, step=0.05, name="Prediction Interval: ")
interval_val = alt.param(value=0.95, bind=slider, name="interval")
slider = alt.binding_range(name="Prediction Interval: ", min=0, max=1, step=0.05)
interval_val = alt.param(name="interval", value=0.95, bind=slider)

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

color = alt.condition(
click,
Expand Down Expand Up @@ -181,11 +180,10 @@ for each target: the median line and the area defined by the interval points.
import numpy as np
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.utils.validation import check_random_state
from quantile_forest import RandomForestQuantileRegressor
random_state = check_random_state(0)
random_state = np.random.RandomState(0)
n_samples = 2500
bounds = [0, 100]
quantiles = np.linspace(0, 1, num=41, endpoint=True).round(3).tolist()
Expand Down Expand Up @@ -245,10 +243,10 @@ for each target: the median line and the area defined by the interval points.
def plot_multitargets(df, legend):
# Slider for varying the displayed prediction intervals.
slider = alt.binding_range(min=0, max=1, step=0.05, name="Prediction Interval: ")
interval_val = alt.param(value=0.95, bind=slider, name="interval")
slider = alt.binding_range(name="Prediction Interval: ", min=0, max=1, step=0.05)
interval_val = alt.param(name="interval", value=0.95, bind=slider)
click = alt.selection_point(fields=["target"], bind="legend")
click = alt.selection_point(bind="legend", fields=["target"], on="click")
color = alt.condition(
click,
Expand Down
Loading

0 comments on commit 30a3d13

Please sign in to comment.