neulab/docprompting-conala huggingface dataset:
sklearn.compose.make_column_selector(pattern=None, *, dtype_include=None, dtype_exclude=None) [source]
 
Create a callable to select columns to be used with ColumnTransformer. make_column_selector can select columns based on datatype or the columns name with a regex. When using multiple selection criteria, all criteria must match for a column to be selected.  Parameters 
 
patternstr, default=None 

Name of columns containing this regex pattern will be included. If None, column selection will not be selected based on pattern.  
dtype_includecolumn dtype or list of column dtypes, default=None 

A selection of dtypes to include. For more details, see pandas.DataFrame.select_dtypes.  
dtype_excludecolumn dtype or list of column dtypes, default=None 

A selection of dtypes to exclude. For more details, see pandas.DataFrame.select_dtypes.    Returns 
 
selectorcallable 

Callable for column selection to be used by a ColumnTransformer.      See also  
ColumnTransformer


Class that allows combining the outputs of multiple transformer objects used on column subsets of the data into a single feature space.    Examples >>> from sklearn.preprocessing import StandardScaler, OneHotEncoder
>>> from sklearn.compose import make_column_transformer
>>> from sklearn.compose import make_column_selector
>>> import pandas as pd  
>>> X = pd.DataFrame({'city': ['London', 'London', 'Paris', 'Sallisaw'],
...                   'rating': [5, 3, 4, 5]})  
>>> ct = make_column_transformer(
...       (StandardScaler(),
...        make_column_selector(dtype_include=np.number)),  # rating
...       (OneHotEncoder(),
...        make_column_selector(dtype_include=object)))  # city
>>> ct.fit_transform(X)  
array([[ 0.90453403,  1.        ,  0.        ,  0.        ],
       [-1.50755672,  1.        ,  0.        ,  0.        ],
       [-0.30151134,  0.        ,  1.        ,  0.        ],
       [ 0.90453403,  0.        ,  0.        ,  1.        ]])
fit(X, y, **fit_params) [source]
 
Fit the model according to the given training data.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training vector, where n_samples is the number of samples and n_features is the number of features.  
yarray-like of shape (n_samples,) 

Target values.  
**fit_paramsdict 

Parameters passed to the fit method of the underlying regressor.    Returns 
 
selfobject
predict(X) [source]
 
Predict using the base regressor, applying inverse. The regressor is used to predict and the inverse_func or inverse_transform is applied before returning the prediction.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Samples.    Returns 
 
y_hatndarray of shape (n_samples,) 

Predicted values.
sklearn.config_context(**new_config) [source]
 
Context manager for global scikit-learn configuration  Parameters 
 
assume_finitebool, default=False 

If True, validation for finiteness will be skipped, saving time, but leading to potential crashes. If False, validation for finiteness will be performed, avoiding error. Global default: False.  
working_memoryint, default=1024 

If set, scikit-learn will attempt to limit the size of temporary arrays to this number of MiB (per job when parallelised), often saving both computation time and memory on expensive operations that can be performed in chunks. Global default: 1024.  
print_changed_onlybool, default=True 

If True, only the parameters that were set to non-default values will be printed when printing an estimator. For example, print(SVC()) while True will only print ‘SVC()’, but would print ‘SVC(C=1.0, cache_size=200, …)’ with all the non-changed parameters when False. Default is True.  Changed in version 0.23: Default changed from False to True.   
display{‘text’, ‘diagram’}, default=’text’ 

If ‘diagram’, estimators will be displayed as a diagram in a Jupyter lab or notebook context. If ‘text’, estimators will be displayed as text. Default is ‘text’.  New in version 0.23.       See also  
set_config


Set global scikit-learn configuration.  
get_config


Retrieve current values of the global configuration.    Notes All settings, not just those presently modified, will be returned to their previous values when the context manager is exited. This is not thread-safe. Examples >>> import sklearn
>>> from sklearn.utils.validation import assert_all_finite
>>> with sklearn.config_context(assume_finite=True):
...     assert_all_finite([float('nan')])
>>> with sklearn.config_context(assume_finite=True):
...     with sklearn.config_context(assume_finite=False):
...         assert_all_finite([float('nan')])
Traceback (most recent call last):
...
ValueError: Input contains NaN, ...
correct_covariance(data) [source]
 
Apply a correction to raw Minimum Covariance Determinant estimates. Correction using the empirical correction factor suggested by Rousseeuw and Van Driessen in [RVD].  Parameters 
 
dataarray-like of shape (n_samples, n_features) 

The data matrix, with p features and n samples. The data set must be the one which was used to compute the raw estimates.    Returns 
 
covariance_correctedndarray of shape (n_features, n_features) 

Corrected robust covariance estimate.     References  
RVD  
A Fast Algorithm for the Minimum Covariance Determinant Estimator, 1999, American Statistical Association and the American Society for Quality, TECHNOMETRICS
decision_function(X) [source]
 
Compute the decision function of the given observations.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

The data matrix.    Returns 
 
decisionndarray of shape (n_samples,) 

Decision function of the samples. It is equal to the shifted Mahalanobis distances. The threshold for being an outlier is 0, which ensures a compatibility with other outlier detection algorithms.
error_norm(comp_cov, norm='frobenius', scaling=True, squared=True) [source]
 
Computes the Mean Squared Error between two covariance estimators. (In the sense of the Frobenius norm).  Parameters 
 
comp_covarray-like of shape (n_features, n_features) 

The covariance to compare with.  
norm{“frobenius”, “spectral”}, default=”frobenius” 

The type of norm used to compute the error. Available error types: - ‘frobenius’ (default): sqrt(tr(A^t.A)) - ‘spectral’: sqrt(max(eigenvalues(A^t.A)) where A is the error (comp_cov - self.covariance_).  
scalingbool, default=True 

If True (default), the squared error norm is divided by n_features. If False, the squared error norm is not rescaled.  
squaredbool, default=True 

Whether to compute the squared error norm or the error norm. If True (default), the squared error norm is returned. If False, the error norm is returned.    Returns 
 
resultfloat 

The Mean Squared Error (in the sense of the Frobenius norm) between self and comp_cov covariance estimators.
fit(X, y=None) [source]
 
Fit the EllipticEnvelope model.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training data.  
yIgnored 

Not used, present for API consistency by convention.
fit_predict(X, y=None) [source]
 
Perform fit on X and returns labels for X. Returns -1 for outliers and 1 for inliers.  Parameters 
 
X{array-like, sparse matrix, dataframe} of shape (n_samples, n_features) 

yIgnored 

Not used, present for API consistency by convention.    Returns 
 
yndarray of shape (n_samples,) 

1 for inliers, -1 for outliers.
get_precision() [source]
 
Getter for the precision matrix.  Returns 
 
precision_array-like of shape (n_features, n_features) 

The precision matrix associated to the current covariance object.
mahalanobis(X) [source]
 
Computes the squared Mahalanobis distances of given observations.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

The observations, the Mahalanobis distances of the which we compute. Observations are assumed to be drawn from the same distribution than the data used in fit.    Returns 
 
distndarray of shape (n_samples,) 

Squared Mahalanobis distances of the observations.
predict(X) [source]
 
Predict the labels (1 inlier, -1 outlier) of X according to the fitted model.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

The data matrix.    Returns 
 
is_inlierndarray of shape (n_samples,) 

Returns -1 for anomalies/outliers and +1 for inliers.
reweight_covariance(data) [source]
 
Re-weight raw Minimum Covariance Determinant estimates. Re-weight observations using Rousseeuw’s method (equivalent to deleting outlying observations from the data set before computing location and covariance estimates) described in [RVDriessen].  Parameters 
 
dataarray-like of shape (n_samples, n_features) 

The data matrix, with p features and n samples. The data set must be the one which was used to compute the raw estimates.    Returns 
 
location_reweightedndarray of shape (n_features,) 

Re-weighted robust location estimate.  
covariance_reweightedndarray of shape (n_features, n_features) 

Re-weighted robust covariance estimate.  
support_reweightedndarray of shape (n_samples,), dtype=bool 

A mask of the observations that have been used to compute the re-weighted robust location and covariance estimates.     References  
RVDriessen  
A Fast Algorithm for the Minimum Covariance Determinant Estimator, 1999, American Statistical Association and the American Society for Quality, TECHNOMETRICS
score(X, y, sample_weight=None) [source]
 
Returns the mean accuracy on the given test data and labels. In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Test samples.  
yarray-like of shape (n_samples,) or (n_samples, n_outputs) 

True labels for X.  
sample_weightarray-like of shape (n_samples,), default=None 

Sample weights.    Returns 
 
scorefloat 

Mean accuracy of self.predict(X) w.r.t. y.
score_samples(X) [source]
 
Compute the negative Mahalanobis distances.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

The data matrix.    Returns 
 
negative_mahal_distancesarray-like of shape (n_samples,) 

Opposite of the Mahalanobis distances.
fit(X, y=None) [source]
 
Fits the Maximum Likelihood Estimator covariance model according to the given training data and parameters.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training data, where n_samples is the number of samples and n_features is the number of features.  
yIgnored 

Not used, present for API consistency by convention.    Returns 
 
selfobject
score(X_test, y=None) [source]
 
Computes the log-likelihood of a Gaussian data set with self.covariance_ as an estimator of its covariance matrix.  Parameters 
 
X_testarray-like of shape (n_samples, n_features) 

Test data of which we compute the likelihood, where n_samples is the number of samples and n_features is the number of features. X_test is assumed to be drawn from the same distribution than the data used in fit (including centering).  
yIgnored 

Not used, present for API consistency by convention.    Returns 
 
resfloat 

The likelihood of the data set with self.covariance_ as an estimator of its covariance matrix.
sklearn.covariance.empirical_covariance(X, *, assume_centered=False) [source]
 
Computes the Maximum likelihood covariance estimator  Parameters 
 
Xndarray of shape (n_samples, n_features) 

Data from which to compute the covariance estimate  
assume_centeredbool, default=False 

If True, data will not be centered before computation. Useful when working with data whose mean is almost, but not exactly zero. If False, data will be centered before computation.    Returns 
 
covariancendarray of shape (n_features, n_features) 

Empirical covariance (Maximum Likelihood Estimator).     Examples >>> from sklearn.covariance import empirical_covariance
>>> X = [[1,1,1],[1,1,1],[1,1,1],
...      [0,0,0],[0,0,0],[0,0,0]]
>>> empirical_covariance(X)
array([[0.25, 0.25, 0.25],
       [0.25, 0.25, 0.25],
       [0.25, 0.25, 0.25]])
fit(X, y=None) [source]
 
Fits the GraphicalLasso model to X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data from which to compute the covariance estimate  
yIgnored 

Not used, present for API consistency by convention.    Returns 
 
selfobject
fit(X, y=None) [source]
 
Fits the GraphicalLasso covariance model to X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data from which to compute the covariance estimate  
yIgnored 

Not used, present for API consistency by convention.    Returns 
 
selfobject
sklearn.covariance.graphical_lasso(emp_cov, alpha, *, cov_init=None, mode='cd', tol=0.0001, enet_tol=0.0001, max_iter=100, verbose=False, return_costs=False, eps=2.220446049250313e-16, return_n_iter=False) [source]
 
l1-penalized covariance estimator Read more in the User Guide.  Changed in version v0.20: graph_lasso has been renamed to graphical_lasso   Parameters 
 
emp_covndarray of shape (n_features, n_features) 

Empirical covariance from which to compute the covariance estimate.  
alphafloat 

The regularization parameter: the higher alpha, the more regularization, the sparser the inverse covariance. Range is (0, inf].  
cov_initarray of shape (n_features, n_features), default=None 

The initial guess for the covariance. If None, then the empirical covariance is used.  
mode{‘cd’, ‘lars’}, default=’cd’ 

The Lasso solver to use: coordinate descent or LARS. Use LARS for very sparse underlying graphs, where p > n. Elsewhere prefer cd which is more numerically stable.  
tolfloat, default=1e-4 

The tolerance to declare convergence: if the dual gap goes below this value, iterations are stopped. Range is (0, inf].  
enet_tolfloat, default=1e-4 

The tolerance for the elastic net solver used to calculate the descent direction. This parameter controls the accuracy of the search direction for a given column update, not of the overall parameter estimate. Only used for mode=’cd’. Range is (0, inf].  
max_iterint, default=100 

The maximum number of iterations.  
verbosebool, default=False 

If verbose is True, the objective function and dual gap are printed at each iteration.  
return_costsbool, default=Flase 

If return_costs is True, the objective function and dual gap at each iteration are returned.  
epsfloat, default=eps 

The machine-precision regularization in the computation of the Cholesky diagonal factors. Increase this for very ill-conditioned systems. Default is np.finfo(np.float64).eps.  
return_n_iterbool, default=False 

Whether or not to return the number of iterations.    Returns 
 
covariancendarray of shape (n_features, n_features) 

The estimated covariance matrix.  
precisionndarray of shape (n_features, n_features) 

The estimated (sparse) precision matrix.  
costslist of (objective, dual_gap) pairs 

The list of values of the objective function and the dual gap at each iteration. Returned only if return_costs is True.  
n_iterint 

Number of iterations. Returned only if return_n_iter is set to True.      See also  
GraphicalLasso, GraphicalLassoCV

  Notes The algorithm employed to solve this problem is the GLasso algorithm, from the Friedman 2008 Biostatistics paper. It is the same algorithm as in the R glasso package. One possible difference with the glasso R package is that the diagonal coefficients are not penalized.
fit(X, y=None) [source]
 
Fit the Ledoit-Wolf shrunk covariance model according to the given training data and parameters.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training data, where n_samples is the number of samples and n_features is the number of features.  
yIgnored 

Not used, present for API consistency by convention.    Returns 
 
selfobject
sklearn.covariance.ledoit_wolf(X, *, assume_centered=False, block_size=1000) [source]
 
Estimates the shrunk Ledoit-Wolf covariance matrix. Read more in the User Guide.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data from which to compute the covariance estimate  
assume_centeredbool, default=False 

If True, data will not be centered before computation. Useful to work with data whose mean is significantly equal to zero but is not exactly zero. If False, data will be centered before computation.  
block_sizeint, default=1000 

Size of blocks into which the covariance matrix will be split. This is purely a memory optimization and does not affect results.    Returns 
 
shrunk_covndarray of shape (n_features, n_features) 

Shrunk covariance.  
shrinkagefloat 

Coefficient in the convex combination used for the computation of the shrunk estimate.     Notes The regularized (shrunk) covariance is: (1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features) where mu = trace(cov) / n_features
fit(X, y=None) [source]
 
Fits a Minimum Covariance Determinant with the FastMCD algorithm.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training data, where n_samples is the number of samples and n_features is the number of features.  y: Ignored

Not used, present for API consistency by convention.    Returns 
 
selfobject
sklearn.covariance.oas(X, *, assume_centered=False) [source]
 
Estimate covariance with the Oracle Approximating Shrinkage algorithm.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data from which to compute the covariance estimate.  
assume_centeredbool, default=False 

If True, data will not be centered before computation. Useful to work with data whose mean is significantly equal to zero but is not exactly zero. If False, data will be centered before computation.    Returns 
 
shrunk_covarray-like of shape (n_features, n_features) 

Shrunk covariance.  
shrinkagefloat 

Coefficient in the convex combination used for the computation of the shrunk estimate.     Notes The regularised (shrunk) covariance is: (1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features) where mu = trace(cov) / n_features The formula we used to implement the OAS is slightly modified compared to the one given in the article. See OAS for more details.
fit(X, y=None) [source]
 
Fit the Oracle Approximating Shrinkage covariance model according to the given training data and parameters.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training data, where n_samples is the number of samples and n_features is the number of features.  
yIgnored 

Not used, present for API consistency by convention.    Returns 
 
selfobject
fit(X, y=None) [source]
 
Fit the shrunk covariance model according to the given training data and parameters.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training data, where n_samples is the number of samples and n_features is the number of features.  y: Ignored

Not used, present for API consistency by convention.    Returns 
 
selfobject
sklearn.covariance.shrunk_covariance(emp_cov, shrinkage=0.1) [source]
 
Calculates a covariance matrix shrunk on the diagonal Read more in the User Guide.  Parameters 
 
emp_covarray-like of shape (n_features, n_features) 

Covariance matrix to be shrunk  
shrinkagefloat, default=0.1 

Coefficient in the convex combination used for the computation of the shrunk estimate. Range is [0, 1].    Returns 
 
shrunk_covndarray of shape (n_features, n_features) 

Shrunk covariance.     Notes The regularized (shrunk) covariance is given by: (1 - shrinkage) * cov + shrinkage * mu * np.identity(n_features) where mu = trace(cov) / n_features
fit(X, Y) [source]
 
Fit model to data.  Parameters 
 
Xarray-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.  
Yarray-like of shape (n_samples,) or (n_samples, n_targets) 

Target vectors, where n_samples is the number of samples and n_targets is the number of response variables.
fit_transform(X, y=None) [source]
 
Learn and apply the dimension reduction on the train data.  Parameters 
 
Xarray-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.  
yarray-like of shape (n_samples, n_targets), default=None 

Target vectors, where n_samples is the number of samples and n_targets is the number of response variables.    Returns 
 x_scores if Y is not given, (x_scores, y_scores) otherwise.
inverse_transform(X) [source]
 
Transform data back to its original space.  Parameters 
 
Xarray-like of shape (n_samples, n_components) 

New data, where n_samples is the number of samples and n_components is the number of pls components.    Returns 
 
x_reconstructedarray-like of shape (n_samples, n_features) 
   Notes This transformation will only be exact if n_components=n_features.
predict(X, copy=True) [source]
 
Predict targets of given samples.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Samples.  
copybool, default=True 

Whether to copy X and Y, or perform in-place normalization.     Notes This call requires the estimation of a matrix of shape (n_features, n_targets), which may be an issue in high dimensional space.
transform(X, Y=None, copy=True) [source]
 
Apply the dimension reduction.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Samples to transform.  
Yarray-like of shape (n_samples, n_targets), default=None 

Target vectors.  
copybool, default=True 

Whether to copy X and Y, or perform in-place normalization.    Returns 
 
x_scores if Y is not given, (x_scores, y_scores) otherwise.
fit(X, Y) [source]
 
Fit model to data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training samples.  
Yarray-like of shape (n_samples,) or (n_samples, n_targets) 

Targets.
fit_transform(X, y=None) [source]
 
Learn and apply the dimensionality reduction.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training samples.  
yarray-like of shape (n_samples,) or (n_samples, n_targets), default=None 

Targets.    Returns 
 
outarray-like or tuple of array-like 

The transformed data X_tranformed if Y is not None, (X_transformed, Y_transformed) otherwise.
transform(X, Y=None) [source]
 
Apply the dimensionality reduction.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Samples to be transformed.  
Yarray-like of shape (n_samples,) or (n_samples, n_targets), default=None 

Targets.    Returns 
 
outarray-like or tuple of array-like 

The transformed data X_tranformed if Y is not None, (X_transformed, Y_transformed) otherwise.
sklearn.datasets.clear_data_home(data_home=None) [source]
 
Delete all the content of the data home cache.  Parameters 
 
data_homestr, default=None 

The path to scikit-learn data directory. If None, the default path is ~/sklearn_learn_data.
sklearn.datasets.dump_svmlight_file(X, y, f, *, zero_based=True, comment=None, query_id=None, multilabel=False) [source]
 
Dump the dataset in svmlight / libsvm file format. This format is a text-based format, with one sample per line. It does not store zero valued features hence is suitable for sparse dataset. The first element of each line can be used to store a target variable to predict.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training vectors, where n_samples is the number of samples and n_features is the number of features.  
y{array-like, sparse matrix}, shape = [n_samples (, n_labels)] 

Target values. Class labels must be an integer or float, or array-like objects of integer or float for multilabel classifications.  
fstring or file-like in binary mode 

If string, specifies the path that will contain the data. If file-like, data will be written to f. f should be opened in binary mode.  
zero_basedboolean, default=True 

Whether column indices should be written zero-based (True) or one-based (False).  
commentstring, default=None 

Comment to insert at the top of the file. This should be either a Unicode string, which will be encoded as UTF-8, or an ASCII byte string. If a comment is given, then it will be preceded by one that identifies the file as having been dumped by scikit-learn. Note that not all tools grok comments in SVMlight files.  
query_idarray-like of shape (n_samples,), default=None 

Array containing pairwise preference constraints (qid in svmlight format).  
multilabelboolean, default=False 

Samples may have several labels each (see https://www.csie.ntu.edu.tw/~cjlin/libsvmtools/datasets/multilabel.html)  New in version 0.17: parameter multilabel to support multilabel datasets.