repository stringclasses 11
values | repo_id stringlengths 1 3 | target_module_path stringlengths 16 72 | prompt stringlengths 407 21.7k | relavent_test_path stringlengths 51 97 | full_function stringlengths 2.6k 33.8k | function_name stringlengths 3 49 | context-complexity stringclasses 3
values |
|---|---|---|---|---|---|---|---|
seaborn | 6 | seaborn/_base.py | def iter_data(
self, grouping_vars=None, *,
reverse=False, from_comp_data=False,
by_facet=True, allow_empty=False, dropna=True,
):
"""Generator for getting subsets of data defined by semantic variables.
Also injects "col" and "row" into grouping semantics.
Param... | /usr/src/app/target_test_cases/failed_tests_VectorPlotter.iter_data.txt | def iter_data(
self, grouping_vars=None, *,
reverse=False, from_comp_data=False,
by_facet=True, allow_empty=False, dropna=True,
):
"""Generator for getting subsets of data defined by semantic variables.
Also injects "col" and "row" into grouping semantics.
Param... | VectorPlotter.iter_data | Self-Contained |
seaborn | 21 | seaborn/axisgrid.py | def add_legend(self, legend_data=None, title=None, label_order=None,
adjust_subtitles=False, **kwargs):
"""Draw a legend, maybe placing it outside axes and resizing the figure.
Parameters
----------
legend_data : dict
Dictionary mapping label names (or... | /usr/src/app/target_test_cases/failed_tests_axisgrid.Grid.add_legend.txt | def add_legend(self, legend_data=None, title=None, label_order=None,
adjust_subtitles=False, **kwargs):
"""Draw a legend, maybe placing it outside axes and resizing the figure.
Parameters
----------
legend_data : dict
Dictionary mapping label names (or... | axisgrid.Grid.add_legend | Repo-Level |
seaborn | 28 | seaborn/axisgrid.py | def __init__(
self, data, *, hue=None, vars=None, x_vars=None, y_vars=None,
hue_order=None, palette=None, hue_kws=None, corner=False, diag_sharey=True,
height=2.5, aspect=1, layout_pad=.5, despine=True, dropna=False,
):
"""Initialize the plot figure and PairGrid object.
... | /usr/src/app/target_test_cases/failed_tests_axisgrid.PairGrid.__init__.txt | def __init__(
self, data, *, hue=None, vars=None, x_vars=None, y_vars=None,
hue_order=None, palette=None, hue_kws=None, corner=False, diag_sharey=True,
height=2.5, aspect=1, layout_pad=.5, despine=True, dropna=False,
):
"""Initialize the plot figure and PairGrid object.
... | axisgrid.PairGrid.__init__ | Repo-Level |
seaborn | 29 | seaborn/axisgrid.py | def pairplot(
data, *,
hue=None, hue_order=None, palette=None,
vars=None, x_vars=None, y_vars=None,
kind="scatter", diag_kind="auto", markers=None,
height=2.5, aspect=1, corner=False, dropna=False,
plot_kws=None, diag_kws=None, grid_kws=None, size=None,
):
"""Plot pairwise relationships in a... | /usr/src/app/target_test_cases/failed_tests_axisgrid.pairplot.txt | def pairplot(
data, *,
hue=None, hue_order=None, palette=None,
vars=None, x_vars=None, y_vars=None,
kind="scatter", diag_kind="auto", markers=None,
height=2.5, aspect=1, corner=False, dropna=False,
plot_kws=None, diag_kws=None, grid_kws=None, size=None,
):
"""Plot pairwise relationships in a... | axisgrid.pairplot | Self-Contained |
seaborn | 33 | seaborn/palettes.py | def color_palette(palette=None, n_colors=None, desat=None, as_cmap=False):
"""Return a list of colors or continuous colormap defining a palette.
Possible ``palette`` values include:
- Name of a seaborn palette (deep, muted, bright, pastel, dark, colorblind)
- Name of matplotlib colormap
... | /usr/src/app/target_test_cases/failed_tests_color_palette.txt | def color_palette(palette=None, n_colors=None, desat=None, as_cmap=False):
"""Return a list of colors or continuous colormap defining a palette.
Possible ``palette`` values include:
- Name of a seaborn palette (deep, muted, bright, pastel, dark, colorblind)
- Name of matplotlib colormap
... | color_palette | Repo-Level |
seaborn | 71 | seaborn/utils.py | def despine(fig=None, ax=None, top=True, right=True, left=False,
bottom=False, offset=None, trim=False):
"""Remove the top and right spines from plot(s).
fig : matplotlib figure, optional
Figure to despine all axes of, defaults to the current figure.
ax : matplotlib axes, optional
... | /usr/src/app/target_test_cases/failed_tests_utils.despine.txt | def despine(fig=None, ax=None, top=True, right=True, left=False,
bottom=False, offset=None, trim=False):
"""Remove the top and right spines from plot(s).
fig : matplotlib figure, optional
Figure to despine all axes of, defaults to the current figure.
ax : matplotlib axes, optional
... | utils.despine | Self-Contained |
seaborn | 73 | seaborn/utils.py | def move_legend(obj, loc, **kwargs):
"""
Recreate a plot's legend at a new location.
The name is a slight misnomer. Matplotlib legends do not expose public
control over their position parameters. So this function creates a new legend,
copying over the data from the original object, which is then re... | /usr/src/app/target_test_cases/failed_tests_utils.move_legend.txt | def move_legend(obj, loc, **kwargs):
"""
Recreate a plot's legend at a new location.
The name is a slight misnomer. Matplotlib legends do not expose public
control over their position parameters. So this function creates a new legend,
copying over the data from the original object, which is then re... | utils.move_legend | Self-Contained |
scikit-learn | 0 | sklearn/linear_model/_bayes.py | def fit(self, X, y):
"""Fit the model according to the given training data and parameters.
Iterative procedure to maximize the evidence
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training vector, where `n_samples` is the number of samp... | /usr/src/app/target_test_cases/failed_tests_ARDRegression.fit.txt | def fit(self, X, y):
"""Fit the model according to the given training data and parameters.
Iterative procedure to maximize the evidence
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training vector, where `n_samples` is the number of samp... | ARDRegression.fit | Repo-Level |
scikit-learn | 9 | sklearn/linear_model/_bayes.py | def fit(self, X, y, sample_weight=None):
"""Fit the model.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
Training data.
y : ndarray of shape (n_samples,)
Target values. Will be cast to X's dtype if necessary.
sample_weigh... | /usr/src/app/target_test_cases/failed_tests_BayesianRidge.fit.txt | def fit(self, X, y, sample_weight=None):
"""Fit the model.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
Training data.
y : ndarray of shape (n_samples,)
Target values. Will be cast to X's dtype if necessary.
sample_weigh... | BayesianRidge.fit | Repo-Level |
scikit-learn | 14 | sklearn/cluster/_bisect_k_means.py | def fit(self, X, y=None, sample_weight=None):
"""Compute bisecting k-means clustering.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to cluster.
.. note:: The data will be converted to C ordering,
... | /usr/src/app/target_test_cases/failed_tests_BisectingKMeans.fit.txt | def fit(self, X, y=None, sample_weight=None):
"""Compute bisecting k-means clustering.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to cluster.
.. note:: The data will be converted to C ordering,
... | BisectingKMeans.fit | Repo-Level |
scikit-learn | 15 | sklearn/calibration.py | def fit(self, X, y, sample_weight=None, **fit_params):
"""Fit the calibrated model.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
sample_weight : arra... | /usr/src/app/target_test_cases/failed_tests_CalibratedClassifierCV.fit.txt | def fit(self, X, y, sample_weight=None, **fit_params):
"""Fit the calibrated model.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
sample_weight : arra... | CalibratedClassifierCV.fit | Repo-Level |
scikit-learn | 38 | sklearn/linear_model/_coordinate_descent.py | def fit(self, X, y, sample_weight=None, check_input=True):
"""Fit model with coordinate descent.
Parameters
----------
X : {ndarray, sparse matrix, sparse array} of (n_samples, n_features)
Data.
Note that large sparse matrices and arrays requiring `int64`
... | /usr/src/app/target_test_cases/failed_tests_ElasticNet.fit.txt | def fit(self, X, y, sample_weight=None, check_input=True):
"""Fit model with coordinate descent.
Parameters
----------
X : {ndarray, sparse matrix, sparse array} of (n_samples, n_features)
Data.
Note that large sparse matrices and arrays requiring `int64`
... | ElasticNet.fit | Repo-Level |
scikit-learn | 55 | sklearn/gaussian_process/_gpc.py | def log_marginal_likelihood(
self, theta=None, eval_gradient=False, clone_kernel=True
):
"""Return log-marginal likelihood of theta for training data.
In the case of multi-class classification, the mean log-marginal
likelihood of the one-versus-rest classifiers are returned.
... | /usr/src/app/target_test_cases/failed_tests_GaussianProcessClassifier.log_marginal_likelihood.txt | def log_marginal_likelihood(
self, theta=None, eval_gradient=False, clone_kernel=True
):
"""Return log-marginal likelihood of theta for training data.
In the case of multi-class classification, the mean log-marginal
likelihood of the one-versus-rest classifiers are returned.
... | GaussianProcessClassifier.log_marginal_likelihood | Repo-Level |
scikit-learn | 57 | sklearn/gaussian_process/_gpr.py | def fit(self, X, y):
"""Fit Gaussian process regression model.
Parameters
----------
X : array-like of shape (n_samples, n_features) or list of object
Feature vectors or other representations of training data.
y : array-like of shape (n_samples,) or (n_samples, ... | /usr/src/app/target_test_cases/failed_tests_GaussianProcessRegressor.fit.txt | def fit(self, X, y):
"""Fit Gaussian process regression model.
Parameters
----------
X : array-like of shape (n_samples, n_features) or list of object
Feature vectors or other representations of training data.
y : array-like of shape (n_samples,) or (n_samples, ... | GaussianProcessRegressor.fit | Repo-Level |
scikit-learn | 58 | sklearn/gaussian_process/_gpr.py | def log_marginal_likelihood(
self, theta=None, eval_gradient=False, clone_kernel=True
):
"""Return log-marginal likelihood of theta for training data.
Parameters
----------
theta : array-like of shape (n_kernel_params,) default=None
Kernel hyperparameters for... | /usr/src/app/target_test_cases/failed_tests_GaussianProcessRegressor.log_marginal_likelihood.txt | def log_marginal_likelihood(
self, theta=None, eval_gradient=False, clone_kernel=True
):
"""Return log-marginal likelihood of theta for training data.
Parameters
----------
theta : array-like of shape (n_kernel_params,) default=None
Kernel hyperparameters for... | GaussianProcessRegressor.log_marginal_likelihood | Self-Contained |
scikit-learn | 59 | sklearn/gaussian_process/_gpr.py | def predict(self, X, return_std=False, return_cov=False):
"""Predict using the Gaussian process regression model.
We can also predict based on an unfitted model by using the GP prior.
In addition to the mean of the predictive distribution, optionally also
returns its standard deviat... | /usr/src/app/target_test_cases/failed_tests_GaussianProcessRegressor.predict.txt | def predict(self, X, return_std=False, return_cov=False):
"""Predict using the Gaussian process regression model.
We can also predict based on an unfitted model by using the GP prior.
In addition to the mean of the predictive distribution, optionally also
returns its standard deviat... | GaussianProcessRegressor.predict | Repo-Level |
scikit-learn | 66 | sklearn/decomposition/_incremental_pca.py | def partial_fit(self, X, y=None, check_input=True):
"""Incremental fit with X. All of X is processed as a single batch.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples and
`n_feat... | /usr/src/app/target_test_cases/failed_tests_IncrementalPCA.partial_fit.txt | def partial_fit(self, X, y=None, check_input=True):
"""Incremental fit with X. All of X is processed as a single batch.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training data, where `n_samples` is the number of samples and
`n_feat... | IncrementalPCA.partial_fit | Repo-Level |
scikit-learn | 70 | sklearn/impute/_iterative.py | def fit_transform(self, X, y=None, **params):
"""Fit the imputer on `X` and return the transformed `X`.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Input data, where `n_samples` is the number of samples and
`n_features` is the number o... | /usr/src/app/target_test_cases/failed_tests_IterativeImputer.fit_transform.txt | def fit_transform(self, X, y=None, **params):
"""Fit the imputer on `X` and return the transformed `X`.
Parameters
----------
X : array-like, shape (n_samples, n_features)
Input data, where `n_samples` is the number of samples and
`n_features` is the number o... | IterativeImputer.fit_transform | Repo-Level |
scikit-learn | 72 | sklearn/preprocessing/_discretization.py | def fit(self, X, y=None, sample_weight=None):
"""
Fit the estimator.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Data to be discretized.
y : None
Ignored. This parameter exists only for compatibility with
... | /usr/src/app/target_test_cases/failed_tests_KBinsDiscretizer.fit.txt | def fit(self, X, y=None, sample_weight=None):
"""
Fit the estimator.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Data to be discretized.
y : None
Ignored. This parameter exists only for compatibility with
... | KBinsDiscretizer.fit | Repo-Level |
scikit-learn | 75 | sklearn/cluster/_kmeans.py | def fit(self, X, y=None, sample_weight=None):
"""Compute k-means clustering.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to cluster. It must be noted that the data
will be converted to C ordering, ... | /usr/src/app/target_test_cases/failed_tests_KMeans.fit.txt | def fit(self, X, y=None, sample_weight=None):
"""Compute k-means clustering.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to cluster. It must be noted that the data
will be converted to C ordering, ... | KMeans.fit | Repo-Level |
scikit-learn | 77 | sklearn/impute/_knn.py | def transform(self, X):
"""Impute all missing values in X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The input data to complete.
Returns
-------
X : array-like of shape (n_samples, n_output_features)
The im... | /usr/src/app/target_test_cases/failed_tests_KNNImputer.transform.txt | def transform(self, X):
"""Impute all missing values in X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The input data to complete.
Returns
-------
X : array-like of shape (n_samples, n_output_features)
The im... | KNNImputer.transform | Repo-Level |
scikit-learn | 99 | sklearn/linear_model/_linear_loss.py | def gradient_hessian(
self,
coef,
X,
y,
sample_weight=None,
l2_reg_strength=0.0,
n_threads=1,
gradient_out=None,
hessian_out=None,
raw_prediction=None,
):
"""Computes gradient and hessian w.r.t. coef.
Parameters
... | /usr/src/app/target_test_cases/failed_tests_LinearModelLoss.gradient_hessian.txt | def gradient_hessian(
self,
coef,
X,
y,
sample_weight=None,
l2_reg_strength=0.0,
n_threads=1,
gradient_out=None,
hessian_out=None,
raw_prediction=None,
):
"""Computes gradient and hessian w.r.t. coef.
Parameters
... | LinearModelLoss.gradient_hessian | File-Level |
scikit-learn | 100 | sklearn/linear_model/_linear_loss.py | def gradient_hessian_product(
self, coef, X, y, sample_weight=None, l2_reg_strength=0.0, n_threads=1
):
"""Computes gradient and hessp (hessian product function) w.r.t. coef.
Parameters
----------
coef : ndarray of shape (n_dof,), (n_classes, n_dof) or (n_classes * n_dof... | /usr/src/app/target_test_cases/failed_tests_LinearModelLoss.gradient_hessian_product.txt | def gradient_hessian_product(
self, coef, X, y, sample_weight=None, l2_reg_strength=0.0, n_threads=1
):
"""Computes gradient and hessp (hessian product function) w.r.t. coef.
Parameters
----------
coef : ndarray of shape (n_dof,), (n_classes, n_dof) or (n_classes * n_dof... | LinearModelLoss.gradient_hessian_product | File-Level |
scikit-learn | 103 | sklearn/linear_model/_base.py | def fit(self, X, y, sample_weight=None):
"""
Fit linear model.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,) or (n_samples, n_targets)
Target values.... | /usr/src/app/target_test_cases/failed_tests_LinearRegression.fit.txt | def fit(self, X, y, sample_weight=None):
"""
Fit linear model.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,) or (n_samples, n_targets)
Target values.... | LinearRegression.fit | Repo-Level |
scikit-learn | 114 | sklearn/cluster/_kmeans.py | def fit(self, X, y=None, sample_weight=None):
"""Compute the centroids on X by chunking it into mini-batches.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to cluster. It must be noted that the data
... | /usr/src/app/target_test_cases/failed_tests_MiniBatchKMeans.fit.txt | def fit(self, X, y=None, sample_weight=None):
"""Compute the centroids on X by chunking it into mini-batches.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to cluster. It must be noted that the data
... | MiniBatchKMeans.fit | Repo-Level |
scikit-learn | 115 | sklearn/cluster/_kmeans.py | def partial_fit(self, X, y=None, sample_weight=None):
"""Update k means estimate on a single mini-batch X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to cluster. It must be noted that the data
wil... | /usr/src/app/target_test_cases/failed_tests_MiniBatchKMeans.partial_fit.txt | def partial_fit(self, X, y=None, sample_weight=None):
"""Update k means estimate on a single mini-batch X.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training instances to cluster. It must be noted that the data
wil... | MiniBatchKMeans.partial_fit | Repo-Level |
scikit-learn | 120 | sklearn/linear_model/_coordinate_descent.py | def fit(self, X, y):
"""Fit MultiTaskElasticNet model with coordinate descent.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
Data.
y : ndarray of shape (n_samples, n_targets)
Target. Will be cast to X's dtype if necessary.
... | /usr/src/app/target_test_cases/failed_tests_MultiTaskElasticNet.fit.txt | def fit(self, X, y):
"""Fit MultiTaskElasticNet model with coordinate descent.
Parameters
----------
X : ndarray of shape (n_samples, n_features)
Data.
y : ndarray of shape (n_samples, n_targets)
Target. Will be cast to X's dtype if necessary.
... | MultiTaskElasticNet.fit | Repo-Level |
scikit-learn | 123 | sklearn/neighbors/_nca.py | def fit(self, X, y):
"""Fit the model according to the given training data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The training samples.
y : array-like of shape (n_samples,)
The corresponding training labels.
R... | /usr/src/app/target_test_cases/failed_tests_NeighborhoodComponentsAnalysis.fit.txt | def fit(self, X, y):
"""Fit the model according to the given training data.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The training samples.
y : array-like of shape (n_samples,)
The corresponding training labels.
R... | NeighborhoodComponentsAnalysis.fit | Repo-Level |
scikit-learn | 131 | sklearn/multiclass.py | def partial_fit(self, X, y, classes=None, **partial_fit_params):
"""Partially fit underlying estimators.
Should be used when memory is inefficient to train all data. Chunks
of data can be passed in several iteration, where the first call
should have an array of all target variables.... | /usr/src/app/target_test_cases/failed_tests_OneVsOneClassifier.partial_fit.txt | def partial_fit(self, X, y, classes=None, **partial_fit_params):
"""Partially fit underlying estimators.
Should be used when memory is inefficient to train all data. Chunks
of data can be passed in several iteration, where the first call
should have an array of all target variables.... | OneVsOneClassifier.partial_fit | Repo-Level |
scikit-learn | 133 | sklearn/multiclass.py | def partial_fit(self, X, y, classes=None, **partial_fit_params):
"""Partially fit underlying estimators.
Should be used when memory is inefficient to train all data.
Chunks of data can be passed in several iterations.
Parameters
----------
X : {array-like, sparse ma... | /usr/src/app/target_test_cases/failed_tests_OneVsRestClassifier.partial_fit.txt | def partial_fit(self, X, y, classes=None, **partial_fit_params):
"""Partially fit underlying estimators.
Should be used when memory is inefficient to train all data.
Chunks of data can be passed in several iterations.
Parameters
----------
X : {array-like, sparse ma... | OneVsRestClassifier.partial_fit | Repo-Level |
scikit-learn | 158 | sklearn/linear_model/_quantile.py | def fit(self, X, y, sample_weight=None):
"""Fit the model according to the given training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
... | /usr/src/app/target_test_cases/failed_tests_QuantileRegressor.fit.txt | def fit(self, X, y, sample_weight=None):
"""Fit the model according to the given training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
... | QuantileRegressor.fit | Repo-Level |
scikit-learn | 159 | sklearn/linear_model/_ransac.py | def fit(self, X, y, *, sample_weight=None, **fit_params):
"""Fit estimator using RANSAC algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,) or (n_samples, n_targets... | /usr/src/app/target_test_cases/failed_tests_RANSACRegressor.fit.txt | def fit(self, X, y, *, sample_weight=None, **fit_params):
"""Fit estimator using RANSAC algorithm.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,) or (n_samples, n_targets... | RANSACRegressor.fit | Repo-Level |
scikit-learn | 166 | sklearn/feature_selection/_rfe.py | def fit(self, X, y, *, groups=None, **params):
"""Fit the RFE model and automatically tune the number of selected features.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vector, where `n_samples` is the number of samples ... | /usr/src/app/target_test_cases/failed_tests_RFECV.fit.txt | def fit(self, X, y, *, groups=None, **params):
"""Fit the RFE model and automatically tune the number of selected features.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training vector, where `n_samples` is the number of samples ... | RFECV.fit | Repo-Level |
scikit-learn | 170 | sklearn/semi_supervised/_self_training.py | def fit(self, X, y, **params):
"""
Fit self-training classifier using `X`, `y` as training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Array representing the data.
y : {array-like, sparse matrix} of shape ... | /usr/src/app/target_test_cases/failed_tests_SelfTrainingClassifier.fit.txt | def fit(self, X, y, **params):
"""
Fit self-training classifier using `X`, `y` as training data.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Array representing the data.
y : {array-like, sparse matrix} of shape ... | SelfTrainingClassifier.fit | Repo-Level |
scikit-learn | 173 | sklearn/feature_selection/_sequential.py | def fit(self, X, y=None, **params):
"""Learn the features to select from X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of predictors.
... | /usr/src/app/target_test_cases/failed_tests_SequentialFeatureSelector.fit.txt | def fit(self, X, y=None, **params):
"""Learn the features to select from X.
Parameters
----------
X : array-like of shape (n_samples, n_features)
Training vectors, where `n_samples` is the number of samples and
`n_features` is the number of predictors.
... | SequentialFeatureSelector.fit | Repo-Level |
scikit-learn | 180 | sklearn/cluster/_spectral.py | def fit(self, X, y=None):
"""Perform spectral clustering from features, or affinity matrix.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features) or \
(n_samples, n_samples)
Training instances to cluster, similarities / af... | /usr/src/app/target_test_cases/failed_tests_SpectralClustering.fit.txt | def fit(self, X, y=None):
"""Perform spectral clustering from features, or affinity matrix.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features) or \
(n_samples, n_samples)
Training instances to cluster, similarities / af... | SpectralClustering.fit | Repo-Level |
scikit-learn | 181 | sklearn/preprocessing/_polynomial.py | def fit(self, X, y=None, sample_weight=None):
"""Compute knot positions of splines.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data.
y : None
Ignored.
sample_weight : array-like of shape (n_samples,), default =... | /usr/src/app/target_test_cases/failed_tests_SplineTransformer.fit.txt | def fit(self, X, y=None, sample_weight=None):
"""Compute knot positions of splines.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data.
y : None
Ignored.
sample_weight : array-like of shape (n_samples,), default =... | SplineTransformer.fit | Repo-Level |
scikit-learn | 182 | sklearn/preprocessing/_polynomial.py | def transform(self, X):
"""Transform each feature data to B-splines.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data to transform.
Returns
-------
XBS : {ndarray, sparse matrix} of shape (n_samples, n_features * n_s... | /usr/src/app/target_test_cases/failed_tests_SplineTransformer.transform.txt | def transform(self, X):
"""Transform each feature data to B-splines.
Parameters
----------
X : array-like of shape (n_samples, n_features)
The data to transform.
Returns
-------
XBS : {ndarray, sparse matrix} of shape (n_samples, n_features * n_s... | SplineTransformer.transform | Repo-Level |
scikit-learn | 204 | sklearn/linear_model/_glm/glm.py | def fit(self, X, y, sample_weight=None):
"""Fit a Generalized Linear Model.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
sample_weig... | /usr/src/app/target_test_cases/failed_tests__GeneralizedLinearRegressor.fit.txt | def fit(self, X, y, sample_weight=None):
"""Fit a Generalized Linear Model.
Parameters
----------
X : {array-like, sparse matrix} of shape (n_samples, n_features)
Training data.
y : array-like of shape (n_samples,)
Target values.
sample_weig... | _GeneralizedLinearRegressor.fit | Repo-Level |
scikit-learn | 210 | sklearn/metrics/_base.py | def _average_binary_score(binary_metric, y_true, y_score, average, sample_weight=None):
"""Average a binary metric for multilabel classification.
Parameters
----------
y_true : array, shape = [n_samples] or [n_samples, n_classes]
True binary labels in binary label indicators.
y_score : arr... | /usr/src/app/target_test_cases/failed_tests__average_binary_score.txt | def _average_binary_score(binary_metric, y_true, y_score, average, sample_weight=None):
"""Average a binary metric for multilabel classification.
Parameters
----------
y_true : array, shape = [n_samples] or [n_samples, n_classes]
True binary labels in binary label indicators.
y_score : arr... | _average_binary_score | Repo-Level |
scikit-learn | 218 | sklearn/utils/validation.py | def _check_psd_eigenvalues(lambdas, enable_warnings=False):
"""Check the eigenvalues of a positive semidefinite (PSD) matrix.
Checks the provided array of PSD matrix eigenvalues for numerical or
conditioning issues and returns a fixed validated version. This method
should typically be used if the PSD m... | /usr/src/app/target_test_cases/failed_tests__check_psd_eigenvalues.txt | def _check_psd_eigenvalues(lambdas, enable_warnings=False):
"""Check the eigenvalues of a positive semidefinite (PSD) matrix.
Checks the provided array of PSD matrix eigenvalues for numerical or
conditioning issues and returns a fixed validated version. This method
should typically be used if the PSD m... | _check_psd_eigenvalues | Self-Contained |
scikit-learn | 221 | sklearn/metrics/_classification.py | def _check_targets(y_true, y_pred):
"""Check that y_true and y_pred belong to the same classification task.
This converts multiclass or binary types to a common shape, and raises a
ValueError for a mix of multilabel and multiclass targets, a mix of
multilabel formats, for the presence of continuous-val... | /usr/src/app/target_test_cases/failed_tests__check_targets.txt | def _check_targets(y_true, y_pred):
"""Check that y_true and y_pred belong to the same classification task.
This converts multiclass or binary types to a common shape, and raises a
ValueError for a mix of multilabel and multiclass targets, a mix of
multilabel formats, for the presence of continuous-val... | _check_targets | Repo-Level |
scikit-learn | 224 | sklearn/utils/_testing.py | def _convert_container(
container,
constructor_name,
columns_name=None,
dtype=None,
minversion=None,
categorical_feature_names=None,
):
"""Convert a given container to a specific array-like with a dtype.
Parameters
----------
container : array-like
The container to conve... | /usr/src/app/target_test_cases/failed_tests__convert_container.txt | def _convert_container(
container,
constructor_name,
columns_name=None,
dtype=None,
minversion=None,
categorical_feature_names=None,
):
"""Convert a given container to a specific array-like with a dtype.
Parameters
----------
container : array-like
The container to conve... | _convert_container | Self-Contained |
scikit-learn | 234 | sklearn/model_selection/_validation.py | def _fit_and_score(
estimator,
X,
y,
*,
scorer,
train,
test,
verbose,
parameters,
fit_params,
score_params,
return_train_score=False,
return_parameters=False,
return_n_test_samples=False,
return_times=False,
return_estimator=False,
split_progress=None,... | /usr/src/app/target_test_cases/failed_tests__fit_and_score.txt | def _fit_and_score(
estimator,
X,
y,
*,
scorer,
train,
test,
verbose,
parameters,
fit_params,
score_params,
return_train_score=False,
return_parameters=False,
return_n_test_samples=False,
return_times=False,
return_estimator=False,
split_progress=None,... | _fit_and_score | Repo-Level |
scikit-learn | 236 | sklearn/utils/graph.py | def _fix_connected_components(
X,
graph,
n_connected_components,
component_labels,
mode="distance",
metric="euclidean",
**kwargs,
):
"""Add connections to sparse graph to connect unconnected components.
For each pair of unconnected components, compute all pairwise distances
from... | /usr/src/app/target_test_cases/failed_tests__fix_connected_components.txt | def _fix_connected_components(
X,
graph,
n_connected_components,
component_labels,
mode="distance",
metric="euclidean",
**kwargs,
):
"""Add connections to sparse graph to connect unconnected components.
For each pair of unconnected components, compute all pairwise distances
from... | _fix_connected_components | Repo-Level |
scikit-learn | 240 | sklearn/utils/_response.py | def _get_response_values(
estimator,
X,
response_method,
pos_label=None,
return_response_method_used=False,
):
"""Compute the response values of a classifier, an outlier detector, or a regressor.
The response values are predictions such that it follows the following shape:
- for binary... | /usr/src/app/target_test_cases/failed_tests__get_response_values.txt | def _get_response_values(
estimator,
X,
response_method,
pos_label=None,
return_response_method_used=False,
):
"""Compute the response values of a classifier, an outlier detector, or a regressor.
The response values are predictions such that it follows the following shape:
- for binary... | _get_response_values | Repo-Level |
scikit-learn | 242 | sklearn/manifold/_t_sne.py | def _gradient_descent(
objective,
p0,
it,
max_iter,
n_iter_check=1,
n_iter_without_progress=300,
momentum=0.8,
learning_rate=200.0,
min_gain=0.01,
min_grad_norm=1e-7,
verbose=0,
args=None,
kwargs=None,
):
"""Batch gradient descent with momentum and individual gain... | /usr/src/app/target_test_cases/failed_tests__gradient_descent.txt | def _gradient_descent(
objective,
p0,
it,
max_iter,
n_iter_check=1,
n_iter_without_progress=300,
momentum=0.8,
learning_rate=200.0,
min_gain=0.01,
min_grad_norm=1e-7,
verbose=0,
args=None,
kwargs=None,
):
"""Batch gradient descent with momentum and individual gain... | _gradient_descent | Self-Contained |
scikit-learn | 245 | sklearn/inspection/_partial_dependence.py | def _grid_from_X(X, percentiles, is_categorical, grid_resolution):
"""Generate a grid of points based on the percentiles of X.
The grid is a cartesian product between the columns of ``values``. The
ith column of ``values`` consists in ``grid_resolution`` equally-spaced
points between the percentiles of... | /usr/src/app/target_test_cases/failed_tests__grid_from_X.txt | def _grid_from_X(X, percentiles, is_categorical, grid_resolution):
"""Generate a grid of points based on the percentiles of X.
The grid is a cartesian product between the columns of ``values``. The
ith column of ``values`` consists in ``grid_resolution`` equally-spaced
points between the percentiles of... | _grid_from_X | Repo-Level |
scikit-learn | 247 | sklearn/linear_model/_huber.py | def _huber_loss_and_gradient(w, X, y, epsilon, alpha, sample_weight=None):
"""Returns the Huber loss and the gradient.
Parameters
----------
w : ndarray, shape (n_features + 1,) or (n_features + 2,)
Feature vector.
w[:n_features] gives the coefficients
w[-1] gives the scale fact... | /usr/src/app/target_test_cases/failed_tests__huber_loss_and_gradient.txt | def _huber_loss_and_gradient(w, X, y, epsilon, alpha, sample_weight=None):
"""Returns the Huber loss and the gradient.
Parameters
----------
w : ndarray, shape (n_features + 1,) or (n_features + 2,)
Feature vector.
w[:n_features] gives the coefficients
w[-1] gives the scale fact... | _huber_loss_and_gradient | Repo-Level |
scikit-learn | 253 | sklearn/linear_model/_least_angle.py | def _lars_path_residues(
X_train,
y_train,
X_test,
y_test,
Gram=None,
copy=True,
method="lar",
verbose=False,
fit_intercept=True,
max_iter=500,
eps=np.finfo(float).eps,
positive=False,
):
"""Compute the residues on left-out data for a full LARS path
Parameters
... | /usr/src/app/target_test_cases/failed_tests__lars_path_residues.txt | def _lars_path_residues(
X_train,
y_train,
X_test,
y_test,
Gram=None,
copy=True,
method="lar",
verbose=False,
fit_intercept=True,
max_iter=500,
eps=np.finfo(float).eps,
positive=False,
):
"""Compute the residues on left-out data for a full LARS path
Parameters
... | _lars_path_residues | Repo-Level |
scikit-learn | 254 | sklearn/linear_model/_logistic.py | def _log_reg_scoring_path(
X,
y,
train,
test,
*,
pos_class,
Cs,
scoring,
fit_intercept,
max_iter,
tol,
class_weight,
verbose,
solver,
penalty,
dual,
intercept_scaling,
multi_class,
random_state,
max_squared_sum,
sample_weight,
l1_ra... | /usr/src/app/target_test_cases/failed_tests__log_reg_scoring_path.txt | def _log_reg_scoring_path(
X,
y,
train,
test,
*,
pos_class,
Cs,
scoring,
fit_intercept,
max_iter,
tol,
class_weight,
verbose,
solver,
penalty,
dual,
intercept_scaling,
multi_class,
random_state,
max_squared_sum,
sample_weight,
l1_ra... | _log_reg_scoring_path | Repo-Level |
scikit-learn | 256 | sklearn/linear_model/_logistic.py | def _logistic_regression_path(
X,
y,
pos_class=None,
Cs=10,
fit_intercept=True,
max_iter=100,
tol=1e-4,
verbose=0,
solver="lbfgs",
coef=None,
class_weight=None,
dual=False,
penalty="l2",
intercept_scaling=1.0,
multi_class="auto",
random_state=None,
che... | /usr/src/app/target_test_cases/failed_tests__logistic_regression_path.txt | def _logistic_regression_path(
X,
y,
pos_class=None,
Cs=10,
fit_intercept=True,
max_iter=100,
tol=1e-4,
verbose=0,
solver="lbfgs",
coef=None,
class_weight=None,
dual=False,
penalty="l2",
intercept_scaling=1.0,
multi_class="auto",
random_state=None,
che... | _logistic_regression_path | Repo-Level |
scikit-learn | 257 | sklearn/cluster/_kmeans.py | def _mini_batch_step(
X,
sample_weight,
centers,
centers_new,
weight_sums,
random_state,
random_reassign=False,
reassignment_ratio=0.01,
verbose=False,
n_threads=1,
):
"""Incremental update of the centers for the Minibatch K-Means algorithm.
Parameters
----------
... | /usr/src/app/target_test_cases/failed_tests__mini_batch_step.txt | def _mini_batch_step(
X,
sample_weight,
centers,
centers_new,
weight_sums,
random_state,
random_reassign=False,
reassignment_ratio=0.01,
verbose=False,
n_threads=1,
):
"""Incremental update of the centers for the Minibatch K-Means algorithm.
Parameters
----------
... | _mini_batch_step | File-Level |
scikit-learn | 260 | sklearn/utils/optimize.py | def _newton_cg(
grad_hess,
func,
grad,
x0,
args=(),
tol=1e-4,
maxiter=100,
maxinner=200,
line_search=True,
warn=True,
verbose=0,
):
"""
Minimization of scalar function of one or more variables using the
Newton-CG algorithm.
Parameters
----------
grad_... | /usr/src/app/target_test_cases/failed_tests__newton_cg.txt | def _newton_cg(
grad_hess,
func,
grad,
x0,
args=(),
tol=1e-4,
maxiter=100,
maxinner=200,
line_search=True,
warn=True,
verbose=0,
):
"""
Minimization of scalar function of one or more variables using the
Newton-CG algorithm.
Parameters
----------
grad_... | _newton_cg | File-Level |
scikit-learn | 263 | sklearn/inspection/_partial_dependence.py | def _partial_dependence_brute(
est, grid, features, X, response_method, sample_weight=None
):
"""Calculate partial dependence via the brute force method.
The brute method explicitly averages the predictions of an estimator over a
grid of feature values.
For each `grid` value, all the samples from ... | /usr/src/app/target_test_cases/failed_tests__partial_dependence_brute.txt | def _partial_dependence_brute(
est, grid, features, X, response_method, sample_weight=None
):
"""Calculate partial dependence via the brute force method.
The brute method explicitly averages the predictions of an estimator over a
grid of feature values.
For each `grid` value, all the samples from ... | _partial_dependence_brute | Repo-Level |
scikit-learn | 266 | sklearn/utils/extmath.py | def _randomized_eigsh(
M,
n_components,
*,
n_oversamples=10,
n_iter="auto",
power_iteration_normalizer="auto",
selection="module",
random_state=None,
):
"""Computes a truncated eigendecomposition using randomized methods
This method solves the fixed-rank approximation problem de... | /usr/src/app/target_test_cases/failed_tests__randomized_eigsh.txt | def _randomized_eigsh(
M,
n_components,
*,
n_oversamples=10,
n_iter="auto",
power_iteration_normalizer="auto",
selection="module",
random_state=None,
):
"""Computes a truncated eigendecomposition using randomized methods
This method solves the fixed-rank approximation problem de... | _randomized_eigsh | File-Level |
scikit-learn | 273 | sklearn/calibration.py | def _sigmoid_calibration(
predictions, y, sample_weight=None, max_abs_prediction_threshold=30
):
"""Probability Calibration with sigmoid method (Platt 2000)
Parameters
----------
predictions : ndarray of shape (n_samples,)
The decision function or predict proba for the samples.
y : nda... | /usr/src/app/target_test_cases/failed_tests__sigmoid_calibration.txt | def _sigmoid_calibration(
predictions, y, sample_weight=None, max_abs_prediction_threshold=30
):
"""Probability Calibration with sigmoid method (Platt 2000)
Parameters
----------
predictions : ndarray of shape (n_samples,)
The decision function or predict proba for the samples.
y : nda... | _sigmoid_calibration | Repo-Level |
scikit-learn | 278 | sklearn/utils/_estimator_html_repr.py | def _write_label_html(
out,
name,
name_details,
name_caption=None,
doc_link_label=None,
outer_class="sk-label-container",
inner_class="sk-label",
checked=False,
doc_link="",
is_fitted_css_class="",
is_fitted_icon="",
):
"""Write labeled html with or without a dropdown wit... | /usr/src/app/target_test_cases/failed_tests__write_label_html.txt | def _write_label_html(
out,
name,
name_details,
name_caption=None,
doc_link_label=None,
outer_class="sk-label-container",
inner_class="sk-label",
checked=False,
doc_link="",
is_fitted_css_class="",
is_fitted_icon="",
):
"""Write labeled html with or without a dropdown wit... | _write_label_html | Self-Contained |
scikit-learn | 285 | sklearn/utils/validation.py | def check_X_y(
X,
y,
accept_sparse=False,
*,
accept_large_sparse=True,
dtype="numeric",
order=None,
copy=False,
force_writeable=False,
force_all_finite="deprecated",
ensure_all_finite=None,
ensure_2d=True,
allow_nd=False,
multi_output=False,
ensure_min_samples... | /usr/src/app/target_test_cases/failed_tests_check_X_y.txt | def check_X_y(
X,
y,
accept_sparse=False,
*,
accept_large_sparse=True,
dtype="numeric",
order=None,
copy=False,
force_writeable=False,
force_all_finite="deprecated",
ensure_all_finite=None,
ensure_2d=True,
allow_nd=False,
multi_output=False,
ensure_min_samples... | check_X_y | Repo-Level |
scikit-learn | 286 | sklearn/utils/validation.py | def check_array(
array,
accept_sparse=False,
*,
accept_large_sparse=True,
dtype="numeric",
order=None,
copy=False,
force_writeable=False,
force_all_finite="deprecated",
ensure_all_finite=None,
ensure_non_negative=False,
ensure_2d=True,
allow_nd=False,
ensure_min_s... | /usr/src/app/target_test_cases/failed_tests_check_array.txt | def check_array(
array,
accept_sparse=False,
*,
accept_large_sparse=True,
dtype="numeric",
order=None,
copy=False,
force_writeable=False,
force_all_finite="deprecated",
ensure_all_finite=None,
ensure_non_negative=False,
ensure_2d=True,
allow_nd=False,
ensure_min_s... | check_array | Repo-Level |
scikit-learn | 288 | sklearn/metrics/pairwise.py | def check_pairwise_arrays(
X,
Y,
*,
precomputed=False,
dtype="infer_float",
accept_sparse="csr",
force_all_finite="deprecated",
ensure_all_finite=None,
ensure_2d=True,
copy=False,
):
"""Set X and Y appropriately and checks inputs.
If Y is None, it is set as a pointer to ... | /usr/src/app/target_test_cases/failed_tests_check_pairwise_arrays.txt | def check_pairwise_arrays(
X,
Y,
*,
precomputed=False,
dtype="infer_float",
accept_sparse="csr",
force_all_finite="deprecated",
ensure_all_finite=None,
ensure_2d=True,
copy=False,
):
"""Set X and Y appropriately and checks inputs.
If Y is None, it is set as a pointer to ... | check_pairwise_arrays | Repo-Level |
scikit-learn | 293 | sklearn/cluster/_spectral.py | def discretize(
vectors, *, copy=True, max_svd_restarts=30, n_iter_max=20, random_state=None
):
"""Search for a partition matrix which is closest to the eigenvector embedding.
This implementation was proposed in [1]_.
Parameters
----------
vectors : array-like of shape (n_samples, n_clusters)
... | /usr/src/app/target_test_cases/failed_tests_discretize.txt | def discretize(
vectors, *, copy=True, max_svd_restarts=30, n_iter_max=20, random_state=None
):
"""Search for a partition matrix which is closest to the eigenvector embedding.
This implementation was proposed in [1]_.
Parameters
----------
vectors : array-like of shape (n_samples, n_clusters)
... | discretize | Repo-Level |
scikit-learn | 295 | sklearn/covariance/_robust_covariance.py | def fast_mcd(
X,
support_fraction=None,
cov_computation_method=empirical_covariance,
random_state=None,
):
"""Estimate the Minimum Covariance Determinant matrix.
Read more in the :ref:`User Guide <robust_covariance>`.
Parameters
----------
X : array-like of shape (n_samples, n_feat... | /usr/src/app/target_test_cases/failed_tests_fast_mcd.txt | def fast_mcd(
X,
support_fraction=None,
cov_computation_method=empirical_covariance,
random_state=None,
):
"""Estimate the Minimum Covariance Determinant matrix.
Read more in the :ref:`User Guide <robust_covariance>`.
Parameters
----------
X : array-like of shape (n_samples, n_feat... | fast_mcd | Repo-Level |
scikit-learn | 299 | sklearn/utils/sparsefuncs.py | def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n, weights=None):
"""Compute incremental mean and variance along an axis on a CSR or CSC matrix.
last_mean, last_var are the statistics computed at the last step by this
function. Both must be initialized to 0-arrays of the proper size, i.e.... | /usr/src/app/target_test_cases/failed_tests_incr_mean_variance_axis.txt | def incr_mean_variance_axis(X, *, axis, last_mean, last_var, last_n, weights=None):
"""Compute incremental mean and variance along an axis on a CSR or CSC matrix.
last_mean, last_var are the statistics computed at the last step by this
function. Both must be initialized to 0-arrays of the proper size, i.e.... | incr_mean_variance_axis | Repo-Level |
scikit-learn | 301 | sklearn/cluster/_agglomerative.py | def linkage_tree(
X,
connectivity=None,
n_clusters=None,
linkage="complete",
affinity="euclidean",
return_distance=False,
):
"""Linkage agglomerative clustering based on a Feature matrix.
The inertia matrix uses a Heapq-based representation.
This is the structured version, that tak... | /usr/src/app/target_test_cases/failed_tests_linkage_tree.txt | def linkage_tree(
X,
connectivity=None,
n_clusters=None,
linkage="complete",
affinity="euclidean",
return_distance=False,
):
"""Linkage agglomerative clustering based on a Feature matrix.
The inertia matrix uses a Heapq-based representation.
This is the structured version, that tak... | linkage_tree | Repo-Level |
scikit-learn | 303 | sklearn/datasets/_base.py | def load_diabetes(*, return_X_y=False, as_frame=False, scaled=True):
"""Load and return the diabetes dataset (regression).
============== ==================
Samples total 442
Dimensionality 10
Features real, -.2 < x < .2
Targets integer 25 - 346
============== ====... | /usr/src/app/target_test_cases/failed_tests_load_diabetes.txt | def load_diabetes(*, return_X_y=False, as_frame=False, scaled=True):
"""Load and return the diabetes dataset (regression).
============== ==================
Samples total 442
Dimensionality 10
Features real, -.2 < x < .2
Targets integer 25 - 346
============== ====... | load_diabetes | Repo-Level |
scikit-learn | 305 | sklearn/datasets/_samples_generator.py | def make_blobs(
n_samples=100,
n_features=2,
*,
centers=None,
cluster_std=1.0,
center_box=(-10.0, 10.0),
shuffle=True,
random_state=None,
return_centers=False,
):
"""Generate isotropic Gaussian blobs for clustering.
For an example of usage, see
:ref:`sphx_glr_auto_exampl... | /usr/src/app/target_test_cases/failed_tests_make_blobs.txt | def make_blobs(
n_samples=100,
n_features=2,
*,
centers=None,
cluster_std=1.0,
center_box=(-10.0, 10.0),
shuffle=True,
random_state=None,
return_centers=False,
):
"""Generate isotropic Gaussian blobs for clustering.
For an example of usage, see
:ref:`sphx_glr_auto_exampl... | make_blobs | Repo-Level |
scikit-learn | 313 | sklearn/utils/multiclass.py | def type_of_target(y, input_name=""):
"""Determine the type of data indicated by the target.
Note that this type is the most specific type that can be inferred.
For example:
* ``binary`` is more specific but compatible with ``multiclass``.
* ``multiclass`` of integers is more specific but compatib... | /usr/src/app/target_test_cases/failed_tests_type_of_target.txt | def type_of_target(y, input_name=""):
"""Determine the type of data indicated by the target.
Note that this type is the most specific type that can be inferred.
For example:
* ``binary`` is more specific but compatible with ``multiclass``.
* ``multiclass`` of integers is more specific but compatib... | type_of_target | Repo-Level |
astropy | 0 | astropy/modeling/physical_models.py | def evaluate(self, x, temperature, scale):
"""Evaluate the model.
Parameters
----------
x : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['frequency']
Frequency at which to compute the blackbody. If no units are given,
this defaults to Hz (or AA if `... | /usr/src/app/target_test_cases/failed_tests_BlackBody.evaluate.txt | def evaluate(self, x, temperature, scale):
"""Evaluate the model.
Parameters
----------
x : float, `~numpy.ndarray`, or `~astropy.units.Quantity` ['frequency']
Frequency at which to compute the blackbody. If no units are given,
this defaults to Hz (or AA if `... | BlackBody.evaluate | Self-Contained |
astropy | 2 | astropy/timeseries/periodograms/bls/core.py | def compute_stats(self, period, duration, transit_time):
"""Compute descriptive statistics for a given transit model.
These statistics are commonly used for vetting of transit candidates.
Parameters
----------
period : float or `~astropy.units.Quantity` ['time']
... | /usr/src/app/target_test_cases/failed_tests_BoxLeastSquares.compute_stats.txt | def compute_stats(self, period, duration, transit_time):
"""Compute descriptive statistics for a given transit model.
These statistics are commonly used for vetting of transit candidates.
Parameters
----------
period : float or `~astropy.units.Quantity` ['time']
... | BoxLeastSquares.compute_stats | File-Level |
astropy | 6 | astropy/nddata/ccddata.py | def to_hdu(
self,
hdu_mask="MASK",
hdu_uncertainty="UNCERT",
hdu_flags=None,
wcs_relax=True,
key_uncertainty_type="UTYPE",
as_image_hdu=False,
hdu_psf="PSFIMAGE",
):
"""Creates an HDUList object from a CCDData object.
Parameters
... | /usr/src/app/target_test_cases/failed_tests_CCDData.to_hdu.txt | def to_hdu(
self,
hdu_mask="MASK",
hdu_uncertainty="UNCERT",
hdu_flags=None,
wcs_relax=True,
key_uncertainty_type="UTYPE",
as_image_hdu=False,
hdu_psf="PSFIMAGE",
):
"""Creates an HDUList object from a CCDData object.
Parameters
... | CCDData.to_hdu | File-Level |
astropy | 24 | astropy/coordinates/sky_coordinate.py | def apply_space_motion(self, new_obstime=None, dt=None):
"""Compute the position to a new time using the velocities.
Compute the position of the source represented by this coordinate object
to a new time using the velocities stored in this object and assuming
linear space motion (in... | /usr/src/app/target_test_cases/failed_tests_SkyCoord.apply_space_motion.txt | def apply_space_motion(self, new_obstime=None, dt=None):
"""Compute the position to a new time using the velocities.
Compute the position of the source represented by this coordinate object
to a new time using the velocities stored in this object and assuming
linear space motion (in... | SkyCoord.apply_space_motion | Self-Contained |
astropy | 28 | astropy/coordinates/spectral_quantity.py | def to(self, unit, equivalencies=[], doppler_rest=None, doppler_convention=None):
"""
Return a new `~astropy.coordinates.SpectralQuantity` object with the specified unit.
By default, the ``spectral`` equivalency will be enabled, as well as
one of the Doppler equivalencies if convert... | /usr/src/app/target_test_cases/failed_tests_SpectralQuantity.to.txt | def to(self, unit, equivalencies=[], doppler_rest=None, doppler_convention=None):
"""
Return a new `~astropy.coordinates.SpectralQuantity` object with the specified unit.
By default, the ``spectral`` equivalency will be enabled, as well as
one of the Doppler equivalencies if convert... | SpectralQuantity.to | Self-Contained |
astropy | 36 | astropy/timeseries/sampled.py | def fold(
self,
period=None,
epoch_time=None,
epoch_phase=0,
wrap_phase=None,
normalize_phase=False,
):
"""
Return a new `~astropy.timeseries.TimeSeries` folded with a period and
epoch.
Parameters
----------
period ... | /usr/src/app/target_test_cases/failed_tests_TimeSeries.fold.txt | def fold(
self,
period=None,
epoch_time=None,
epoch_phase=0,
wrap_phase=None,
normalize_phase=False,
):
"""
Return a new `~astropy.timeseries.TimeSeries` folded with a period and
epoch.
Parameters
----------
period ... | TimeSeries.fold | Self-Contained |
astropy | 40 | astropy/timeseries/downsample.py | def aggregate_downsample(
time_series,
*,
time_bin_size=None,
time_bin_start=None,
time_bin_end=None,
n_bins=None,
aggregate_func=None,
):
"""
Downsample a time series by binning values into bins with a fixed size or
custom sizes, using a single function to combine the values in ... | /usr/src/app/target_test_cases/failed_tests_aggregate_downsample.txt | def aggregate_downsample(
time_series,
*,
time_bin_size=None,
time_bin_start=None,
time_bin_end=None,
n_bins=None,
aggregate_func=None,
):
"""
Downsample a time series by binning values into bins with a fixed size or
custom sizes, using a single function to combine the values in ... | aggregate_downsample | File-Level |
astropy | 44 | astropy/io/fits/hdu/compressed/_tiled_compression.py | def compress_image_data(
image_data,
compression_type,
compressed_header,
compressed_coldefs,
):
"""
Compress the data in a `~astropy.io.fits.CompImageHDU`.
The input HDU is expected to have a uncompressed numpy array as it's
``.data`` attribute.
Parameters
----------
image... | /usr/src/app/target_test_cases/failed_tests_compress_image_data.txt | def compress_image_data(
image_data,
compression_type,
compressed_header,
compressed_coldefs,
):
"""
Compress the data in a `~astropy.io.fits.CompImageHDU`.
The input HDU is expected to have a uncompressed numpy array as it's
``.data`` attribute.
Parameters
----------
image... | compress_image_data | Repo-Level |
astropy | 49 | astropy/utils/data.py | def download_file(
remote_url,
cache=False,
show_progress=True,
timeout=None,
sources=None,
pkgname="astropy",
http_headers=None,
ssl_context=None,
allow_insecure=False,
):
"""Downloads a URL and optionally caches the result.
It returns the filename of a file containing the ... | /usr/src/app/target_test_cases/failed_tests_download_file.txt | def download_file(
remote_url,
cache=False,
show_progress=True,
timeout=None,
sources=None,
pkgname="astropy",
http_headers=None,
ssl_context=None,
allow_insecure=False,
):
"""Downloads a URL and optionally caches the result.
It returns the filename of a file containing the ... | download_file | File-Level |
astropy | 52 | astropy/coordinates/funcs.py | def get_constellation(coord, short_name=False, constellation_list="iau"):
"""
Determines the constellation(s) a given coordinate object contains.
Parameters
----------
coord : coordinate-like
The object to determine the constellation of.
short_name : bool
If True, the returned n... | /usr/src/app/target_test_cases/failed_tests_get_constellation.txt | def get_constellation(coord, short_name=False, constellation_list="iau"):
"""
Determines the constellation(s) a given coordinate object contains.
Parameters
----------
coord : coordinate-like
The object to determine the constellation of.
short_name : bool
If True, the returned n... | get_constellation | Self-Contained |
astropy | 67 | astropy/nddata/utils.py | def overlap_slices(large_array_shape, small_array_shape, position, mode="partial"):
"""
Get slices for the overlapping part of a small and a large array.
Given a certain position of the center of the small array, with
respect to the large array, tuples of slices are returned which can be
used to ex... | /usr/src/app/target_test_cases/failed_tests_overlap_slices.txt | def overlap_slices(large_array_shape, small_array_shape, position, mode="partial"):
"""
Get slices for the overlapping part of a small and a large array.
Given a certain position of the center of the small array, with
respect to the large array, tuples of slices are returned which can be
used to ex... | overlap_slices | Self-Contained |
astropy | 68 | astropy/io/votable/table.py | def parse(
source,
columns=None,
invalid="exception",
verify=None,
chunk_size=tree.DEFAULT_CHUNK_SIZE,
table_number=None,
table_id=None,
filename=None,
unit_format=None,
datatype_mapping=None,
_debug_python_based_parser=False,
):
"""
Parses a VOTABLE_ xml file (or fil... | /usr/src/app/target_test_cases/failed_tests_parse.txt | def parse(
source,
columns=None,
invalid="exception",
verify=None,
chunk_size=tree.DEFAULT_CHUNK_SIZE,
table_number=None,
table_id=None,
filename=None,
unit_format=None,
datatype_mapping=None,
_debug_python_based_parser=False,
):
"""
Parses a VOTABLE_ xml file (or fil... | parse | Self-Contained |
astropy | 72 | astropy/io/fits/convenience.py | def printdiff(inputa, inputb, *args, **kwargs):
"""
Compare two parts of a FITS file, including entire FITS files,
FITS `HDUList` objects and FITS ``HDU`` objects.
Parameters
----------
inputa : str, `HDUList` object, or ``HDU`` object
The filename of a FITS file, `HDUList`, or ``HDU``
... | /usr/src/app/target_test_cases/failed_tests_printdiff.txt | def printdiff(inputa, inputb, *args, **kwargs):
"""
Compare two parts of a FITS file, including entire FITS files,
FITS `HDUList` objects and FITS ``HDU`` objects.
Parameters
----------
inputa : str, `HDUList` object, or ``HDU`` object
The filename of a FITS file, `HDUList`, or ``HDU``
... | printdiff | Repo-Level |
astropy | 74 | astropy/stats/sigma_clipping.py | def sigma_clipped_stats(
data: ArrayLike,
mask: NDArray | None = None,
mask_value: float | None = None,
sigma: float | None = 3.0,
sigma_lower: float | None = None,
sigma_upper: float | None = None,
maxiters: int | None = 5,
cenfunc: Literal["median", "mean"] | Callable | None = "median"... | /usr/src/app/target_test_cases/failed_tests_sigma_clipped_stats.txt | def sigma_clipped_stats(
data: ArrayLike,
mask: NDArray | None = None,
mask_value: float | None = None,
sigma: float | None = 3.0,
sigma_lower: float | None = None,
sigma_upper: float | None = None,
maxiters: int | None = 5,
cenfunc: Literal["median", "mean"] | Callable | None = "median"... | sigma_clipped_stats | Self-Contained |
astropy | 77 | astropy/io/fits/convenience.py | def table_to_hdu(table, character_as_bytes=False):
"""
Convert an `~astropy.table.Table` object to a FITS
`~astropy.io.fits.BinTableHDU`.
Parameters
----------
table : astropy.table.Table
The table to convert.
character_as_bytes : bool
Whether to return bytes for string colu... | /usr/src/app/target_test_cases/failed_tests_table_to_hdu.txt | def table_to_hdu(table, character_as_bytes=False):
"""
Convert an `~astropy.table.Table` object to a FITS
`~astropy.io.fits.BinTableHDU`.
Parameters
----------
table : astropy.table.Table
The table to convert.
character_as_bytes : bool
Whether to return bytes for string colu... | table_to_hdu | Repo-Level |
astropy | 78 | astropy/io/fits/fitstime.py | def time_to_fits(table):
"""
Replace Time columns in a Table with non-mixin columns containing
each element as a vector of two doubles (jd1, jd2) and return a FITS
header with appropriate time coordinate keywords.
jd = jd1 + jd2 represents time in the Julian Date format with
high-precision.
... | /usr/src/app/target_test_cases/failed_tests_time_to_fits.txt | def time_to_fits(table):
"""
Replace Time columns in a Table with non-mixin columns containing
each element as a vector of two doubles (jd1, jd2) and return a FITS
header with appropriate time coordinate keywords.
jd = jd1 + jd2 represents time in the Julian Date format with
high-precision.
... | time_to_fits | Self-Contained |
flask | 7 | src/flask/app.py | def make_response(self, rv: ft.ResponseReturnValue) -> Response:
"""Convert the return value from a view function to an instance of
:attr:`response_class`.
:param rv: the return value from the view function. The view function
must return a response. Returning ``None``, or the vi... | /usr/src/app/target_test_cases/failed_tests_app.Flask.make_response.txt | def make_response(self, rv: ft.ResponseReturnValue) -> Response:
"""Convert the return value from a view function to an instance of
:attr:`response_class`.
:param rv: the return value from the view function. The view function
must return a response. Returning ``None``, or the vi... | app.Flask.make_response | Self-Contained |
flask | 10 | src/flask/app.py | def run(
self,
host: str | None = None,
port: int | None = None,
debug: bool | None = None,
load_dotenv: bool = True,
**options: t.Any,
) -> None:
"""Runs the application on a local development server.
Do not use ``run()`` in a production setting.... | /usr/src/app/target_test_cases/failed_tests_app.Flask.run.txt | def run(
self,
host: str | None = None,
port: int | None = None,
debug: bool | None = None,
load_dotenv: bool = True,
**options: t.Any,
) -> None:
"""Runs the application on a local development server.
Do not use ``run()`` in a production setting.... | app.Flask.run | Repo-Level |
flask | 13 | src/flask/app.py | def url_for(
self,
/,
endpoint: str,
*,
_anchor: str | None = None,
_method: str | None = None,
_scheme: str | None = None,
_external: bool | None = None,
**values: t.Any,
) -> str:
"""Generate a URL to the given endpoint with the g... | /usr/src/app/target_test_cases/failed_tests_app.Flask.url_for.txt | def url_for(
self,
/,
endpoint: str,
*,
_anchor: str | None = None,
_method: str | None = None,
_scheme: str | None = None,
_external: bool | None = None,
**values: t.Any,
) -> str:
"""Generate a URL to the given endpoint with the g... | app.Flask.url_for | File-Level |
more-itertools | 13 | more_itertools/more.py | def distinct_permutations(iterable, r=None):
"""Yield successive distinct permutations of the elements in *iterable*.
>>> sorted(distinct_permutations([1, 0, 1]))
[(0, 1, 1), (1, 0, 1), (1, 1, 0)]
Equivalent to yielding from ``set(permutations(iterable))``, except
duplicates are not genera... | /usr/src/app/target_test_cases/failed_tests_more.distinct_permutations.txt | def distinct_permutations(iterable, r=None):
"""Yield successive distinct permutations of the elements in *iterable*.
>>> sorted(distinct_permutations([1, 0, 1]))
[(0, 1, 1), (1, 0, 1), (1, 1, 0)]
Equivalent to yielding from ``set(permutations(iterable))``, except
duplicates are not genera... | more.distinct_permutations | File-Level |
plotly.py | 1 | packages/python/plotly/plotly/figure_factory/_bullet.py | def create_bullet(
data,
markers=None,
measures=None,
ranges=None,
subtitles=None,
titles=None,
orientation="h",
range_colors=("rgb(200, 200, 200)", "rgb(245, 245, 245)"),
measure_colors=("rgb(31, 119, 180)", "rgb(176, 196, 221)"),
horizontal_spacing=None,
vertical_spacing=No... | /usr/src/app/target_test_cases/failed_tests__bullet.create_bullet.txt | def create_bullet(
data,
markers=None,
measures=None,
ranges=None,
subtitles=None,
titles=None,
orientation="h",
range_colors=("rgb(200, 200, 200)", "rgb(245, 245, 245)"),
measure_colors=("rgb(31, 119, 180)", "rgb(176, 196, 221)"),
horizontal_spacing=None,
vertical_spacing=No... | _bullet.create_bullet | File-Level |
plotly.py | 4 | packages/python/plotly/plotly/graph_objs/histogram2dcontour/_contours.py | def __init__(
self,
arg=None,
coloring=None,
end=None,
labelfont=None,
labelformat=None,
operation=None,
showlabels=None,
showlines=None,
size=None,
start=None,
type=None,
value=None,
**kwargs,
):
... | /usr/src/app/target_test_cases/failed_tests__contours.Contours.__init__.txt | def __init__(
self,
arg=None,
coloring=None,
end=None,
labelfont=None,
labelformat=None,
operation=None,
showlabels=None,
showlines=None,
size=None,
start=None,
type=None,
value=None,
**kwargs,
):
... | _contours.Contours.__init__ | Self-Contained |
plotly.py | 5 | packages/python/plotly/plotly/figure_factory/_county_choropleth.py | def create_choropleth(
fips,
values,
scope=["usa"],
binning_endpoints=None,
colorscale=None,
order=None,
simplify_county=0.02,
simplify_state=0.02,
asp=None,
show_hover=True,
show_state_data=True,
state_outline=None,
county_outline=None,
centroid_marker=None,
... | /usr/src/app/target_test_cases/failed_tests__county_choropleth.create_choropleth.txt | def create_choropleth(
fips,
values,
scope=["usa"],
binning_endpoints=None,
colorscale=None,
order=None,
simplify_county=0.02,
simplify_state=0.02,
asp=None,
show_hover=True,
show_state_data=True,
state_outline=None,
county_outline=None,
centroid_marker=None,
... | _county_choropleth.create_choropleth | File-Level |
plotly.py | 6 | packages/python/plotly/plotly/graph_objs/parcoords/_dimension.py | def __init__(
self,
arg=None,
constraintrange=None,
label=None,
multiselect=None,
name=None,
range=None,
templateitemname=None,
tickformat=None,
ticktext=None,
ticktextsrc=None,
tickvals=None,
tickvalssrc=None,
... | /usr/src/app/target_test_cases/failed_tests__dimension.Dimension.__init__.txt | def __init__(
self,
arg=None,
constraintrange=None,
label=None,
multiselect=None,
name=None,
range=None,
templateitemname=None,
tickformat=None,
ticktext=None,
ticktextsrc=None,
tickvals=None,
tickvalssrc=None,
... | _dimension.Dimension.__init__ | Self-Contained |
plotly.py | 7 | packages/python/plotly/plotly/figure_factory/_distplot.py | def create_distplot(
hist_data,
group_labels,
bin_size=1.0,
curve_type="kde",
colors=None,
rug_text=None,
histnorm=DEFAULT_HISTNORM,
show_hist=True,
show_curve=True,
show_rug=True,
):
"""
Function that creates a distplot similar to seaborn.distplot;
**this function is... | /usr/src/app/target_test_cases/failed_tests__distplot.create_distplot.txt | def create_distplot(
hist_data,
group_labels,
bin_size=1.0,
curve_type="kde",
colors=None,
rug_text=None,
histnorm=DEFAULT_HISTNORM,
show_hist=True,
show_curve=True,
show_rug=True,
):
"""
Function that creates a distplot similar to seaborn.distplot;
**this function is... | _distplot.create_distplot | File-Level |
plotly.py | 8 | packages/python/plotly/plotly/figure_factory/_facet_grid.py | def create_facet_grid(
df,
x=None,
y=None,
facet_row=None,
facet_col=None,
color_name=None,
colormap=None,
color_is_cat=False,
facet_row_labels=None,
facet_col_labels=None,
height=None,
width=None,
trace_type="scatter",
scales="fixed",
dtick_x=None,
dtick_... | /usr/src/app/target_test_cases/failed_tests__facet_grid.create_facet_grid.txt | def create_facet_grid(
df,
x=None,
y=None,
facet_row=None,
facet_col=None,
color_name=None,
colormap=None,
color_is_cat=False,
facet_row_labels=None,
facet_col_labels=None,
height=None,
width=None,
trace_type="scatter",
scales="fixed",
dtick_x=None,
dtick_... | _facet_grid.create_facet_grid | File-Level |
plotly.py | 9 | packages/python/plotly/plotly/graph_objs/_funnel.py | def __init__(
self,
arg=None,
alignmentgroup=None,
cliponaxis=None,
connector=None,
constraintext=None,
customdata=None,
customdatasrc=None,
dx=None,
dy=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
... | /usr/src/app/target_test_cases/failed_tests__funnel.Funnel.__init__.txt | def __init__(
self,
arg=None,
alignmentgroup=None,
cliponaxis=None,
connector=None,
constraintext=None,
customdata=None,
customdatasrc=None,
dx=None,
dy=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
... | _funnel.Funnel.__init__ | Self-Contained |
plotly.py | 11 | packages/python/plotly/plotly/graph_objs/_funnelarea.py | def __init__(
self,
arg=None,
aspectratio=None,
baseratio=None,
customdata=None,
customdatasrc=None,
dlabel=None,
domain=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
hovertemplate=None,
hovertemplate... | /usr/src/app/target_test_cases/failed_tests__funnelarea.Funnelarea.__init__.txt | def __init__(
self,
arg=None,
aspectratio=None,
baseratio=None,
customdata=None,
customdatasrc=None,
dlabel=None,
domain=None,
hoverinfo=None,
hoverinfosrc=None,
hoverlabel=None,
hovertemplate=None,
hovertemplate... | _funnelarea.Funnelarea.__init__ | Self-Contained |
plotly.py | 12 | packages/python/plotly/plotly/figure_factory/_gantt.py | def create_gantt(
df,
colors=None,
index_col=None,
show_colorbar=False,
reverse_colors=False,
title="Gantt Chart",
bar_width=0.2,
showgrid_x=False,
showgrid_y=False,
height=600,
width=None,
tasks=None,
task_names=None,
data=None,
group_tasks=False,
show_ho... | /usr/src/app/target_test_cases/failed_tests__gantt.create_gantt.txt | def create_gantt(
df,
colors=None,
index_col=None,
show_colorbar=False,
reverse_colors=False,
title="Gantt Chart",
bar_width=0.2,
showgrid_x=False,
showgrid_y=False,
height=600,
width=None,
tasks=None,
task_names=None,
data=None,
group_tasks=False,
show_ho... | _gantt.create_gantt | File-Level |
plotly.py | 13 | packages/python/plotly/plotly/graph_objs/layout/_grid.py | def __init__(
self,
arg=None,
columns=None,
domain=None,
pattern=None,
roworder=None,
rows=None,
subplots=None,
xaxes=None,
xgap=None,
xside=None,
yaxes=None,
ygap=None,
yside=None,
**kwargs,
... | /usr/src/app/target_test_cases/failed_tests__grid.Grid.__init__.txt | def __init__(
self,
arg=None,
columns=None,
domain=None,
pattern=None,
roworder=None,
rows=None,
subplots=None,
xaxes=None,
xgap=None,
xside=None,
yaxes=None,
ygap=None,
yside=None,
**kwargs,
... | _grid.Grid.__init__ | Self-Contained |
plotly.py | 15 | packages/python/plotly/plotly/io/_html.py | def to_html(
fig,
config=None,
auto_play=True,
include_plotlyjs=True,
include_mathjax=False,
post_script=None,
full_html=True,
animation_opts=None,
default_width="100%",
default_height="100%",
validate=True,
div_id=None,
):
"""
Convert a figure to an HTML string r... | /usr/src/app/target_test_cases/failed_tests__html.to_html.txt | def to_html(
fig,
config=None,
auto_play=True,
include_plotlyjs=True,
include_mathjax=False,
post_script=None,
full_html=True,
animation_opts=None,
default_width="100%",
default_height="100%",
validate=True,
div_id=None,
):
"""
Convert a figure to an HTML string r... | _html.to_html | Self-Contained |
plotly.py | 16 | packages/python/plotly/plotly/io/_html.py | def write_html(
fig,
file,
config=None,
auto_play=True,
include_plotlyjs=True,
include_mathjax=False,
post_script=None,
full_html=True,
animation_opts=None,
validate=True,
default_width="100%",
default_height="100%",
auto_open=False,
div_id=None,
):
"""
Wr... | /usr/src/app/target_test_cases/failed_tests__html.write_html.txt | def write_html(
fig,
file,
config=None,
auto_play=True,
include_plotlyjs=True,
include_mathjax=False,
post_script=None,
full_html=True,
animation_opts=None,
validate=True,
default_width="100%",
default_height="100%",
auto_open=False,
div_id=None,
):
"""
Wr... | _html.write_html | File-Level |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.