Skip to content

Commit

Permalink
deploy: 3c9c784
Browse files Browse the repository at this point in the history
  • Loading branch information
reidjohnson committed Sep 14, 2024
1 parent af8630f commit 5d8d10a
Show file tree
Hide file tree
Showing 10 changed files with 439 additions and 191 deletions.
375 changes: 271 additions & 104 deletions _sources/gallery/plot_qrf_huggingface_inference.rst.txt

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions _sources/gallery/plot_qrf_interpolation_methods.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ handled when a quantile does not exactly match a data point.
"method": ["Actual"] * len(y),
"X": [f"Sample {idx + 1} ({x})" for idx, x in enumerate(X.tolist())],
"y_pred": y.tolist(),
"y_pred_low": y.tolist(),
"y_pred_upp": y.tolist(),
"y_pred_low": [None] * len(y),
"y_pred_upp": [None] * len(y),
"quantile_low": [None] * len(y),
"quantile_upp": [None] * len(y),
}
Expand Down Expand Up @@ -225,8 +225,8 @@ handled when a quantile does not exactly match a data point.
"method": ["Actual"] * len(y),
"X": [f"Sample {idx + 1} ({x})" for idx, x in enumerate(X.tolist())],
"y_pred": y.tolist(),
"y_pred_low": y.tolist(),
"y_pred_upp": y.tolist(),
"y_pred_low": [None] * len(y),
"y_pred_upp": [None] * len(y),
"quantile_low": [None] * len(y),
"quantile_upp": [None] * len(y),
}
Expand Down
26 changes: 12 additions & 14 deletions _sources/gallery/plot_qrf_multitarget.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ for each target: the median line and the area defined by the interval points.
quantiles = np.linspace(0, 1, num=41, endpoint=True).round(3).tolist()

# Define functions that generate targets; each function maps to one target.
funcs = [
target_funcs = [
{
"signal": lambda x: np.log1p(x + 1),
"noise": lambda x: np.log1p(x) * random_state.uniform(size=len(x)),
Expand All @@ -49,18 +49,19 @@ for each target: the median line and the area defined by the interval points.
},
]

legend = {k: v for f in funcs for k, v in f["legend"].items()}


def make_funcs_Xy(funcs, n_samples, bounds):
"""Make a dataset from specified function(s) with signal and noise."""
"""Make a dataset from specified function(s)."""
x = np.linspace(*bounds, n_samples)
y = np.empty((len(x), len(funcs)))
for i, func in enumerate(funcs):
y[:, i] = func["signal"](x) + func["noise"](x)
y[:, i] = func(x)
return np.atleast_2d(x).T, y

funcs = [lambda x, f=f: f["signal"](x) + f["noise"](x) for f in target_funcs]
legend = {k: v for f in target_funcs for k, v in f["legend"].items()}

# Create a dataset with multiple target variables.
X, y = make_funcs_Xy(funcs, n_samples, bounds)

Expand All @@ -76,7 +77,6 @@ for each target: the median line and the area defined by the interval points.
{
"x": np.tile(X.squeeze(), len(funcs)),
"y": y.reshape(-1, order="F"),
"y_true": np.concatenate([f["signal"](X.squeeze()) for f in funcs]),
"y_pred": np.concatenate([y_pred[:, i, len(quantiles) // 2] for i in range(len(funcs))]),
"target": np.concatenate([[str(i)] * len(X) for i in range(len(funcs))]),
**{f"q_{q_i:.3g}": y_i.ravel() for q_i, y_i in zip(quantiles, y_pred.T)},
Expand Down Expand Up @@ -108,7 +108,6 @@ for each target: the median line and the area defined by the interval points.
alt.Tooltip("target:N", title="Target"),
alt.Tooltip("x:Q", format=",.3f", title="X"),
alt.Tooltip("y:Q", format=",.3f", title="Y"),
alt.Tooltip("y_true:Q", format=",.3f", title="Y"),
alt.Tooltip("y_pred:Q", format=",.3f", title="Predicted Y"),
alt.Tooltip("y_pred_low:Q", format=",.3f", title="Predicted Lower Y"),
alt.Tooltip("y_pred_upp:Q", format=",.3f", title="Predicted Upper Y"),
Expand Down Expand Up @@ -186,7 +185,7 @@ for each target: the median line and the area defined by the interval points.
quantiles = np.linspace(0, 1, num=41, endpoint=True).round(3).tolist()
# Define functions that generate targets; each function maps to one target.
funcs = [
target_funcs = [
{
"signal": lambda x: np.log1p(x + 1),
"noise": lambda x: np.log1p(x) * random_state.uniform(size=len(x)),
Expand All @@ -199,18 +198,19 @@ for each target: the median line and the area defined by the interval points.
},
]
legend = {k: v for f in funcs for k, v in f["legend"].items()}
def make_funcs_Xy(funcs, n_samples, bounds):
"""Make a dataset from specified function(s) with signal and noise."""
"""Make a dataset from specified function(s)."""
x = np.linspace(*bounds, n_samples)
y = np.empty((len(x), len(funcs)))
for i, func in enumerate(funcs):
y[:, i] = func["signal"](x) + func["noise"](x)
y[:, i] = func(x)
return np.atleast_2d(x).T, y
funcs = [lambda x, f=f: f["signal"](x) + f["noise"](x) for f in target_funcs]
legend = {k: v for f in target_funcs for k, v in f["legend"].items()}
# Create a dataset with multiple target variables.
X, y = make_funcs_Xy(funcs, n_samples, bounds)
Expand All @@ -226,7 +226,6 @@ for each target: the median line and the area defined by the interval points.
{
"x": np.tile(X.squeeze(), len(funcs)),
"y": y.reshape(-1, order="F"),
"y_true": np.concatenate([f["signal"](X.squeeze()) for f in funcs]),
"y_pred": np.concatenate([y_pred[:, i, len(quantiles) // 2] for i in range(len(funcs))]),
"target": np.concatenate([[str(i)] * len(X) for i in range(len(funcs))]),
**{f"q_{q_i:.3g}": y_i.ravel() for q_i, y_i in zip(quantiles, y_pred.T)},
Expand Down Expand Up @@ -258,7 +257,6 @@ for each target: the median line and the area defined by the interval points.
alt.Tooltip("target:N", title="Target"),
alt.Tooltip("x:Q", format=",.3f", title="X"),
alt.Tooltip("y:Q", format=",.3f", title="Y"),
alt.Tooltip("y_true:Q", format=",.3f", title="Y"),
alt.Tooltip("y_pred:Q", format=",.3f", title="Predicted Y"),
alt.Tooltip("y_pred_low:Q", format=",.3f", title="Predicted Lower Y"),
alt.Tooltip("y_pred_upp:Q", format=",.3f", title="Predicted Upper Y"),
Expand Down
2 changes: 1 addition & 1 deletion _static/_image_hashes.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"plot_qrf_interpolation_methods.png": "2f3d43fde381d714a2952769c00dd6e7", "plot_qrf_custom_functions.png": "2f257ba3ed3ea39ace3775dfaac212a1", "plot_qrf_extrapolation.png": "54e94b1539025c3d9c702131f6c5615c", "plot_qrf_multitarget.png": "0601977950010fdc870894be0dc4b5b2", "plot_qrf_predictions.png": "98dc4349f8db21311b7ba0e3a73723d1", "plot_qrf_conformalized_intervals.png": "b1b1ce4e8ee95f3bc13b3454a1ef43ad", "plot_qrf_prediction_intervals.png": "5c5daed975c01484ea8888a01ff887d2", "plot_qrf_vs_rf_predictions.png": "4253fe19a649541d50bf5d5bbd407206", "plot_qrf_treeshap_explanations.png": "5a87665596448c2371b828fde9b07e8e", "plot_qrf_proximity_counts.png": "ad7468e53cdd8d6ae0aecd3ac9760700", "plot_qrf_quantile_ranks.png": "5fc3187fb02476f94edf43aa918e0cd9", "plot_qrf_huggingface_inference.png": "c87554d2fada2c6debe8c18c118efff8"}
{"plot_qrf_interpolation_methods.png": "e9ef9605621f0fe49946d59df4f50cb8", "plot_qrf_custom_functions.png": "2f257ba3ed3ea39ace3775dfaac212a1", "plot_qrf_extrapolation.png": "54e94b1539025c3d9c702131f6c5615c", "plot_qrf_multitarget.png": "1aa7118314c961afee806294cd4fd23a", "plot_qrf_predictions.png": "98dc4349f8db21311b7ba0e3a73723d1", "plot_qrf_conformalized_intervals.png": "b1b1ce4e8ee95f3bc13b3454a1ef43ad", "plot_qrf_prediction_intervals.png": "5c5daed975c01484ea8888a01ff887d2", "plot_qrf_vs_rf_predictions.png": "4253fe19a649541d50bf5d5bbd407206", "plot_qrf_treeshap_explanations.png": "5a87665596448c2371b828fde9b07e8e", "plot_qrf_proximity_counts.png": "ad7468e53cdd8d6ae0aecd3ac9760700", "plot_qrf_quantile_ranks.png": "5fc3187fb02476f94edf43aa918e0cd9", "plot_qrf_huggingface_inference.png": "512abbd5ec0f690e4361c4b0800db202"}
Binary file modified _static/plot_qrf_huggingface_inference-thumb.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _static/plot_qrf_huggingface_inference.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
196 changes: 140 additions & 56 deletions gallery/plot_qrf_huggingface_inference.html

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions gallery/plot_qrf_interpolation_methods.html

Large diffs are not rendered by default.

15 changes: 7 additions & 8 deletions gallery/plot_qrf_multitarget.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion searchindex.js

Large diffs are not rendered by default.

0 comments on commit 5d8d10a

Please sign in to comment.