repo stringlengths 7 54 | path stringlengths 4 223 | func_name stringlengths 1 134 | original_string stringlengths 75 104k | language stringclasses 1
value | code stringlengths 75 104k | code_tokens listlengths 20 28.4k | docstring stringlengths 1 46.3k | docstring_tokens listlengths 1 1.66k | sha stringlengths 40 40 | url stringlengths 87 315 | partition stringclasses 1
value | summary stringlengths 4 350 | obf_code stringlengths 7.85k 764k |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
DistrictDataLabs/yellowbrick | yellowbrick/contrib/statsmodels/base.py | StatsModelsWrapper.fit | def fit(self, X, y):
"""
Pretend to be a sklearn estimator, fit is called on creation
"""
# note that GLM takes endog (y) and then exog (X):
# this is the reverse of sklearn's methods
self.glm_model = self.glm_partial(y, X)
self.glm_results = self.glm_model.fit()... | python | def fit(self, X, y):
"""
Pretend to be a sklearn estimator, fit is called on creation
"""
# note that GLM takes endog (y) and then exog (X):
# this is the reverse of sklearn's methods
self.glm_model = self.glm_partial(y, X)
self.glm_results = self.glm_model.fit()... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
")",
":",
"# note that GLM takes endog (y) and then exog (X):",
"# this is the reverse of sklearn's methods",
"self",
".",
"glm_model",
"=",
"self",
".",
"glm_partial",
"(",
"y",
",",
"X",
")",
"self",
".",
"glm_resul... | Pretend to be a sklearn estimator, fit is called on creation | [
"Pretend",
"to",
"be",
"a",
"sklearn",
"estimator",
"fit",
"is",
"called",
"on",
"creation"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/contrib/statsmodels/base.py#L69-L78 | train | Fit the GLM model on the data X and y. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/contrib/missing/dispersion.py | missing_dispersion | def missing_dispersion(X, y=None, ax=None, classes=None, alpha=0.5, marker="|", **kwargs):
"""
The Missing Values Dispersion visualizer shows the locations of missing (nan)
values in the feature dataset by the order of the index.
When y targets are supplied to fit, the output dispersion plot is color
... | python | def missing_dispersion(X, y=None, ax=None, classes=None, alpha=0.5, marker="|", **kwargs):
"""
The Missing Values Dispersion visualizer shows the locations of missing (nan)
values in the feature dataset by the order of the index.
When y targets are supplied to fit, the output dispersion plot is color
... | [
"def",
"missing_dispersion",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"classes",
"=",
"None",
",",
"alpha",
"=",
"0.5",
",",
"marker",
"=",
"\"|\"",
",",
"*",
"*",
"kwargs",
")",
":",
"# Instantiate the visualizer",
"visualizer",
"... | The Missing Values Dispersion visualizer shows the locations of missing (nan)
values in the feature dataset by the order of the index.
When y targets are supplied to fit, the output dispersion plot is color
coded according to the target y that the element refers to.
Parameters
----------
alpha... | [
"The",
"Missing",
"Values",
"Dispersion",
"visualizer",
"shows",
"the",
"locations",
"of",
"missing",
"(",
"nan",
")",
"values",
"in",
"the",
"feature",
"dataset",
"by",
"the",
"order",
"of",
"the",
"index",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/contrib/missing/dispersion.py#L176-L226 | train | Creates a Missing Values Dispersion visualizer that shows the locations of missing values in the feature dataset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/contrib/missing/dispersion.py | MissingValuesDispersion.get_nan_locs | def get_nan_locs(self, **kwargs):
"""Gets the locations of nans in feature data and returns
the coordinates in the matrix
"""
if np.issubdtype(self.X.dtype, np.string_) or np.issubdtype(self.X.dtype, np.unicode_):
mask = np.where( self.X == '' )
nan_matrix = np.ze... | python | def get_nan_locs(self, **kwargs):
"""Gets the locations of nans in feature data and returns
the coordinates in the matrix
"""
if np.issubdtype(self.X.dtype, np.string_) or np.issubdtype(self.X.dtype, np.unicode_):
mask = np.where( self.X == '' )
nan_matrix = np.ze... | [
"def",
"get_nan_locs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"np",
".",
"issubdtype",
"(",
"self",
".",
"X",
".",
"dtype",
",",
"np",
".",
"string_",
")",
"or",
"np",
".",
"issubdtype",
"(",
"self",
".",
"X",
".",
"dtype",
",",
... | Gets the locations of nans in feature data and returns
the coordinates in the matrix | [
"Gets",
"the",
"locations",
"of",
"nans",
"in",
"feature",
"data",
"and",
"returns",
"the",
"coordinates",
"in",
"the",
"matrix"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/contrib/missing/dispersion.py#L93-L115 | train | Gets the locations of nans in feature data and returns
the coordinates in the matrix | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/contrib/missing/dispersion.py | MissingValuesDispersion.draw | def draw(self, X, y, **kwargs):
"""Called from the fit method, this method creates a scatter plot that
draws each instance as a class or target colored point, whose location
is determined by the feature data set.
If y is not None, then it draws a scatter plot where each class is in a
... | python | def draw(self, X, y, **kwargs):
"""Called from the fit method, this method creates a scatter plot that
draws each instance as a class or target colored point, whose location
is determined by the feature data set.
If y is not None, then it draws a scatter plot where each class is in a
... | [
"def",
"draw",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"nan_locs",
"=",
"self",
".",
"get_nan_locs",
"(",
")",
"if",
"y",
"is",
"None",
":",
"x_",
",",
"y_",
"=",
"list",
"(",
"zip",
"(",
"*",
"nan_locs",
")",
")",... | Called from the fit method, this method creates a scatter plot that
draws each instance as a class or target colored point, whose location
is determined by the feature data set.
If y is not None, then it draws a scatter plot where each class is in a
different color. | [
"Called",
"from",
"the",
"fit",
"method",
"this",
"method",
"creates",
"a",
"scatter",
"plot",
"that",
"draws",
"each",
"instance",
"as",
"a",
"class",
"or",
"target",
"colored",
"point",
"whose",
"location",
"is",
"determined",
"by",
"the",
"feature",
"data... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/contrib/missing/dispersion.py#L117-L130 | train | Called from the fit method this method creates a scatter plot that draws each instance of a class or target colored point whose location is determined by the feature data set. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/contrib/missing/dispersion.py | MissingValuesDispersion.draw_multi_dispersion_chart | def draw_multi_dispersion_chart(self, nan_locs):
"""Draws a multi dimensional dispersion chart, each color corresponds
to a different target variable.
"""
for index, nan_values in enumerate(nan_locs):
label, nan_locations = nan_values
# if features passed in then... | python | def draw_multi_dispersion_chart(self, nan_locs):
"""Draws a multi dimensional dispersion chart, each color corresponds
to a different target variable.
"""
for index, nan_values in enumerate(nan_locs):
label, nan_locations = nan_values
# if features passed in then... | [
"def",
"draw_multi_dispersion_chart",
"(",
"self",
",",
"nan_locs",
")",
":",
"for",
"index",
",",
"nan_values",
"in",
"enumerate",
"(",
"nan_locs",
")",
":",
"label",
",",
"nan_locations",
"=",
"nan_values",
"# if features passed in then, label as such",
"if",
"sel... | Draws a multi dimensional dispersion chart, each color corresponds
to a different target variable. | [
"Draws",
"a",
"multi",
"dimensional",
"dispersion",
"chart",
"each",
"color",
"corresponds",
"to",
"a",
"different",
"target",
"variable",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/contrib/missing/dispersion.py#L132-L146 | train | Draws a multi dimensional dispersion chart for each color corresponds to a different target variable. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/gridsearch/base.py | param_projection | def param_projection(cv_results, x_param, y_param, metric='mean_test_score'):
"""
Projects the grid search results onto 2 dimensions.
The display value is taken as the max over the non-displayed dimensions.
Parameters
----------
cv_results : dict
A dictionary of results from the `GridS... | python | def param_projection(cv_results, x_param, y_param, metric='mean_test_score'):
"""
Projects the grid search results onto 2 dimensions.
The display value is taken as the max over the non-displayed dimensions.
Parameters
----------
cv_results : dict
A dictionary of results from the `GridS... | [
"def",
"param_projection",
"(",
"cv_results",
",",
"x_param",
",",
"y_param",
",",
"metric",
"=",
"'mean_test_score'",
")",
":",
"# Extract the parameter values and score corresponding to each gridsearch",
"# trial.",
"# These are masked arrays where the cases where each parameter is... | Projects the grid search results onto 2 dimensions.
The display value is taken as the max over the non-displayed dimensions.
Parameters
----------
cv_results : dict
A dictionary of results from the `GridSearchCV` object's `cv_results_`
attribute.
x_param : string
The name ... | [
"Projects",
"the",
"grid",
"search",
"results",
"onto",
"2",
"dimensions",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/gridsearch/base.py#L21-L111 | train | This function projects the grid search results onto 2 dimensions. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/gridsearch/base.py | GridSearchVisualizer.param_projection | def param_projection(self, x_param, y_param, metric):
"""
Projects the grid search results onto 2 dimensions.
The wrapped GridSearch object is assumed to be fit already.
The display value is taken as the max over the non-displayed dimensions.
Parameters
----------
... | python | def param_projection(self, x_param, y_param, metric):
"""
Projects the grid search results onto 2 dimensions.
The wrapped GridSearch object is assumed to be fit already.
The display value is taken as the max over the non-displayed dimensions.
Parameters
----------
... | [
"def",
"param_projection",
"(",
"self",
",",
"x_param",
",",
"y_param",
",",
"metric",
")",
":",
"return",
"param_projection",
"(",
"self",
".",
"estimator",
".",
"cv_results_",
",",
"x_param",
",",
"y_param",
",",
"metric",
")"
] | Projects the grid search results onto 2 dimensions.
The wrapped GridSearch object is assumed to be fit already.
The display value is taken as the max over the non-displayed dimensions.
Parameters
----------
x_param : string
The name of the parameter to be visualized... | [
"Projects",
"the",
"grid",
"search",
"results",
"onto",
"2",
"dimensions",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/gridsearch/base.py#L134-L163 | train | This method projects the grid search results onto 2 dimensions and returns a 2D numpy array that contains the max over the non - displayed dimensions. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/utils/kneed.py | KneeLocator.__threshold | def __threshold(self, ymx_i):
"""
Calculates the difference threshold for a
given difference local maximum.
Parameters
-----------
ymx_i : float
The normalized y value of a local maximum.
"""
return ymx_i - (self.S * np.diff(self.xsn).mean()) | python | def __threshold(self, ymx_i):
"""
Calculates the difference threshold for a
given difference local maximum.
Parameters
-----------
ymx_i : float
The normalized y value of a local maximum.
"""
return ymx_i - (self.S * np.diff(self.xsn).mean()) | [
"def",
"__threshold",
"(",
"self",
",",
"ymx_i",
")",
":",
"return",
"ymx_i",
"-",
"(",
"self",
".",
"S",
"*",
"np",
".",
"diff",
"(",
"self",
".",
"xsn",
")",
".",
"mean",
"(",
")",
")"
] | Calculates the difference threshold for a
given difference local maximum.
Parameters
-----------
ymx_i : float
The normalized y value of a local maximum. | [
"Calculates",
"the",
"difference",
"threshold",
"for",
"a",
"given",
"difference",
"local",
"maximum",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/kneed.py#L143-L153 | train | Calculates the difference threshold for a specific local maximum. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/utils/kneed.py | KneeLocator.find_knee | def find_knee(self, ):
"""
Finds and returns the "knee"or "elbow" value, the normalized knee
value, and the x value where the knee is located.
"""
if not self.xmx_idx.size:
warning_message = \
'No "knee" or "elbow point" detected ' \
'... | python | def find_knee(self, ):
"""
Finds and returns the "knee"or "elbow" value, the normalized knee
value, and the x value where the knee is located.
"""
if not self.xmx_idx.size:
warning_message = \
'No "knee" or "elbow point" detected ' \
'... | [
"def",
"find_knee",
"(",
"self",
",",
")",
":",
"if",
"not",
"self",
".",
"xmx_idx",
".",
"size",
":",
"warning_message",
"=",
"'No \"knee\" or \"elbow point\" detected '",
"'This could be due to bad clustering, no '",
"'actual clusters being formed etc.'",
"warnings",
".",... | Finds and returns the "knee"or "elbow" value, the normalized knee
value, and the x value where the knee is located. | [
"Finds",
"and",
"returns",
"the",
"knee",
"or",
"elbow",
"value",
"the",
"normalized",
"knee",
"value",
"and",
"the",
"x",
"value",
"where",
"the",
"knee",
"is",
"located",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/kneed.py#L155-L199 | train | Finds and returns the knee or elbow value normalized knee or None. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/utils/kneed.py | KneeLocator.plot_knee_normalized | def plot_knee_normalized(self, ):
"""
Plots the normalized curve, the distance curve (xd, ysn) and the
knee, if it exists.
"""
import matplotlib.pyplot as plt
plt.figure(figsize=(8, 8))
plt.plot(self.xsn, self.ysn)
plt.plot(self.xd, self.yd, 'r')
... | python | def plot_knee_normalized(self, ):
"""
Plots the normalized curve, the distance curve (xd, ysn) and the
knee, if it exists.
"""
import matplotlib.pyplot as plt
plt.figure(figsize=(8, 8))
plt.plot(self.xsn, self.ysn)
plt.plot(self.xd, self.yd, 'r')
... | [
"def",
"plot_knee_normalized",
"(",
"self",
",",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"8",
",",
"8",
")",
")",
"plt",
".",
"plot",
"(",
"self",
".",
"xsn",
",",
"self",
".",
... | Plots the normalized curve, the distance curve (xd, ysn) and the
knee, if it exists. | [
"Plots",
"the",
"normalized",
"curve",
"the",
"distance",
"curve",
"(",
"xd",
"ysn",
")",
"and",
"the",
"knee",
"if",
"it",
"exists",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/kneed.py#L201-L215 | train | Plots the normalized curve the distance curve and the knee | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/utils/kneed.py | KneeLocator.plot_knee | def plot_knee(self, ):
"""
Plot the curve and the knee, if it exists
"""
import matplotlib.pyplot as plt
plt.figure(figsize=(8, 8))
plt.plot(self.x, self.y)
plt.vlines(self.knee, plt.ylim()[0], plt.ylim()[1]) | python | def plot_knee(self, ):
"""
Plot the curve and the knee, if it exists
"""
import matplotlib.pyplot as plt
plt.figure(figsize=(8, 8))
plt.plot(self.x, self.y)
plt.vlines(self.knee, plt.ylim()[0], plt.ylim()[1]) | [
"def",
"plot_knee",
"(",
"self",
",",
")",
":",
"import",
"matplotlib",
".",
"pyplot",
"as",
"plt",
"plt",
".",
"figure",
"(",
"figsize",
"=",
"(",
"8",
",",
"8",
")",
")",
"plt",
".",
"plot",
"(",
"self",
".",
"x",
",",
"self",
".",
"y",
")",
... | Plot the curve and the knee, if it exists | [
"Plot",
"the",
"curve",
"and",
"the",
"knee",
"if",
"it",
"exists"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/kneed.py#L217-L226 | train | Plot the curve and the knee if it exists | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/regressor/alphas.py | AlphaSelection.fit | def fit(self, X, y, **kwargs):
"""
A simple pass-through method; calls fit on the estimator and then
draws the alpha-error plot.
"""
self.estimator.fit(X, y, **kwargs)
self.draw()
return self | python | def fit(self, X, y, **kwargs):
"""
A simple pass-through method; calls fit on the estimator and then
draws the alpha-error plot.
"""
self.estimator.fit(X, y, **kwargs)
self.draw()
return self | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"estimator",
".",
"fit",
"(",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
"self",
".",
"draw",
"(",
")",
"return",
"self"
] | A simple pass-through method; calls fit on the estimator and then
draws the alpha-error plot. | [
"A",
"simple",
"pass",
"-",
"through",
"method",
";",
"calls",
"fit",
"on",
"the",
"estimator",
"and",
"then",
"draws",
"the",
"alpha",
"-",
"error",
"plot",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/alphas.py#L128-L135 | train | A simple pass - through method that draws the alpha - error plot. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/regressor/alphas.py | AlphaSelection.score | def score(self, X, y, **kwargs):
"""
Simply returns the score of the underlying CV model
"""
return self.estimator.score(X, y, **kwargs) | python | def score(self, X, y, **kwargs):
"""
Simply returns the score of the underlying CV model
"""
return self.estimator.score(X, y, **kwargs) | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"self",
".",
"estimator",
".",
"score",
"(",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")"
] | Simply returns the score of the underlying CV model | [
"Simply",
"returns",
"the",
"score",
"of",
"the",
"underlying",
"CV",
"model"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/alphas.py#L137-L141 | train | Simply returns the score of the underlying CV model and the underlying CV model. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/regressor/alphas.py | AlphaSelection.draw | def draw(self):
"""
Draws the alpha plot based on the values on the estimator.
"""
# Search for the correct parameters on the estimator.
alphas = self._find_alphas_param()
errors = self._find_errors_param()
alpha = self.estimator.alpha_ # Get decision from the e... | python | def draw(self):
"""
Draws the alpha plot based on the values on the estimator.
"""
# Search for the correct parameters on the estimator.
alphas = self._find_alphas_param()
errors = self._find_errors_param()
alpha = self.estimator.alpha_ # Get decision from the e... | [
"def",
"draw",
"(",
"self",
")",
":",
"# Search for the correct parameters on the estimator.",
"alphas",
"=",
"self",
".",
"_find_alphas_param",
"(",
")",
"errors",
"=",
"self",
".",
"_find_errors_param",
"(",
")",
"alpha",
"=",
"self",
".",
"estimator",
".",
"a... | Draws the alpha plot based on the values on the estimator. | [
"Draws",
"the",
"alpha",
"plot",
"based",
"on",
"the",
"values",
"on",
"the",
"estimator",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/alphas.py#L143-L162 | train | Draws the alpha plot based on the values on the estimator. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/regressor/alphas.py | AlphaSelection._find_alphas_param | def _find_alphas_param(self):
"""
Searches for the parameter on the estimator that contains the array of
alphas that was used to produce the error selection. If it cannot find
the parameter then a YellowbrickValueError is raised.
"""
# NOTE: The order of the search is ve... | python | def _find_alphas_param(self):
"""
Searches for the parameter on the estimator that contains the array of
alphas that was used to produce the error selection. If it cannot find
the parameter then a YellowbrickValueError is raised.
"""
# NOTE: The order of the search is ve... | [
"def",
"_find_alphas_param",
"(",
"self",
")",
":",
"# NOTE: The order of the search is very important!",
"for",
"attr",
"in",
"(",
"\"cv_alphas_\"",
",",
"\"alphas_\"",
",",
"\"alphas\"",
",",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"self",
".",
"estimato... | Searches for the parameter on the estimator that contains the array of
alphas that was used to produce the error selection. If it cannot find
the parameter then a YellowbrickValueError is raised. | [
"Searches",
"for",
"the",
"parameter",
"on",
"the",
"estimator",
"that",
"contains",
"the",
"array",
"of",
"alphas",
"that",
"was",
"used",
"to",
"produce",
"the",
"error",
"selection",
".",
"If",
"it",
"cannot",
"find",
"the",
"parameter",
"then",
"a",
"Y... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/alphas.py#L181-L199 | train | Searches for the parameter on the estimator that contains the array of alphas that was used to produce the error selection. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/regressor/alphas.py | AlphaSelection._find_errors_param | def _find_errors_param(self):
"""
Searches for the parameter on the estimator that contains the array of
errors that was used to determine the optimal alpha. If it cannot find
the parameter then a YellowbrickValueError is raised.
"""
# NOTE: The order of the search is ve... | python | def _find_errors_param(self):
"""
Searches for the parameter on the estimator that contains the array of
errors that was used to determine the optimal alpha. If it cannot find
the parameter then a YellowbrickValueError is raised.
"""
# NOTE: The order of the search is ve... | [
"def",
"_find_errors_param",
"(",
"self",
")",
":",
"# NOTE: The order of the search is very important!",
"if",
"hasattr",
"(",
"self",
".",
"estimator",
",",
"'mse_path_'",
")",
":",
"return",
"self",
".",
"estimator",
".",
"mse_path_",
".",
"mean",
"(",
"1",
"... | Searches for the parameter on the estimator that contains the array of
errors that was used to determine the optimal alpha. If it cannot find
the parameter then a YellowbrickValueError is raised. | [
"Searches",
"for",
"the",
"parameter",
"on",
"the",
"estimator",
"that",
"contains",
"the",
"array",
"of",
"errors",
"that",
"was",
"used",
"to",
"determine",
"the",
"optimal",
"alpha",
".",
"If",
"it",
"cannot",
"find",
"the",
"parameter",
"then",
"a",
"Y... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/alphas.py#L201-L219 | train | Searches for the parameter that contains the array of
errors that was used to determine the optimal alpha. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/regressor/alphas.py | ManualAlphaSelection.draw | def draw(self):
"""
Draws the alphas values against their associated error in a similar
fashion to the AlphaSelection visualizer.
"""
# Plot the alpha against the error
self.ax.plot(self.alphas, self.errors, label=self.name.lower())
# Draw a dashed vline at the a... | python | def draw(self):
"""
Draws the alphas values against their associated error in a similar
fashion to the AlphaSelection visualizer.
"""
# Plot the alpha against the error
self.ax.plot(self.alphas, self.errors, label=self.name.lower())
# Draw a dashed vline at the a... | [
"def",
"draw",
"(",
"self",
")",
":",
"# Plot the alpha against the error",
"self",
".",
"ax",
".",
"plot",
"(",
"self",
".",
"alphas",
",",
"self",
".",
"errors",
",",
"label",
"=",
"self",
".",
"name",
".",
"lower",
"(",
")",
")",
"# Draw a dashed vlin... | Draws the alphas values against their associated error in a similar
fashion to the AlphaSelection visualizer. | [
"Draws",
"the",
"alphas",
"values",
"against",
"their",
"associated",
"error",
"in",
"a",
"similar",
"fashion",
"to",
"the",
"AlphaSelection",
"visualizer",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/regressor/alphas.py#L343-L361 | train | Draws the alphas values against their associated error in a similar similar
fashion to the AlphaSelection visualizer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/postag.py | postag | def postag(
X,
ax=None,
tagset="penn_treebank",
colormap=None,
colors=None,
frequency=False,
**kwargs
):
"""
Display a barchart with the counts of different parts of speech
in X, which consists of a part-of-speech-tagged corpus, which the
visualizer expects to be a list of li... | python | def postag(
X,
ax=None,
tagset="penn_treebank",
colormap=None,
colors=None,
frequency=False,
**kwargs
):
"""
Display a barchart with the counts of different parts of speech
in X, which consists of a part-of-speech-tagged corpus, which the
visualizer expects to be a list of li... | [
"def",
"postag",
"(",
"X",
",",
"ax",
"=",
"None",
",",
"tagset",
"=",
"\"penn_treebank\"",
",",
"colormap",
"=",
"None",
",",
"colors",
"=",
"None",
",",
"frequency",
"=",
"False",
",",
"*",
"*",
"kwargs",
")",
":",
"# Instantiate the visualizer",
"visu... | Display a barchart with the counts of different parts of speech
in X, which consists of a part-of-speech-tagged corpus, which the
visualizer expects to be a list of lists of lists of (token, tag)
tuples.
Parameters
----------
X : list or generator
Should be provided as a list of documen... | [
"Display",
"a",
"barchart",
"with",
"the",
"counts",
"of",
"different",
"parts",
"of",
"speech",
"in",
"X",
"which",
"consists",
"of",
"a",
"part",
"-",
"of",
"-",
"speech",
"-",
"tagged",
"corpus",
"which",
"the",
"visualizer",
"expects",
"to",
"be",
"a... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/postag.py#L369-L421 | train | Display a barchart with the counts of different parts of speech
in X. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/postag.py | PosTagVisualizer.fit | def fit(self, X, y=None, **kwargs):
"""
Fits the corpus to the appropriate tag map.
Text documents must be tokenized & tagged before passing to fit.
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
... | python | def fit(self, X, y=None, **kwargs):
"""
Fits the corpus to the appropriate tag map.
Text documents must be tokenized & tagged before passing to fit.
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# TODO: add support for other tagsets?",
"if",
"self",
".",
"tagset",
"==",
"\"penn_treebank\"",
":",
"self",
".",
"pos_tag_counts_",
"=",
"self",
".",
"_penn_t... | Fits the corpus to the appropriate tag map.
Text documents must be tokenized & tagged before passing to fit.
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
that yields a list of documents that contain a list o... | [
"Fits",
"the",
"corpus",
"to",
"the",
"appropriate",
"tag",
"map",
".",
"Text",
"documents",
"must",
"be",
"tokenized",
"&",
"tagged",
"before",
"passing",
"to",
"fit",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/postag.py#L118-L152 | train | Fits the corpus to the appropriate tag map. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/postag.py | PosTagVisualizer._handle_universal | def _handle_universal(self, X):
"""
Scan through the corpus to compute counts of each Universal
Dependencies part-of-speech.
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
that yields a list of... | python | def _handle_universal(self, X):
"""
Scan through the corpus to compute counts of each Universal
Dependencies part-of-speech.
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
that yields a list of... | [
"def",
"_handle_universal",
"(",
"self",
",",
"X",
")",
":",
"jump",
"=",
"{",
"# combine proper and regular nouns",
"\"NOUN\"",
":",
"\"noun\"",
",",
"\"PROPN\"",
":",
"\"noun\"",
",",
"\"ADJ\"",
":",
"\"adjective\"",
",",
"\"VERB\"",
":",
"\"verb\"",
",",
"#... | Scan through the corpus to compute counts of each Universal
Dependencies part-of-speech.
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
that yields a list of documents that contain a list of
senten... | [
"Scan",
"through",
"the",
"corpus",
"to",
"compute",
"counts",
"of",
"each",
"Universal",
"Dependencies",
"part",
"-",
"of",
"-",
"speech",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/postag.py#L202-L236 | train | Handles Universal related information. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/postag.py | PosTagVisualizer._handle_treebank | def _handle_treebank(self, X):
"""
Create a part-of-speech tag mapping using the Penn Treebank tags
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
that yields a list of documents that contain a list of... | python | def _handle_treebank(self, X):
"""
Create a part-of-speech tag mapping using the Penn Treebank tags
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
that yields a list of documents that contain a list of... | [
"def",
"_handle_treebank",
"(",
"self",
",",
"X",
")",
":",
"for",
"tagged_doc",
"in",
"X",
":",
"for",
"tagged_sent",
"in",
"tagged_doc",
":",
"for",
"_",
",",
"tag",
"in",
"tagged_sent",
":",
"if",
"tag",
".",
"startswith",
"(",
"\"N\"",
")",
":",
... | Create a part-of-speech tag mapping using the Penn Treebank tags
Parameters
----------
X : list or generator
Should be provided as a list of documents or a generator
that yields a list of documents that contain a list of
sentences that contain (token, tag) tu... | [
"Create",
"a",
"part",
"-",
"of",
"-",
"speech",
"tag",
"mapping",
"using",
"the",
"Penn",
"Treebank",
"tags"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/postag.py#L238-L293 | train | This function handles the Penn Treebank tags and returns a dictionary of the part - of - speech tag mapping. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/postag.py | PosTagVisualizer.draw | def draw(self, **kwargs):
"""
Called from the fit method, this method creates the canvas and
draws the part-of-speech tag mapping as a bar chart.
Parameters
----------
kwargs: dict
generic keyword arguments.
Returns
-------
ax : matpl... | python | def draw(self, **kwargs):
"""
Called from the fit method, this method creates the canvas and
draws the part-of-speech tag mapping as a bar chart.
Parameters
----------
kwargs: dict
generic keyword arguments.
Returns
-------
ax : matpl... | [
"def",
"draw",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"colors",
"=",
"resolve_colors",
"(",
"n_colors",
"=",
"len",
"(",
"self",
".",
"pos_tag_counts_",
")",
",",
"colormap",
"=",
"self",
".",
"colormap",
",",
"colors",
"=",
"self",
".",
"co... | Called from the fit method, this method creates the canvas and
draws the part-of-speech tag mapping as a bar chart.
Parameters
----------
kwargs: dict
generic keyword arguments.
Returns
-------
ax : matplotlib axes
Axes on which the PosTa... | [
"Called",
"from",
"the",
"fit",
"method",
"this",
"method",
"creates",
"the",
"canvas",
"and",
"draws",
"the",
"part",
"-",
"of",
"-",
"speech",
"tag",
"mapping",
"as",
"a",
"bar",
"chart",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/postag.py#L295-L331 | train | This method creates the canvas and draws the part - of - speech tag mapping as a bar chart. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/postag.py | PosTagVisualizer.finalize | def finalize(self, **kwargs):
"""
Finalize the plot with ticks, labels, and title
Parameters
----------
kwargs: dict
generic keyword arguments.
"""
# NOTE: not deduping here, so this is total, not unique
self.set_title(
"PosTag plo... | python | def finalize(self, **kwargs):
"""
Finalize the plot with ticks, labels, and title
Parameters
----------
kwargs: dict
generic keyword arguments.
"""
# NOTE: not deduping here, so this is total, not unique
self.set_title(
"PosTag plo... | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# NOTE: not deduping here, so this is total, not unique",
"self",
".",
"set_title",
"(",
"\"PosTag plot for {}-token corpus\"",
".",
"format",
"(",
"(",
"sum",
"(",
"self",
".",
"pos_tag_counts_",
"... | Finalize the plot with ticks, labels, and title
Parameters
----------
kwargs: dict
generic keyword arguments. | [
"Finalize",
"the",
"plot",
"with",
"ticks",
"labels",
"and",
"title"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/postag.py#L333-L361 | train | Finalize the plot with ticks labels and title | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/tsne.py | tsne | def tsne(X, y=None, ax=None, decompose='svd', decompose_by=50, classes=None,
colors=None, colormap=None, alpha=0.7, **kwargs):
"""
Display a projection of a vectorized corpus in two dimensions using TSNE,
a nonlinear dimensionality reduction method that is particularly well
suited to embeddin... | python | def tsne(X, y=None, ax=None, decompose='svd', decompose_by=50, classes=None,
colors=None, colormap=None, alpha=0.7, **kwargs):
"""
Display a projection of a vectorized corpus in two dimensions using TSNE,
a nonlinear dimensionality reduction method that is particularly well
suited to embeddin... | [
"def",
"tsne",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"decompose",
"=",
"'svd'",
",",
"decompose_by",
"=",
"50",
",",
"classes",
"=",
"None",
",",
"colors",
"=",
"None",
",",
"colormap",
"=",
"None",
",",
"alpha",
"=",
"0.7... | Display a projection of a vectorized corpus in two dimensions using TSNE,
a nonlinear dimensionality reduction method that is particularly well
suited to embedding in two or three dimensions for visualization as a
scatter plot. TSNE is widely used in text analysis to show clusters or
groups of documents... | [
"Display",
"a",
"projection",
"of",
"a",
"vectorized",
"corpus",
"in",
"two",
"dimensions",
"using",
"TSNE",
"a",
"nonlinear",
"dimensionality",
"reduction",
"method",
"that",
"is",
"particularly",
"well",
"suited",
"to",
"embedding",
"in",
"two",
"or",
"three",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/tsne.py#L38-L104 | train | This function is used to plot a vectorized corpus using TSNE. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/tsne.py | TSNEVisualizer.make_transformer | def make_transformer(self, decompose='svd', decompose_by=50, tsne_kwargs={}):
"""
Creates an internal transformer pipeline to project the data set into
2D space using TSNE, applying an pre-decomposition technique ahead of
embedding if necessary. This method will reset the transformer on ... | python | def make_transformer(self, decompose='svd', decompose_by=50, tsne_kwargs={}):
"""
Creates an internal transformer pipeline to project the data set into
2D space using TSNE, applying an pre-decomposition technique ahead of
embedding if necessary. This method will reset the transformer on ... | [
"def",
"make_transformer",
"(",
"self",
",",
"decompose",
"=",
"'svd'",
",",
"decompose_by",
"=",
"50",
",",
"tsne_kwargs",
"=",
"{",
"}",
")",
":",
"# TODO: detect decompose by inferring from sparse matrix or dense or",
"# If number of features > 50 etc.",
"decompositions"... | Creates an internal transformer pipeline to project the data set into
2D space using TSNE, applying an pre-decomposition technique ahead of
embedding if necessary. This method will reset the transformer on the
class, and can be used to explore different decompositions.
Parameters
... | [
"Creates",
"an",
"internal",
"transformer",
"pipeline",
"to",
"project",
"the",
"data",
"set",
"into",
"2D",
"space",
"using",
"TSNE",
"applying",
"an",
"pre",
"-",
"decomposition",
"technique",
"ahead",
"of",
"embedding",
"if",
"necessary",
".",
"This",
"meth... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/tsne.py#L200-L255 | train | Creates a pipeline that will project the data set into the internal 2D space using TSNE. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/tsne.py | TSNEVisualizer.finalize | def finalize(self, **kwargs):
"""
Finalize the drawing by adding a title and legend, and removing the
axes objects that do not convey information about TNSE.
"""
self.set_title(
"TSNE Projection of {} Documents".format(self.n_instances_)
)
# Remove th... | python | def finalize(self, **kwargs):
"""
Finalize the drawing by adding a title and legend, and removing the
axes objects that do not convey information about TNSE.
"""
self.set_title(
"TSNE Projection of {} Documents".format(self.n_instances_)
)
# Remove th... | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"set_title",
"(",
"\"TSNE Projection of {} Documents\"",
".",
"format",
"(",
"self",
".",
"n_instances_",
")",
")",
"# Remove the ticks",
"self",
".",
"ax",
".",
"set_yticks",
"(... | Finalize the drawing by adding a title and legend, and removing the
axes objects that do not convey information about TNSE. | [
"Finalize",
"the",
"drawing",
"by",
"adding",
"a",
"title",
"and",
"legend",
"and",
"removing",
"the",
"axes",
"objects",
"that",
"do",
"not",
"convey",
"information",
"about",
"TNSE",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/tsne.py#L352-L372 | train | Finalize the drawing by removing ticks and axes objects that do not convey information about TNSE. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | setup.py | get_version | def get_version(path=VERSION_PATH):
"""
Reads the python file defined in the VERSION_PATH to find the get_version
function, and executes it to ensure that it is loaded correctly. Separating
the version in this way ensures no additional code is executed.
"""
namespace = {}
exec(read(path), na... | python | def get_version(path=VERSION_PATH):
"""
Reads the python file defined in the VERSION_PATH to find the get_version
function, and executes it to ensure that it is loaded correctly. Separating
the version in this way ensures no additional code is executed.
"""
namespace = {}
exec(read(path), na... | [
"def",
"get_version",
"(",
"path",
"=",
"VERSION_PATH",
")",
":",
"namespace",
"=",
"{",
"}",
"exec",
"(",
"read",
"(",
"path",
")",
",",
"namespace",
")",
"return",
"namespace",
"[",
"'get_version'",
"]",
"(",
"short",
"=",
"True",
")"
] | Reads the python file defined in the VERSION_PATH to find the get_version
function, and executes it to ensure that it is loaded correctly. Separating
the version in this way ensures no additional code is executed. | [
"Reads",
"the",
"python",
"file",
"defined",
"in",
"the",
"VERSION_PATH",
"to",
"find",
"the",
"get_version",
"function",
"and",
"executes",
"it",
"to",
"ensure",
"that",
"it",
"is",
"loaded",
"correctly",
".",
"Separating",
"the",
"version",
"in",
"this",
"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/setup.py#L91-L99 | train | Reads the VERSION_PATH and returns the version string. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | setup.py | get_requires | def get_requires(path=REQUIRE_PATH):
"""
Yields a generator of requirements as defined by the REQUIRE_PATH which
should point to a requirements.txt output by `pip freeze`.
"""
for line in read(path).splitlines():
line = line.strip()
if line and not line.startswith('#'):
y... | python | def get_requires(path=REQUIRE_PATH):
"""
Yields a generator of requirements as defined by the REQUIRE_PATH which
should point to a requirements.txt output by `pip freeze`.
"""
for line in read(path).splitlines():
line = line.strip()
if line and not line.startswith('#'):
y... | [
"def",
"get_requires",
"(",
"path",
"=",
"REQUIRE_PATH",
")",
":",
"for",
"line",
"in",
"read",
"(",
"path",
")",
".",
"splitlines",
"(",
")",
":",
"line",
"=",
"line",
".",
"strip",
"(",
")",
"if",
"line",
"and",
"not",
"line",
".",
"startswith",
... | Yields a generator of requirements as defined by the REQUIRE_PATH which
should point to a requirements.txt output by `pip freeze`. | [
"Yields",
"a",
"generator",
"of",
"requirements",
"as",
"defined",
"by",
"the",
"REQUIRE_PATH",
"which",
"should",
"point",
"to",
"a",
"requirements",
".",
"txt",
"output",
"by",
"pip",
"freeze",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/setup.py#L102-L110 | train | Yields a generator of requirements as defined by the REQUIRE_PATH which is the path to the requirements. txt file. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | setup.py | get_description_type | def get_description_type(path=PKG_DESCRIBE):
"""
Returns the long_description_content_type based on the extension of the
package describe path (e.g. .txt, .rst, or .md).
"""
_, ext = os.path.splitext(path)
return {
".rst": "text/x-rst",
".txt": "text/plain",
".md": "text/... | python | def get_description_type(path=PKG_DESCRIBE):
"""
Returns the long_description_content_type based on the extension of the
package describe path (e.g. .txt, .rst, or .md).
"""
_, ext = os.path.splitext(path)
return {
".rst": "text/x-rst",
".txt": "text/plain",
".md": "text/... | [
"def",
"get_description_type",
"(",
"path",
"=",
"PKG_DESCRIBE",
")",
":",
"_",
",",
"ext",
"=",
"os",
".",
"path",
".",
"splitext",
"(",
"path",
")",
"return",
"{",
"\".rst\"",
":",
"\"text/x-rst\"",
",",
"\".txt\"",
":",
"\"text/plain\"",
",",
"\".md\"",... | Returns the long_description_content_type based on the extension of the
package describe path (e.g. .txt, .rst, or .md). | [
"Returns",
"the",
"long_description_content_type",
"based",
"on",
"the",
"extension",
"of",
"the",
"package",
"describe",
"path",
"(",
"e",
".",
"g",
".",
".",
"txt",
".",
"rst",
"or",
".",
"md",
")",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/setup.py#L113-L123 | train | Returns the long_description_content_type based on the extension of the passed in path. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/model_selection/learning_curve.py | learning_curve | def learning_curve(model, X, y, ax=None, groups=None,
train_sizes=DEFAULT_TRAIN_SIZES, cv=None, scoring=None,
exploit_incremental_learning=False, n_jobs=1,
pre_dispatch="all", shuffle=False, random_state=None,
**kwargs):
"""
Displays a learning curve b... | python | def learning_curve(model, X, y, ax=None, groups=None,
train_sizes=DEFAULT_TRAIN_SIZES, cv=None, scoring=None,
exploit_incremental_learning=False, n_jobs=1,
pre_dispatch="all", shuffle=False, random_state=None,
**kwargs):
"""
Displays a learning curve b... | [
"def",
"learning_curve",
"(",
"model",
",",
"X",
",",
"y",
",",
"ax",
"=",
"None",
",",
"groups",
"=",
"None",
",",
"train_sizes",
"=",
"DEFAULT_TRAIN_SIZES",
",",
"cv",
"=",
"None",
",",
"scoring",
"=",
"None",
",",
"exploit_incremental_learning",
"=",
... | Displays a learning curve based on number of samples vs training and
cross validation scores. The learning curve aims to show how a model
learns and improves with experience.
This helper function is a quick wrapper to utilize the LearningCurve
for one-off analysis.
Parameters
----------
mo... | [
"Displays",
"a",
"learning",
"curve",
"based",
"on",
"number",
"of",
"samples",
"vs",
"training",
"and",
"cross",
"validation",
"scores",
".",
"The",
"learning",
"curve",
"aims",
"to",
"show",
"how",
"a",
"model",
"learns",
"and",
"improves",
"with",
"experi... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/learning_curve.py#L289-L396 | train | This function returns a LearningCurve object that displays the training and test sets for one - off analysis. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/model_selection/learning_curve.py | LearningCurve.fit | def fit(self, X, y=None):
"""
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)
Trainin... | python | def fit(self, X, y=None):
"""
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)
Trainin... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# arguments to pass to sk_learning_curve",
"sklc_kwargs",
"=",
"{",
"key",
":",
"self",
".",
"get_params",
"(",
")",
"[",
"key",
"]",
"for",
"key",
"in",
"(",
"'groups'",
",",
"'tra... | 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... | [
"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",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/learning_curve.py#L191-L237 | train | Fits the learning curve with the wrapped model to the specified data and saves the scores on the estimator. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/model_selection/learning_curve.py | LearningCurve.draw | def draw(self, **kwargs):
"""
Renders the training and test learning curves.
"""
# Specify the curves to draw and their labels
labels = ("Training Score", "Cross Validation Score")
curves = (
(self.train_scores_mean_, self.train_scores_std_),
(self... | python | def draw(self, **kwargs):
"""
Renders the training and test learning curves.
"""
# Specify the curves to draw and their labels
labels = ("Training Score", "Cross Validation Score")
curves = (
(self.train_scores_mean_, self.train_scores_std_),
(self... | [
"def",
"draw",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Specify the curves to draw and their labels",
"labels",
"=",
"(",
"\"Training Score\"",
",",
"\"Cross Validation Score\"",
")",
"curves",
"=",
"(",
"(",
"self",
".",
"train_scores_mean_",
",",
"self... | Renders the training and test learning curves. | [
"Renders",
"the",
"training",
"and",
"test",
"learning",
"curves",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/learning_curve.py#L239-L268 | train | Renders the training and test learning curves. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/pcoords.py | parallel_coordinates | def parallel_coordinates(X, y, ax=None, features=None, classes=None,
normalize=None, sample=1.0, color=None, colormap=None,
alpha=None, fast=False, vlines=True, vlines_kwds=None,
**kwargs):
"""Displays each feature as a vertical axis and eac... | python | def parallel_coordinates(X, y, ax=None, features=None, classes=None,
normalize=None, sample=1.0, color=None, colormap=None,
alpha=None, fast=False, vlines=True, vlines_kwds=None,
**kwargs):
"""Displays each feature as a vertical axis and eac... | [
"def",
"parallel_coordinates",
"(",
"X",
",",
"y",
",",
"ax",
"=",
"None",
",",
"features",
"=",
"None",
",",
"classes",
"=",
"None",
",",
"normalize",
"=",
"None",
",",
"sample",
"=",
"1.0",
",",
"color",
"=",
"None",
",",
"colormap",
"=",
"None",
... | Displays each feature as a vertical axis and each instance as a line.
This helper function is a quick wrapper to utilize the ParallelCoordinates
Visualizer (Transformer) for one-off analysis.
Parameters
----------
X : ndarray or DataFrame of shape n x m
A matrix of n instances with m feat... | [
"Displays",
"each",
"feature",
"as",
"a",
"vertical",
"axis",
"and",
"each",
"instance",
"as",
"a",
"line",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/pcoords.py#L38-L127 | train | This function is used to plot a single feature and each instance of a class in a set of features and classes. The function can be used to plot a single feature and each instance of a class in a set of features and classes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/pcoords.py | ParallelCoordinates.fit | 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
... | python | 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",
")",
":",
"# Convert from pandas data types",
"if",
"is_dataframe",
"(",
"X",
")",
":",
"# Get column names before reverting to an np.ndarray",
"if",
"self",
".",
"features_",
... | 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
... | [
"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",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/pcoords.py#L313-L374 | train | Fit the transformer to the target class and return the instance of the visualization. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/pcoords.py | ParallelCoordinates.draw | def draw(self, X, y, **kwargs):
"""
Called from the fit method, this method creates the parallel
coordinates canvas and draws each instance and vertical lines on it.
Parameters
----------
X : ndarray of shape n x m
A matrix of n instances with m features
... | python | def draw(self, X, y, **kwargs):
"""
Called from the fit method, this method creates the parallel
coordinates canvas and draws each instance and vertical lines on it.
Parameters
----------
X : ndarray of shape n x m
A matrix of n instances with m features
... | [
"def",
"draw",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"self",
".",
"fast",
":",
"return",
"self",
".",
"draw_classes",
"(",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
"return",
"self",
".",
"draw_instances",
... | Called from the fit method, this method creates the parallel
coordinates canvas and draws each instance and vertical lines on it.
Parameters
----------
X : ndarray of shape n x m
A matrix of n instances with m features
y : ndarray of length n
An array or... | [
"Called",
"from",
"the",
"fit",
"method",
"this",
"method",
"creates",
"the",
"parallel",
"coordinates",
"canvas",
"and",
"draws",
"each",
"instance",
"and",
"vertical",
"lines",
"on",
"it",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/pcoords.py#L376-L395 | train | This method creates the parallel set of instances and classes and vertical lines on it. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/pcoords.py | ParallelCoordinates.draw_instances | def draw_instances(self, X, y, **kwargs):
"""
Draw the instances colored by the target y such that each line is a
single instance. This is the "slow" mode of drawing, since each
instance has to be drawn individually. However, in so doing, the
density of instances in braids is mor... | python | def draw_instances(self, X, y, **kwargs):
"""
Draw the instances colored by the target y such that each line is a
single instance. This is the "slow" mode of drawing, since each
instance has to be drawn individually. However, in so doing, the
density of instances in braids is mor... | [
"def",
"draw_instances",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get alpha from param or default",
"alpha",
"=",
"self",
".",
"alpha",
"or",
"0.25",
"for",
"idx",
"in",
"range",
"(",
"len",
"(",
"X",
")",
")",
":",
"Xi"... | Draw the instances colored by the target y such that each line is a
single instance. This is the "slow" mode of drawing, since each
instance has to be drawn individually. However, in so doing, the
density of instances in braids is more apparent since lines have an
independent alpha that ... | [
"Draw",
"the",
"instances",
"colored",
"by",
"the",
"target",
"y",
"such",
"that",
"each",
"line",
"is",
"a",
"single",
"instance",
".",
"This",
"is",
"the",
"slow",
"mode",
"of",
"drawing",
"since",
"each",
"instance",
"has",
"to",
"be",
"drawn",
"indiv... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/pcoords.py#L397-L439 | train | Draw the instances colored by the target y. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/pcoords.py | ParallelCoordinates.draw_classes | def draw_classes(self, X, y, **kwargs):
"""
Draw the instances colored by the target y such that each line is a
single class. This is the "fast" mode of drawing, since the number of
lines drawn equals the number of classes, rather than the number of
instances. However, this drawi... | python | def draw_classes(self, X, y, **kwargs):
"""
Draw the instances colored by the target y such that each line is a
single class. This is the "fast" mode of drawing, since the number of
lines drawn equals the number of classes, rather than the number of
instances. However, this drawi... | [
"def",
"draw_classes",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get alpha from param or default",
"alpha",
"=",
"self",
".",
"alpha",
"or",
"0.5",
"# Prepare to flatten data within each class:",
"# introduce separation between individual ... | Draw the instances colored by the target y such that each line is a
single class. This is the "fast" mode of drawing, since the number of
lines drawn equals the number of classes, rather than the number of
instances. However, this drawing method sacrifices inter-class density
of points u... | [
"Draw",
"the",
"instances",
"colored",
"by",
"the",
"target",
"y",
"such",
"that",
"each",
"line",
"is",
"a",
"single",
"class",
".",
"This",
"is",
"the",
"fast",
"mode",
"of",
"drawing",
"since",
"the",
"number",
"of",
"lines",
"drawn",
"equals",
"the",... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/pcoords.py#L441-L486 | train | Draw the instances colored by the target y such that each line is a single class. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/pcoords.py | ParallelCoordinates.finalize | 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(
... | python | 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",
")",
":",
"# Set the title",
"self",
".",
"set_title",
"(",
"'Parallel Coordinates for {} Features'",
".",
"format",
"(",
"len",
"(",
"self",
".",
"features_",
")",
")",
")",
"# Add the vertical lines",
... | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/pcoords.py#L488-L520 | train | Finalize executes any subclass - specific axes finalization steps. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/model_selection/validation_curve.py | validation_curve | def validation_curve(model, X, y, param_name, param_range, ax=None, logx=False,
groups=None, cv=None, scoring=None, n_jobs=1,
pre_dispatch="all", **kwargs):
"""
Displays a validation curve for the specified param and values, plotting
both the train and cross-validat... | python | def validation_curve(model, X, y, param_name, param_range, ax=None, logx=False,
groups=None, cv=None, scoring=None, n_jobs=1,
pre_dispatch="all", **kwargs):
"""
Displays a validation curve for the specified param and values, plotting
both the train and cross-validat... | [
"def",
"validation_curve",
"(",
"model",
",",
"X",
",",
"y",
",",
"param_name",
",",
"param_range",
",",
"ax",
"=",
"None",
",",
"logx",
"=",
"False",
",",
"groups",
"=",
"None",
",",
"cv",
"=",
"None",
",",
"scoring",
"=",
"None",
",",
"n_jobs",
"... | Displays a validation curve for the specified param and values, plotting
both the train and cross-validated test scores. The validation curve is a
visual, single-parameter grid search used to tune a model to find the best
balance between error due to bias and error due to variance.
This helper function... | [
"Displays",
"a",
"validation",
"curve",
"for",
"the",
"specified",
"param",
"and",
"values",
"plotting",
"both",
"the",
"train",
"and",
"cross",
"-",
"validated",
"test",
"scores",
".",
"The",
"validation",
"curve",
"is",
"a",
"visual",
"single",
"-",
"param... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/validation_curve.py#L272-L364 | train | This function is used to plot a validation curve for the specified parameter and values. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/model_selection/validation_curve.py | ValidationCurve.fit | def fit(self, X, y=None):
"""
Fits the validation curve with the wrapped estimator and parameter
array to the specified data. Draws training and test score curves and
saves the scores to the visualizer.
Parameters
----------
X : array-like, shape (n_samples, n_fe... | python | def fit(self, X, y=None):
"""
Fits the validation curve with the wrapped estimator and parameter
array to the specified data. Draws training and test score curves and
saves the scores to the visualizer.
Parameters
----------
X : array-like, shape (n_samples, n_fe... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# arguments to pass to sk_validation_curve",
"skvc_kwargs",
"=",
"{",
"key",
":",
"self",
".",
"get_params",
"(",
")",
"[",
"key",
"]",
"for",
"key",
"in",
"(",
"'param_name'",
",",
... | Fits the validation curve with the wrapped estimator and parameter
array to the specified data. Draws training and test score curves and
saves the scores to the visualizer.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Training vector, where n_s... | [
"Fits",
"the",
"validation",
"curve",
"with",
"the",
"wrapped",
"estimator",
"and",
"parameter",
"array",
"to",
"the",
"specified",
"data",
".",
"Draws",
"training",
"and",
"test",
"score",
"curves",
"and",
"saves",
"the",
"scores",
"to",
"the",
"visualizer",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/model_selection/validation_curve.py#L172-L217 | train | Fits the validation curve with the wrapped estimator and parameter
array to the specified data. Draws training and test score curves and saves the scores to the visualizer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/classifier/base.py | ClassificationScoreVisualizer.classes_ | def classes_(self):
"""
Proxy property to smartly access the classes from the estimator or
stored locally on the score visualizer for visualization.
"""
if self.__classes is None:
try:
return self.estimator.classes_
except AttributeError:
... | python | def classes_(self):
"""
Proxy property to smartly access the classes from the estimator or
stored locally on the score visualizer for visualization.
"""
if self.__classes is None:
try:
return self.estimator.classes_
except AttributeError:
... | [
"def",
"classes_",
"(",
"self",
")",
":",
"if",
"self",
".",
"__classes",
"is",
"None",
":",
"try",
":",
"return",
"self",
".",
"estimator",
".",
"classes_",
"except",
"AttributeError",
":",
"return",
"None",
"return",
"self",
".",
"__classes"
] | Proxy property to smartly access the classes from the estimator or
stored locally on the score visualizer for visualization. | [
"Proxy",
"property",
"to",
"smartly",
"access",
"the",
"classes",
"from",
"the",
"estimator",
"or",
"stored",
"locally",
"on",
"the",
"score",
"visualizer",
"for",
"visualization",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/base.py#L68-L78 | train | Property to smartly access the classes from the estimator or the estimator s classes_
property. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/classifier/base.py | ClassificationScoreVisualizer.fit | def fit(self, X, y=None, **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 or class values
kwargs: keyword argument... | python | def fit(self, X, y=None, **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 or class values
kwargs: keyword argument... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Fit the inner estimator",
"self",
".",
"estimator",
".",
"fit",
"(",
"X",
",",
"y",
")",
"# Extract the classes from the estimator",
"if",
"self",
".",
"cla... | 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
kwargs: keyword arguments passed to Scikit-Learn API.
Returns
-... | [
"Parameters",
"----------"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/base.py#L84-L111 | train | Fit the inner estimator to the target and class values of the target or class and return the instance of the classification score visualizer. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/datasets/loaders.py | _load_dataset | def _load_dataset(name, data_home=None, return_dataset=False):
"""
Load a dataset by name and return specified format.
"""
info = DATASETS[name]
data = Dataset(name, data_home=data_home, **info)
if return_dataset:
return data
return data.to_data() | python | def _load_dataset(name, data_home=None, return_dataset=False):
"""
Load a dataset by name and return specified format.
"""
info = DATASETS[name]
data = Dataset(name, data_home=data_home, **info)
if return_dataset:
return data
return data.to_data() | [
"def",
"_load_dataset",
"(",
"name",
",",
"data_home",
"=",
"None",
",",
"return_dataset",
"=",
"False",
")",
":",
"info",
"=",
"DATASETS",
"[",
"name",
"]",
"data",
"=",
"Dataset",
"(",
"name",
",",
"data_home",
"=",
"data_home",
",",
"*",
"*",
"info"... | Load a dataset by name and return specified format. | [
"Load",
"a",
"dataset",
"by",
"name",
"and",
"return",
"specified",
"format",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/datasets/loaders.py#L42-L50 | train | Load a dataset by name and return specified format. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/datasets/loaders.py | _load_corpus | def _load_corpus(name, data_home=None):
"""
Load a corpus object by name.
"""
info = DATASETS[name]
return Corpus(name, data_home=data_home, **info) | python | def _load_corpus(name, data_home=None):
"""
Load a corpus object by name.
"""
info = DATASETS[name]
return Corpus(name, data_home=data_home, **info) | [
"def",
"_load_corpus",
"(",
"name",
",",
"data_home",
"=",
"None",
")",
":",
"info",
"=",
"DATASETS",
"[",
"name",
"]",
"return",
"Corpus",
"(",
"name",
",",
"data_home",
"=",
"data_home",
",",
"*",
"*",
"info",
")"
] | Load a corpus object by name. | [
"Load",
"a",
"corpus",
"object",
"by",
"name",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/datasets/loaders.py#L53-L58 | train | Load a corpus object by name. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/style/colors.py | resolve_colors | def resolve_colors(n_colors=None, colormap=None, colors=None):
"""
Generates a list of colors based on common color arguments, for example
the name of a colormap or palette or another iterable of colors. The list
is then truncated (or multiplied) to the specific number of requested
colors.
Para... | python | def resolve_colors(n_colors=None, colormap=None, colors=None):
"""
Generates a list of colors based on common color arguments, for example
the name of a colormap or palette or another iterable of colors. The list
is then truncated (or multiplied) to the specific number of requested
colors.
Para... | [
"def",
"resolve_colors",
"(",
"n_colors",
"=",
"None",
",",
"colormap",
"=",
"None",
",",
"colors",
"=",
"None",
")",
":",
"# Work with the colormap if specified and colors is not",
"if",
"colormap",
"is",
"not",
"None",
"and",
"colors",
"is",
"None",
":",
"if",... | Generates a list of colors based on common color arguments, for example
the name of a colormap or palette or another iterable of colors. The list
is then truncated (or multiplied) to the specific number of requested
colors.
Parameters
----------
n_colors : int, default: None
Specify the... | [
"Generates",
"a",
"list",
"of",
"colors",
"based",
"on",
"common",
"color",
"arguments",
"for",
"example",
"the",
"name",
"of",
"a",
"colormap",
"or",
"palette",
"or",
"another",
"iterable",
"of",
"colors",
".",
"The",
"list",
"is",
"then",
"truncated",
"(... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/style/colors.py#L57-L121 | train | Generates a list of colors based on common color arguments for the given colormap and colors. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/style/colors.py | ColorMap.colors | def colors(self, value):
"""
Converts color strings into a color listing.
"""
if isinstance(value, str):
# Must import here to avoid recursive import
from .palettes import PALETTES
if value not in PALETTES:
raise YellowbrickValueError(... | python | def colors(self, value):
"""
Converts color strings into a color listing.
"""
if isinstance(value, str):
# Must import here to avoid recursive import
from .palettes import PALETTES
if value not in PALETTES:
raise YellowbrickValueError(... | [
"def",
"colors",
"(",
"self",
",",
"value",
")",
":",
"if",
"isinstance",
"(",
"value",
",",
"str",
")",
":",
"# Must import here to avoid recursive import",
"from",
".",
"palettes",
"import",
"PALETTES",
"if",
"value",
"not",
"in",
"PALETTES",
":",
"raise",
... | Converts color strings into a color listing. | [
"Converts",
"color",
"strings",
"into",
"a",
"color",
"listing",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/style/colors.py#L145-L161 | train | Converts color strings into a color listing. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/utils/decorators.py | memoized | def memoized(fget):
"""
Return a property attribute for new-style classes that only calls its
getter on the first access. The result is stored and on subsequent
accesses is returned, preventing the need to call the getter any more.
Parameters
----------
fget: function
The getter met... | python | def memoized(fget):
"""
Return a property attribute for new-style classes that only calls its
getter on the first access. The result is stored and on subsequent
accesses is returned, preventing the need to call the getter any more.
Parameters
----------
fget: function
The getter met... | [
"def",
"memoized",
"(",
"fget",
")",
":",
"attr_name",
"=",
"'_{0}'",
".",
"format",
"(",
"fget",
".",
"__name__",
")",
"@",
"wraps",
"(",
"fget",
")",
"def",
"fget_memoized",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"attr_nam... | Return a property attribute for new-style classes that only calls its
getter on the first access. The result is stored and on subsequent
accesses is returned, preventing the need to call the getter any more.
Parameters
----------
fget: function
The getter method to memoize for subsequent ac... | [
"Return",
"a",
"property",
"attribute",
"for",
"new",
"-",
"style",
"classes",
"that",
"only",
"calls",
"its",
"getter",
"on",
"the",
"first",
"access",
".",
"The",
"result",
"is",
"stored",
"and",
"on",
"subsequent",
"accesses",
"is",
"returned",
"preventin... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/utils/decorators.py#L27-L51 | train | Returns a property attribute for new - style classes that only calls its
getter on the first access. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/anscombe.py | anscombe | def anscombe():
"""
Creates 2x2 grid plot of the 4 anscombe datasets for illustration.
"""
_, ((axa, axb), (axc, axd)) = plt.subplots(2, 2, sharex='col', sharey='row')
colors = get_color_cycle()
for arr, ax, color in zip(ANSCOMBE, (axa, axb, axc, axd), colors):
x = arr[0]
y = a... | python | def anscombe():
"""
Creates 2x2 grid plot of the 4 anscombe datasets for illustration.
"""
_, ((axa, axb), (axc, axd)) = plt.subplots(2, 2, sharex='col', sharey='row')
colors = get_color_cycle()
for arr, ax, color in zip(ANSCOMBE, (axa, axb, axc, axd), colors):
x = arr[0]
y = a... | [
"def",
"anscombe",
"(",
")",
":",
"_",
",",
"(",
"(",
"axa",
",",
"axb",
")",
",",
"(",
"axc",
",",
"axd",
")",
")",
"=",
"plt",
".",
"subplots",
"(",
"2",
",",
"2",
",",
"sharex",
"=",
"'col'",
",",
"sharey",
"=",
"'row'",
")",
"colors",
"... | Creates 2x2 grid plot of the 4 anscombe datasets for illustration. | [
"Creates",
"2x2",
"grid",
"plot",
"of",
"the",
"4",
"anscombe",
"datasets",
"for",
"illustration",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/anscombe.py#L51-L72 | train | Creates 2x2 grid plot of the 4 anscombe datasets for illustration. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/radviz.py | radviz | def radviz(X, y=None, ax=None, features=None, classes=None,
color=None, colormap=None, alpha=1.0, **kwargs):
"""
Displays each feature as an axis around a circle surrounding a scatter
plot whose points are each individual instance.
This helper function is a quick wrapper to utilize the Radia... | python | def radviz(X, y=None, ax=None, features=None, classes=None,
color=None, colormap=None, alpha=1.0, **kwargs):
"""
Displays each feature as an axis around a circle surrounding a scatter
plot whose points are each individual instance.
This helper function is a quick wrapper to utilize the Radia... | [
"def",
"radviz",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"features",
"=",
"None",
",",
"classes",
"=",
"None",
",",
"color",
"=",
"None",
",",
"colormap",
"=",
"None",
",",
"alpha",
"=",
"1.0",
",",
"*",
"*",
"kwargs",
")"... | Displays each feature as an axis around a circle surrounding a scatter
plot whose points are each individual instance.
This helper function is a quick wrapper to utilize the RadialVisualizer
(Transformer) for one-off analysis.
Parameters
----------
X : ndarray or DataFrame of shape n x m
... | [
"Displays",
"each",
"feature",
"as",
"an",
"axis",
"around",
"a",
"circle",
"surrounding",
"a",
"scatter",
"plot",
"whose",
"points",
"are",
"each",
"individual",
"instance",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/radviz.py#L34-L86 | train | This function is a quick wrapper to utilize the RadialVisualizer class for one - off analysis. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/radviz.py | RadialVisualizer.normalize | def normalize(X):
"""
MinMax normalization to fit a matrix in the space [0,1] by column.
"""
a = X.min(axis=0)
b = X.max(axis=0)
return (X - a[np.newaxis, :]) / ((b - a)[np.newaxis, :]) | python | def normalize(X):
"""
MinMax normalization to fit a matrix in the space [0,1] by column.
"""
a = X.min(axis=0)
b = X.max(axis=0)
return (X - a[np.newaxis, :]) / ((b - a)[np.newaxis, :]) | [
"def",
"normalize",
"(",
"X",
")",
":",
"a",
"=",
"X",
".",
"min",
"(",
"axis",
"=",
"0",
")",
"b",
"=",
"X",
".",
"max",
"(",
"axis",
"=",
"0",
")",
"return",
"(",
"X",
"-",
"a",
"[",
"np",
".",
"newaxis",
",",
":",
"]",
")",
"/",
"(",... | MinMax normalization to fit a matrix in the space [0,1] by column. | [
"MinMax",
"normalization",
"to",
"fit",
"a",
"matrix",
"in",
"the",
"space",
"[",
"0",
"1",
"]",
"by",
"column",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/radviz.py#L157-L163 | train | Normalize a matrix X to fit a matrix in the space [ 0 1 ) by column. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/radviz.py | RadialVisualizer.draw | def draw(self, X, y, **kwargs):
"""
Called from the fit method, this method creates the radviz canvas and
draws each instance as a class or target colored point, whose location
is determined by the feature data set.
"""
# Convert from dataframe
if is_dataframe(X):... | python | def draw(self, X, y, **kwargs):
"""
Called from the fit method, this method creates the radviz canvas and
draws each instance as a class or target colored point, whose location
is determined by the feature data set.
"""
# Convert from dataframe
if is_dataframe(X):... | [
"def",
"draw",
"(",
"self",
",",
"X",
",",
"y",
",",
"*",
"*",
"kwargs",
")",
":",
"# Convert from dataframe",
"if",
"is_dataframe",
"(",
"X",
")",
":",
"X",
"=",
"X",
".",
"values",
"# Clean out nans and warn that the user they aren't plotted",
"nan_warnings",
... | Called from the fit method, this method creates the radviz canvas and
draws each instance as a class or target colored point, whose location
is determined by the feature data set. | [
"Called",
"from",
"the",
"fit",
"method",
"this",
"method",
"creates",
"the",
"radviz",
"canvas",
"and",
"draws",
"each",
"instance",
"as",
"a",
"class",
"or",
"target",
"colored",
"point",
"whose",
"location",
"is",
"determined",
"by",
"the",
"feature",
"da... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/radviz.py#L165-L249 | train | Creates the radviz canvas and draws each instance of the class or target colored point at each location in the class or target data set. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/features/radviz.py | RadialVisualizer.finalize | 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(
... | python | 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",
")",
":",
"# Set the title",
"self",
".",
"set_title",
"(",
"'RadViz for {} Features'",
".",
"format",
"(",
"len",
"(",
"self",
".",
"features_",
")",
")",
")",
"# Remove the ticks from the graph",
"self... | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/features/radviz.py#L251-L272 | train | Finalize executes any subclass - specific axes finalization steps. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | percentile_index | def percentile_index(a, q):
"""
Returns the index of the value at the Qth percentile in array a.
"""
return np.where(
a==np.percentile(a, q, interpolation='nearest')
)[0][0] | python | def percentile_index(a, q):
"""
Returns the index of the value at the Qth percentile in array a.
"""
return np.where(
a==np.percentile(a, q, interpolation='nearest')
)[0][0] | [
"def",
"percentile_index",
"(",
"a",
",",
"q",
")",
":",
"return",
"np",
".",
"where",
"(",
"a",
"==",
"np",
".",
"percentile",
"(",
"a",
",",
"q",
",",
"interpolation",
"=",
"'nearest'",
")",
")",
"[",
"0",
"]",
"[",
"0",
"]"
] | Returns the index of the value at the Qth percentile in array a. | [
"Returns",
"the",
"index",
"of",
"the",
"value",
"at",
"the",
"Qth",
"percentile",
"in",
"array",
"a",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L387-L393 | train | Returns the index of the value at the Qth percentile in array a. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | validate_string_param | def validate_string_param(s, valid, param_name="param"):
"""
Raises a well formatted exception if s is not in valid, otherwise does not
raise an exception. Uses ``param_name`` to identify the parameter.
"""
if s.lower() not in valid:
raise YellowbrickValueError(
"unknown {} '{}',... | python | def validate_string_param(s, valid, param_name="param"):
"""
Raises a well formatted exception if s is not in valid, otherwise does not
raise an exception. Uses ``param_name`` to identify the parameter.
"""
if s.lower() not in valid:
raise YellowbrickValueError(
"unknown {} '{}',... | [
"def",
"validate_string_param",
"(",
"s",
",",
"valid",
",",
"param_name",
"=",
"\"param\"",
")",
":",
"if",
"s",
".",
"lower",
"(",
")",
"not",
"in",
"valid",
":",
"raise",
"YellowbrickValueError",
"(",
"\"unknown {} '{}', chose from '{}'\"",
".",
"format",
"... | Raises a well formatted exception if s is not in valid, otherwise does not
raise an exception. Uses ``param_name`` to identify the parameter. | [
"Raises",
"a",
"well",
"formatted",
"exception",
"if",
"s",
"is",
"not",
"in",
"valid",
"otherwise",
"does",
"not",
"raise",
"an",
"exception",
".",
"Uses",
"param_name",
"to",
"identify",
"the",
"parameter",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L396-L406 | train | Raises an exception if s is not in valid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | intercluster_distance | def intercluster_distance(model, X, y=None, ax=None,
min_size=400, max_size=25000,
embedding='mds', scoring='membership',
legend=True, legend_loc="lower left", legend_size=1.5,
random_state=None, **kwargs):
"""Qu... | python | def intercluster_distance(model, X, y=None, ax=None,
min_size=400, max_size=25000,
embedding='mds', scoring='membership',
legend=True, legend_loc="lower left", legend_size=1.5,
random_state=None, **kwargs):
"""Qu... | [
"def",
"intercluster_distance",
"(",
"model",
",",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"min_size",
"=",
"400",
",",
"max_size",
"=",
"25000",
",",
"embedding",
"=",
"'mds'",
",",
"scoring",
"=",
"'membership'",
",",
"legend",
"=",
... | Quick Method:
Intercluster distance maps display an embedding of the cluster centers in
2 dimensions with the distance to other centers preserved. E.g. the closer
to centers are in the visualization, the closer they are in the original
feature space. The clusters are sized according to a scoring metric... | [
"Quick",
"Method",
":"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L427-L519 | train | Quick Method that displays an intercluster distance map for a set of clusters. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance.lax | def lax(self):
"""
Returns the legend axes, creating it only on demand by creating a 2"
by 2" inset axes that has no grid, ticks, spines or face frame (e.g
is mostly invisible). The legend can then be drawn on this axes.
"""
if inset_locator is None:
raise Yel... | python | def lax(self):
"""
Returns the legend axes, creating it only on demand by creating a 2"
by 2" inset axes that has no grid, ticks, spines or face frame (e.g
is mostly invisible). The legend can then be drawn on this axes.
"""
if inset_locator is None:
raise Yel... | [
"def",
"lax",
"(",
"self",
")",
":",
"if",
"inset_locator",
"is",
"None",
":",
"raise",
"YellowbrickValueError",
"(",
"(",
"\"intercluster distance map legend requires matplotlib 2.0.2 or greater \"",
"\"please upgrade matplotlib or set legend=False on the visualizer\"",
")",
")"... | Returns the legend axes, creating it only on demand by creating a 2"
by 2" inset axes that has no grid, ticks, spines or face frame (e.g
is mostly invisible). The legend can then be drawn on this axes. | [
"Returns",
"the",
"legend",
"axes",
"creating",
"it",
"only",
"on",
"demand",
"by",
"creating",
"a",
"2",
"by",
"2",
"inset",
"axes",
"that",
"has",
"no",
"grid",
"ticks",
"spines",
"or",
"face",
"frame",
"(",
"e",
".",
"g",
"is",
"mostly",
"invisible"... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L184-L211 | train | Returns the legend axes creating it only on demand by creating a 2. 0. 2 inset axes that has no grid ticks spines and face frame. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance.transformer | def transformer(self):
"""
Creates the internal transformer that maps the cluster center's high
dimensional space to its two dimensional space.
"""
ttype = self.embedding.lower() # transformer method type
if ttype == 'mds':
return MDS(n_components=2, random_s... | python | def transformer(self):
"""
Creates the internal transformer that maps the cluster center's high
dimensional space to its two dimensional space.
"""
ttype = self.embedding.lower() # transformer method type
if ttype == 'mds':
return MDS(n_components=2, random_s... | [
"def",
"transformer",
"(",
"self",
")",
":",
"ttype",
"=",
"self",
".",
"embedding",
".",
"lower",
"(",
")",
"# transformer method type",
"if",
"ttype",
"==",
"'mds'",
":",
"return",
"MDS",
"(",
"n_components",
"=",
"2",
",",
"random_state",
"=",
"self",
... | Creates the internal transformer that maps the cluster center's high
dimensional space to its two dimensional space. | [
"Creates",
"the",
"internal",
"transformer",
"that",
"maps",
"the",
"cluster",
"center",
"s",
"high",
"dimensional",
"space",
"to",
"its",
"two",
"dimensional",
"space",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L214-L227 | train | Returns the internal transformer that maps the cluster center s high
dimensional space to its two dimensional space. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance.cluster_centers_ | def cluster_centers_(self):
"""
Searches for or creates cluster centers for the specified clustering
algorithm. This algorithm ensures that that the centers are
appropriately drawn and scaled so that distance between clusters are
maintained.
"""
# TODO: Handle agg... | python | def cluster_centers_(self):
"""
Searches for or creates cluster centers for the specified clustering
algorithm. This algorithm ensures that that the centers are
appropriately drawn and scaled so that distance between clusters are
maintained.
"""
# TODO: Handle agg... | [
"def",
"cluster_centers_",
"(",
"self",
")",
":",
"# TODO: Handle agglomerative clustering and LDA",
"for",
"attr",
"in",
"(",
"'cluster_centers_'",
",",
")",
":",
"try",
":",
"return",
"getattr",
"(",
"self",
".",
"estimator",
",",
"attr",
")",
"except",
"Attri... | Searches for or creates cluster centers for the specified clustering
algorithm. This algorithm ensures that that the centers are
appropriately drawn and scaled so that distance between clusters are
maintained. | [
"Searches",
"for",
"or",
"creates",
"cluster",
"centers",
"for",
"the",
"specified",
"clustering",
"algorithm",
".",
"This",
"algorithm",
"ensures",
"that",
"that",
"the",
"centers",
"are",
"appropriately",
"drawn",
"and",
"scaled",
"so",
"that",
"distance",
"be... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L230-L247 | train | Searches for or creates cluster centers for the specified clustering
algorithm. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance.fit | def fit(self, X, y=None):
"""
Fit the clustering model, computing the centers then embeds the centers
into 2D space using the embedding method specified.
"""
with Timer() as self.fit_time_:
# Fit the underlying estimator
self.estimator.fit(X, y)
... | python | def fit(self, X, y=None):
"""
Fit the clustering model, computing the centers then embeds the centers
into 2D space using the embedding method specified.
"""
with Timer() as self.fit_time_:
# Fit the underlying estimator
self.estimator.fit(X, y)
... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"with",
"Timer",
"(",
")",
"as",
"self",
".",
"fit_time_",
":",
"# Fit the underlying estimator",
"self",
".",
"estimator",
".",
"fit",
"(",
"X",
",",
"y",
")",
"# Get the centers",
... | Fit the clustering model, computing the centers then embeds the centers
into 2D space using the embedding method specified. | [
"Fit",
"the",
"clustering",
"model",
"computing",
"the",
"centers",
"then",
"embeds",
"the",
"centers",
"into",
"2D",
"space",
"using",
"the",
"embedding",
"method",
"specified",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L249-L268 | train | Fit the clustering model computing the centers then embeds the centers into 2D space using the embedding method specified. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance.draw | def draw(self):
"""
Draw the embedded centers with their sizes on the visualization.
"""
# Compute the sizes of the markers from their score
sizes = self._get_cluster_sizes()
# Draw the scatter plots with associated sizes on the graph
self.ax.scatter(
... | python | def draw(self):
"""
Draw the embedded centers with their sizes on the visualization.
"""
# Compute the sizes of the markers from their score
sizes = self._get_cluster_sizes()
# Draw the scatter plots with associated sizes on the graph
self.ax.scatter(
... | [
"def",
"draw",
"(",
"self",
")",
":",
"# Compute the sizes of the markers from their score",
"sizes",
"=",
"self",
".",
"_get_cluster_sizes",
"(",
")",
"# Draw the scatter plots with associated sizes on the graph",
"self",
".",
"ax",
".",
"scatter",
"(",
"self",
".",
"e... | Draw the embedded centers with their sizes on the visualization. | [
"Draw",
"the",
"embedded",
"centers",
"with",
"their",
"sizes",
"on",
"the",
"visualization",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L270-L291 | train | Draw the embedded centers with their sizes on the visualization. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance.finalize | def finalize(self):
"""
Finalize the visualization to create an "origin grid" feel instead of
the default matplotlib feel. Set the title, remove spines, and label
the grid with components. This function also adds a legend from the
sizes if required.
"""
# Set the ... | python | def finalize(self):
"""
Finalize the visualization to create an "origin grid" feel instead of
the default matplotlib feel. Set the title, remove spines, and label
the grid with components. This function also adds a legend from the
sizes if required.
"""
# Set the ... | [
"def",
"finalize",
"(",
"self",
")",
":",
"# Set the default title if a user hasn't supplied one",
"self",
".",
"set_title",
"(",
"\"{} Intercluster Distance Map (via {})\"",
".",
"format",
"(",
"self",
".",
"estimator",
".",
"__class__",
".",
"__name__",
",",
"self",
... | Finalize the visualization to create an "origin grid" feel instead of
the default matplotlib feel. Set the title, remove spines, and label
the grid with components. This function also adds a legend from the
sizes if required. | [
"Finalize",
"the",
"visualization",
"to",
"create",
"an",
"origin",
"grid",
"feel",
"instead",
"of",
"the",
"default",
"matplotlib",
"feel",
".",
"Set",
"the",
"title",
"remove",
"spines",
"and",
"label",
"the",
"grid",
"with",
"components",
".",
"This",
"fu... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L293-L318 | train | Finalize the visualization to create an origin grid feel instead of the default matplotlib feel. Set the title remove spines label the label of the grid with components and add a legend from the size if required. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance._score_clusters | def _score_clusters(self, X, y=None):
"""
Determines the "scores" of the cluster, the metric that determines the
size of the cluster visualized on the visualization.
"""
stype = self.scoring.lower() # scoring method name
if stype == "membership":
return np.bi... | python | def _score_clusters(self, X, y=None):
"""
Determines the "scores" of the cluster, the metric that determines the
size of the cluster visualized on the visualization.
"""
stype = self.scoring.lower() # scoring method name
if stype == "membership":
return np.bi... | [
"def",
"_score_clusters",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"stype",
"=",
"self",
".",
"scoring",
".",
"lower",
"(",
")",
"# scoring method name",
"if",
"stype",
"==",
"\"membership\"",
":",
"return",
"np",
".",
"bincount",
"(",
"... | Determines the "scores" of the cluster, the metric that determines the
size of the cluster visualized on the visualization. | [
"Determines",
"the",
"scores",
"of",
"the",
"cluster",
"the",
"metric",
"that",
"determines",
"the",
"size",
"of",
"the",
"cluster",
"visualized",
"on",
"the",
"visualization",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L320-L330 | train | Determines the scores of the clusters in X. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance._get_cluster_sizes | def _get_cluster_sizes(self):
"""
Returns the marker size (in points, e.g. area of the circle) based on
the scores, using the prop_to_size scaling mechanism.
"""
# NOTE: log and power are hardcoded, should we allow the user to specify?
return prop_to_size(
sel... | python | def _get_cluster_sizes(self):
"""
Returns the marker size (in points, e.g. area of the circle) based on
the scores, using the prop_to_size scaling mechanism.
"""
# NOTE: log and power are hardcoded, should we allow the user to specify?
return prop_to_size(
sel... | [
"def",
"_get_cluster_sizes",
"(",
"self",
")",
":",
"# NOTE: log and power are hardcoded, should we allow the user to specify?",
"return",
"prop_to_size",
"(",
"self",
".",
"scores_",
",",
"mi",
"=",
"self",
".",
"min_size",
",",
"ma",
"=",
"self",
".",
"max_size",
... | Returns the marker size (in points, e.g. area of the circle) based on
the scores, using the prop_to_size scaling mechanism. | [
"Returns",
"the",
"marker",
"size",
"(",
"in",
"points",
"e",
".",
"g",
".",
"area",
"of",
"the",
"circle",
")",
"based",
"on",
"the",
"scores",
"using",
"the",
"prop_to_size",
"scaling",
"mechanism",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L332-L340 | train | Returns the marker sizes based on the scores. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/cluster/icdm.py | InterclusterDistance._make_size_legend | def _make_size_legend(self):
"""
Draw a legend that shows relative sizes of the clusters at the 25th,
50th, and 75th percentile based on the current scoring metric.
"""
# Compute the size of the markers and scale them to our figure size
# NOTE: the marker size is the area... | python | def _make_size_legend(self):
"""
Draw a legend that shows relative sizes of the clusters at the 25th,
50th, and 75th percentile based on the current scoring metric.
"""
# Compute the size of the markers and scale them to our figure size
# NOTE: the marker size is the area... | [
"def",
"_make_size_legend",
"(",
"self",
")",
":",
"# Compute the size of the markers and scale them to our figure size",
"# NOTE: the marker size is the area of the plot, we need to compute the",
"# radius of the markers.",
"areas",
"=",
"self",
".",
"_get_cluster_sizes",
"(",
")",
... | Draw a legend that shows relative sizes of the clusters at the 25th,
50th, and 75th percentile based on the current scoring metric. | [
"Draw",
"a",
"legend",
"that",
"shows",
"relative",
"sizes",
"of",
"the",
"clusters",
"at",
"the",
"25th",
"50th",
"and",
"75th",
"percentile",
"based",
"on",
"the",
"current",
"scoring",
"metric",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/cluster/icdm.py#L342-L380 | train | Draw a legend that shows relative sizes of the clusters at the 25th 50th and 75th percentile based on the current scoring metric. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/draw.py | manual_legend | def manual_legend(g, labels, colors, **legend_kwargs):
"""
Adds a manual legend for a scatter plot to the visualizer where the labels
and associated colors are drawn with circle patches instead of determining
them from the labels of the artist objects on the axes. This helper is
used either when the... | python | def manual_legend(g, labels, colors, **legend_kwargs):
"""
Adds a manual legend for a scatter plot to the visualizer where the labels
and associated colors are drawn with circle patches instead of determining
them from the labels of the artist objects on the axes. This helper is
used either when the... | [
"def",
"manual_legend",
"(",
"g",
",",
"labels",
",",
"colors",
",",
"*",
"*",
"legend_kwargs",
")",
":",
"# Get access to the matplotlib Axes",
"if",
"isinstance",
"(",
"g",
",",
"Visualizer",
")",
":",
"g",
"=",
"g",
".",
"ax",
"elif",
"g",
"is",
"None... | Adds a manual legend for a scatter plot to the visualizer where the labels
and associated colors are drawn with circle patches instead of determining
them from the labels of the artist objects on the axes. This helper is
used either when there are a lot of duplicate labels, no labeled artists,
or when t... | [
"Adds",
"a",
"manual",
"legend",
"for",
"a",
"scatter",
"plot",
"to",
"the",
"visualizer",
"where",
"the",
"labels",
"and",
"associated",
"colors",
"are",
"drawn",
"with",
"circle",
"patches",
"instead",
"of",
"determining",
"them",
"from",
"the",
"labels",
... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/draw.py#L29-L90 | train | This function adds a manual legend to the current axes. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/freqdist.py | freqdist | def freqdist(X, y=None, ax=None, color=None, N=50, **kwargs):
"""Displays frequency distribution plot for text.
This helper function is a quick wrapper to utilize the FreqDist
Visualizer (Transformer) for one-off analysis.
Parameters
----------
X: ndarray or DataFrame of shape n x m
A... | python | def freqdist(X, y=None, ax=None, color=None, N=50, **kwargs):
"""Displays frequency distribution plot for text.
This helper function is a quick wrapper to utilize the FreqDist
Visualizer (Transformer) for one-off analysis.
Parameters
----------
X: ndarray or DataFrame of shape n x m
A... | [
"def",
"freqdist",
"(",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"color",
"=",
"None",
",",
"N",
"=",
"50",
",",
"*",
"*",
"kwargs",
")",
":",
"# Instantiate the visualizer",
"visualizer",
"=",
"FreqDistVisualizer",
"(",
"ax",
",",
"X... | Displays frequency distribution plot for text.
This helper function is a quick wrapper to utilize the FreqDist
Visualizer (Transformer) for one-off analysis.
Parameters
----------
X: ndarray or DataFrame of shape n x m
A matrix of n instances with m features. In the case of text,
... | [
"Displays",
"frequency",
"distribution",
"plot",
"for",
"text",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/freqdist.py#L32-L75 | train | Displays frequency distribution plot for text. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/freqdist.py | FrequencyVisualizer.count | def count(self, X):
"""
Called from the fit method, this method gets all the
words from the corpus and their corresponding frequency
counts.
Parameters
----------
X : ndarray or masked ndarray
Pass in the matrix of vectorized documents, can be masked... | python | def count(self, X):
"""
Called from the fit method, this method gets all the
words from the corpus and their corresponding frequency
counts.
Parameters
----------
X : ndarray or masked ndarray
Pass in the matrix of vectorized documents, can be masked... | [
"def",
"count",
"(",
"self",
",",
"X",
")",
":",
"# Sum on axis 0 (by columns), each column is a word",
"# Convert the matrix to an array",
"# Squeeze to remove the 1 dimension objects (like ravel)",
"return",
"np",
".",
"squeeze",
"(",
"np",
".",
"asarray",
"(",
"X",
".",
... | Called from the fit method, this method gets all the
words from the corpus and their corresponding frequency
counts.
Parameters
----------
X : ndarray or masked ndarray
Pass in the matrix of vectorized documents, can be masked in
order to sum the word fr... | [
"Called",
"from",
"the",
"fit",
"method",
"this",
"method",
"gets",
"all",
"the",
"words",
"from",
"the",
"corpus",
"and",
"their",
"corresponding",
"frequency",
"counts",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/freqdist.py#L132-L155 | train | Returns the counts of all the words in X in the corpus and their corresponding frequency. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/freqdist.py | FrequencyVisualizer.fit | def fit(self, X, y=None):
"""
The fit method is the primary drawing input for the frequency
distribution visualization. It requires vectorized lists of
documents and a list of features, which are the actual words
from the original corpus (needed to label the x-axis ticks).
... | python | def fit(self, X, y=None):
"""
The fit method is the primary drawing input for the frequency
distribution visualization. It requires vectorized lists of
documents and a list of features, which are the actual words
from the original corpus (needed to label the x-axis ticks).
... | [
"def",
"fit",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
")",
":",
"# Compute the conditional word frequency",
"if",
"y",
"is",
"not",
"None",
":",
"# Fit the frequencies",
"self",
".",
"conditional_freqdist_",
"=",
"{",
"}",
"# Conditional frequency distributi... | The fit method is the primary drawing input for the frequency
distribution visualization. It requires vectorized lists of
documents and a list of features, which are the actual words
from the original corpus (needed to label the x-axis ticks).
Parameters
----------
X : n... | [
"The",
"fit",
"method",
"is",
"the",
"primary",
"drawing",
"input",
"for",
"the",
"frequency",
"distribution",
"visualization",
".",
"It",
"requires",
"vectorized",
"lists",
"of",
"documents",
"and",
"a",
"list",
"of",
"features",
"which",
"are",
"the",
"actua... | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/freqdist.py#L157-L200 | train | This method is used to fit the frequency distribution for a set of words and vocab. It is used to draw the frequency distribution for a set of words and vocab. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/freqdist.py | FrequencyVisualizer.draw | def draw(self, **kwargs):
"""
Called from the fit method, this method creates the canvas and
draws the distribution plot on it.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Prepare the data
bins = np.arange(self.N)
word... | python | def draw(self, **kwargs):
"""
Called from the fit method, this method creates the canvas and
draws the distribution plot on it.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Prepare the data
bins = np.arange(self.N)
word... | [
"def",
"draw",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Prepare the data",
"bins",
"=",
"np",
".",
"arange",
"(",
"self",
".",
"N",
")",
"words",
"=",
"[",
"self",
".",
"features",
"[",
"i",
"]",
"for",
"i",
"in",
"self",
".",
"sorted_"... | Called from the fit method, this method creates the canvas and
draws the distribution plot on it.
Parameters
----------
kwargs: generic keyword arguments. | [
"Called",
"from",
"the",
"fit",
"method",
"this",
"method",
"creates",
"the",
"canvas",
"and",
"draws",
"the",
"distribution",
"plot",
"on",
"it",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/freqdist.py#L202-L263 | train | This method creates the canvas and draws the distribution plot on it. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/text/freqdist.py | FrequencyVisualizer.finalize | def finalize(self, **kwargs):
"""
The finalize method executes any subclass-specific axes
finalization steps. The user calls poof & poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Set the title
self.set_title(
... | python | def finalize(self, **kwargs):
"""
The finalize method executes any subclass-specific axes
finalization steps. The user calls poof & poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments.
"""
# Set the title
self.set_title(
... | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the title",
"self",
".",
"set_title",
"(",
"'Frequency Distribution of Top {} tokens'",
".",
"format",
"(",
"self",
".",
"N",
")",
")",
"# Create the vocab, count, and hapaxes labels",
"infola... | The finalize method executes any subclass-specific axes
finalization steps. The user calls poof & poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | [
"The",
"finalize",
"method",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"&",
"poof",
"calls",
"finalize",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/text/freqdist.py#L265-L290 | train | Sets the title and axes to the base class s title and the label. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/classifier/classification_report.py | classification_report | def classification_report(model, X, y=None, ax=None, classes=None,
random_state=None,**kwargs):
"""Quick method:
Displays precision, recall, F1, and support scores for the model.
Integrates numerical scores as well as color-coded heatmap.
This helper function is a quick wrapp... | python | def classification_report(model, X, y=None, ax=None, classes=None,
random_state=None,**kwargs):
"""Quick method:
Displays precision, recall, F1, and support scores for the model.
Integrates numerical scores as well as color-coded heatmap.
This helper function is a quick wrapp... | [
"def",
"classification_report",
"(",
"model",
",",
"X",
",",
"y",
"=",
"None",
",",
"ax",
"=",
"None",
",",
"classes",
"=",
"None",
",",
"random_state",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"# Instantiate the visualizer",
"visualizer",
"=",
"C... | Quick method:
Displays precision, recall, F1, and support scores for the model.
Integrates numerical scores as well as color-coded heatmap.
This helper function is a quick wrapper to utilize the ClassificationReport
ScoreVisualizer for one-off analysis.
Parameters
----------
X : ndarray ... | [
"Quick",
"method",
":"
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/classification_report.py#L238-L285 | train | Generates a classification report for a single - off analysis. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/classifier/classification_report.py | ClassificationReport.score | def score(self, X, y=None, **kwargs):
"""
Generates the Scikit-Learn classification report.
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... | python | def score(self, X, y=None, **kwargs):
"""
Generates the Scikit-Learn classification report.
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... | [
"def",
"score",
"(",
"self",
",",
"X",
",",
"y",
"=",
"None",
",",
"*",
"*",
"kwargs",
")",
":",
"y_pred",
"=",
"self",
".",
"predict",
"(",
"X",
")",
"scores",
"=",
"precision_recall_fscore_support",
"(",
"y",
",",
"y_pred",
")",
"# Calculate the perc... | Generates the Scikit-Learn classification report.
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
Returns
------... | [
"Generates",
"the",
"Scikit",
"-",
"Learn",
"classification",
"report",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/classification_report.py#L111-L154 | train | Generates the Scikit - Learn classification report. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/classifier/classification_report.py | ClassificationReport.draw | def draw(self):
"""
Renders the classification report across each axis.
"""
# Create display grid
cr_display = np.zeros((len(self.classes_), len(self._displayed_scores)))
# For each class row, append columns for precision, recall, f1, and support
for idx, cls in... | python | def draw(self):
"""
Renders the classification report across each axis.
"""
# Create display grid
cr_display = np.zeros((len(self.classes_), len(self._displayed_scores)))
# For each class row, append columns for precision, recall, f1, and support
for idx, cls in... | [
"def",
"draw",
"(",
"self",
")",
":",
"# Create display grid",
"cr_display",
"=",
"np",
".",
"zeros",
"(",
"(",
"len",
"(",
"self",
".",
"classes_",
")",
",",
"len",
"(",
"self",
".",
"_displayed_scores",
")",
")",
")",
"# For each class row, append columns ... | Renders the classification report across each axis. | [
"Renders",
"the",
"classification",
"report",
"across",
"each",
"axis",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/classification_report.py#L156-L213 | train | Draws the classification report across each axis. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
DistrictDataLabs/yellowbrick | yellowbrick/classifier/classification_report.py | ClassificationReport.finalize | 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 of the classifiation report
... | python | 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 of the classifiation report
... | [
"def",
"finalize",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the title of the classifiation report",
"self",
".",
"set_title",
"(",
"'{} Classification Report'",
".",
"format",
"(",
"self",
".",
"name",
")",
")",
"# Set the tick marks appropriately",
"s... | Finalize executes any subclass-specific axes finalization steps.
The user calls poof and poof calls finalize.
Parameters
----------
kwargs: generic keyword arguments. | [
"Finalize",
"executes",
"any",
"subclass",
"-",
"specific",
"axes",
"finalization",
"steps",
".",
"The",
"user",
"calls",
"poof",
"and",
"poof",
"calls",
"finalize",
"."
] | 59b67236a3862c73363e8edad7cd86da5b69e3b2 | https://github.com/DistrictDataLabs/yellowbrick/blob/59b67236a3862c73363e8edad7cd86da5b69e3b2/yellowbrick/classifier/classification_report.py#L215-L235 | train | Finalize executes any subclass - specific axes finalization steps. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/protocol.py | _deprecated_getitem_method | def _deprecated_getitem_method(name, attrs):
"""Create a deprecated ``__getitem__`` method that tells users to use
getattr instead.
Parameters
----------
name : str
The name of the object in the warning message.
attrs : iterable[str]
The set of allowed attributes.
Returns
... | python | def _deprecated_getitem_method(name, attrs):
"""Create a deprecated ``__getitem__`` method that tells users to use
getattr instead.
Parameters
----------
name : str
The name of the object in the warning message.
attrs : iterable[str]
The set of allowed attributes.
Returns
... | [
"def",
"_deprecated_getitem_method",
"(",
"name",
",",
"attrs",
")",
":",
"attrs",
"=",
"frozenset",
"(",
"attrs",
")",
"msg",
"=",
"(",
"\"'{name}[{attr!r}]' is deprecated, please use\"",
"\" '{name}.{attr}' instead\"",
")",
"def",
"__getitem__",
"(",
"self",
",",
... | Create a deprecated ``__getitem__`` method that tells users to use
getattr instead.
Parameters
----------
name : str
The name of the object in the warning message.
attrs : iterable[str]
The set of allowed attributes.
Returns
-------
__getitem__ : callable[any, str]
... | [
"Create",
"a",
"deprecated",
"__getitem__",
"method",
"that",
"tells",
"users",
"to",
"use",
"getattr",
"instead",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/protocol.py#L85-L115 | train | Create a deprecated __getitem__ method that tells users to use the getattr method instead. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/backend/alpaca.py | skip_http_error | def skip_http_error(statuses):
'''
A decorator to wrap with try..except to swallow
specific HTTP errors.
@skip_http_error((404, 503))
def fetch():
...
'''
assert isinstance(statuses, tuple)
def decorator(func):
def wrapper(*args, **kwargs):
try:
... | python | def skip_http_error(statuses):
'''
A decorator to wrap with try..except to swallow
specific HTTP errors.
@skip_http_error((404, 503))
def fetch():
...
'''
assert isinstance(statuses, tuple)
def decorator(func):
def wrapper(*args, **kwargs):
try:
... | [
"def",
"skip_http_error",
"(",
"statuses",
")",
":",
"assert",
"isinstance",
"(",
"statuses",
",",
"tuple",
")",
"def",
"decorator",
"(",
"func",
")",
":",
"def",
"wrapper",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"return",
"... | A decorator to wrap with try..except to swallow
specific HTTP errors.
@skip_http_error((404, 503))
def fetch():
... | [
"A",
"decorator",
"to",
"wrap",
"with",
"try",
"..",
"except",
"to",
"swallow",
"specific",
"HTTP",
"errors",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/backend/alpaca.py#L66-L89 | train | A decorator to wrap with try.. except to swallow HTTP errors. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/backend/alpaca.py | Backend._symbols2assets | def _symbols2assets(self, symbols):
'''
Utility for debug/testing
'''
assets = {a.symbol: a for a in self.get_equities()}
return [assets[symbol] for symbol in symbols if symbol in assets] | python | def _symbols2assets(self, symbols):
'''
Utility for debug/testing
'''
assets = {a.symbol: a for a in self.get_equities()}
return [assets[symbol] for symbol in symbols if symbol in assets] | [
"def",
"_symbols2assets",
"(",
"self",
",",
"symbols",
")",
":",
"assets",
"=",
"{",
"a",
".",
"symbol",
":",
"a",
"for",
"a",
"in",
"self",
".",
"get_equities",
"(",
")",
"}",
"return",
"[",
"assets",
"[",
"symbol",
"]",
"for",
"symbol",
"in",
"sy... | Utility for debug/testing | [
"Utility",
"for",
"debug",
"/",
"testing"
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/backend/alpaca.py#L161-L167 | train | Utility for debug and testing
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/backend/alpaca.py | Backend.get_bars | def get_bars(self, assets, data_frequency, bar_count=500):
'''
Interface method.
Return: pd.Dataframe() with columns MultiIndex [asset -> OHLCV]
'''
assets_is_scalar = not isinstance(assets, (list, set, tuple))
is_daily = 'd' in data_frequency # 'daily' or '1d'
... | python | def get_bars(self, assets, data_frequency, bar_count=500):
'''
Interface method.
Return: pd.Dataframe() with columns MultiIndex [asset -> OHLCV]
'''
assets_is_scalar = not isinstance(assets, (list, set, tuple))
is_daily = 'd' in data_frequency # 'daily' or '1d'
... | [
"def",
"get_bars",
"(",
"self",
",",
"assets",
",",
"data_frequency",
",",
"bar_count",
"=",
"500",
")",
":",
"assets_is_scalar",
"=",
"not",
"isinstance",
"(",
"assets",
",",
"(",
"list",
",",
"set",
",",
"tuple",
")",
")",
"is_daily",
"=",
"'d'",
"in... | Interface method.
Return: pd.Dataframe() with columns MultiIndex [asset -> OHLCV] | [
"Interface",
"method",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/backend/alpaca.py#L474-L527 | train | Interface method. get_bars Return a DataFrame with columns MultiIndex open high low and volume for each asset. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/backend/alpaca.py | Backend._symbol_bars | def _symbol_bars(
self,
symbols,
size,
_from=None,
to=None,
limit=None):
'''
Query historic_agg either minute or day in parallel
for multiple symbols, and return in dict.
symbols: list[str]
size: str ('da... | python | def _symbol_bars(
self,
symbols,
size,
_from=None,
to=None,
limit=None):
'''
Query historic_agg either minute or day in parallel
for multiple symbols, and return in dict.
symbols: list[str]
size: str ('da... | [
"def",
"_symbol_bars",
"(",
"self",
",",
"symbols",
",",
"size",
",",
"_from",
"=",
"None",
",",
"to",
"=",
"None",
",",
"limit",
"=",
"None",
")",
":",
"assert",
"size",
"in",
"(",
"'day'",
",",
"'minute'",
")",
"# temp workaround for less bars after mask... | Query historic_agg either minute or day in parallel
for multiple symbols, and return in dict.
symbols: list[str]
size: str ('day', 'minute')
_from: str or pd.Timestamp
to: str or pd.Timestamp
limit: str or int
return: dict[str -> pd.DataFrame] | [
"Query",
"historic_agg",
"either",
"minute",
"or",
"day",
"in",
"parallel",
"for",
"multiple",
"symbols",
"and",
"return",
"in",
"dict",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/backend/alpaca.py#L529-L576 | train | Query historic_agg for multiple symbols and return in dict. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/backend/alpaca.py | Backend._symbol_trades | def _symbol_trades(self, symbols):
'''
Query last_trade in parallel for multiple symbols and
return in dict.
symbols: list[str]
return: dict[str -> polygon.Trade]
'''
@skip_http_error((404, 504))
def fetch(symbol):
return self._api.polygon.l... | python | def _symbol_trades(self, symbols):
'''
Query last_trade in parallel for multiple symbols and
return in dict.
symbols: list[str]
return: dict[str -> polygon.Trade]
'''
@skip_http_error((404, 504))
def fetch(symbol):
return self._api.polygon.l... | [
"def",
"_symbol_trades",
"(",
"self",
",",
"symbols",
")",
":",
"@",
"skip_http_error",
"(",
"(",
"404",
",",
"504",
")",
")",
"def",
"fetch",
"(",
"symbol",
")",
":",
"return",
"self",
".",
"_api",
".",
"polygon",
".",
"last_trade",
"(",
"symbol",
"... | Query last_trade in parallel for multiple symbols and
return in dict.
symbols: list[str]
return: dict[str -> polygon.Trade] | [
"Query",
"last_trade",
"in",
"parallel",
"for",
"multiple",
"symbols",
"and",
"return",
"in",
"dict",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/backend/alpaca.py#L578-L592 | train | Query last_trade in parallel for multiple symbols and
return in dict.
symbols is a list of symbols | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/algorithm.py | Algorithm.record | def record(self, *args, **kwargs):
"""Track and record values each day.
Parameters
----------
**kwargs
The names and values to record.
Notes
-----
These values will appear in the performance packets and the performance
dataframe passed to ``a... | python | def record(self, *args, **kwargs):
"""Track and record values each day.
Parameters
----------
**kwargs
The names and values to record.
Notes
-----
These values will appear in the performance packets and the performance
dataframe passed to ``a... | [
"def",
"record",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Make 2 objects both referencing the same iterator",
"args",
"=",
"[",
"iter",
"(",
"args",
")",
"]",
"*",
"2",
"# Zip generates list entries by calling `next` on each iterator it",
... | Track and record values each day.
Parameters
----------
**kwargs
The names and values to record.
Notes
-----
These values will appear in the performance packets and the performance
dataframe passed to ``analyze`` and returned from
:func:`~zip... | [
"Track",
"and",
"record",
"values",
"each",
"day",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/algorithm.py#L395-L418 | train | Track and record values each day. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/algorithm.py | Algorithm.symbols | def symbols(self, *args, **kwargs):
'''Lookup equities by symbol.
Parameters:
args (iterable[str]): List of ticker symbols for the asset.
Returns:
equities (List[Equity]): The equity lookuped by the ``symbol``.
Raises:
AssetNotFound: When could not ... | python | def symbols(self, *args, **kwargs):
'''Lookup equities by symbol.
Parameters:
args (iterable[str]): List of ticker symbols for the asset.
Returns:
equities (List[Equity]): The equity lookuped by the ``symbol``.
Raises:
AssetNotFound: When could not ... | [
"def",
"symbols",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"return",
"[",
"self",
".",
"symbol",
"(",
"idendifier",
",",
"*",
"*",
"kwargs",
")",
"for",
"idendifier",
"in",
"args",
"]"
] | Lookup equities by symbol.
Parameters:
args (iterable[str]): List of ticker symbols for the asset.
Returns:
equities (List[Equity]): The equity lookuped by the ``symbol``.
Raises:
AssetNotFound: When could not resolve the ``Asset`` by ``symbol``. | [
"Lookup",
"equities",
"by",
"symbol",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/algorithm.py#L446-L458 | train | Lookup equities by symbol. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/algorithm.py | Algorithm.get_all_orders | def get_all_orders(
self,
asset=None,
before=None,
status='all',
days_back=None):
'''
If asset is unspecified or None, returns a dictionary keyed by
asset ID. The dictionary contains a list of orders for each ID,
oldest first. I... | python | def get_all_orders(
self,
asset=None,
before=None,
status='all',
days_back=None):
'''
If asset is unspecified or None, returns a dictionary keyed by
asset ID. The dictionary contains a list of orders for each ID,
oldest first. I... | [
"def",
"get_all_orders",
"(",
"self",
",",
"asset",
"=",
"None",
",",
"before",
"=",
"None",
",",
"status",
"=",
"'all'",
",",
"days_back",
"=",
"None",
")",
":",
"orders",
"=",
"self",
".",
"_backend",
".",
"all_orders",
"(",
"before",
",",
"status",
... | If asset is unspecified or None, returns a dictionary keyed by
asset ID. The dictionary contains a list of orders for each ID,
oldest first. If an asset is specified, returns a list of open
orders for that asset, oldest first. Orders submitted after
before will not be returned. If provid... | [
"If",
"asset",
"is",
"unspecified",
"or",
"None",
"returns",
"a",
"dictionary",
"keyed",
"by",
"asset",
"ID",
".",
"The",
"dictionary",
"contains",
"a",
"list",
"of",
"orders",
"for",
"each",
"ID",
"oldest",
"first",
".",
"If",
"an",
"asset",
"is",
"spec... | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/algorithm.py#L653-L682 | train | Returns a dictionary keyed by asset ID and list of orders for each ID. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/algorithm.py | Algorithm.history | def history(self, bar_count, frequency, field, ffill=True):
"""DEPRECATED: use ``data.history`` instead.
"""
return self.get_history_window(
bar_count,
frequency,
self._calculate_universe(),
field,
ffill,
) | python | def history(self, bar_count, frequency, field, ffill=True):
"""DEPRECATED: use ``data.history`` instead.
"""
return self.get_history_window(
bar_count,
frequency,
self._calculate_universe(),
field,
ffill,
) | [
"def",
"history",
"(",
"self",
",",
"bar_count",
",",
"frequency",
",",
"field",
",",
"ffill",
"=",
"True",
")",
":",
"return",
"self",
".",
"get_history_window",
"(",
"bar_count",
",",
"frequency",
",",
"self",
".",
"_calculate_universe",
"(",
")",
",",
... | DEPRECATED: use ``data.history`` instead. | [
"DEPRECATED",
":",
"use",
"data",
".",
"history",
"instead",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/algorithm.py#L697-L707 | train | Get the history window of a specific frequency and field. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/algorithm.py | Algorithm._calculate_order_value_amount | def _calculate_order_value_amount(self, asset, value):
"""
Calculates how many shares/contracts to order based on the type of
asset being ordered.
"""
if not self.executor.current_data.can_trade(asset):
raise CannotOrderDelistedAsset(
msg="Cannot order... | python | def _calculate_order_value_amount(self, asset, value):
"""
Calculates how many shares/contracts to order based on the type of
asset being ordered.
"""
if not self.executor.current_data.can_trade(asset):
raise CannotOrderDelistedAsset(
msg="Cannot order... | [
"def",
"_calculate_order_value_amount",
"(",
"self",
",",
"asset",
",",
"value",
")",
":",
"if",
"not",
"self",
".",
"executor",
".",
"current_data",
".",
"can_trade",
"(",
"asset",
")",
":",
"raise",
"CannotOrderDelistedAsset",
"(",
"msg",
"=",
"\"Cannot orde... | Calculates how many shares/contracts to order based on the type of
asset being ordered. | [
"Calculates",
"how",
"many",
"shares",
"/",
"contracts",
"to",
"order",
"based",
"on",
"the",
"type",
"of",
"asset",
"being",
"ordered",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/algorithm.py#L814-L842 | train | Calculates how many shares and contracts to order based on the type of asset being ordered. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/algorithm.py | Algorithm.set_do_not_order_list | def set_do_not_order_list(self, restricted_list, on_error='fail'):
"""Set a restriction on which assets can be ordered.
Parameters
----------
restricted_list : container[Asset], SecurityList
The assets that cannot be ordered.
"""
if isinstance(restricted_list... | python | def set_do_not_order_list(self, restricted_list, on_error='fail'):
"""Set a restriction on which assets can be ordered.
Parameters
----------
restricted_list : container[Asset], SecurityList
The assets that cannot be ordered.
"""
if isinstance(restricted_list... | [
"def",
"set_do_not_order_list",
"(",
"self",
",",
"restricted_list",
",",
"on_error",
"=",
"'fail'",
")",
":",
"if",
"isinstance",
"(",
"restricted_list",
",",
"SecurityList",
")",
":",
"warnings",
".",
"warn",
"(",
"\"`set_do_not_order_list(security_lists.leveraged_e... | Set a restriction on which assets can be ordered.
Parameters
----------
restricted_list : container[Asset], SecurityList
The assets that cannot be ordered. | [
"Set",
"a",
"restriction",
"on",
"which",
"assets",
"can",
"be",
"ordered",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/algorithm.py#L1000-L1029 | train | Set a restriction on which assets can be ordered. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/loader.py | translate | def translate(script):
'''translate zipline script into pylivetrader script.
'''
tree = ast.parse(script)
ZiplineImportVisitor().visit(tree)
return astor.to_source(tree) | python | def translate(script):
'''translate zipline script into pylivetrader script.
'''
tree = ast.parse(script)
ZiplineImportVisitor().visit(tree)
return astor.to_source(tree) | [
"def",
"translate",
"(",
"script",
")",
":",
"tree",
"=",
"ast",
".",
"parse",
"(",
"script",
")",
"ZiplineImportVisitor",
"(",
")",
".",
"visit",
"(",
"tree",
")",
"return",
"astor",
".",
"to_source",
"(",
"tree",
")"
] | translate zipline script into pylivetrader script. | [
"translate",
"zipline",
"script",
"into",
"pylivetrader",
"script",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/loader.py#L72-L79 | train | translate zipline script into pylivetrader script.
| Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/misc/events.py | make_eventrule | def make_eventrule(date_rule, time_rule, cal, half_days=True):
"""
Constructs an event rule from the factory api.
"""
# Insert the calendar in to the individual rules
date_rule.cal = cal
time_rule.cal = cal
if half_days:
inner_rule = date_rule & time_rule
else:
nhd_rule... | python | def make_eventrule(date_rule, time_rule, cal, half_days=True):
"""
Constructs an event rule from the factory api.
"""
# Insert the calendar in to the individual rules
date_rule.cal = cal
time_rule.cal = cal
if half_days:
inner_rule = date_rule & time_rule
else:
nhd_rule... | [
"def",
"make_eventrule",
"(",
"date_rule",
",",
"time_rule",
",",
"cal",
",",
"half_days",
"=",
"True",
")",
":",
"# Insert the calendar in to the individual rules",
"date_rule",
".",
"cal",
"=",
"cal",
"time_rule",
".",
"cal",
"=",
"cal",
"if",
"half_days",
":"... | Constructs an event rule from the factory api. | [
"Constructs",
"an",
"event",
"rule",
"from",
"the",
"factory",
"api",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/misc/events.py#L625-L641 | train | Creates an event rule from the factory api. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | examples/graham-fundamentals/GrahamFundamentals.py | build_sector_fundamentals | def build_sector_fundamentals(sector):
'''
In this method, for the given sector, we'll get the data we need for each stock
in the sector from IEX. Once we have the data, we'll check that the earnings
reports meet our criteria with `eps_good()`. We'll put stocks that meet those
requirements into a da... | python | def build_sector_fundamentals(sector):
'''
In this method, for the given sector, we'll get the data we need for each stock
in the sector from IEX. Once we have the data, we'll check that the earnings
reports meet our criteria with `eps_good()`. We'll put stocks that meet those
requirements into a da... | [
"def",
"build_sector_fundamentals",
"(",
"sector",
")",
":",
"stocks",
"=",
"get_sector",
"(",
"sector",
")",
"if",
"len",
"(",
"stocks",
")",
"==",
"0",
":",
"raise",
"ValueError",
"(",
"\"Invalid sector name: {}\"",
".",
"format",
"(",
"sector",
")",
")",
... | In this method, for the given sector, we'll get the data we need for each stock
in the sector from IEX. Once we have the data, we'll check that the earnings
reports meet our criteria with `eps_good()`. We'll put stocks that meet those
requirements into a dataframe along with all the data about them we'll ne... | [
"In",
"this",
"method",
"for",
"the",
"given",
"sector",
"we",
"ll",
"get",
"the",
"data",
"we",
"need",
"for",
"each",
"stock",
"in",
"the",
"sector",
"from",
"IEX",
".",
"Once",
"we",
"have",
"the",
"data",
"we",
"ll",
"check",
"that",
"the",
"earn... | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/examples/graham-fundamentals/GrahamFundamentals.py#L146-L202 | train | This method builds a dictionary of all the fundamentals for a given sector. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | examples/q01/algo.py | make_pipeline | def make_pipeline(context):
"""
Create our pipeline.
"""
# Filter for primary share equities. IsPrimaryShare is a built-in filter.
primary_share = IsPrimaryShare()
# Not when-issued equities.
not_wi = ~IEXCompany.symbol.latest.endswith('.WI')
# Equities without LP in their name, .matc... | python | def make_pipeline(context):
"""
Create our pipeline.
"""
# Filter for primary share equities. IsPrimaryShare is a built-in filter.
primary_share = IsPrimaryShare()
# Not when-issued equities.
not_wi = ~IEXCompany.symbol.latest.endswith('.WI')
# Equities without LP in their name, .matc... | [
"def",
"make_pipeline",
"(",
"context",
")",
":",
"# Filter for primary share equities. IsPrimaryShare is a built-in filter.",
"primary_share",
"=",
"IsPrimaryShare",
"(",
")",
"# Not when-issued equities.",
"not_wi",
"=",
"~",
"IEXCompany",
".",
"symbol",
".",
"latest",
".... | Create our pipeline. | [
"Create",
"our",
"pipeline",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/examples/q01/algo.py#L82-L158 | train | Create our pipeline for the current context. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | examples/q01/algo.py | my_record_vars | def my_record_vars(context, data):
"""
Record variables at the end of each day.
"""
# Record our variables.
record(leverage=context.account.leverage)
record(positions=len(context.portfolio.positions))
if 0 < len(context.age):
MaxAge = context.age[max(
list(context.age.ke... | python | def my_record_vars(context, data):
"""
Record variables at the end of each day.
"""
# Record our variables.
record(leverage=context.account.leverage)
record(positions=len(context.portfolio.positions))
if 0 < len(context.age):
MaxAge = context.age[max(
list(context.age.ke... | [
"def",
"my_record_vars",
"(",
"context",
",",
"data",
")",
":",
"# Record our variables.",
"record",
"(",
"leverage",
"=",
"context",
".",
"account",
".",
"leverage",
")",
"record",
"(",
"positions",
"=",
"len",
"(",
"context",
".",
"portfolio",
".",
"positi... | Record variables at the end of each day. | [
"Record",
"variables",
"at",
"the",
"end",
"of",
"each",
"day",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/examples/q01/algo.py#L291-L304 | train | Record variables at the end of each day. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/assets/finder.py | AssetFinder.retrieve_all | def retrieve_all(self, sids, default_none=False):
"""
Retrieve all assets in `sids`.
Parameters
----------
sids : iterable of string
Assets to retrieve.
default_none : bool
If True, return None for failed lookups.
If False, raise `Sids... | python | def retrieve_all(self, sids, default_none=False):
"""
Retrieve all assets in `sids`.
Parameters
----------
sids : iterable of string
Assets to retrieve.
default_none : bool
If True, return None for failed lookups.
If False, raise `Sids... | [
"def",
"retrieve_all",
"(",
"self",
",",
"sids",
",",
"default_none",
"=",
"False",
")",
":",
"failures",
"=",
"set",
"(",
")",
"hits",
"=",
"{",
"}",
"for",
"sid",
"in",
"sids",
":",
"try",
":",
"hits",
"[",
"sid",
"]",
"=",
"self",
".",
"_asset... | Retrieve all assets in `sids`.
Parameters
----------
sids : iterable of string
Assets to retrieve.
default_none : bool
If True, return None for failed lookups.
If False, raise `SidsNotFound`.
Returns
-------
assets : list[Asse... | [
"Retrieve",
"all",
"assets",
"in",
"sids",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/assets/finder.py#L57-L95 | train | Retrieve all assets in sids. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/assets/finder.py | AssetFinder.retrieve_asset | def retrieve_asset(self, sid, default_none=False):
"""
Retrieve the Asset for a given sid.
"""
try:
asset = self._asset_cache[sid]
if asset is None and not default_none:
raise SidsNotFound(sids=[sid])
return asset
except KeyErro... | python | def retrieve_asset(self, sid, default_none=False):
"""
Retrieve the Asset for a given sid.
"""
try:
asset = self._asset_cache[sid]
if asset is None and not default_none:
raise SidsNotFound(sids=[sid])
return asset
except KeyErro... | [
"def",
"retrieve_asset",
"(",
"self",
",",
"sid",
",",
"default_none",
"=",
"False",
")",
":",
"try",
":",
"asset",
"=",
"self",
".",
"_asset_cache",
"[",
"sid",
"]",
"if",
"asset",
"is",
"None",
"and",
"not",
"default_none",
":",
"raise",
"SidsNotFound"... | Retrieve the Asset for a given sid. | [
"Retrieve",
"the",
"Asset",
"for",
"a",
"given",
"sid",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/assets/finder.py#L97-L107 | train | Retrieve the Asset for a given sid. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/assets/finder.py | AssetFinder.retrieve_equities | def retrieve_equities(self, sids):
"""
Retrieve Equity objects for a list of sids.
Users generally shouldn't need to this method (instead, they should
prefer the more general/friendly `retrieve_assets`), but it has a
documented interface and tests because it's used upstream.
... | python | def retrieve_equities(self, sids):
"""
Retrieve Equity objects for a list of sids.
Users generally shouldn't need to this method (instead, they should
prefer the more general/friendly `retrieve_assets`), but it has a
documented interface and tests because it's used upstream.
... | [
"def",
"retrieve_equities",
"(",
"self",
",",
"sids",
")",
":",
"cache",
"=",
"self",
".",
"_asset_cache",
"try",
":",
"return",
"{",
"k",
":",
"cache",
"[",
"k",
"]",
"for",
"k",
"in",
"sids",
"}",
"except",
"KeyError",
":",
"raise",
"EquitiesNotFound... | Retrieve Equity objects for a list of sids.
Users generally shouldn't need to this method (instead, they should
prefer the more general/friendly `retrieve_assets`), but it has a
documented interface and tests because it's used upstream.
Parameters
----------
sids : iter... | [
"Retrieve",
"Equity",
"objects",
"for",
"a",
"list",
"of",
"sids",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/assets/finder.py#L109-L138 | train | Retrieve Equity objects for a list of sids. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/finance/execution.py | asymmetric_round_price_to_penny | def asymmetric_round_price_to_penny(price, prefer_round_down,
diff=(0.0095 - .005)):
"""
Asymmetric rounding function for adjusting prices to two places in a way
that "improves" the price. For limit prices, this means preferring to
round down on buys and preferring t... | python | def asymmetric_round_price_to_penny(price, prefer_round_down,
diff=(0.0095 - .005)):
"""
Asymmetric rounding function for adjusting prices to two places in a way
that "improves" the price. For limit prices, this means preferring to
round down on buys and preferring t... | [
"def",
"asymmetric_round_price_to_penny",
"(",
"price",
",",
"prefer_round_down",
",",
"diff",
"=",
"(",
"0.0095",
"-",
".005",
")",
")",
":",
"# Subtracting an epsilon from diff to enforce the open-ness of the upper",
"# bound on buys and the lower bound on sells. Using the actua... | Asymmetric rounding function for adjusting prices to two places in a way
that "improves" the price. For limit prices, this means preferring to
round down on buys and preferring to round up on sells. For stop prices,
it means the reverse.
If prefer_round_down == True:
When .05 below to .95 abo... | [
"Asymmetric",
"rounding",
"function",
"for",
"adjusting",
"prices",
"to",
"two",
"places",
"in",
"a",
"way",
"that",
"improves",
"the",
"price",
".",
"For",
"limit",
"prices",
"this",
"means",
"preferring",
"to",
"round",
"down",
"on",
"buys",
"and",
"prefer... | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/finance/execution.py#L147-L174 | train | Asymmetric rounding function for adjusting prices to two places in a way
that improves the price. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/data/bardata.py | BarData.can_trade | def can_trade(self, assets):
"""
For the given asset or iterable of assets, returns true if all of the
following are true:
1) the asset is alive for the session of the current simulation time
(if current simulation time is not a market minute, we use the next
session)... | python | def can_trade(self, assets):
"""
For the given asset or iterable of assets, returns true if all of the
following are true:
1) the asset is alive for the session of the current simulation time
(if current simulation time is not a market minute, we use the next
session)... | [
"def",
"can_trade",
"(",
"self",
",",
"assets",
")",
":",
"dt",
"=",
"self",
".",
"datetime",
"if",
"self",
".",
"_adjust_minutes",
":",
"adjusted_dt",
"=",
"self",
".",
"_get_current_minute",
"(",
")",
"else",
":",
"adjusted_dt",
"=",
"dt",
"data_portal",... | For the given asset or iterable of assets, returns true if all of the
following are true:
1) the asset is alive for the session of the current simulation time
(if current simulation time is not a market minute, we use the next
session)
2) (if we are in minute mode) the asset'... | [
"For",
"the",
"given",
"asset",
"or",
"iterable",
"of",
"assets",
"returns",
"true",
"if",
"all",
"of",
"the",
"following",
"are",
"true",
":",
"1",
")",
"the",
"asset",
"is",
"alive",
"for",
"the",
"session",
"of",
"the",
"current",
"simulation",
"time"... | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/data/bardata.py#L180-L231 | train | Returns True if the asset s exchange calendar can be tradeed at the current simulation time. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/data/bardata.py | BarData.is_stale | def is_stale(self, assets):
"""
For the given asset or iterable of assets, returns true if the asset
is alive and there is no trade data for the current simulation time.
If the asset has never traded, returns False.
If the current simulation time is not a valid market time, we ... | python | def is_stale(self, assets):
"""
For the given asset or iterable of assets, returns true if the asset
is alive and there is no trade data for the current simulation time.
If the asset has never traded, returns False.
If the current simulation time is not a valid market time, we ... | [
"def",
"is_stale",
"(",
"self",
",",
"assets",
")",
":",
"dt",
"=",
"self",
".",
"datetime",
"if",
"self",
".",
"_adjust_minutes",
":",
"adjusted_dt",
"=",
"self",
".",
"_get_current_minute",
"(",
")",
"else",
":",
"adjusted_dt",
"=",
"dt",
"data_portal",
... | For the given asset or iterable of assets, returns true if the asset
is alive and there is no trade data for the current simulation time.
If the asset has never traded, returns False.
If the current simulation time is not a valid market time, we use the
current time to check if the ass... | [
"For",
"the",
"given",
"asset",
"or",
"iterable",
"of",
"assets",
"returns",
"true",
"if",
"the",
"asset",
"is",
"alive",
"and",
"there",
"is",
"no",
"trade",
"data",
"for",
"the",
"current",
"simulation",
"time",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/data/bardata.py#L269-L306 | train | Returns True if the asset is alive and there is no trade data for the current simulation time. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/data/bardata.py | BarData._get_current_minute | def _get_current_minute(self):
"""
Internal utility method to get the current simulation time.
Possible answers are:
- whatever the algorithm's get_datetime() method returns (this is what
`self.simulation_dt_func()` points to)
- sometimes we're knowingly not in a mar... | python | def _get_current_minute(self):
"""
Internal utility method to get the current simulation time.
Possible answers are:
- whatever the algorithm's get_datetime() method returns (this is what
`self.simulation_dt_func()` points to)
- sometimes we're knowingly not in a mar... | [
"def",
"_get_current_minute",
"(",
"self",
")",
":",
"dt",
"=",
"self",
".",
"datetime",
"if",
"self",
".",
"_adjust_minutes",
":",
"dt",
"=",
"self",
".",
"data_portal",
".",
"trading_calendar",
".",
"previous_minute",
"(",
"dt",
")",
"if",
"self",
".",
... | Internal utility method to get the current simulation time.
Possible answers are:
- whatever the algorithm's get_datetime() method returns (this is what
`self.simulation_dt_func()` points to)
- sometimes we're knowingly not in a market minute, like if we're in
before_tra... | [
"Internal",
"utility",
"method",
"to",
"get",
"the",
"current",
"simulation",
"time",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/data/bardata.py#L333-L357 | train | Internal utility method to get the current simulation time. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | pylivetrader/misc/api_context.py | api_method | def api_method(f):
'''
Redirect pylivetrader.api.* operations to the algorithm
in the local context.
'''
@wraps(f)
def wrapped(*args, **kwargs):
# Get the instance and call the method
algorithm = get_context()
if algorithm is None:
raise RuntimeError(
... | python | def api_method(f):
'''
Redirect pylivetrader.api.* operations to the algorithm
in the local context.
'''
@wraps(f)
def wrapped(*args, **kwargs):
# Get the instance and call the method
algorithm = get_context()
if algorithm is None:
raise RuntimeError(
... | [
"def",
"api_method",
"(",
"f",
")",
":",
"@",
"wraps",
"(",
"f",
")",
"def",
"wrapped",
"(",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Get the instance and call the method",
"algorithm",
"=",
"get_context",
"(",
")",
"if",
"algorithm",
"is",
"No... | Redirect pylivetrader.api.* operations to the algorithm
in the local context. | [
"Redirect",
"pylivetrader",
".",
"api",
".",
"*",
"operations",
"to",
"the",
"algorithm",
"in",
"the",
"local",
"context",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/pylivetrader/misc/api_context.py#L48-L69 | train | Decorator for handling API methods. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
alpacahq/pylivetrader | examples/q01/original.py | make_pipeline | def make_pipeline(context):
"""
Create our pipeline.
"""
# Filter for primary share equities. IsPrimaryShare is a built-in filter.
primary_share = IsPrimaryShare()
# Equities listed as common stock (as opposed to, say, preferred stock).
# 'ST00000001' indicates common stock.
common_sto... | python | def make_pipeline(context):
"""
Create our pipeline.
"""
# Filter for primary share equities. IsPrimaryShare is a built-in filter.
primary_share = IsPrimaryShare()
# Equities listed as common stock (as opposed to, say, preferred stock).
# 'ST00000001' indicates common stock.
common_sto... | [
"def",
"make_pipeline",
"(",
"context",
")",
":",
"# Filter for primary share equities. IsPrimaryShare is a built-in filter.",
"primary_share",
"=",
"IsPrimaryShare",
"(",
")",
"# Equities listed as common stock (as opposed to, say, preferred stock).",
"# 'ST00000001' indicates common stoc... | Create our pipeline. | [
"Create",
"our",
"pipeline",
"."
] | fd328b6595428c0789d9f218df34623f83a02b8b | https://github.com/alpacahq/pylivetrader/blob/fd328b6595428c0789d9f218df34623f83a02b8b/examples/q01/original.py#L70-L168 | train | Create a new pipeline for the given context. | Pu7Z6IJCgH3a,vcEHXBQXuDuh,sHOWSIAKtU58,ZVWAAMjVVHHl,qRin5pdYOdbB,IySsVMyKT3tF,FwEHNICjJCy0,yISIa0MMKKfB,GAtvbI59wr0o,OmNM6rT0Sgul,gu1MSKhYvigU,S2TTo9DhhiSh,aaLV7ZjAfkcR,ker4pIJmdvxf,WaQEaQCVMQ03,xV97BFGi0hY9,YnM1HtHE4j7G,X5FyJb4ToTo6,jLmadlzMdunT,GGFwFLsDF9Fv,prtR0Uw1GMh5,oNamnshN4dFG,QZzQeAYvsoum,VHAt7CcYKC2T,cKsTbNGL... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.