partition stringclasses 3
values | func_name stringlengths 1 134 | docstring stringlengths 1 46.9k | path stringlengths 4 223 | original_string stringlengths 75 104k | code stringlengths 75 104k | docstring_tokens listlengths 1 1.97k | repo stringlengths 7 55 | language stringclasses 1
value | url stringlengths 87 315 | code_tokens listlengths 19 28.4k | sha stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|
train | confusion_matrix | Quick method:
Creates a heatmap visualization of the sklearn.metrics.confusion_matrix().
A confusion matrix shows each combination of the true and predicted
classes for a test data set.
The default color map uses a yellow/orange/red color scale. The user can
choose between displaying values as the... | yellowbrick/classifier/confusion_matrix.py | def confusion_matrix(model, X, y, ax=None, classes=None, sample_weight=None,
percent=False, label_encoder=None, cmap='YlOrRd',
fontsize=None, random_state=None, **kwargs):
"""Quick method:
Creates a heatmap visualization of the sklearn.metrics.confusion_matrix().
A... | def confusion_matrix(model, X, y, ax=None, classes=None, sample_weight=None,
percent=False, label_encoder=None, cmap='YlOrRd',
fontsize=None, random_state=None, **kwargs):
"""Quick method:
Creates a heatmap visualization of the sklearn.metrics.confusion_matrix().
A... | [
"Quick",
"method",
":"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/confusion_matrix.py#L284-L374 | [
"def",
"confusion_matrix",
"(",
"model",
",",
"X",
",",
"y",
",",
"ax",
"=",
"None",
",",
"classes",
"=",
"None",
",",
"sample_weight",
"=",
"None",
",",
"percent",
"=",
"False",
",",
"label_encoder",
"=",
"None",
",",
"cmap",
"=",
"'YlOrRd'",
",",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ConfusionMatrix.score | Draws a confusion matrix based on the test data supplied by comparing
predictions on instances X with the true values specified by the
target vector y.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ... | yellowbrick/classifier/confusion_matrix.py | def score(self, X, y):
"""
Draws a confusion matrix based on the test data supplied by comparing
predictions on instances X with the true values specified by the
target vector y.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix o... | def score(self, X, y):
"""
Draws a confusion matrix based on the test data supplied by comparing
predictions on instances X with the true values specified by the
target vector y.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix o... | [
"Draws",
"a",
"confusion",
"matrix",
"based",
"on",
"the",
"test",
"data",
"supplied",
"by",
"comparing",
"predictions",
"on",
"instances",
"X",
"with",
"the",
"true",
"values",
"specified",
"by",
"the",
"target",
"vector",
"y",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/confusion_matrix.py#L139-L194 | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"# Create predictions from X (will raise not fitted error)",
"y_pred",
"=",
"self",
".",
"predict",
"(",
"X",
")",
"# Encode the target with the supplied label encoder",
"if",
"self",
".",
"label_encoder",
":"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ConfusionMatrix.draw | Renders the classification report; must be called after score. | yellowbrick/classifier/confusion_matrix.py | def draw(self):
"""
Renders the classification report; must be called after score.
"""
# Perform display related manipulations on the confusion matrix data
cm_display = self.confusion_matrix_
# Convert confusion matrix to percent of each row, i.e. the
# predicte... | def draw(self):
"""
Renders the classification report; must be called after score.
"""
# Perform display related manipulations on the confusion matrix data
cm_display = self.confusion_matrix_
# Convert confusion matrix to percent of each row, i.e. the
# predicte... | [
"Renders",
"the",
"classification",
"report",
";",
"must",
"be",
"called",
"after",
"score",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/confusion_matrix.py#L196-L271 | [
"def",
"draw",
"(",
"self",
")",
":",
"# Perform display related manipulations on the confusion matrix data",
"cm_display",
"=",
"self",
".",
"confusion_matrix_",
"# Convert confusion matrix to percent of each row, i.e. the",
"# predicted as a percent of true in each class.",
"if",
"se... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | pca_decomposition | Produce a two or three dimensional principal component plot of the data array ``X``
projected onto it's largest sequential principal components. It is common practice to scale the
data array ``X`` before applying a PC decomposition. Variable scaling can be controlled using
the ``scale`` argument.
Param... | yellowbrick/features/pca.py | def pca_decomposition(X, y=None, ax=None, features=None, scale=True,
proj_dim=2, proj_features=False, color=None,
colormap=palettes.DEFAULT_SEQUENCE, alpha=0.75,
random_state=None, **kwargs):
"""Produce a two or three dimensional principal component ... | def pca_decomposition(X, y=None, ax=None, features=None, scale=True,
proj_dim=2, proj_features=False, color=None,
colormap=palettes.DEFAULT_SEQUENCE, alpha=0.75,
random_state=None, **kwargs):
"""Produce a two or three dimensional principal component ... | [
"Produce",
"a",
"two",
"or",
"three",
"dimensional",
"principal",
"component",
"plot",
"of",
"the",
"data",
"array",
"X",
"projected",
"onto",
"it",
"s",
"largest",
"sequential",
"principal",
"components",
".",
"It",
"is",
"common",
"practice",
"to",
"scale",
... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/pca.py#L222-L302 | [
"def",
"pca_decomposition",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"features",
"=",
"None",
",",
"scale",
"=",
"True",
",",
"proj_dim",
"=",
"2",
",",
"proj_features",
"=",
"False",
",",
"color",
"=",
"None",
",",
"colormap",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PCADecomposition.fit | Fits the PCA transformer, transforms the data in X, then draws the
decomposition in either 2D or 3D space as a scatter plot.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features.
y : ndarray or Series of length n
... | yellowbrick/features/pca.py | def fit(self, X, y=None, **kwargs):
"""
Fits the PCA transformer, transforms the data in X, then draws the
decomposition in either 2D or 3D space as a scatter plot.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m f... | def fit(self, X, y=None, **kwargs):
"""
Fits the PCA transformer, transforms the data in X, then draws the
decomposition in either 2D or 3D space as a scatter plot.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m f... | [
"Fits",
"the",
"PCA",
"transformer",
"transforms",
"the",
"data",
"in",
"X",
"then",
"draws",
"the",
"decomposition",
"in",
"either",
"2D",
"or",
"3D",
"space",
"as",
"a",
"scatter",
"plot",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/pca.py#L131-L152 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"PCADecomposition",
",",
"self",
")",
".",
"fit",
"(",
"X",
"=",
"X",
",",
"y",
"=",
"y",
",",
"*",
"*",
"kwargs",
")",
"self",
"."... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | precision_recall_curve | Precision-Recall Curve quick method:
Parameters
----------
model : the Scikit-Learn estimator
A classification model to score the precision-recall curve on.
X : ndarray or DataFrame of shape n x m
A feature array of n instances with m features the model is trained on.
This arra... | yellowbrick/classifier/prcurve.py | def precision_recall_curve(model, X, y, X_test=None, y_test=None, ax=None, train_size=0.8,
random_state=None, shuffle=True, **kwargs):
"""Precision-Recall Curve quick method:
Parameters
----------
model : the Scikit-Learn estimator
A classification model to score the ... | def precision_recall_curve(model, X, y, X_test=None, y_test=None, ax=None, train_size=0.8,
random_state=None, shuffle=True, **kwargs):
"""Precision-Recall Curve quick method:
Parameters
----------
model : the Scikit-Learn estimator
A classification model to score the ... | [
"Precision",
"-",
"Recall",
"Curve",
"quick",
"method",
":"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L377-L500 | [
"def",
"precision_recall_curve",
"(",
"model",
",",
"X",
",",
"y",
",",
"X_test",
"=",
"None",
",",
"y_test",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"train_size",
"=",
"0.8",
",",
"random_state",
"=",
"None",
",",
"shuffle",
"=",
"True",
",",
"*",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PrecisionRecallCurve.fit | Fit the classification model; if y is multi-class, then the estimator
is adapted with a OneVsRestClassifier strategy, otherwise the estimator
is fit directly. | yellowbrick/classifier/prcurve.py | def fit(self, X, y=None):
"""
Fit the classification model; if y is multi-class, then the estimator
is adapted with a OneVsRestClassifier strategy, otherwise the estimator
is fit directly.
"""
# The target determines what kind of estimator is fit
ttype = type_of_t... | def fit(self, X, y=None):
"""
Fit the classification model; if y is multi-class, then the estimator
is adapted with a OneVsRestClassifier strategy, otherwise the estimator
is fit directly.
"""
# The target determines what kind of estimator is fit
ttype = type_of_t... | [
"Fit",
"the",
"classification",
"model",
";",
"if",
"y",
"is",
"multi",
"-",
"class",
"then",
"the",
"estimator",
"is",
"adapted",
"with",
"a",
"OneVsRestClassifier",
"strategy",
"otherwise",
"the",
"estimator",
"is",
"fit",
"directly",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L170-L199 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# The target determines what kind of estimator is fit",
"ttype",
"=",
"type_of_target",
"(",
"y",
")",
"if",
"ttype",
".",
"startswith",
"(",
"MULTICLASS",
")",
":",
"self",
".",
"target_... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PrecisionRecallCurve.score | Generates the Precision-Recall curve on the specified test data.
Returns
-------
score_ : float
Average precision, a summary of the plot as a weighted mean of
precision at each threshold, weighted by the increase in recall from
the previous threshold. | yellowbrick/classifier/prcurve.py | def score(self, X, y=None):
"""
Generates the Precision-Recall curve on the specified test data.
Returns
-------
score_ : float
Average precision, a summary of the plot as a weighted mean of
precision at each threshold, weighted by the increase in recall ... | def score(self, X, y=None):
"""
Generates the Precision-Recall curve on the specified test data.
Returns
-------
score_ : float
Average precision, a summary of the plot as a weighted mean of
precision at each threshold, weighted by the increase in recall ... | [
"Generates",
"the",
"Precision",
"-",
"Recall",
"curve",
"on",
"the",
"specified",
"test",
"data",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L201-L251 | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# If we don't do this check, then it is possible that OneVsRestClassifier",
"# has not correctly been fitted for multi-class targets.",
"if",
"not",
"hasattr",
"(",
"self",
",",
"\"target_type_\"",
")"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PrecisionRecallCurve.draw | Draws the precision-recall curves computed in score on the axes. | yellowbrick/classifier/prcurve.py | def draw(self):
"""
Draws the precision-recall curves computed in score on the axes.
"""
if self.iso_f1_curves:
for f1 in self.iso_f1_values:
x = np.linspace(0.01, 1)
y = f1 * x / (2 * x - f1)
self.ax.plot(x[y>=0], y[y>=0], colo... | def draw(self):
"""
Draws the precision-recall curves computed in score on the axes.
"""
if self.iso_f1_curves:
for f1 in self.iso_f1_values:
x = np.linspace(0.01, 1)
y = f1 * x / (2 * x - f1)
self.ax.plot(x[y>=0], y[y>=0], colo... | [
"Draws",
"the",
"precision",
"-",
"recall",
"curves",
"computed",
"in",
"score",
"on",
"the",
"axes",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L253-L266 | [
"def",
"draw",
"(",
"self",
")",
":",
"if",
"self",
".",
"iso_f1_curves",
":",
"for",
"f1",
"in",
"self",
".",
"iso_f1_values",
":",
"x",
"=",
"np",
".",
"linspace",
"(",
"0.01",
",",
"1",
")",
"y",
"=",
"f1",
"*",
"x",
"/",
"(",
"2",
"*",
"x... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PrecisionRecallCurve._draw_binary | Draw the precision-recall curves in the binary case | yellowbrick/classifier/prcurve.py | def _draw_binary(self):
"""
Draw the precision-recall curves in the binary case
"""
self._draw_pr_curve(self.recall_, self.precision_, label="binary PR curve")
self._draw_ap_score(self.score_) | def _draw_binary(self):
"""
Draw the precision-recall curves in the binary case
"""
self._draw_pr_curve(self.recall_, self.precision_, label="binary PR curve")
self._draw_ap_score(self.score_) | [
"Draw",
"the",
"precision",
"-",
"recall",
"curves",
"in",
"the",
"binary",
"case"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L268-L273 | [
"def",
"_draw_binary",
"(",
"self",
")",
":",
"self",
".",
"_draw_pr_curve",
"(",
"self",
".",
"recall_",
",",
"self",
".",
"precision_",
",",
"label",
"=",
"\"binary PR curve\"",
")",
"self",
".",
"_draw_ap_score",
"(",
"self",
".",
"score_",
")"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PrecisionRecallCurve._draw_multiclass | Draw the precision-recall curves in the multiclass case | yellowbrick/classifier/prcurve.py | def _draw_multiclass(self):
"""
Draw the precision-recall curves in the multiclass case
"""
# TODO: handle colors better with a mapping and user input
if self.per_class:
for cls in self.classes_:
precision = self.precision_[cls]
recall ... | def _draw_multiclass(self):
"""
Draw the precision-recall curves in the multiclass case
"""
# TODO: handle colors better with a mapping and user input
if self.per_class:
for cls in self.classes_:
precision = self.precision_[cls]
recall ... | [
"Draw",
"the",
"precision",
"-",
"recall",
"curves",
"in",
"the",
"multiclass",
"case"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L276-L294 | [
"def",
"_draw_multiclass",
"(",
"self",
")",
":",
"# TODO: handle colors better with a mapping and user input",
"if",
"self",
".",
"per_class",
":",
"for",
"cls",
"in",
"self",
".",
"classes_",
":",
"precision",
"=",
"self",
".",
"precision_",
"[",
"cls",
"]",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PrecisionRecallCurve._draw_pr_curve | Helper function to draw a precision-recall curve with specified settings | yellowbrick/classifier/prcurve.py | def _draw_pr_curve(self, recall, precision, label=None):
"""
Helper function to draw a precision-recall curve with specified settings
"""
self.ax.step(
recall, precision, alpha=self.line_opacity, where='post', label=label
)
if self.fill_area:
self.... | def _draw_pr_curve(self, recall, precision, label=None):
"""
Helper function to draw a precision-recall curve with specified settings
"""
self.ax.step(
recall, precision, alpha=self.line_opacity, where='post', label=label
)
if self.fill_area:
self.... | [
"Helper",
"function",
"to",
"draw",
"a",
"precision",
"-",
"recall",
"curve",
"with",
"specified",
"settings"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L296-L304 | [
"def",
"_draw_pr_curve",
"(",
"self",
",",
"recall",
",",
"precision",
",",
"label",
"=",
"None",
")",
":",
"self",
".",
"ax",
".",
"step",
"(",
"recall",
",",
"precision",
",",
"alpha",
"=",
"self",
".",
"line_opacity",
",",
"where",
"=",
"'post'",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PrecisionRecallCurve._draw_ap_score | Helper function to draw the AP score annotation | yellowbrick/classifier/prcurve.py | def _draw_ap_score(self, score, label=None):
"""
Helper function to draw the AP score annotation
"""
label = label or "Avg Precision={:0.2f}".format(score)
if self.ap_score:
self.ax.axhline(
y=score, color="r", ls="--", label=label
) | def _draw_ap_score(self, score, label=None):
"""
Helper function to draw the AP score annotation
"""
label = label or "Avg Precision={:0.2f}".format(score)
if self.ap_score:
self.ax.axhline(
y=score, color="r", ls="--", label=label
) | [
"Helper",
"function",
"to",
"draw",
"the",
"AP",
"score",
"annotation"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L306-L314 | [
"def",
"_draw_ap_score",
"(",
"self",
",",
"score",
",",
"label",
"=",
"None",
")",
":",
"label",
"=",
"label",
"or",
"\"Avg Precision={:0.2f}\"",
".",
"format",
"(",
"score",
")",
"if",
"self",
".",
"ap_score",
":",
"self",
".",
"ax",
".",
"axhline",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PrecisionRecallCurve._get_y_scores | The ``precision_recall_curve`` metric requires target scores that
can either be the probability estimates of the positive class,
confidence values, or non-thresholded measures of decisions (as
returned by a "decision function"). | yellowbrick/classifier/prcurve.py | def _get_y_scores(self, X):
"""
The ``precision_recall_curve`` metric requires target scores that
can either be the probability estimates of the positive class,
confidence values, or non-thresholded measures of decisions (as
returned by a "decision function").
"""
... | def _get_y_scores(self, X):
"""
The ``precision_recall_curve`` metric requires target scores that
can either be the probability estimates of the positive class,
confidence values, or non-thresholded measures of decisions (as
returned by a "decision function").
"""
... | [
"The",
"precision_recall_curve",
"metric",
"requires",
"target",
"scores",
"that",
"can",
"either",
"be",
"the",
"probability",
"estimates",
"of",
"the",
"positive",
"class",
"confidence",
"values",
"or",
"non",
"-",
"thresholded",
"measures",
"of",
"decisions",
"... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/prcurve.py#L329-L366 | [
"def",
"_get_y_scores",
"(",
"self",
",",
"X",
")",
":",
"# TODO refactor shared method with ROCAUC",
"# Resolution order of scoring functions",
"attrs",
"=",
"(",
"'decision_function'",
",",
"'predict_proba'",
",",
")",
"# Return the first resolved function",
"for",
"attr",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | balanced_binning_reference | BalancedBinningReference generates a histogram with vertical lines
showing the recommended value point to bin your data so they can be evenly
distributed in each bin.
Parameters
----------
y : an array of one dimension or a pandas Series
ax : matplotlib Axes, default: None
This is ... | yellowbrick/target/binning.py | def balanced_binning_reference(y, ax=None, target='Frequency', bins=4, **kwargs):
"""
BalancedBinningReference generates a histogram with vertical lines
showing the recommended value point to bin your data so they can be evenly
distributed in each bin.
Parameters
----------
y : an arra... | def balanced_binning_reference(y, ax=None, target='Frequency', bins=4, **kwargs):
"""
BalancedBinningReference generates a histogram with vertical lines
showing the recommended value point to bin your data so they can be evenly
distributed in each bin.
Parameters
----------
y : an arra... | [
"BalancedBinningReference",
"generates",
"a",
"histogram",
"with",
"vertical",
"lines",
"showing",
"the",
"recommended",
"value",
"point",
"to",
"bin",
"your",
"data",
"so",
"they",
"can",
"be",
"evenly",
"distributed",
"in",
"each",
"bin",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/binning.py#L143-L174 | [
"def",
"balanced_binning_reference",
"(",
"y",
",",
"ax",
"=",
"None",
",",
"target",
"=",
"'Frequency'",
",",
"bins",
"=",
"4",
",",
"*",
"*",
"kwargs",
")",
":",
"# Initialize the visualizer",
"visualizer",
"=",
"BalancedBinningReference",
"(",
"ax",
"=",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | BalancedBinningReference.draw | Draws a histogram with the reference value for binning as vertical
lines.
Parameters
----------
y : an array of one dimension or a pandas Series | yellowbrick/target/binning.py | def draw(self, y, **kwargs):
"""
Draws a histogram with the reference value for binning as vertical
lines.
Parameters
----------
y : an array of one dimension or a pandas Series
"""
# draw the histogram
hist, bin_edges = np.histogram(y, bins=self... | def draw(self, y, **kwargs):
"""
Draws a histogram with the reference value for binning as vertical
lines.
Parameters
----------
y : an array of one dimension or a pandas Series
"""
# draw the histogram
hist, bin_edges = np.histogram(y, bins=self... | [
"Draws",
"a",
"histogram",
"with",
"the",
"reference",
"value",
"for",
"binning",
"as",
"vertical",
"lines",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/binning.py#L77-L93 | [
"def",
"draw",
"(",
"self",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"# draw the histogram",
"hist",
",",
"bin_edges",
"=",
"np",
".",
"histogram",
"(",
"y",
",",
"bins",
"=",
"self",
".",
"bins",
")",
"self",
".",
"bin_edges_",
"=",
"bin_edges",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | BalancedBinningReference.fit | Sets up y for the histogram and checks to
ensure that ``y`` is of the correct data type.
Fit calls draw.
Parameters
----------
y : an array of one dimension or a pandas Series
kwargs : dict
keyword arguments passed to scikit-learn API. | yellowbrick/target/binning.py | def fit(self, y, **kwargs):
"""
Sets up y for the histogram and checks to
ensure that ``y`` is of the correct data type.
Fit calls draw.
Parameters
----------
y : an array of one dimension or a pandas Series
kwargs : dict
keyword arguments pa... | def fit(self, y, **kwargs):
"""
Sets up y for the histogram and checks to
ensure that ``y`` is of the correct data type.
Fit calls draw.
Parameters
----------
y : an array of one dimension or a pandas Series
kwargs : dict
keyword arguments pa... | [
"Sets",
"up",
"y",
"for",
"the",
"histogram",
"and",
"checks",
"to",
"ensure",
"that",
"y",
"is",
"of",
"the",
"correct",
"data",
"type",
".",
"Fit",
"calls",
"draw",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/binning.py#L95-L119 | [
"def",
"fit",
"(",
"self",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"#throw an error if y has more than 1 column",
"if",
"y",
".",
"ndim",
">",
"1",
":",
"raise",
"YellowbrickValueError",
"(",
"\"y needs to be an array or Series with one dimension\"",
")",
"# Ha... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | BalancedBinningReference.finalize | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | yellowbrick/target/binning.py | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
self.ax.set_xlabel(self.target)
for tk in... | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
self.ax.set_xlabel(self.target)
for tk in... | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/binning.py#L121-L136 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"ax",
".",
"set_xlabel",
"(",
"self",
".",
"target",
")",
"for",
"tk",
"in",
"self",
".",
"ax",
".",
"get_xticklabels",
"(",
")",
":",
"tk",
".",
"set_visible",
"(",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | download_all | Downloads all the example datasets to the data directory specified by
``get_data_home``. This function ensures that all datasets are available
for use with the examples. | yellowbrick/download.py | def download_all(data_home=None, replace=False):
"""
Downloads all the example datasets to the data directory specified by
``get_data_home``. This function ensures that all datasets are available
for use with the examples.
"""
for _, meta in DATASETS.items():
download_data(
m... | def download_all(data_home=None, replace=False):
"""
Downloads all the example datasets to the data directory specified by
``get_data_home``. This function ensures that all datasets are available
for use with the examples.
"""
for _, meta in DATASETS.items():
download_data(
m... | [
"Downloads",
"all",
"the",
"example",
"datasets",
"to",
"the",
"data",
"directory",
"specified",
"by",
"get_data_home",
".",
"This",
"function",
"ensures",
"that",
"all",
"datasets",
"are",
"available",
"for",
"use",
"with",
"the",
"examples",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/download.py#L35-L48 | [
"def",
"download_all",
"(",
"data_home",
"=",
"None",
",",
"replace",
"=",
"False",
")",
":",
"for",
"_",
",",
"meta",
"in",
"DATASETS",
".",
"items",
"(",
")",
":",
"download_data",
"(",
"meta",
"[",
"'url'",
"]",
",",
"meta",
"[",
"'signature'",
"]... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | cleanup_all | Cleans up all the example datasets in the data directory specified by
``get_data_home`` either to clear up disk space or start from fresh. | yellowbrick/download.py | def cleanup_all(data_home=None):
"""
Cleans up all the example datasets in the data directory specified by
``get_data_home`` either to clear up disk space or start from fresh.
"""
removed = 0
for name, meta in DATASETS.items():
_, ext = os.path.splitext(meta['url'])
removed += cl... | def cleanup_all(data_home=None):
"""
Cleans up all the example datasets in the data directory specified by
``get_data_home`` either to clear up disk space or start from fresh.
"""
removed = 0
for name, meta in DATASETS.items():
_, ext = os.path.splitext(meta['url'])
removed += cl... | [
"Cleans",
"up",
"all",
"the",
"example",
"datasets",
"in",
"the",
"data",
"directory",
"specified",
"by",
"get_data_home",
"either",
"to",
"clear",
"up",
"disk",
"space",
"or",
"start",
"from",
"fresh",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/download.py#L51-L63 | [
"def",
"cleanup_all",
"(",
"data_home",
"=",
"None",
")",
":",
"removed",
"=",
"0",
"for",
"name",
",",
"meta",
"in",
"DATASETS",
".",
"items",
"(",
")",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"meta",
"[",
"'url'",
"]... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | class_balance | Quick method:
One of the biggest challenges for classification models is an imbalance of
classes in the training data. This function vizualizes the relationship of
the support for each class in both the training and test data by
displaying how frequently each class occurs as a bar graph.
The figur... | yellowbrick/target/class_balance.py | def class_balance(y_train, y_test=None, ax=None, labels=None, **kwargs):
"""Quick method:
One of the biggest challenges for classification models is an imbalance of
classes in the training data. This function vizualizes the relationship of
the support for each class in both the training and test data b... | def class_balance(y_train, y_test=None, ax=None, labels=None, **kwargs):
"""Quick method:
One of the biggest challenges for classification models is an imbalance of
classes in the training data. This function vizualizes the relationship of
the support for each class in both the training and test data b... | [
"Quick",
"method",
":"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/class_balance.py#L249-L302 | [
"def",
"class_balance",
"(",
"y_train",
",",
"y_test",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Instantiate the visualizer",
"visualizer",
"=",
"ClassBalance",
"(",
"ax",
"=",
"ax",
",",
"labe... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ClassBalance.fit | Fit the visualizer to the the target variables, which must be 1D
vectors containing discrete (classification) data. Fit has two modes:
1. Balance mode: if only y_train is specified
2. Compare mode: if both train and test are specified
In balance mode, the bar chart is displayed with ea... | yellowbrick/target/class_balance.py | def fit(self, y_train, y_test=None):
"""
Fit the visualizer to the the target variables, which must be 1D
vectors containing discrete (classification) data. Fit has two modes:
1. Balance mode: if only y_train is specified
2. Compare mode: if both train and test are specified
... | def fit(self, y_train, y_test=None):
"""
Fit the visualizer to the the target variables, which must be 1D
vectors containing discrete (classification) data. Fit has two modes:
1. Balance mode: if only y_train is specified
2. Compare mode: if both train and test are specified
... | [
"Fit",
"the",
"visualizer",
"to",
"the",
"the",
"target",
"variables",
"which",
"must",
"be",
"1D",
"vectors",
"containing",
"discrete",
"(",
"classification",
")",
"data",
".",
"Fit",
"has",
"two",
"modes",
":"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/class_balance.py#L96-L162 | [
"def",
"fit",
"(",
"self",
",",
"y_train",
",",
"y_test",
"=",
"None",
")",
":",
"# check to make sure that y_train is not a 2D array, e.g. X",
"if",
"y_train",
".",
"ndim",
"==",
"2",
":",
"raise",
"YellowbrickValueError",
"(",
"(",
"\"fit has changed to only require... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ClassBalance.draw | Renders the class balance chart on the specified axes from support. | yellowbrick/target/class_balance.py | def draw(self):
"""
Renders the class balance chart on the specified axes from support.
"""
# Number of colors is either number of classes or 2
colors = resolve_colors(len(self.support_))
if self._mode == BALANCE:
self.ax.bar(
np.arange(len(se... | def draw(self):
"""
Renders the class balance chart on the specified axes from support.
"""
# Number of colors is either number of classes or 2
colors = resolve_colors(len(self.support_))
if self._mode == BALANCE:
self.ax.bar(
np.arange(len(se... | [
"Renders",
"the",
"class",
"balance",
"chart",
"on",
"the",
"specified",
"axes",
"from",
"support",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/class_balance.py#L164-L192 | [
"def",
"draw",
"(",
"self",
")",
":",
"# Number of colors is either number of classes or 2",
"colors",
"=",
"resolve_colors",
"(",
"len",
"(",
"self",
".",
"support_",
")",
")",
"if",
"self",
".",
"_mode",
"==",
"BALANCE",
":",
"self",
".",
"ax",
".",
"bar",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ClassBalance.finalize | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | yellowbrick/target/class_balance.py | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Set the title
self.set_title(
... | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Set the title
self.set_title(
... | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/class_balance.py#L194-L228 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the title",
"self",
".",
"set_title",
"(",
"'Class Balance for {:,} Instances'",
".",
"format",
"(",
"self",
".",
"support_",
".",
"sum",
"(",
")",
")",
")",
"# Set the x ticks with the ... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ClassBalance._validate_target | Raises a value error if the target is not a classification target. | yellowbrick/target/class_balance.py | def _validate_target(self, y):
"""
Raises a value error if the target is not a classification target.
"""
# Ignore None values
if y is None:
return
y_type = type_of_target(y)
if y_type not in ("binary", "multiclass"):
raise YellowbrickValu... | def _validate_target(self, y):
"""
Raises a value error if the target is not a classification target.
"""
# Ignore None values
if y is None:
return
y_type = type_of_target(y)
if y_type not in ("binary", "multiclass"):
raise YellowbrickValu... | [
"Raises",
"a",
"value",
"error",
"if",
"the",
"target",
"is",
"not",
"a",
"classification",
"target",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/target/class_balance.py#L230-L242 | [
"def",
"_validate_target",
"(",
"self",
",",
"y",
")",
":",
"# Ignore None values",
"if",
"y",
"is",
"None",
":",
"return",
"y_type",
"=",
"type_of_target",
"(",
"y",
")",
"if",
"y_type",
"not",
"in",
"(",
"\"binary\"",
",",
"\"multiclass\"",
")",
":",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | get_model_name | Detects the model name for a Scikit-Learn model or pipeline.
Parameters
----------
model: class or instance
The object to determine the name for. If the model is an estimator it
returns the class name; if it is a Pipeline it returns the class name
of the final transformer or estimat... | yellowbrick/utils/helpers.py | def get_model_name(model):
"""
Detects the model name for a Scikit-Learn model or pipeline.
Parameters
----------
model: class or instance
The object to determine the name for. If the model is an estimator it
returns the class name; if it is a Pipeline it returns the class name
... | def get_model_name(model):
"""
Detects the model name for a Scikit-Learn model or pipeline.
Parameters
----------
model: class or instance
The object to determine the name for. If the model is an estimator it
returns the class name; if it is a Pipeline it returns the class name
... | [
"Detects",
"the",
"model",
"name",
"for",
"a",
"Scikit",
"-",
"Learn",
"model",
"or",
"pipeline",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/helpers.py#L33-L60 | [
"def",
"get_model_name",
"(",
"model",
")",
":",
"if",
"not",
"is_estimator",
"(",
"model",
")",
":",
"raise",
"YellowbrickTypeError",
"(",
"\"Cannot detect the model name for non estimator: '{}'\"",
".",
"format",
"(",
"type",
"(",
"model",
")",
")",
")",
"else",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | has_ndarray_int_columns | Checks if numeric feature columns exist in ndarray | yellowbrick/utils/helpers.py | def has_ndarray_int_columns(features, X):
""" Checks if numeric feature columns exist in ndarray """
_, ncols = X.shape
if not all(d.isdigit() for d in features if isinstance(d, str)) or not isinstance(X, np.ndarray):
return False
ndarray_columns = np.arange(0, ncols)
feature_cols = np.uniqu... | def has_ndarray_int_columns(features, X):
""" Checks if numeric feature columns exist in ndarray """
_, ncols = X.shape
if not all(d.isdigit() for d in features if isinstance(d, str)) or not isinstance(X, np.ndarray):
return False
ndarray_columns = np.arange(0, ncols)
feature_cols = np.uniqu... | [
"Checks",
"if",
"numeric",
"feature",
"columns",
"exist",
"in",
"ndarray"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/helpers.py#L63-L70 | [
"def",
"has_ndarray_int_columns",
"(",
"features",
",",
"X",
")",
":",
"_",
",",
"ncols",
"=",
"X",
".",
"shape",
"if",
"not",
"all",
"(",
"d",
".",
"isdigit",
"(",
")",
"for",
"d",
"in",
"features",
"if",
"isinstance",
"(",
"d",
",",
"str",
")",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | is_monotonic | Tests whether a vector a has monotonicity.
Parameters
----------
a : array-like
Array that should be tested for monotonicity
increasing : bool, default: True
Test if the array is montonically increasing, otherwise test if the
array is montonically decreasing. | yellowbrick/utils/helpers.py | def is_monotonic(a, increasing=True):
"""
Tests whether a vector a has monotonicity.
Parameters
----------
a : array-like
Array that should be tested for monotonicity
increasing : bool, default: True
Test if the array is montonically increasing, otherwise test if the
ar... | def is_monotonic(a, increasing=True):
"""
Tests whether a vector a has monotonicity.
Parameters
----------
a : array-like
Array that should be tested for monotonicity
increasing : bool, default: True
Test if the array is montonically increasing, otherwise test if the
ar... | [
"Tests",
"whether",
"a",
"vector",
"a",
"has",
"monotonicity",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/helpers.py#L76-L99 | [
"def",
"is_monotonic",
"(",
"a",
",",
"increasing",
"=",
"True",
")",
":",
"a",
"=",
"np",
".",
"asarray",
"(",
"a",
")",
"# ensure a is array-like",
"if",
"a",
".",
"ndim",
">",
"1",
":",
"raise",
"ValueError",
"(",
"\"not supported for multi-dimensonal arr... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | div_safe | Ufunc-extension that returns 0 instead of nan when dividing numpy arrays
Parameters
----------
numerator: array-like
denominator: scalar or array-like that can be validly divided by the numerator
returns a numpy array
example: div_safe( [-1, 0, 1], 0 ) == [0, 0, 0] | yellowbrick/utils/helpers.py | def div_safe( numerator, denominator ):
"""
Ufunc-extension that returns 0 instead of nan when dividing numpy arrays
Parameters
----------
numerator: array-like
denominator: scalar or array-like that can be validly divided by the numerator
returns a numpy array
example: div_safe( [-1... | def div_safe( numerator, denominator ):
"""
Ufunc-extension that returns 0 instead of nan when dividing numpy arrays
Parameters
----------
numerator: array-like
denominator: scalar or array-like that can be validly divided by the numerator
returns a numpy array
example: div_safe( [-1... | [
"Ufunc",
"-",
"extension",
"that",
"returns",
"0",
"instead",
"of",
"nan",
"when",
"dividing",
"numpy",
"arrays"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/helpers.py#L107-L132 | [
"def",
"div_safe",
"(",
"numerator",
",",
"denominator",
")",
":",
"#First handle scalars",
"if",
"np",
".",
"isscalar",
"(",
"numerator",
")",
":",
"raise",
"ValueError",
"(",
"\"div_safe should only be used with an array-like numerator\"",
")",
"#Then numpy arrays",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | prop_to_size | Converts an array of property values (e.g. a metric or score) to values
that are more useful for marker sizes, line widths, or other visual
sizes. The new sizes are computed as:
y = mi + (ma -mi)(\frac{x_i - min(x){max(x) - min(x)})^{power}
If ``log=True``, the natural logarithm of the property va... | yellowbrick/utils/helpers.py | def prop_to_size(vals, mi=0.0, ma=5.0, power=0.5, log=False):
"""
Converts an array of property values (e.g. a metric or score) to values
that are more useful for marker sizes, line widths, or other visual
sizes. The new sizes are computed as:
y = mi + (ma -mi)(\frac{x_i - min(x){max(x) - min(x... | def prop_to_size(vals, mi=0.0, ma=5.0, power=0.5, log=False):
"""
Converts an array of property values (e.g. a metric or score) to values
that are more useful for marker sizes, line widths, or other visual
sizes. The new sizes are computed as:
y = mi + (ma -mi)(\frac{x_i - min(x){max(x) - min(x... | [
"Converts",
"an",
"array",
"of",
"property",
"values",
"(",
"e",
".",
"g",
".",
"a",
"metric",
"or",
"score",
")",
"to",
"values",
"that",
"are",
"more",
"useful",
"for",
"marker",
"sizes",
"line",
"widths",
"or",
"other",
"visual",
"sizes",
".",
"The"... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/helpers.py#L135-L179 | [
"def",
"prop_to_size",
"(",
"vals",
",",
"mi",
"=",
"0.0",
",",
"ma",
"=",
"5.0",
",",
"power",
"=",
"0.5",
",",
"log",
"=",
"False",
")",
":",
"# ensure that prop is an array",
"vals",
"=",
"np",
".",
"asarray",
"(",
"vals",
")",
"# apply natural log if... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | slugify | Returns a slug of given text, normalizing unicode data for file-safe
strings. Used for deciding where to write images to disk.
Parameters
----------
text : string
The string to slugify
Returns
-------
slug : string
A normalized slug representation of the text
.. seeals... | yellowbrick/utils/helpers.py | def slugify(text):
"""
Returns a slug of given text, normalizing unicode data for file-safe
strings. Used for deciding where to write images to disk.
Parameters
----------
text : string
The string to slugify
Returns
-------
slug : string
A normalized slug representa... | def slugify(text):
"""
Returns a slug of given text, normalizing unicode data for file-safe
strings. Used for deciding where to write images to disk.
Parameters
----------
text : string
The string to slugify
Returns
-------
slug : string
A normalized slug representa... | [
"Returns",
"a",
"slug",
"of",
"given",
"text",
"normalizing",
"unicode",
"data",
"for",
"file",
"-",
"safe",
"strings",
".",
"Used",
"for",
"deciding",
"where",
"to",
"write",
"images",
"to",
"disk",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/helpers.py#L187-L206 | [
"def",
"slugify",
"(",
"text",
")",
":",
"slug",
"=",
"re",
".",
"sub",
"(",
"r'[^\\w]+'",
",",
"' '",
",",
"text",
")",
"slug",
"=",
"\"-\"",
".",
"join",
"(",
"slug",
".",
"lower",
"(",
")",
".",
"strip",
"(",
")",
".",
"split",
"(",
")",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | distortion_score | Compute the mean distortion of all samples.
The distortion is computed as the the sum of the squared distances between
each observation and its closest centroid. Logically, this is the metric
that K-Means attempts to minimize as it is fitting the model.
.. seealso:: http://kldavenport.com/the-cost-fun... | yellowbrick/cluster/elbow.py | def distortion_score(X, labels, metric='euclidean'):
"""
Compute the mean distortion of all samples.
The distortion is computed as the the sum of the squared distances between
each observation and its closest centroid. Logically, this is the metric
that K-Means attempts to minimize as it is fitting... | def distortion_score(X, labels, metric='euclidean'):
"""
Compute the mean distortion of all samples.
The distortion is computed as the the sum of the squared distances between
each observation and its closest centroid. Logically, this is the metric
that K-Means attempts to minimize as it is fitting... | [
"Compute",
"the",
"mean",
"distortion",
"of",
"all",
"samples",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/elbow.py#L48-L107 | [
"def",
"distortion_score",
"(",
"X",
",",
"labels",
",",
"metric",
"=",
"'euclidean'",
")",
":",
"# Encode labels to get unique centers and groups",
"le",
"=",
"LabelEncoder",
"(",
")",
"labels",
"=",
"le",
".",
"fit_transform",
"(",
"labels",
")",
"unique_labels"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | KElbowVisualizer.fit | Fits n KMeans models where n is the length of ``self.k_values_``,
storing the silhouette scores in the ``self.k_scores_`` attribute.
The "elbow" and silhouette score corresponding to it are stored in
``self.elbow_value`` and ``self.elbow_score`` respectively.
This method finishes up by c... | yellowbrick/cluster/elbow.py | def fit(self, X, y=None, **kwargs):
"""
Fits n KMeans models where n is the length of ``self.k_values_``,
storing the silhouette scores in the ``self.k_scores_`` attribute.
The "elbow" and silhouette score corresponding to it are stored in
``self.elbow_value`` and ``self.elbow_sc... | def fit(self, X, y=None, **kwargs):
"""
Fits n KMeans models where n is the length of ``self.k_values_``,
storing the silhouette scores in the ``self.k_scores_`` attribute.
The "elbow" and silhouette score corresponding to it are stored in
``self.elbow_value`` and ``self.elbow_sc... | [
"Fits",
"n",
"KMeans",
"models",
"where",
"n",
"is",
"the",
"length",
"of",
"self",
".",
"k_values_",
"storing",
"the",
"silhouette",
"scores",
"in",
"the",
"self",
".",
"k_scores_",
"attribute",
".",
"The",
"elbow",
"and",
"silhouette",
"score",
"correspond... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/elbow.py#L269-L318 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"k_scores_",
"=",
"[",
"]",
"self",
".",
"k_timers_",
"=",
"[",
"]",
"if",
"self",
".",
"locate_elbow",
":",
"self",
".",
"elbow_value_",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | KElbowVisualizer.draw | Draw the elbow curve for the specified scores and values of K. | yellowbrick/cluster/elbow.py | def draw(self):
"""
Draw the elbow curve for the specified scores and values of K.
"""
# Plot the silhouette score against k
self.ax.plot(self.k_values_, self.k_scores_, marker="D")
if self.locate_elbow and self.elbow_value_!=None:
elbow_label = "$elbow\ at\ k... | def draw(self):
"""
Draw the elbow curve for the specified scores and values of K.
"""
# Plot the silhouette score against k
self.ax.plot(self.k_values_, self.k_scores_, marker="D")
if self.locate_elbow and self.elbow_value_!=None:
elbow_label = "$elbow\ at\ k... | [
"Draw",
"the",
"elbow",
"curve",
"for",
"the",
"specified",
"scores",
"and",
"values",
"of",
"K",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/elbow.py#L320-L339 | [
"def",
"draw",
"(",
"self",
")",
":",
"# Plot the silhouette score against k",
"self",
".",
"ax",
".",
"plot",
"(",
"self",
".",
"k_values_",
",",
"self",
".",
"k_scores_",
",",
"marker",
"=",
"\"D\"",
")",
"if",
"self",
".",
"locate_elbow",
"and",
"self",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | KElbowVisualizer.finalize | Prepare the figure for rendering by setting the title as well as the
X and Y axis labels and adding the legend. | yellowbrick/cluster/elbow.py | def finalize(self):
"""
Prepare the figure for rendering by setting the title as well as the
X and Y axis labels and adding the legend.
"""
# Get the metric name
metric = self.scoring_metric.__name__.replace("_", " ").title()
# Set the title
self... | def finalize(self):
"""
Prepare the figure for rendering by setting the title as well as the
X and Y axis labels and adding the legend.
"""
# Get the metric name
metric = self.scoring_metric.__name__.replace("_", " ").title()
# Set the title
self... | [
"Prepare",
"the",
"figure",
"for",
"rendering",
"by",
"setting",
"the",
"title",
"as",
"well",
"as",
"the",
"X",
"and",
"Y",
"axis",
"labels",
"and",
"adding",
"the",
"legend",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/elbow.py#L341-L367 | [
"def",
"finalize",
"(",
"self",
")",
":",
"# Get the metric name",
"metric",
"=",
"self",
".",
"scoring_metric",
".",
"__name__",
".",
"replace",
"(",
"\"_\"",
",",
"\" \"",
")",
".",
"title",
"(",
")",
"# Set the title",
"self",
".",
"set_title",
"(",
"'{... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | savefig | Saves the figure to the gallery directory | docs/gallery.py | def savefig(viz, name, gallery=GALLERY):
"""
Saves the figure to the gallery directory
"""
if not path.exists(gallery):
os.makedirs(gallery)
# Must save as png
if len(name.split(".")) > 1:
raise ValueError("name should not specify extension")
outpath = path.join(gallery, na... | def savefig(viz, name, gallery=GALLERY):
"""
Saves the figure to the gallery directory
"""
if not path.exists(gallery):
os.makedirs(gallery)
# Must save as png
if len(name.split(".")) > 1:
raise ValueError("name should not specify extension")
outpath = path.join(gallery, na... | [
"Saves",
"the",
"figure",
"to",
"the",
"gallery",
"directory"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/docs/gallery.py#L67-L80 | [
"def",
"savefig",
"(",
"viz",
",",
"name",
",",
"gallery",
"=",
"GALLERY",
")",
":",
"if",
"not",
"path",
".",
"exists",
"(",
"gallery",
")",
":",
"os",
".",
"makedirs",
"(",
"gallery",
")",
"# Must save as png",
"if",
"len",
"(",
"name",
".",
"split... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | VisualPipeline.poof | A single entry point to rendering all visualizations in the visual
pipeline. The rendering for the output depends on the backend context,
but for path based renderings (e.g. saving to a file), specify a
directory and extension to compse an outpath to save each
visualization (file names w... | yellowbrick/pipeline.py | def poof(self, outdir=None, ext=".pdf", **kwargs):
"""
A single entry point to rendering all visualizations in the visual
pipeline. The rendering for the output depends on the backend context,
but for path based renderings (e.g. saving to a file), specify a
directory and extensio... | def poof(self, outdir=None, ext=".pdf", **kwargs):
"""
A single entry point to rendering all visualizations in the visual
pipeline. The rendering for the output depends on the backend context,
but for path based renderings (e.g. saving to a file), specify a
directory and extensio... | [
"A",
"single",
"entry",
"point",
"to",
"rendering",
"all",
"visualizations",
"in",
"the",
"visual",
"pipeline",
".",
"The",
"rendering",
"for",
"the",
"output",
"depends",
"on",
"the",
"backend",
"context",
"but",
"for",
"path",
"based",
"renderings",
"(",
"... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/pipeline.py#L76-L101 | [
"def",
"poof",
"(",
"self",
",",
"outdir",
"=",
"None",
",",
"ext",
"=",
"\".pdf\"",
",",
"*",
"*",
"kwargs",
")",
":",
"for",
"name",
",",
"step",
"in",
"self",
".",
"visual_steps",
".",
"items",
"(",
")",
":",
"if",
"outdir",
"is",
"not",
"None... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | VisualPipeline.fit_transform_poof | Fit the model and transforms and then call poof. | yellowbrick/pipeline.py | def fit_transform_poof(self, X, y=None, outpath=None, **kwargs):
"""
Fit the model and transforms and then call poof.
"""
self.fit_transform(X, y, **kwargs)
self.poof(outpath, **kwargs) | def fit_transform_poof(self, X, y=None, outpath=None, **kwargs):
"""
Fit the model and transforms and then call poof.
"""
self.fit_transform(X, y, **kwargs)
self.poof(outpath, **kwargs) | [
"Fit",
"the",
"model",
"and",
"transforms",
"and",
"then",
"call",
"poof",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/pipeline.py#L103-L108 | [
"def",
"fit_transform_poof",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"outpath",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"fit_transform",
"(",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"poof",
"(",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | umap | Display a projection of a vectorized corpus in two dimensions using UMAP (Uniform
Manifold Approximation and Projection),
a nonlinear dimensionality reduction method that is particularly well
suited to embedding in two or three dimensions for visualization as a
scatter plot. UMAP is a relatively new tec... | yellowbrick/text/umap_vis.py | def umap(X, y=None, ax=None, classes=None,
colors=None, colormap=None, alpha=0.7, **kwargs):
"""
Display a projection of a vectorized corpus in two dimensions using UMAP (Uniform
Manifold Approximation and Projection),
a nonlinear dimensionality reduction method that is particularly well
... | def umap(X, y=None, ax=None, classes=None,
colors=None, colormap=None, alpha=0.7, **kwargs):
"""
Display a projection of a vectorized corpus in two dimensions using UMAP (Uniform
Manifold Approximation and Projection),
a nonlinear dimensionality reduction method that is particularly well
... | [
"Display",
"a",
"projection",
"of",
"a",
"vectorized",
"corpus",
"in",
"two",
"dimensions",
"using",
"UMAP",
"(",
"Uniform",
"Manifold",
"Approximation",
"and",
"Projection",
")",
"a",
"nonlinear",
"dimensionality",
"reduction",
"method",
"that",
"is",
"particular... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/umap_vis.py#L46-L111 | [
"def",
"umap",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"classes",
"=",
"None",
",",
"colors",
"=",
"None",
",",
"colormap",
"=",
"None",
",",
"alpha",
"=",
"0.7",
",",
"*",
"*",
"kwargs",
")",
":",
"# Instantiate the visualize... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | UMAPVisualizer.make_transformer | Creates an internal transformer pipeline to project the data set into
2D space using UMAP. This method will reset the transformer on the
class.
Parameters
----------
Returns
-------
transformer : Pipeline
Pipelined transformer for UMAP projections | yellowbrick/text/umap_vis.py | def make_transformer(self, umap_kwargs={}):
"""
Creates an internal transformer pipeline to project the data set into
2D space using UMAP. This method will reset the transformer on the
class.
Parameters
----------
Returns
-------
transformer : Pi... | def make_transformer(self, umap_kwargs={}):
"""
Creates an internal transformer pipeline to project the data set into
2D space using UMAP. This method will reset the transformer on the
class.
Parameters
----------
Returns
-------
transformer : Pi... | [
"Creates",
"an",
"internal",
"transformer",
"pipeline",
"to",
"project",
"the",
"data",
"set",
"into",
"2D",
"space",
"using",
"UMAP",
".",
"This",
"method",
"will",
"reset",
"the",
"transformer",
"on",
"the",
"class",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/umap_vis.py#L224-L247 | [
"def",
"make_transformer",
"(",
"self",
",",
"umap_kwargs",
"=",
"{",
"}",
")",
":",
"# Create the pipeline steps",
"steps",
"=",
"[",
"]",
"# Add the UMAP manifold",
"steps",
".",
"append",
"(",
"(",
"'umap'",
",",
"UMAP",
"(",
"n_components",
"=",
"2",
","... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | UMAPVisualizer.fit | The fit method is the primary drawing input for the UMAP projection
since the visualization requires both X and an optional y value. The
fit method expects an array of numeric vectors, so text documents must
be vectorized before passing them to this method.
Parameters
----------... | yellowbrick/text/umap_vis.py | def fit(self, X, y=None, **kwargs):
"""
The fit method is the primary drawing input for the UMAP projection
since the visualization requires both X and an optional y value. The
fit method expects an array of numeric vectors, so text documents must
be vectorized before passing the... | def fit(self, X, y=None, **kwargs):
"""
The fit method is the primary drawing input for the UMAP projection
since the visualization requires both X and an optional y value. The
fit method expects an array of numeric vectors, so text documents must
be vectorized before passing the... | [
"The",
"fit",
"method",
"is",
"the",
"primary",
"drawing",
"input",
"for",
"the",
"UMAP",
"projection",
"since",
"the",
"visualization",
"requires",
"both",
"X",
"and",
"an",
"optional",
"y",
"value",
".",
"The",
"fit",
"method",
"expects",
"an",
"array",
... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/umap_vis.py#L250-L295 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Store the classes we observed in y",
"if",
"y",
"is",
"not",
"None",
":",
"self",
".",
"classes_",
"=",
"np",
".",
"unique",
"(",
"y",
")",
"elif",
"y... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | UMAPVisualizer.draw | Called from the fit method, this method draws the UMAP scatter plot,
from a set of decomposed points in 2 dimensions. This method also
accepts a third dimension, target, which is used to specify the colors
of each of the points. If the target is not specified, then the points
are plotted... | yellowbrick/text/umap_vis.py | def draw(self, points, target=None, **kwargs):
"""
Called from the fit method, this method draws the UMAP scatter plot,
from a set of decomposed points in 2 dimensions. This method also
accepts a third dimension, target, which is used to specify the colors
of each of the points. ... | def draw(self, points, target=None, **kwargs):
"""
Called from the fit method, this method draws the UMAP scatter plot,
from a set of decomposed points in 2 dimensions. This method also
accepts a third dimension, target, which is used to specify the colors
of each of the points. ... | [
"Called",
"from",
"the",
"fit",
"method",
"this",
"method",
"draws",
"the",
"UMAP",
"scatter",
"plot",
"from",
"a",
"set",
"of",
"decomposed",
"points",
"in",
"2",
"dimensions",
".",
"This",
"method",
"also",
"accepts",
"a",
"third",
"dimension",
"target",
... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/umap_vis.py#L297-L343 | [
"def",
"draw",
"(",
"self",
",",
"points",
",",
"target",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Resolve the labels with the classes",
"labels",
"=",
"self",
".",
"labels",
"if",
"self",
".",
"labels",
"is",
"not",
"None",
"else",
"self",
"."... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | explained_variance_visualizer | Produce a plot of the explained variance produced by a dimensionality
reduction algorithm using n=1 to n=n_components dimensions. This is a single
plot to help identify the best trade off between number of dimensions
and amount of information retained within the data.
Parameters
... | yellowbrick/features/decomposition.py | def explained_variance_visualizer(X, y=None, ax=None, scale=True,
center=True, colormap=palettes.DEFAULT_SEQUENCE,
**kwargs):
"""Produce a plot of the explained variance produced by a dimensionality
reduction algorithm using n=1 to n=... | def explained_variance_visualizer(X, y=None, ax=None, scale=True,
center=True, colormap=palettes.DEFAULT_SEQUENCE,
**kwargs):
"""Produce a plot of the explained variance produced by a dimensionality
reduction algorithm using n=1 to n=... | [
"Produce",
"a",
"plot",
"of",
"the",
"explained",
"variance",
"produced",
"by",
"a",
"dimensionality",
"reduction",
"algorithm",
"using",
"n",
"=",
"1",
"to",
"n",
"=",
"n_components",
"dimensions",
".",
"This",
"is",
"a",
"single",
"plot",
"to",
"help",
"... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/decomposition.py#L16-L64 | [
"def",
"explained_variance_visualizer",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"scale",
"=",
"True",
",",
"center",
"=",
"True",
",",
"colormap",
"=",
"palettes",
".",
"DEFAULT_SEQUENCE",
",",
"*",
"*",
"kwargs",
")",
":",
"# Ins... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | roc_auc | ROCAUC Quick method:
Receiver Operating Characteristic (ROC) curves are a measure of a
classifier's predictive quality that compares and visualizes the tradeoff
between the models' sensitivity and specificity. The ROC curve displays
the true positive rate on the Y axis and the false positive rate on th... | yellowbrick/classifier/rocauc.py | def roc_auc(model, X, y=None, ax=None, **kwargs):
"""ROCAUC Quick method:
Receiver Operating Characteristic (ROC) curves are a measure of a
classifier's predictive quality that compares and visualizes the tradeoff
between the models' sensitivity and specificity. The ROC curve displays
the true posi... | def roc_auc(model, X, y=None, ax=None, **kwargs):
"""ROCAUC Quick method:
Receiver Operating Characteristic (ROC) curves are a measure of a
classifier's predictive quality that compares and visualizes the tradeoff
between the models' sensitivity and specificity. The ROC curve displays
the true posi... | [
"ROCAUC",
"Quick",
"method",
":"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/rocauc.py#L399-L503 | [
"def",
"roc_auc",
"(",
"model",
",",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Instantiate the visualizer",
"visualizer",
"=",
"ROCAUC",
"(",
"model",
",",
"ax",
",",
"*",
"*",
"kwargs",
")",
"# Create ... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ROCAUC.score | Generates the predicted target values using the Scikit-Learn
estimator.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ndarray or Series of length n
An array or series of target or class values
... | yellowbrick/classifier/rocauc.py | def score(self, X, y=None, **kwargs):
"""
Generates the predicted target values using the Scikit-Learn
estimator.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ndarray or Series of length n
... | def score(self, X, y=None, **kwargs):
"""
Generates the predicted target values using the Scikit-Learn
estimator.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ndarray or Series of length n
... | [
"Generates",
"the",
"predicted",
"target",
"values",
"using",
"the",
"Scikit",
"-",
"Learn",
"estimator",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/rocauc.py#L148-L239 | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Compute the predictions for the test data",
"y_pred",
"=",
"self",
".",
"_get_y_scores",
"(",
"X",
")",
"# Note: In the above, _get_y_scores calls either a decision_f... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ROCAUC.draw | Renders ROC-AUC plot.
Called internally by score, possibly more than once
Returns
-------
ax : the axis with the plotted figure | yellowbrick/classifier/rocauc.py | def draw(self):
"""
Renders ROC-AUC plot.
Called internally by score, possibly more than once
Returns
-------
ax : the axis with the plotted figure
"""
colors = self.colors[0:len(self.classes_)]
n_classes = len(colors)
# If it's a binary ... | def draw(self):
"""
Renders ROC-AUC plot.
Called internally by score, possibly more than once
Returns
-------
ax : the axis with the plotted figure
"""
colors = self.colors[0:len(self.classes_)]
n_classes = len(colors)
# If it's a binary ... | [
"Renders",
"ROC",
"-",
"AUC",
"plot",
".",
"Called",
"internally",
"by",
"score",
"possibly",
"more",
"than",
"once"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/rocauc.py#L241-L294 | [
"def",
"draw",
"(",
"self",
")",
":",
"colors",
"=",
"self",
".",
"colors",
"[",
"0",
":",
"len",
"(",
"self",
".",
"classes_",
")",
"]",
"n_classes",
"=",
"len",
"(",
"colors",
")",
"# If it's a binary decision, plot the single ROC curve",
"if",
"self",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ROCAUC.finalize | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | yellowbrick/classifier/rocauc.py | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Set the title and add the legend
self.s... | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Set the title and add the legend
self.s... | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/rocauc.py#L296-L316 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the title and add the legend",
"self",
".",
"set_title",
"(",
"'ROC Curves for {}'",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"self",
".",
"ax",
".",
"legend",
"(",
"loc",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ROCAUC._get_y_scores | The ``roc_curve`` metric requires target scores that can either be the
probability estimates of the positive class, confidence values or non-
thresholded measure of decisions (as returned by "decision_function").
This method computes the scores by resolving the estimator methods
that re... | yellowbrick/classifier/rocauc.py | def _get_y_scores(self, X):
"""
The ``roc_curve`` metric requires target scores that can either be the
probability estimates of the positive class, confidence values or non-
thresholded measure of decisions (as returned by "decision_function").
This method computes the scores by... | def _get_y_scores(self, X):
"""
The ``roc_curve`` metric requires target scores that can either be the
probability estimates of the positive class, confidence values or non-
thresholded measure of decisions (as returned by "decision_function").
This method computes the scores by... | [
"The",
"roc_curve",
"metric",
"requires",
"target",
"scores",
"that",
"can",
"either",
"be",
"the",
"probability",
"estimates",
"of",
"the",
"positive",
"class",
"confidence",
"values",
"or",
"non",
"-",
"thresholded",
"measure",
"of",
"decisions",
"(",
"as",
... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/rocauc.py#L318-L359 | [
"def",
"_get_y_scores",
"(",
"self",
",",
"X",
")",
":",
"# The resolution order of scoring functions",
"attrs",
"=",
"(",
"'predict_proba'",
",",
"'decision_function'",
",",
")",
"# Return the first resolved function",
"for",
"attr",
"in",
"attrs",
":",
"try",
":",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ROCAUC._score_micro_average | Compute the micro average scores for the ROCAUC curves. | yellowbrick/classifier/rocauc.py | def _score_micro_average(self, y, y_pred, classes, n_classes):
"""
Compute the micro average scores for the ROCAUC curves.
"""
# Convert y to binarized array for micro and macro scores
y = label_binarize(y, classes=classes)
if n_classes == 2:
y = np.hstack((1-... | def _score_micro_average(self, y, y_pred, classes, n_classes):
"""
Compute the micro average scores for the ROCAUC curves.
"""
# Convert y to binarized array for micro and macro scores
y = label_binarize(y, classes=classes)
if n_classes == 2:
y = np.hstack((1-... | [
"Compute",
"the",
"micro",
"average",
"scores",
"for",
"the",
"ROCAUC",
"curves",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/rocauc.py#L361-L372 | [
"def",
"_score_micro_average",
"(",
"self",
",",
"y",
",",
"y_pred",
",",
"classes",
",",
"n_classes",
")",
":",
"# Convert y to binarized array for micro and macro scores",
"y",
"=",
"label_binarize",
"(",
"y",
",",
"classes",
"=",
"classes",
")",
"if",
"n_classe... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ROCAUC._score_macro_average | Compute the macro average scores for the ROCAUC curves. | yellowbrick/classifier/rocauc.py | def _score_macro_average(self, n_classes):
"""
Compute the macro average scores for the ROCAUC curves.
"""
# Gather all FPRs
all_fpr = np.unique(np.concatenate([self.fpr[i] for i in range(n_classes)]))
avg_tpr = np.zeros_like(all_fpr)
# Compute the averages per c... | def _score_macro_average(self, n_classes):
"""
Compute the macro average scores for the ROCAUC curves.
"""
# Gather all FPRs
all_fpr = np.unique(np.concatenate([self.fpr[i] for i in range(n_classes)]))
avg_tpr = np.zeros_like(all_fpr)
# Compute the averages per c... | [
"Compute",
"the",
"macro",
"average",
"scores",
"for",
"the",
"ROCAUC",
"curves",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/rocauc.py#L374-L392 | [
"def",
"_score_macro_average",
"(",
"self",
",",
"n_classes",
")",
":",
"# Gather all FPRs",
"all_fpr",
"=",
"np",
".",
"unique",
"(",
"np",
".",
"concatenate",
"(",
"[",
"self",
".",
"fpr",
"[",
"i",
"]",
"for",
"i",
"in",
"range",
"(",
"n_classes",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | is_estimator | Determines if a model is an estimator using issubclass and isinstance.
Parameters
----------
estimator : class or instance
The object to test if it is a Scikit-Learn clusterer, especially a
Scikit-Learn estimator or Yellowbrick visualizer | yellowbrick/utils/types.py | def is_estimator(model):
"""
Determines if a model is an estimator using issubclass and isinstance.
Parameters
----------
estimator : class or instance
The object to test if it is a Scikit-Learn clusterer, especially a
Scikit-Learn estimator or Yellowbrick visualizer
"""
if ... | def is_estimator(model):
"""
Determines if a model is an estimator using issubclass and isinstance.
Parameters
----------
estimator : class or instance
The object to test if it is a Scikit-Learn clusterer, especially a
Scikit-Learn estimator or Yellowbrick visualizer
"""
if ... | [
"Determines",
"if",
"a",
"model",
"is",
"an",
"estimator",
"using",
"issubclass",
"and",
"isinstance",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/types.py#L30-L43 | [
"def",
"is_estimator",
"(",
"model",
")",
":",
"if",
"inspect",
".",
"isclass",
"(",
"model",
")",
":",
"return",
"issubclass",
"(",
"model",
",",
"BaseEstimator",
")",
"return",
"isinstance",
"(",
"model",
",",
"BaseEstimator",
")"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | is_gridsearch | Returns True if the given estimator is a clusterer.
Parameters
----------
estimator : class or instance
The object to test if it is a Scikit-Learn clusterer, especially a
Scikit-Learn estimator or Yellowbrick visualizer | yellowbrick/utils/types.py | def is_gridsearch(estimator):
"""
Returns True if the given estimator is a clusterer.
Parameters
----------
estimator : class or instance
The object to test if it is a Scikit-Learn clusterer, especially a
Scikit-Learn estimator or Yellowbrick visualizer
"""
from sklearn.mod... | def is_gridsearch(estimator):
"""
Returns True if the given estimator is a clusterer.
Parameters
----------
estimator : class or instance
The object to test if it is a Scikit-Learn clusterer, especially a
Scikit-Learn estimator or Yellowbrick visualizer
"""
from sklearn.mod... | [
"Returns",
"True",
"if",
"the",
"given",
"estimator",
"is",
"a",
"clusterer",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/types.py#L113-L129 | [
"def",
"is_gridsearch",
"(",
"estimator",
")",
":",
"from",
"sklearn",
".",
"model_selection",
"import",
"GridSearchCV",
",",
"RandomizedSearchCV",
"if",
"inspect",
".",
"isclass",
"(",
"estimator",
")",
":",
"return",
"issubclass",
"(",
"estimator",
",",
"(",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | is_dataframe | Returns True if the given object is a Pandas Data Frame.
Parameters
----------
obj: instance
The object to test whether or not is a Pandas DataFrame. | yellowbrick/utils/types.py | def is_dataframe(obj):
"""
Returns True if the given object is a Pandas Data Frame.
Parameters
----------
obj: instance
The object to test whether or not is a Pandas DataFrame.
"""
try:
# This is the best method of type checking
from pandas import DataFrame
r... | def is_dataframe(obj):
"""
Returns True if the given object is a Pandas Data Frame.
Parameters
----------
obj: instance
The object to test whether or not is a Pandas DataFrame.
"""
try:
# This is the best method of type checking
from pandas import DataFrame
r... | [
"Returns",
"True",
"if",
"the",
"given",
"object",
"is",
"a",
"Pandas",
"Data",
"Frame",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/types.py#L160-L175 | [
"def",
"is_dataframe",
"(",
"obj",
")",
":",
"try",
":",
"# This is the best method of type checking",
"from",
"pandas",
"import",
"DataFrame",
"return",
"isinstance",
"(",
"obj",
",",
"DataFrame",
")",
"except",
"ImportError",
":",
"# Pandas is not a dependency, so thi... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | is_series | Returns True if the given object is a Pandas Series.
Parameters
----------
obj: instance
The object to test whether or not is a Pandas Series. | yellowbrick/utils/types.py | def is_series(obj):
"""
Returns True if the given object is a Pandas Series.
Parameters
----------
obj: instance
The object to test whether or not is a Pandas Series.
"""
try:
# This is the best method of type checking
from pandas import Series
return isinsta... | def is_series(obj):
"""
Returns True if the given object is a Pandas Series.
Parameters
----------
obj: instance
The object to test whether or not is a Pandas Series.
"""
try:
# This is the best method of type checking
from pandas import Series
return isinsta... | [
"Returns",
"True",
"if",
"the",
"given",
"object",
"is",
"a",
"Pandas",
"Series",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/types.py#L181-L196 | [
"def",
"is_series",
"(",
"obj",
")",
":",
"try",
":",
"# This is the best method of type checking",
"from",
"pandas",
"import",
"Series",
"return",
"isinstance",
"(",
"obj",
",",
"Series",
")",
"except",
"ImportError",
":",
"# Pandas is not a dependency, so this is scar... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | is_structured_array | Returns True if the given object is a Numpy Structured Array.
Parameters
----------
obj: instance
The object to test whether or not is a Numpy Structured Array. | yellowbrick/utils/types.py | def is_structured_array(obj):
"""
Returns True if the given object is a Numpy Structured Array.
Parameters
----------
obj: instance
The object to test whether or not is a Numpy Structured Array.
"""
if isinstance(obj, np.ndarray) and hasattr(obj, 'dtype'):
if obj.dtype.names... | def is_structured_array(obj):
"""
Returns True if the given object is a Numpy Structured Array.
Parameters
----------
obj: instance
The object to test whether or not is a Numpy Structured Array.
"""
if isinstance(obj, np.ndarray) and hasattr(obj, 'dtype'):
if obj.dtype.names... | [
"Returns",
"True",
"if",
"the",
"given",
"object",
"is",
"a",
"Numpy",
"Structured",
"Array",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/types.py#L202-L214 | [
"def",
"is_structured_array",
"(",
"obj",
")",
":",
"if",
"isinstance",
"(",
"obj",
",",
"np",
".",
"ndarray",
")",
"and",
"hasattr",
"(",
"obj",
",",
"'dtype'",
")",
":",
"if",
"obj",
".",
"dtype",
".",
"names",
"is",
"not",
"None",
":",
"return",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | prediction_error | Quick method:
Plot the actual targets from the dataset against the
predicted values generated by our model(s).
This helper function is a quick wrapper to utilize the PredictionError
ScoreVisualizer for one-off analysis.
Parameters
----------
model : the Scikit-Learn estimator (should be a... | yellowbrick/regressor/residuals.py | def prediction_error(model, X, y=None, ax=None, alpha=0.75, **kwargs):
"""
Quick method:
Plot the actual targets from the dataset against the
predicted values generated by our model(s).
This helper function is a quick wrapper to utilize the PredictionError
ScoreVisualizer for one-off analysis.... | def prediction_error(model, X, y=None, ax=None, alpha=0.75, **kwargs):
"""
Quick method:
Plot the actual targets from the dataset against the
predicted values generated by our model(s).
This helper function is a quick wrapper to utilize the PredictionError
ScoreVisualizer for one-off analysis.... | [
"Quick",
"method",
":"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L255-L328 | [
"def",
"prediction_error",
"(",
"model",
",",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"alpha",
"=",
"0.75",
",",
"*",
"*",
"kwargs",
")",
":",
"# Instantiate the visualizer",
"visualizer",
"=",
"PredictionError",
"(",
"model",
",",
"ax",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | residuals_plot | Quick method:
Divides the dataset X, y into a train and test split (the size of the
splits determined by test_size) then plots the training and test residuals
agains the predicted value for the given model.
This helper function is a quick wrapper to utilize the ResidualsPlot
ScoreVisualizer for on... | yellowbrick/regressor/residuals.py | def residuals_plot(model,
X,
y,
ax=None,
hist=True,
test_size=0.25,
train_color='b',
test_color='g',
line_color=LINE_COLOR,
random_state=None,
... | def residuals_plot(model,
X,
y,
ax=None,
hist=True,
test_size=0.25,
train_color='b',
test_color='g',
line_color=LINE_COLOR,
random_state=None,
... | [
"Quick",
"method",
":"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L598-L703 | [
"def",
"residuals_plot",
"(",
"model",
",",
"X",
",",
"y",
",",
"ax",
"=",
"None",
",",
"hist",
"=",
"True",
",",
"test_size",
"=",
"0.25",
",",
"train_color",
"=",
"'b'",
",",
"test_color",
"=",
"'g'",
",",
"line_color",
"=",
"LINE_COLOR",
",",
"ran... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PredictionError.score | The score function is the hook for visual interaction. Pass in test
data and the visualizer will create predictions on the data and
evaluate them with respect to the test values. The evaluation will
then be passed to draw() and the result of the estimator score will
be returned.
... | yellowbrick/regressor/residuals.py | def score(self, X, y=None, **kwargs):
"""
The score function is the hook for visual interaction. Pass in test
data and the visualizer will create predictions on the data and
evaluate them with respect to the test values. The evaluation will
then be passed to draw() and the result... | def score(self, X, y=None, **kwargs):
"""
The score function is the hook for visual interaction. Pass in test
data and the visualizer will create predictions on the data and
evaluate them with respect to the test values. The evaluation will
then be passed to draw() and the result... | [
"The",
"score",
"function",
"is",
"the",
"hook",
"for",
"visual",
"interaction",
".",
"Pass",
"in",
"test",
"data",
"and",
"the",
"visualizer",
"will",
"create",
"predictions",
"on",
"the",
"data",
"and",
"evaluate",
"them",
"with",
"respect",
"to",
"the",
... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L136-L161 | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"score_",
"=",
"self",
".",
"estimator",
".",
"score",
"(",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
"y_pred",
"=",
"self",
".",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PredictionError.draw | Parameters
----------
y : ndarray or Series of length n
An array or series of target or class values
y_pred : ndarray or Series of length n
An array or series of predicted target values
Returns
------
ax : the axis with the plotted figure | yellowbrick/regressor/residuals.py | def draw(self, y, y_pred):
"""
Parameters
----------
y : ndarray or Series of length n
An array or series of target or class values
y_pred : ndarray or Series of length n
An array or series of predicted target values
Returns
----... | def draw(self, y, y_pred):
"""
Parameters
----------
y : ndarray or Series of length n
An array or series of target or class values
y_pred : ndarray or Series of length n
An array or series of predicted target values
Returns
----... | [
"Parameters",
"----------",
"y",
":",
"ndarray",
"or",
"Series",
"of",
"length",
"n",
"An",
"array",
"or",
"series",
"of",
"target",
"or",
"class",
"values"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L163-L200 | [
"def",
"draw",
"(",
"self",
",",
"y",
",",
"y_pred",
")",
":",
"label",
"=",
"\"$R^2 = {:0.3f}$\"",
".",
"format",
"(",
"self",
".",
"score_",
")",
"self",
".",
"ax",
".",
"scatter",
"(",
"y",
",",
"y_pred",
",",
"c",
"=",
"self",
".",
"colors",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | PredictionError.finalize | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | yellowbrick/regressor/residuals.py | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Set the title on the plot
self.set_title... | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Set the title on the plot
self.set_title... | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L202-L253 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the title on the plot",
"self",
".",
"set_title",
"(",
"'Prediction Error for {}'",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"# Square the axes to ensure a 45 degree line",
"if",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ResidualsPlot.hax | Returns the histogram axes, creating it only on demand. | yellowbrick/regressor/residuals.py | def hax(self):
"""
Returns the histogram axes, creating it only on demand.
"""
if make_axes_locatable is None:
raise YellowbrickValueError((
"residuals histogram requires matplotlib 2.0.2 or greater "
"please upgrade matplotlib or set hist=Fals... | def hax(self):
"""
Returns the histogram axes, creating it only on demand.
"""
if make_axes_locatable is None:
raise YellowbrickValueError((
"residuals histogram requires matplotlib 2.0.2 or greater "
"please upgrade matplotlib or set hist=Fals... | [
"Returns",
"the",
"histogram",
"axes",
"creating",
"it",
"only",
"on",
"demand",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L438-L454 | [
"def",
"hax",
"(",
"self",
")",
":",
"if",
"make_axes_locatable",
"is",
"None",
":",
"raise",
"YellowbrickValueError",
"(",
"(",
"\"residuals histogram requires matplotlib 2.0.2 or greater \"",
"\"please upgrade matplotlib or set hist=False on the visualizer\"",
")",
")",
"divi... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ResidualsPlot.fit | Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ndarray or Series of length n
An array or series of target values
kwargs: keyword arguments passed to Scikit-Learn API.
Returns
-------
... | yellowbrick/regressor/residuals.py | def fit(self, X, y, **kwargs):
"""
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ndarray or Series of length n
An array or series of target values
kwargs: keyword arguments passed to Sci... | def fit(self, X, y, **kwargs):
"""
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ndarray or Series of length n
An array or series of target values
kwargs: keyword arguments passed to Sci... | [
"Parameters",
"----------",
"X",
":",
"ndarray",
"or",
"DataFrame",
"of",
"shape",
"n",
"x",
"m",
"A",
"matrix",
"of",
"n",
"instances",
"with",
"m",
"features"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L456-L474 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"ResidualsPlot",
",",
"self",
")",
".",
"fit",
"(",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"score",
"(",
"X",
",",
"y",
",",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ResidualsPlot.score | Generates predicted target values using the Scikit-Learn
estimator.
Parameters
----------
X : array-like
X (also X_test) are the dependent variables of test set to predict
y : array-like
y (also y_test) is the independent actual variables to score agains... | yellowbrick/regressor/residuals.py | def score(self, X, y=None, train=False, **kwargs):
"""
Generates predicted target values using the Scikit-Learn
estimator.
Parameters
----------
X : array-like
X (also X_test) are the dependent variables of test set to predict
y : array-like
... | def score(self, X, y=None, train=False, **kwargs):
"""
Generates predicted target values using the Scikit-Learn
estimator.
Parameters
----------
X : array-like
X (also X_test) are the dependent variables of test set to predict
y : array-like
... | [
"Generates",
"predicted",
"target",
"values",
"using",
"the",
"Scikit",
"-",
"Learn",
"estimator",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L476-L510 | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"train",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"score",
"=",
"self",
".",
"estimator",
".",
"score",
"(",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
"if",
"train"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ResidualsPlot.draw | Draw the residuals against the predicted value for the specified split.
It is best to draw the training split first, then the test split so
that the test split (usually smaller) is above the training split;
particularly if the histogram is turned on.
Parameters
----------
... | yellowbrick/regressor/residuals.py | def draw(self, y_pred, residuals, train=False, **kwargs):
"""
Draw the residuals against the predicted value for the specified split.
It is best to draw the training split first, then the test split so
that the test split (usually smaller) is above the training split;
particularl... | def draw(self, y_pred, residuals, train=False, **kwargs):
"""
Draw the residuals against the predicted value for the specified split.
It is best to draw the training split first, then the test split so
that the test split (usually smaller) is above the training split;
particularl... | [
"Draw",
"the",
"residuals",
"against",
"the",
"predicted",
"value",
"for",
"the",
"specified",
"split",
".",
"It",
"is",
"best",
"to",
"draw",
"the",
"training",
"split",
"first",
"then",
"the",
"test",
"split",
"so",
"that",
"the",
"test",
"split",
"(",
... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L512-L566 | [
"def",
"draw",
"(",
"self",
",",
"y_pred",
",",
"residuals",
",",
"train",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"train",
":",
"color",
"=",
"self",
".",
"colors",
"[",
"'train_point'",
"]",
"label",
"=",
"\"Train $R^2 = {:0.3f}$\"",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | ResidualsPlot.finalize | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | yellowbrick/regressor/residuals.py | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Add the title to the plot
self.set_title... | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Add the title to the plot
self.set_title... | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/residuals.py#L568-L595 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Add the title to the plot",
"self",
".",
"set_title",
"(",
"'Residuals for {} Model'",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"# Set the legend with full opacity patches using manual leg... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | discrimination_threshold | Quick method for DiscriminationThreshold.
Visualizes how precision, recall, f1 score, and queue rate change as the
discrimination threshold increases. For probabilistic, binary classifiers,
the discrimination threshold is the probability at which you choose the
positive class over the negative. General... | yellowbrick/classifier/threshold.py | def discrimination_threshold(model, X, y, ax=None, n_trials=50, cv=0.1,
fbeta=1.0, argmax='fscore', exclude=None,
quantiles=QUANTILES_MEDIAN_80, random_state=None,
**kwargs):
"""Quick method for DiscriminationThreshold.
Visu... | def discrimination_threshold(model, X, y, ax=None, n_trials=50, cv=0.1,
fbeta=1.0, argmax='fscore', exclude=None,
quantiles=QUANTILES_MEDIAN_80, random_state=None,
**kwargs):
"""Quick method for DiscriminationThreshold.
Visu... | [
"Quick",
"method",
"for",
"DiscriminationThreshold",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/threshold.py#L459-L562 | [
"def",
"discrimination_threshold",
"(",
"model",
",",
"X",
",",
"y",
",",
"ax",
"=",
"None",
",",
"n_trials",
"=",
"50",
",",
"cv",
"=",
"0.1",
",",
"fbeta",
"=",
"1.0",
",",
"argmax",
"=",
"'fscore'",
",",
"exclude",
"=",
"None",
",",
"quantiles",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | DiscriminationThreshold.fit | Fit is the entry point for the visualizer. Given instances described
by X and binary classes described in the target y, fit performs n
trials by shuffling and splitting the dataset then computing the
precision, recall, f1, and queue rate scores for each trial. The
scores are aggregated b... | yellowbrick/classifier/threshold.py | def fit(self, X, y, **kwargs):
"""
Fit is the entry point for the visualizer. Given instances described
by X and binary classes described in the target y, fit performs n
trials by shuffling and splitting the dataset then computing the
precision, recall, f1, and queue rate scores ... | def fit(self, X, y, **kwargs):
"""
Fit is the entry point for the visualizer. Given instances described
by X and binary classes described in the target y, fit performs n
trials by shuffling and splitting the dataset then computing the
precision, recall, f1, and queue rate scores ... | [
"Fit",
"is",
"the",
"entry",
"point",
"for",
"the",
"visualizer",
".",
"Given",
"instances",
"described",
"by",
"X",
"and",
"binary",
"classes",
"described",
"in",
"the",
"target",
"y",
"fit",
"performs",
"n",
"trials",
"by",
"shuffling",
"and",
"splitting",... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/threshold.py#L186-L270 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"# Check target before metrics raise crazy exceptions",
"if",
"type_of_target",
"(",
"y",
")",
"!=",
"'binary'",
":",
"raise",
"YellowbrickValueError",
"(",
"\"multiclass format is n... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | DiscriminationThreshold._split_fit_score_trial | Splits the dataset, fits a clone of the estimator, then scores it
according to the required metrics.
The index of the split is added to the random_state if the
random_state is not None; this ensures that every split is shuffled
differently but in a deterministic fashion for testing purp... | yellowbrick/classifier/threshold.py | def _split_fit_score_trial(self, X, y, idx=0):
"""
Splits the dataset, fits a clone of the estimator, then scores it
according to the required metrics.
The index of the split is added to the random_state if the
random_state is not None; this ensures that every split is shuffled
... | def _split_fit_score_trial(self, X, y, idx=0):
"""
Splits the dataset, fits a clone of the estimator, then scores it
according to the required metrics.
The index of the split is added to the random_state if the
random_state is not None; this ensures that every split is shuffled
... | [
"Splits",
"the",
"dataset",
"fits",
"a",
"clone",
"of",
"the",
"estimator",
"then",
"scores",
"it",
"according",
"to",
"the",
"required",
"metrics",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/threshold.py#L272-L331 | [
"def",
"_split_fit_score_trial",
"(",
"self",
",",
"X",
",",
"y",
",",
"idx",
"=",
"0",
")",
":",
"random_state",
"=",
"self",
".",
"random_state",
"if",
"random_state",
"is",
"not",
"None",
":",
"random_state",
"+=",
"idx",
"splitter",
"=",
"self",
".",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | DiscriminationThreshold.draw | Draws the cv scores as a line chart on the current axes. | yellowbrick/classifier/threshold.py | def draw(self):
"""
Draws the cv scores as a line chart on the current axes.
"""
# Set the colors from the supplied values or reasonable defaults
color_values = resolve_colors(n_colors=4, colors=self.color)
for idx, metric in enumerate(METRICS):
# Skip any ex... | def draw(self):
"""
Draws the cv scores as a line chart on the current axes.
"""
# Set the colors from the supplied values or reasonable defaults
color_values = resolve_colors(n_colors=4, colors=self.color)
for idx, metric in enumerate(METRICS):
# Skip any ex... | [
"Draws",
"the",
"cv",
"scores",
"as",
"a",
"line",
"chart",
"on",
"the",
"current",
"axes",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/threshold.py#L333-L381 | [
"def",
"draw",
"(",
"self",
")",
":",
"# Set the colors from the supplied values or reasonable defaults",
"color_values",
"=",
"resolve_colors",
"(",
"n_colors",
"=",
"4",
",",
"colors",
"=",
"self",
".",
"color",
")",
"for",
"idx",
",",
"metric",
"in",
"enumerate... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | DiscriminationThreshold._check_quantiles | Validate the quantiles passed in. Returns the np array if valid. | yellowbrick/classifier/threshold.py | def _check_quantiles(self, val):
"""
Validate the quantiles passed in. Returns the np array if valid.
"""
if len(val) != 3 or not is_monotonic(val) or not np.all(val < 1):
raise YellowbrickValueError(
"quantiles must be a sequence of three "
"m... | def _check_quantiles(self, val):
"""
Validate the quantiles passed in. Returns the np array if valid.
"""
if len(val) != 3 or not is_monotonic(val) or not np.all(val < 1):
raise YellowbrickValueError(
"quantiles must be a sequence of three "
"m... | [
"Validate",
"the",
"quantiles",
"passed",
"in",
".",
"Returns",
"the",
"np",
"array",
"if",
"valid",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/threshold.py#L403-L412 | [
"def",
"_check_quantiles",
"(",
"self",
",",
"val",
")",
":",
"if",
"len",
"(",
"val",
")",
"!=",
"3",
"or",
"not",
"is_monotonic",
"(",
"val",
")",
"or",
"not",
"np",
".",
"all",
"(",
"val",
"<",
"1",
")",
":",
"raise",
"YellowbrickValueError",
"(... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | DiscriminationThreshold._check_cv | Validate the cv method passed in. Returns the split strategy if no
validation exception is raised. | yellowbrick/classifier/threshold.py | def _check_cv(self, val, random_state=None):
"""
Validate the cv method passed in. Returns the split strategy if no
validation exception is raised.
"""
# Use default splitter in this case
if val is None: val = 0.1
if isinstance(val, float) and val <= 1.0:
... | def _check_cv(self, val, random_state=None):
"""
Validate the cv method passed in. Returns the split strategy if no
validation exception is raised.
"""
# Use default splitter in this case
if val is None: val = 0.1
if isinstance(val, float) and val <= 1.0:
... | [
"Validate",
"the",
"cv",
"method",
"passed",
"in",
".",
"Returns",
"the",
"split",
"strategy",
"if",
"no",
"validation",
"exception",
"is",
"raised",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/threshold.py#L414-L434 | [
"def",
"_check_cv",
"(",
"self",
",",
"val",
",",
"random_state",
"=",
"None",
")",
":",
"# Use default splitter in this case",
"if",
"val",
"is",
"None",
":",
"val",
"=",
"0.1",
"if",
"isinstance",
"(",
"val",
",",
"float",
")",
"and",
"val",
"<=",
"1.0... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | DiscriminationThreshold._check_exclude | Validate the excluded metrics. Returns the set of excluded params. | yellowbrick/classifier/threshold.py | def _check_exclude(self, val):
"""
Validate the excluded metrics. Returns the set of excluded params.
"""
if val is None:
exclude = frozenset()
elif isinstance(val, str):
exclude = frozenset([val.lower()])
else:
exclude = frozenset(map(... | def _check_exclude(self, val):
"""
Validate the excluded metrics. Returns the set of excluded params.
"""
if val is None:
exclude = frozenset()
elif isinstance(val, str):
exclude = frozenset([val.lower()])
else:
exclude = frozenset(map(... | [
"Validate",
"the",
"excluded",
"metrics",
".",
"Returns",
"the",
"set",
"of",
"excluded",
"params",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/threshold.py#L436-L452 | [
"def",
"_check_exclude",
"(",
"self",
",",
"val",
")",
":",
"if",
"val",
"is",
"None",
":",
"exclude",
"=",
"frozenset",
"(",
")",
"elif",
"isinstance",
"(",
"val",
",",
"str",
")",
":",
"exclude",
"=",
"frozenset",
"(",
"[",
"val",
".",
"lower",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | decisionviz | DecisionBoundariesVisualizer is a bivariate data visualization algorithm
that plots the decision boundaries of each class.
This helper function is a quick wrapper to utilize the
DecisionBoundariesVisualizers for one-off analysis.
Parameters
----------
model : the Scikit-Learn estimator, re... | yellowbrick/contrib/classifier/boundaries.py | def decisionviz(model,
X,
y,
colors=None,
classes=None,
features=None,
show_scatter=True,
step_size=0.0025,
markers=None,
pcolormesh_alpha=0.8,
scatter_alpha=1.... | def decisionviz(model,
X,
y,
colors=None,
classes=None,
features=None,
show_scatter=True,
step_size=0.0025,
markers=None,
pcolormesh_alpha=0.8,
scatter_alpha=1.... | [
"DecisionBoundariesVisualizer",
"is",
"a",
"bivariate",
"data",
"visualization",
"algorithm",
"that",
"plots",
"the",
"decision",
"boundaries",
"of",
"each",
"class",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/contrib/classifier/boundaries.py#L32-L121 | [
"def",
"decisionviz",
"(",
"model",
",",
"X",
",",
"y",
",",
"colors",
"=",
"None",
",",
"classes",
"=",
"None",
",",
"features",
"=",
"None",
",",
"show_scatter",
"=",
"True",
",",
"step_size",
"=",
"0.0025",
",",
"markers",
"=",
"None",
",",
"pcolo... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | find_text_color | Takes a background color and returns the appropriate light or dark text color.
Users can specify the dark and light text color, or accept the defaults of 'black' and 'white'
base_color: The color of the background. This must be
specified in RGBA with values between 0 and 1 (note, this is the default
... | yellowbrick/style/utils.py | def find_text_color(base_color, dark_color="black", light_color="white", coef_choice=0):
"""
Takes a background color and returns the appropriate light or dark text color.
Users can specify the dark and light text color, or accept the defaults of 'black' and 'white'
base_color: The color of the backgro... | def find_text_color(base_color, dark_color="black", light_color="white", coef_choice=0):
"""
Takes a background color and returns the appropriate light or dark text color.
Users can specify the dark and light text color, or accept the defaults of 'black' and 'white'
base_color: The color of the backgro... | [
"Takes",
"a",
"background",
"color",
"and",
"returns",
"the",
"appropriate",
"light",
"or",
"dark",
"text",
"color",
".",
"Users",
"can",
"specify",
"the",
"dark",
"and",
"light",
"text",
"color",
"or",
"accept",
"the",
"defaults",
"of",
"black",
"and",
"w... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/style/utils.py#L12-L48 | [
"def",
"find_text_color",
"(",
"base_color",
",",
"dark_color",
"=",
"\"black\"",
",",
"light_color",
"=",
"\"white\"",
",",
"coef_choice",
"=",
"0",
")",
":",
"#Coefficients:",
"# option 0: http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | feature_importances | Displays the most informative features in a model by showing a bar chart
of features ranked by their importances. Although primarily a feature
engineering mechanism, this visualizer requires a model that has either a
``coef_`` or ``feature_importances_`` parameter after fit.
Parameters
----------
... | yellowbrick/features/importances.py | def feature_importances(model, X, y=None, ax=None, labels=None,
relative=True, absolute=False, xlabel=None,
stack=False, **kwargs):
"""
Displays the most informative features in a model by showing a bar chart
of features ranked by their importances. Although p... | def feature_importances(model, X, y=None, ax=None, labels=None,
relative=True, absolute=False, xlabel=None,
stack=False, **kwargs):
"""
Displays the most informative features in a model by showing a bar chart
of features ranked by their importances. Although p... | [
"Displays",
"the",
"most",
"informative",
"features",
"in",
"a",
"model",
"by",
"showing",
"a",
"bar",
"chart",
"of",
"features",
"ranked",
"by",
"their",
"importances",
".",
"Although",
"primarily",
"a",
"feature",
"engineering",
"mechanism",
"this",
"visualize... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/importances.py#L320-L385 | [
"def",
"feature_importances",
"(",
"model",
",",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"labels",
"=",
"None",
",",
"relative",
"=",
"True",
",",
"absolute",
"=",
"False",
",",
"xlabel",
"=",
"None",
",",
"stack",
"=",
"False",
",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | FeatureImportances.fit | Fits the estimator to discover the feature importances described by
the data, then draws those importances as a bar plot.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : ndarray or Series of length n
... | yellowbrick/features/importances.py | def fit(self, X, y=None, **kwargs):
"""
Fits the estimator to discover the feature importances described by
the data, then draws those importances as a bar plot.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m feat... | def fit(self, X, y=None, **kwargs):
"""
Fits the estimator to discover the feature importances described by
the data, then draws those importances as a bar plot.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m feat... | [
"Fits",
"the",
"estimator",
"to",
"discover",
"the",
"feature",
"importances",
"described",
"by",
"the",
"data",
"then",
"draws",
"those",
"importances",
"as",
"a",
"bar",
"plot",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/importances.py#L116-L196 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"super",
"(",
"FeatureImportances",
",",
"self",
")",
".",
"fit",
"(",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
"# Get the feature importances from the... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | FeatureImportances.draw | Draws the feature importances as a bar chart; called from fit. | yellowbrick/features/importances.py | def draw(self, **kwargs):
"""
Draws the feature importances as a bar chart; called from fit.
"""
# Quick validation
for param in ('feature_importances_', 'features_'):
if not hasattr(self, param):
raise NotFitted("missing required param '{}'".format(pa... | def draw(self, **kwargs):
"""
Draws the feature importances as a bar chart; called from fit.
"""
# Quick validation
for param in ('feature_importances_', 'features_'):
if not hasattr(self, param):
raise NotFitted("missing required param '{}'".format(pa... | [
"Draws",
"the",
"feature",
"importances",
"as",
"a",
"bar",
"chart",
";",
"called",
"from",
"fit",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/importances.py#L198-L237 | [
"def",
"draw",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Quick validation",
"for",
"param",
"in",
"(",
"'feature_importances_'",
",",
"'features_'",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"param",
")",
":",
"raise",
"NotFitted",
"("... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | FeatureImportances.finalize | Finalize the drawing setting labels and title. | yellowbrick/features/importances.py | def finalize(self, **kwargs):
"""
Finalize the drawing setting labels and title.
"""
# Set the title
self.set_title('Feature Importances of {} Features using {}'.format(
len(self.features_), self.name))
# Set the xlabel
self.ax.set_xlabel(self._ge... | def finalize(self, **kwargs):
"""
Finalize the drawing setting labels and title.
"""
# Set the title
self.set_title('Feature Importances of {} Features using {}'.format(
len(self.features_), self.name))
# Set the xlabel
self.ax.set_xlabel(self._ge... | [
"Finalize",
"the",
"drawing",
"setting",
"labels",
"and",
"title",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/importances.py#L239-L256 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the title",
"self",
".",
"set_title",
"(",
"'Feature Importances of {} Features using {}'",
".",
"format",
"(",
"len",
"(",
"self",
".",
"features_",
")",
",",
"self",
".",
"name",
")"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | FeatureImportances._find_classes_param | Searches the wrapped model for the classes_ parameter. | yellowbrick/features/importances.py | def _find_classes_param(self):
"""
Searches the wrapped model for the classes_ parameter.
"""
for attr in ["classes_"]:
try:
return getattr(self.estimator, attr)
except AttributeError:
continue
raise YellowbrickTypeError(
... | def _find_classes_param(self):
"""
Searches the wrapped model for the classes_ parameter.
"""
for attr in ["classes_"]:
try:
return getattr(self.estimator, attr)
except AttributeError:
continue
raise YellowbrickTypeError(
... | [
"Searches",
"the",
"wrapped",
"model",
"for",
"the",
"classes_",
"parameter",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/importances.py#L258-L272 | [
"def",
"_find_classes_param",
"(",
"self",
")",
":",
"for",
"attr",
"in",
"[",
"\"classes_\"",
"]",
":",
"try",
":",
"return",
"getattr",
"(",
"self",
".",
"estimator",
",",
"attr",
")",
"except",
"AttributeError",
":",
"continue",
"raise",
"YellowbrickTypeE... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | FeatureImportances._get_xlabel | Determines the xlabel based on the underlying data structure | yellowbrick/features/importances.py | def _get_xlabel(self):
"""
Determines the xlabel based on the underlying data structure
"""
# Return user-specified label
if self.xlabel:
return self.xlabel
# Label for coefficients
if hasattr(self.estimator, "coef_"):
if self.relative:
... | def _get_xlabel(self):
"""
Determines the xlabel based on the underlying data structure
"""
# Return user-specified label
if self.xlabel:
return self.xlabel
# Label for coefficients
if hasattr(self.estimator, "coef_"):
if self.relative:
... | [
"Determines",
"the",
"xlabel",
"based",
"on",
"the",
"underlying",
"data",
"structure"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/importances.py#L290-L307 | [
"def",
"_get_xlabel",
"(",
"self",
")",
":",
"# Return user-specified label",
"if",
"self",
".",
"xlabel",
":",
"return",
"self",
".",
"xlabel",
"# Label for coefficients",
"if",
"hasattr",
"(",
"self",
".",
"estimator",
",",
"\"coef_\"",
")",
":",
"if",
"self... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | target_color_type | Determines the type of color space that will best represent the target
variable y, e.g. either a discrete (categorical) color space or a
continuous color space that requires a colormap. This function can handle
both 1D or column vectors as well as multi-output targets.
Parameters
----------
y :... | yellowbrick/utils/target.py | def target_color_type(y):
"""
Determines the type of color space that will best represent the target
variable y, e.g. either a discrete (categorical) color space or a
continuous color space that requires a colormap. This function can handle
both 1D or column vectors as well as multi-output targets.
... | def target_color_type(y):
"""
Determines the type of color space that will best represent the target
variable y, e.g. either a discrete (categorical) color space or a
continuous color space that requires a colormap. This function can handle
both 1D or column vectors as well as multi-output targets.
... | [
"Determines",
"the",
"type",
"of",
"color",
"space",
"that",
"will",
"best",
"represent",
"the",
"target",
"variable",
"y",
"e",
".",
"g",
".",
"either",
"a",
"discrete",
"(",
"categorical",
")",
"color",
"space",
"or",
"a",
"continuous",
"color",
"space",... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/target.py#L38-L76 | [
"def",
"target_color_type",
"(",
"y",
")",
":",
"ttype",
"=",
"type_of_target",
"(",
"y",
")",
"if",
"ttype",
".",
"startswith",
"(",
"CONTINUOUS",
")",
":",
"return",
"CONTINUOUS",
"if",
"ttype",
".",
"startswith",
"(",
"\"binary\"",
")",
":",
"return",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | JointPlot._layout | Creates the grid layout for the joint plot, adding new axes for the histograms
if necessary and modifying the aspect ratio. Does not modify the axes or the
layout if self.hist is False or None. | yellowbrick/features/jointplot.py | def _layout(self):
"""
Creates the grid layout for the joint plot, adding new axes for the histograms
if necessary and modifying the aspect ratio. Does not modify the axes or the
layout if self.hist is False or None.
"""
# Ensure the axes are created if not hist, then ret... | def _layout(self):
"""
Creates the grid layout for the joint plot, adding new axes for the histograms
if necessary and modifying the aspect ratio. Does not modify the axes or the
layout if self.hist is False or None.
"""
# Ensure the axes are created if not hist, then ret... | [
"Creates",
"the",
"grid",
"layout",
"for",
"the",
"joint",
"plot",
"adding",
"new",
"axes",
"for",
"the",
"histograms",
"if",
"necessary",
"and",
"modifying",
"the",
"aspect",
"ratio",
".",
"Does",
"not",
"modify",
"the",
"axes",
"or",
"the",
"layout",
"if... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/jointplot.py#L208-L235 | [
"def",
"_layout",
"(",
"self",
")",
":",
"# Ensure the axes are created if not hist, then return.",
"if",
"not",
"self",
".",
"hist",
":",
"self",
".",
"ax",
"return",
"# Ensure matplotlib version compatibility",
"if",
"make_axes_locatable",
"is",
"None",
":",
"raise",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | JointPlot.fit | Fits the JointPlot, creating a correlative visualization between the columns
specified during initialization and the data and target passed into fit:
- If self.columns is None then X and y must both be specified as 1D arrays
or X must be a 2D array with only 2 columns.
- I... | yellowbrick/features/jointplot.py | def fit(self, X, y=None):
"""
Fits the JointPlot, creating a correlative visualization between the columns
specified during initialization and the data and target passed into fit:
- If self.columns is None then X and y must both be specified as 1D arrays
or X must be a... | def fit(self, X, y=None):
"""
Fits the JointPlot, creating a correlative visualization between the columns
specified during initialization and the data and target passed into fit:
- If self.columns is None then X and y must both be specified as 1D arrays
or X must be a... | [
"Fits",
"the",
"JointPlot",
"creating",
"a",
"correlative",
"visualization",
"between",
"the",
"columns",
"specified",
"during",
"initialization",
"and",
"the",
"data",
"and",
"target",
"passed",
"into",
"fit",
":"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/jointplot.py#L237-L308 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# Convert python objects to numpy arrays",
"if",
"isinstance",
"(",
"X",
",",
"(",
"list",
",",
"tuple",
")",
")",
":",
"X",
"=",
"np",
".",
"array",
"(",
"X",
")",
"if",
"y",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | JointPlot.draw | Draw the joint plot for the data in x and y.
Parameters
----------
x, y : 1D array-like
The data to plot for the x axis and the y axis
xlabel, ylabel : str
The labels for the x and y axes. | yellowbrick/features/jointplot.py | def draw(self, x, y, xlabel=None, ylabel=None):
"""
Draw the joint plot for the data in x and y.
Parameters
----------
x, y : 1D array-like
The data to plot for the x axis and the y axis
xlabel, ylabel : str
The labels for the x and y axes.
... | def draw(self, x, y, xlabel=None, ylabel=None):
"""
Draw the joint plot for the data in x and y.
Parameters
----------
x, y : 1D array-like
The data to plot for the x axis and the y axis
xlabel, ylabel : str
The labels for the x and y axes.
... | [
"Draw",
"the",
"joint",
"plot",
"for",
"the",
"data",
"in",
"x",
"and",
"y",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/jointplot.py#L310-L368 | [
"def",
"draw",
"(",
"self",
",",
"x",
",",
"y",
",",
"xlabel",
"=",
"None",
",",
"ylabel",
"=",
"None",
")",
":",
"# This is a little weird to be here, but it is the best place to perform",
"# this computation given how fit calls draw and returns.",
"self",
".",
"corr_",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | JointPlot.finalize | Finalize executes any remaining image modifications making it ready to show. | yellowbrick/features/jointplot.py | def finalize(self, **kwargs):
"""
Finalize executes any remaining image modifications making it ready to show.
"""
# Set the aspect ratio to make the visualization square
# TODO: still unable to make plot square using make_axes_locatable
# x0,x1 = self.ax.get_xlim()
... | def finalize(self, **kwargs):
"""
Finalize executes any remaining image modifications making it ready to show.
"""
# Set the aspect ratio to make the visualization square
# TODO: still unable to make plot square using make_axes_locatable
# x0,x1 = self.ax.get_xlim()
... | [
"Finalize",
"executes",
"any",
"remaining",
"image",
"modifications",
"making",
"it",
"ready",
"to",
"show",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/jointplot.py#L370-L394 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the aspect ratio to make the visualization square",
"# TODO: still unable to make plot square using make_axes_locatable",
"# x0,x1 = self.ax.get_xlim()",
"# y0,y1 = self.ax.get_ylim()",
"# self.ax.set_aspect(abs(x1... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | JointPlot._index_into | Attempts to get the column from the data using the specified index, raises an
exception if this is not possible from this point in the stack. | yellowbrick/features/jointplot.py | def _index_into(self, idx, data):
"""
Attempts to get the column from the data using the specified index, raises an
exception if this is not possible from this point in the stack.
"""
try:
if is_dataframe(data):
# Assume column indexing
... | def _index_into(self, idx, data):
"""
Attempts to get the column from the data using the specified index, raises an
exception if this is not possible from this point in the stack.
"""
try:
if is_dataframe(data):
# Assume column indexing
... | [
"Attempts",
"to",
"get",
"the",
"column",
"from",
"the",
"data",
"using",
"the",
"specified",
"index",
"raises",
"an",
"exception",
"if",
"this",
"is",
"not",
"possible",
"from",
"this",
"point",
"in",
"the",
"stack",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/jointplot.py#L396-L411 | [
"def",
"_index_into",
"(",
"self",
",",
"idx",
",",
"data",
")",
":",
"try",
":",
"if",
"is_dataframe",
"(",
"data",
")",
":",
"# Assume column indexing",
"return",
"data",
"[",
"idx",
"]",
"# Otherwise assume numpy array-like indexing",
"return",
"data",
"[",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | MissingDataVisualizer.fit | The fit method is the primary drawing input for the
visualization since it has both the X and y data required for the
viz and the transform method does not.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
... | yellowbrick/contrib/missing/base.py | def fit(self, X, y=None, **kwargs):
"""
The fit method is the primary drawing input for the
visualization since it has both the X and y data required for the
viz and the transform method does not.
Parameters
----------
X : ndarray or DataFrame of shape n x m
... | def fit(self, X, y=None, **kwargs):
"""
The fit method is the primary drawing input for the
visualization since it has both the X and y data required for the
viz and the transform method does not.
Parameters
----------
X : ndarray or DataFrame of shape n x m
... | [
"The",
"fit",
"method",
"is",
"the",
"primary",
"drawing",
"input",
"for",
"the",
"visualization",
"since",
"it",
"has",
"both",
"the",
"X",
"and",
"y",
"data",
"required",
"for",
"the",
"viz",
"and",
"the",
"transform",
"method",
"does",
"not",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/contrib/missing/base.py#L32-L63 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"is_dataframe",
"(",
"X",
")",
":",
"self",
".",
"X",
"=",
"X",
".",
"values",
"if",
"self",
".",
"features_",
"is",
"None",
":",
"self",
"."... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | visualize_model | Test various estimators. | docs/tutorial.py | def visualize_model(X, y, estimator, path, **kwargs):
"""
Test various estimators.
"""
y = LabelEncoder().fit_transform(y)
model = Pipeline([
('one_hot_encoder', OneHotEncoder()),
('estimator', estimator)
])
_, ax = plt.subplots()
# Instantiate the classification mo... | def visualize_model(X, y, estimator, path, **kwargs):
"""
Test various estimators.
"""
y = LabelEncoder().fit_transform(y)
model = Pipeline([
('one_hot_encoder', OneHotEncoder()),
('estimator', estimator)
])
_, ax = plt.subplots()
# Instantiate the classification mo... | [
"Test",
"various",
"estimators",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/docs/tutorial.py#L61-L80 | [
"def",
"visualize_model",
"(",
"X",
",",
"y",
",",
"estimator",
",",
"path",
",",
"*",
"*",
"kwargs",
")",
":",
"y",
"=",
"LabelEncoder",
"(",
")",
".",
"fit_transform",
"(",
"y",
")",
"model",
"=",
"Pipeline",
"(",
"[",
"(",
"'one_hot_encoder'",
","... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | cv_scores | Displays cross validation scores as a bar chart and the
average of the scores as a horizontal line
This helper function is a quick wrapper to utilize the
CVScores visualizer for one-off analysis.
Parameters
----------
model : a scikit-learn estimator
An object that implements ``fit`` ... | yellowbrick/model_selection/cross_validation.py | def cv_scores(model, X, y, ax=None, cv=None, scoring=None, **kwargs):
"""
Displays cross validation scores as a bar chart and the
average of the scores as a horizontal line
This helper function is a quick wrapper to utilize the
CVScores visualizer for one-off analysis.
Parameters
---------... | def cv_scores(model, X, y, ax=None, cv=None, scoring=None, **kwargs):
"""
Displays cross validation scores as a bar chart and the
average of the scores as a horizontal line
This helper function is a quick wrapper to utilize the
CVScores visualizer for one-off analysis.
Parameters
---------... | [
"Displays",
"cross",
"validation",
"scores",
"as",
"a",
"bar",
"chart",
"and",
"the",
"average",
"of",
"the",
"scores",
"as",
"a",
"horizontal",
"line"
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/cross_validation.py#L176-L241 | [
"def",
"cv_scores",
"(",
"model",
",",
"X",
",",
"y",
",",
"ax",
"=",
"None",
",",
"cv",
"=",
"None",
",",
"scoring",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Initialize the visualizer",
"visualizer",
"=",
"CVScores",
"(",
"model",
",",
"ax... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | CVScores.fit | Fits the learning curve with the wrapped model to the specified data.
Draws training and test score curves and saves the scores to the
estimator.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training vector, where n_samples is the number of sam... | yellowbrick/model_selection/cross_validation.py | def fit(self, X, y, **kwargs):
"""
Fits the learning curve with the wrapped model to the specified data.
Draws training and test score curves and saves the scores to the
estimator.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Tr... | def fit(self, X, y, **kwargs):
"""
Fits the learning curve with the wrapped model to the specified data.
Draws training and test score curves and saves the scores to the
estimator.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Tr... | [
"Fits",
"the",
"learning",
"curve",
"with",
"the",
"wrapped",
"model",
"to",
"the",
"specified",
"data",
".",
"Draws",
"training",
"and",
"test",
"score",
"curves",
"and",
"saves",
"the",
"scores",
"to",
"the",
"estimator",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/cross_validation.py#L100-L128 | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"cv_scores_",
"=",
"cross_val_score",
"(",
"self",
".",
"estimator",
",",
"X",
",",
"y",
",",
"cv",
"=",
"self",
".",
"cv",
",",
"scoring",
"=",
"sel... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | CVScores.draw | Creates the bar chart of the cross-validated scores generated from the
fit method and places a dashed horizontal line that represents the
average value of the scores. | yellowbrick/model_selection/cross_validation.py | def draw(self, **kwargs):
"""
Creates the bar chart of the cross-validated scores generated from the
fit method and places a dashed horizontal line that represents the
average value of the scores.
"""
color = kwargs.pop("color", "b")
width = kwargs.pop("width", 0... | def draw(self, **kwargs):
"""
Creates the bar chart of the cross-validated scores generated from the
fit method and places a dashed horizontal line that represents the
average value of the scores.
"""
color = kwargs.pop("color", "b")
width = kwargs.pop("width", 0... | [
"Creates",
"the",
"bar",
"chart",
"of",
"the",
"cross",
"-",
"validated",
"scores",
"generated",
"from",
"the",
"fit",
"method",
"and",
"places",
"a",
"dashed",
"horizontal",
"line",
"that",
"represents",
"the",
"average",
"value",
"of",
"the",
"scores",
"."... | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/cross_validation.py#L130-L149 | [
"def",
"draw",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"color",
"=",
"kwargs",
".",
"pop",
"(",
"\"color\"",
",",
"\"b\"",
")",
"width",
"=",
"kwargs",
".",
"pop",
"(",
"\"width\"",
",",
"0.3",
")",
"linewidth",
"=",
"kwargs",
".",
"pop",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | CVScores.finalize | Add the title, legend, and other visual final touches to the plot. | yellowbrick/model_selection/cross_validation.py | def finalize(self, **kwargs):
"""
Add the title, legend, and other visual final touches to the plot.
"""
# Set the title of the figure
self.set_title('Cross Validation Scores for {}'.format(self.name))
# Add the legend
loc = kwargs.pop("loc", "best")
edg... | def finalize(self, **kwargs):
"""
Add the title, legend, and other visual final touches to the plot.
"""
# Set the title of the figure
self.set_title('Cross Validation Scores for {}'.format(self.name))
# Add the legend
loc = kwargs.pop("loc", "best")
edg... | [
"Add",
"the",
"title",
"legend",
"and",
"other",
"visual",
"final",
"touches",
"to",
"the",
"plot",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/cross_validation.py#L151-L169 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the title of the figure",
"self",
".",
"set_title",
"(",
"'Cross Validation Scores for {}'",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"# Add the legend",
"loc",
"=",
"kwargs",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | kendalltau | Accepts a matrix X and returns a correlation matrix so that each column
is the variable and each row is the observations.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features | yellowbrick/features/rankd.py | def kendalltau(X):
"""
Accepts a matrix X and returns a correlation matrix so that each column
is the variable and each row is the observations.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
"""
corrs = np.zeros((X.shape[1... | def kendalltau(X):
"""
Accepts a matrix X and returns a correlation matrix so that each column
is the variable and each row is the observations.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
"""
corrs = np.zeros((X.shape[1... | [
"Accepts",
"a",
"matrix",
"X",
"and",
"returns",
"a",
"correlation",
"matrix",
"so",
"that",
"each",
"column",
"is",
"the",
"variable",
"and",
"each",
"row",
"is",
"the",
"observations",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/rankd.py#L37-L52 | [
"def",
"kendalltau",
"(",
"X",
")",
":",
"corrs",
"=",
"np",
".",
"zeros",
"(",
"(",
"X",
".",
"shape",
"[",
"1",
"]",
",",
"X",
".",
"shape",
"[",
"1",
"]",
")",
")",
"for",
"idx",
",",
"cola",
"in",
"enumerate",
"(",
"X",
".",
"T",
")",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | rank1d | Scores each feature with the algorithm and ranks them in a bar plot.
This helper function is a quick wrapper to utilize the Rank1D Visualizer
(Transformer) for one-off analysis.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
y : n... | yellowbrick/features/rankd.py | def rank1d(X, y=None, ax=None, algorithm='shapiro', features=None,
orient='h', show_feature_names=True, **kwargs):
"""Scores each feature with the algorithm and ranks them in a bar plot.
This helper function is a quick wrapper to utilize the Rank1D Visualizer
(Transformer) for one-off analysis.
... | def rank1d(X, y=None, ax=None, algorithm='shapiro', features=None,
orient='h', show_feature_names=True, **kwargs):
"""Scores each feature with the algorithm and ranks them in a bar plot.
This helper function is a quick wrapper to utilize the Rank1D Visualizer
(Transformer) for one-off analysis.
... | [
"Scores",
"each",
"feature",
"with",
"the",
"algorithm",
"and",
"ranks",
"them",
"in",
"a",
"bar",
"plot",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/rankd.py#L426-L474 | [
"def",
"rank1d",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"algorithm",
"=",
"'shapiro'",
",",
"features",
"=",
"None",
",",
"orient",
"=",
"'h'",
",",
"show_feature_names",
"=",
"True",
",",
"*",
"*",
"kwargs",
")",
":",
"# Ins... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | rank2d | Displays pairwise comparisons of features with the algorithm and ranks
them in a lower-left triangle heatmap plot.
This helper function is a quick wrapper to utilize the Rank2D Visualizer
(Transformer) for one-off analysis.
Parameters
----------
X : ndarray or DataFrame of shape n x m
... | yellowbrick/features/rankd.py | def rank2d(X, y=None, ax=None, algorithm='pearson', features=None,
show_feature_names=True, colormap='RdBu_r', **kwargs):
"""Displays pairwise comparisons of features with the algorithm and ranks
them in a lower-left triangle heatmap plot.
This helper function is a quick wrapper to utilize the R... | def rank2d(X, y=None, ax=None, algorithm='pearson', features=None,
show_feature_names=True, colormap='RdBu_r', **kwargs):
"""Displays pairwise comparisons of features with the algorithm and ranks
them in a lower-left triangle heatmap plot.
This helper function is a quick wrapper to utilize the R... | [
"Displays",
"pairwise",
"comparisons",
"of",
"features",
"with",
"the",
"algorithm",
"and",
"ranks",
"them",
"in",
"a",
"lower",
"-",
"left",
"triangle",
"heatmap",
"plot",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/rankd.py#L476-L527 | [
"def",
"rank2d",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"algorithm",
"=",
"'pearson'",
",",
"features",
"=",
"None",
",",
"show_feature_names",
"=",
"True",
",",
"colormap",
"=",
"'RdBu_r'",
",",
"*",
"*",
"kwargs",
")",
":",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | RankDBase.transform | The transform method is the primary drawing hook for ranking classes.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
kwargs : dict
Pass generic arguments to the drawing method
Returns
------... | yellowbrick/features/rankd.py | def transform(self, X, **kwargs):
"""
The transform method is the primary drawing hook for ranking classes.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
kwargs : dict
Pass generic arguments... | def transform(self, X, **kwargs):
"""
The transform method is the primary drawing hook for ranking classes.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
kwargs : dict
Pass generic arguments... | [
"The",
"transform",
"method",
"is",
"the",
"primary",
"drawing",
"hook",
"for",
"ranking",
"classes",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/rankd.py#L122-L146 | [
"def",
"transform",
"(",
"self",
",",
"X",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"ranks_",
"=",
"self",
".",
"rank",
"(",
"X",
")",
"self",
".",
"draw",
"(",
"*",
"*",
"kwargs",
")",
"# Return the X matrix, unchanged",
"return",
"X"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | RankDBase.rank | Returns the feature ranking.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
algorithm : str or None
The ranking mechanism to use, or None for the default
Returns
-------
ranks : ndar... | yellowbrick/features/rankd.py | def rank(self, X, algorithm=None):
"""
Returns the feature ranking.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
algorithm : str or None
The ranking mechanism to use, or None for the defaul... | def rank(self, X, algorithm=None):
"""
Returns the feature ranking.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m features
algorithm : str or None
The ranking mechanism to use, or None for the defaul... | [
"Returns",
"the",
"feature",
"ranking",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/rankd.py#L148-L179 | [
"def",
"rank",
"(",
"self",
",",
"X",
",",
"algorithm",
"=",
"None",
")",
":",
"algorithm",
"=",
"algorithm",
"or",
"self",
".",
"ranking_",
"algorithm",
"=",
"algorithm",
".",
"lower",
"(",
")",
"if",
"algorithm",
"not",
"in",
"self",
".",
"ranking_me... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | RankDBase.finalize | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: dict
generic keyword arguments | yellowbrick/features/rankd.py | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: dict
generic keyword arguments
"""
# Set the title
self.set_... | def finalize(self, **kwargs):
"""
Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: dict
generic keyword arguments
"""
# Set the title
self.set_... | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/rankd.py#L181-L197 | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the title",
"self",
".",
"set_title",
"(",
"\"{} Ranking of {} Features\"",
".",
"format",
"(",
"self",
".",
"ranking_",
".",
"title",
"(",
")",
",",
"len",
"(",
"self",
".",
"feat... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | Rank1D.draw | Draws the bar plot of the ranking array of features. | yellowbrick/features/rankd.py | def draw(self, **kwargs):
"""
Draws the bar plot of the ranking array of features.
"""
if self.orientation_ == 'h':
# Make the plot
self.ax.barh(np.arange(len(self.ranks_)), self.ranks_, color='b')
# Add ticks and tick labels
self.ax.set_y... | def draw(self, **kwargs):
"""
Draws the bar plot of the ranking array of features.
"""
if self.orientation_ == 'h':
# Make the plot
self.ax.barh(np.arange(len(self.ranks_)), self.ranks_, color='b')
# Add ticks and tick labels
self.ax.set_y... | [
"Draws",
"the",
"bar",
"plot",
"of",
"the",
"ranking",
"array",
"of",
"features",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/rankd.py#L265-L303 | [
"def",
"draw",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"orientation_",
"==",
"'h'",
":",
"# Make the plot",
"self",
".",
"ax",
".",
"barh",
"(",
"np",
".",
"arange",
"(",
"len",
"(",
"self",
".",
"ranks_",
")",
")",
","... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
train | Rank2D.draw | Draws the heatmap of the ranking matrix of variables. | yellowbrick/features/rankd.py | def draw(self, **kwargs):
"""
Draws the heatmap of the ranking matrix of variables.
"""
# Set the axes aspect to be equal
self.ax.set_aspect("equal")
# Generate a mask for the upper triangle
mask = np.zeros_like(self.ranks_, dtype=np.bool)
mask[np.triu_in... | def draw(self, **kwargs):
"""
Draws the heatmap of the ranking matrix of variables.
"""
# Set the axes aspect to be equal
self.ax.set_aspect("equal")
# Generate a mask for the upper triangle
mask = np.zeros_like(self.ranks_, dtype=np.bool)
mask[np.triu_in... | [
"Draws",
"the",
"heatmap",
"of",
"the",
"ranking",
"matrix",
"of",
"variables",
"."
] | DistrictDataLabs/yellowbrick | python | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/rankd.py#L383-L419 | [
"def",
"draw",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the axes aspect to be equal",
"self",
".",
"ax",
".",
"set_aspect",
"(",
"\"equal\"",
")",
"# Generate a mask for the upper triangle",
"mask",
"=",
"np",
".",
"zeros_like",
"(",
"self",
".",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.