elphick.sklearn_viz.model_selection.learning_curve.LearningCurve
- class elphick.sklearn_viz.model_selection.learning_curve.LearningCurve(estimator, x, y, train_sizes=array([0.1, 0.325, 0.55, 0.775, 1.]), cv=5, metrics=None, scorer=None, random_state=42, n_jobs=1)[source]
- __init__(estimator, x, y, train_sizes=array([0.1, 0.325, 0.55, 0.775, 1.]), cv=5, metrics=None, scorer=None, random_state=42, n_jobs=1)[source]
- Parameters:
estimator – The scikit-learn model or pipeline.
x (
DataFrame
) – X values provided to calculate the learning curve.y (
Union
[DataFrame
,Series
]) – y values provided to calculate the learning curve.train_sizes (
Iterable
) – list of training sample counts (or fractions if < 1)cv (
Union
[int
,Any
]) – The number of cross validation folds or a cv callable.metrics (
Optional
[dict
[str
,Callable
]]) – Optional Dict of callable metrics to calculate post-fittingscorer (
Optional
[Any
]) – The scoring method. If None, ‘accuracy’ is used for classifiers and ‘r2’ for regressors.random_state (
int
) – Optional random seedn_jobs (
int
) – Number of parallel jobs to run. If -1, then the number of jobs is set to the number of CPU cores. Recommend setting to -2 for large jobs to retain a core for system interaction.verbosity – Verbosity level. 0 = silent, 1 = overall (start/finish), 2 = each cross-validation.
Methods
__init__
(estimator, x, y[, train_sizes, cv, ...])- type estimator:
calculate_grid_and_subplot_order
(...)calculate_learning_curve
()- rtype:
custom_learning_curve
()- rtype:
plot
([title, metrics, col_wrap, plot_scorer])Create the plot
Attributes
n_cores
results
- plot(title=None, metrics=None, col_wrap=1, plot_scorer=True)[source]
Create the plot
- Parameters:
title (
Optional
[str
]) – title for the plotmetrics (
Optional
[list
[str
]]) – Optional list of metric keys to plotcol_wrap (
int
) – The number of columns to use for the facet grid if plotting metrics.plot_scorer (
bool
) – If True, plot the scorer. Use False to plot only the metrics.
- Return type:
Figure
- Returns:
a plotly GraphObjects.Figure