neulab/docprompting-conala huggingface dataset:
sklearn.preprocessing.binarize(X, *, threshold=0.0, copy=True) [source]
 
Boolean thresholding of array-like or scipy.sparse matrix. Read more in the User Guide.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data to binarize, element by element. scipy.sparse matrices should be in CSR or CSC format to avoid an un-necessary copy.  
thresholdfloat, default=0.0 

Feature values below or equal to this are replaced by 0, above it by 1. Threshold may not be less than 0 for operations on sparse matrices.  
copybool, default=True 

set to False to perform inplace binarization and avoid a copy (if the input is already a numpy array or a scipy.sparse CSR / CSC matrix and if axis is 1).    Returns 
 
X_tr{ndarray, sparse matrix} of shape (n_samples, n_features) 

The transformed data.      See also  
Binarizer


Performs binarization using the Transformer API (e.g. as part of a preprocessing Pipeline).
fit(X, y=None) [source]
 
Do nothing and return the estimator unchanged. This method is just there to implement the usual API and hence work in pipelines.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data.  
yNone 

Ignored.    Returns 
 
selfobject 

Fitted transformer.
transform(X, copy=None) [source]
 
Binarize each element of X.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data to binarize, element by element. scipy.sparse matrices should be in CSR format to avoid an un-necessary copy.  
copybool 

Copy the input X or not.    Returns 
 
X_tr{ndarray, sparse matrix} of shape (n_samples, n_features) 

Transformed array.
fit(X, y=None) [source]
 
Fit transformer by checking X. If validate is True, X will be checked.  Parameters 
 
Xarray-like, shape (n_samples, n_features) 

Input array.    Returns 
 self
inverse_transform(X) [source]
 
Transform X using the inverse function.  Parameters 
 
Xarray-like, shape (n_samples, n_features) 

Input array.    Returns 
 
X_outarray-like, shape (n_samples, n_features) 

Transformed input.
transform(X) [source]
 
Transform X using the forward function.  Parameters 
 
Xarray-like, shape (n_samples, n_features) 

Input array.    Returns 
 
X_outarray-like, shape (n_samples, n_features) 

Transformed input.
fit(X, y=None) [source]
 
Fit the estimator.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data to be discretized.  
yNone 

Ignored. This parameter exists only for compatibility with Pipeline.    Returns 
 self
inverse_transform(Xt) [source]
 
Transform discretized data back to original feature space. Note that this function does not regenerate the original data due to discretization rounding.  Parameters 
 
Xtarray-like of shape (n_samples, n_features) 

Transformed data in the binned space.    Returns 
 
Xinvndarray, dtype={np.float32, np.float64} 

Data in the original feature space.
transform(X) [source]
 
Discretize the data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data to be discretized.    Returns 
 
Xt{ndarray, sparse matrix}, dtype={np.float32, np.float64} 

Data in the binned space. Will be a sparse matrix if self.encode='onehot' and ndarray otherwise.
sklearn.preprocessing.KernelCenterer  
class sklearn.preprocessing.KernelCenterer [source]
 
Center a kernel matrix. Let K(x, z) be a kernel defined by phi(x)^T phi(z), where phi is a function mapping x to a Hilbert space. KernelCenterer centers (i.e., normalize to have zero mean) the data without explicitly computing phi(x). It is equivalent to centering phi(x) with sklearn.preprocessing.StandardScaler(with_std=False). Read more in the User Guide.  Attributes 
 
K_fit_rows_array of shape (n_samples,) 

Average of each column of kernel matrix.  
K_fit_all_float 

Average of kernel matrix.     Examples >>> from sklearn.preprocessing import KernelCenterer
>>> from sklearn.metrics.pairwise import pairwise_kernels
>>> X = [[ 1., -2.,  2.],
...      [ -2.,  1.,  3.],
...      [ 4.,  1., -2.]]
>>> K = pairwise_kernels(X, metric='linear')
>>> K
array([[  9.,   2.,  -2.],
       [  2.,  14., -13.],
       [ -2., -13.,  21.]])
>>> transformer = KernelCenterer().fit(K)
>>> transformer
KernelCenterer()
>>> transformer.transform(K)
array([[  5.,   0.,  -5.],
       [  0.,  14., -14.],
       [ -5., -14.,  19.]])
 Methods  
fit(K[, y]) Fit KernelCenterer  
fit_transform(X[, y]) Fit to data, then transform it.  
get_params([deep]) Get parameters for this estimator.  
set_params(**params) Set the parameters of this estimator.  
transform(K[, copy]) Center kernel matrix.    
fit(K, y=None) [source]
 
Fit KernelCenterer  Parameters 
 
Kndarray of shape (n_samples, n_samples) 

Kernel matrix.  
yNone 

Ignored.    Returns 
 
selfobject 

Fitted transformer.     
  
fit_transform(X, y=None, **fit_params) [source]
 
Fit to data, then transform it. Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Input samples.  
yarray-like of shape (n_samples,) or (n_samples, n_outputs), default=None 

Target values (None for unsupervised transformations).  
**fit_paramsdict 

Additional fit parameters.    Returns 
 
X_newndarray array of shape (n_samples, n_features_new) 

Transformed array.     
  
get_params(deep=True) [source]
 
Get parameters for this estimator.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsdict 

Parameter names mapped to their values.     
  
set_params(**params) [source]
 
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.  Parameters 
 
**paramsdict 

Estimator parameters.    Returns 
 
selfestimator instance 

Estimator instance.     
  
transform(K, copy=True) [source]
 
Center kernel matrix.  Parameters 
 
Kndarray of shape (n_samples1, n_samples2) 

Kernel matrix.  
copybool, default=True 

Set to False to perform inplace computation.    Returns 
 
K_newndarray of shape (n_samples1, n_samples2)
class sklearn.preprocessing.KernelCenterer [source]
 
Center a kernel matrix. Let K(x, z) be a kernel defined by phi(x)^T phi(z), where phi is a function mapping x to a Hilbert space. KernelCenterer centers (i.e., normalize to have zero mean) the data without explicitly computing phi(x). It is equivalent to centering phi(x) with sklearn.preprocessing.StandardScaler(with_std=False). Read more in the User Guide.  Attributes 
 
K_fit_rows_array of shape (n_samples,) 

Average of each column of kernel matrix.  
K_fit_all_float 

Average of kernel matrix.     Examples >>> from sklearn.preprocessing import KernelCenterer
>>> from sklearn.metrics.pairwise import pairwise_kernels
>>> X = [[ 1., -2.,  2.],
...      [ -2.,  1.,  3.],
...      [ 4.,  1., -2.]]
>>> K = pairwise_kernels(X, metric='linear')
>>> K
array([[  9.,   2.,  -2.],
       [  2.,  14., -13.],
       [ -2., -13.,  21.]])
>>> transformer = KernelCenterer().fit(K)
>>> transformer
KernelCenterer()
>>> transformer.transform(K)
array([[  5.,   0.,  -5.],
       [  0.,  14., -14.],
       [ -5., -14.,  19.]])
 Methods  
fit(K[, y]) Fit KernelCenterer  
fit_transform(X[, y]) Fit to data, then transform it.  
get_params([deep]) Get parameters for this estimator.  
set_params(**params) Set the parameters of this estimator.  
transform(K[, copy]) Center kernel matrix.    
fit(K, y=None) [source]
 
Fit KernelCenterer  Parameters 
 
Kndarray of shape (n_samples, n_samples) 

Kernel matrix.  
yNone 

Ignored.    Returns 
 
selfobject 

Fitted transformer.     
  
fit_transform(X, y=None, **fit_params) [source]
 
Fit to data, then transform it. Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Input samples.  
yarray-like of shape (n_samples,) or (n_samples, n_outputs), default=None 

Target values (None for unsupervised transformations).  
**fit_paramsdict 

Additional fit parameters.    Returns 
 
X_newndarray array of shape (n_samples, n_features_new) 

Transformed array.     
  
get_params(deep=True) [source]
 
Get parameters for this estimator.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsdict 

Parameter names mapped to their values.     
  
set_params(**params) [source]
 
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.  Parameters 
 
**paramsdict 

Estimator parameters.    Returns 
 
selfestimator instance 

Estimator instance.     
  
transform(K, copy=True) [source]
 
Center kernel matrix.  Parameters 
 
Kndarray of shape (n_samples1, n_samples2) 

Kernel matrix.  
copybool, default=True 

Set to False to perform inplace computation.    Returns 
 
K_newndarray of shape (n_samples1, n_samples2)
fit(K, y=None) [source]
 
Fit KernelCenterer  Parameters 
 
Kndarray of shape (n_samples, n_samples) 

Kernel matrix.  
yNone 

Ignored.    Returns 
 
selfobject 

Fitted transformer.
transform(K, copy=True) [source]
 
Center kernel matrix.  Parameters 
 
Kndarray of shape (n_samples1, n_samples2) 

Kernel matrix.  
copybool, default=True 

Set to False to perform inplace computation.    Returns 
 
K_newndarray of shape (n_samples1, n_samples2)
fit(y) [source]
 
Fit label binarizer.  Parameters 
 
yndarray of shape (n_samples,) or (n_samples, n_classes) 

Target values. The 2-d matrix should only contain 0 and 1, represents multilabel classification.    Returns 
 
selfreturns an instance of self.
fit_transform(y) [source]
 
Fit label binarizer and transform multi-class labels to binary labels. The output of transform is sometimes referred to as the 1-of-K coding scheme.  Parameters 
 
y{ndarray, sparse matrix} of shape (n_samples,) or (n_samples, n_classes) 

Target values. The 2-d matrix should only contain 0 and 1, represents multilabel classification. Sparse matrix can be CSR, CSC, COO, DOK, or LIL.    Returns 
 
Y{ndarray, sparse matrix} of shape (n_samples, n_classes) 

Shape will be (n_samples, 1) for binary problems. Sparse matrix will be of CSR format.
inverse_transform(Y, threshold=None) [source]
 
Transform binary labels back to multi-class labels.  Parameters 
 
Y{ndarray, sparse matrix} of shape (n_samples, n_classes) 

Target values. All sparse matrices are converted to CSR before inverse transformation.  
thresholdfloat, default=None 

Threshold used in the binary and multi-label cases. Use 0 when Y contains the output of decision_function (classifier). Use 0.5 when Y contains the output of predict_proba. If None, the threshold is assumed to be half way between neg_label and pos_label.    Returns 
 
y{ndarray, sparse matrix} of shape (n_samples,) 

Target values. Sparse matrix will be of CSR format.     Notes In the case when the binary labels are fractional (probabilistic), inverse_transform chooses the class with the greatest value. Typically, this allows to use the output of a linear model’s decision_function method directly as the input of inverse_transform.
transform(y) [source]
 
Transform multi-class labels to binary labels. The output of transform is sometimes referred to by some authors as the 1-of-K coding scheme.  Parameters 
 
y{array, sparse matrix} of shape (n_samples,) or (n_samples, n_classes) 

Target values. The 2-d matrix should only contain 0 and 1, represents multilabel classification. Sparse matrix can be CSR, CSC, COO, DOK, or LIL.    Returns 
 
Y{ndarray, sparse matrix} of shape (n_samples, n_classes) 

Shape will be (n_samples, 1) for binary problems. Sparse matrix will be of CSR format.
class sklearn.preprocessing.LabelEncoder [source]
 
Encode target labels with value between 0 and n_classes-1. This transformer should be used to encode target values, i.e. y, and not the input X. Read more in the User Guide.  New in version 0.12.   Attributes 
 
classes_ndarray of shape (n_classes,) 

Holds the label for each class.      See also  
OrdinalEncoder


Encode categorical features using an ordinal encoding scheme.  
OneHotEncoder


Encode categorical features as a one-hot numeric array.    Examples LabelEncoder can be used to normalize labels. >>> from sklearn import preprocessing
>>> le = preprocessing.LabelEncoder()
>>> le.fit([1, 2, 2, 6])
LabelEncoder()
>>> le.classes_
array([1, 2, 6])
>>> le.transform([1, 1, 2, 6])
array([0, 0, 1, 2]...)
>>> le.inverse_transform([0, 0, 1, 2])
array([1, 1, 2, 6])
 It can also be used to transform non-numerical labels (as long as they are hashable and comparable) to numerical labels. >>> le = preprocessing.LabelEncoder()
>>> le.fit(["paris", "paris", "tokyo", "amsterdam"])
LabelEncoder()
>>> list(le.classes_)
['amsterdam', 'paris', 'tokyo']
>>> le.transform(["tokyo", "tokyo", "paris"])
array([2, 2, 1]...)
>>> list(le.inverse_transform([2, 2, 1]))
['tokyo', 'tokyo', 'paris']
 Methods  
fit(y) Fit label encoder.  
fit_transform(y) Fit label encoder and return encoded labels.  
get_params([deep]) Get parameters for this estimator.  
inverse_transform(y) Transform labels back to original encoding.  
set_params(**params) Set the parameters of this estimator.  
transform(y) Transform labels to normalized encoding.    
fit(y) [source]
 
Fit label encoder.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
selfreturns an instance of self. 
   
  
fit_transform(y) [source]
 
Fit label encoder and return encoded labels.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
yarray-like of shape (n_samples,) 
   
  
get_params(deep=True) [source]
 
Get parameters for this estimator.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsdict 

Parameter names mapped to their values.     
  
inverse_transform(y) [source]
 
Transform labels back to original encoding.  Parameters 
 
yndarray of shape (n_samples,) 

Target values.    Returns 
 
yndarray of shape (n_samples,) 
   
  
set_params(**params) [source]
 
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.  Parameters 
 
**paramsdict 

Estimator parameters.    Returns 
 
selfestimator instance 

Estimator instance.     
  
transform(y) [source]
 
Transform labels to normalized encoding.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
yarray-like of shape (n_samples,)
sklearn.preprocessing.LabelEncoder  
class sklearn.preprocessing.LabelEncoder [source]
 
Encode target labels with value between 0 and n_classes-1. This transformer should be used to encode target values, i.e. y, and not the input X. Read more in the User Guide.  New in version 0.12.   Attributes 
 
classes_ndarray of shape (n_classes,) 

Holds the label for each class.      See also  
OrdinalEncoder


Encode categorical features using an ordinal encoding scheme.  
OneHotEncoder


Encode categorical features as a one-hot numeric array.    Examples LabelEncoder can be used to normalize labels. >>> from sklearn import preprocessing
>>> le = preprocessing.LabelEncoder()
>>> le.fit([1, 2, 2, 6])
LabelEncoder()
>>> le.classes_
array([1, 2, 6])
>>> le.transform([1, 1, 2, 6])
array([0, 0, 1, 2]...)
>>> le.inverse_transform([0, 0, 1, 2])
array([1, 1, 2, 6])
 It can also be used to transform non-numerical labels (as long as they are hashable and comparable) to numerical labels. >>> le = preprocessing.LabelEncoder()
>>> le.fit(["paris", "paris", "tokyo", "amsterdam"])
LabelEncoder()
>>> list(le.classes_)
['amsterdam', 'paris', 'tokyo']
>>> le.transform(["tokyo", "tokyo", "paris"])
array([2, 2, 1]...)
>>> list(le.inverse_transform([2, 2, 1]))
['tokyo', 'tokyo', 'paris']
 Methods  
fit(y) Fit label encoder.  
fit_transform(y) Fit label encoder and return encoded labels.  
get_params([deep]) Get parameters for this estimator.  
inverse_transform(y) Transform labels back to original encoding.  
set_params(**params) Set the parameters of this estimator.  
transform(y) Transform labels to normalized encoding.    
fit(y) [source]
 
Fit label encoder.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
selfreturns an instance of self. 
   
  
fit_transform(y) [source]
 
Fit label encoder and return encoded labels.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
yarray-like of shape (n_samples,) 
   
  
get_params(deep=True) [source]
 
Get parameters for this estimator.  Parameters 
 
deepbool, default=True 

If True, will return the parameters for this estimator and contained subobjects that are estimators.    Returns 
 
paramsdict 

Parameter names mapped to their values.     
  
inverse_transform(y) [source]
 
Transform labels back to original encoding.  Parameters 
 
yndarray of shape (n_samples,) 

Target values.    Returns 
 
yndarray of shape (n_samples,) 
   
  
set_params(**params) [source]
 
Set the parameters of this estimator. The method works on simple estimators as well as on nested objects (such as Pipeline). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.  Parameters 
 
**paramsdict 

Estimator parameters.    Returns 
 
selfestimator instance 

Estimator instance.     
  
transform(y) [source]
 
Transform labels to normalized encoding.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
yarray-like of shape (n_samples,)
fit(y) [source]
 
Fit label encoder.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
selfreturns an instance of self.
fit_transform(y) [source]
 
Fit label encoder and return encoded labels.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
yarray-like of shape (n_samples,)
inverse_transform(y) [source]
 
Transform labels back to original encoding.  Parameters 
 
yndarray of shape (n_samples,) 

Target values.    Returns 
 
yndarray of shape (n_samples,)
transform(y) [source]
 
Transform labels to normalized encoding.  Parameters 
 
yarray-like of shape (n_samples,) 

Target values.    Returns 
 
yarray-like of shape (n_samples,)
sklearn.preprocessing.label_binarize(y, *, classes, neg_label=0, pos_label=1, sparse_output=False) [source]
 
Binarize labels in a one-vs-all fashion. Several regression and binary classification algorithms are available in scikit-learn. A simple way to extend these algorithms to the multi-class classification case is to use the so-called one-vs-all scheme. This function makes it possible to compute this transformation for a fixed set of class labels known ahead of time.  Parameters 
 
yarray-like 

Sequence of integer labels or multilabel data to encode.  
classesarray-like of shape (n_classes,) 

Uniquely holds the label for each class.  
neg_labelint, default=0 

Value with which negative labels must be encoded.  
pos_labelint, default=1 

Value with which positive labels must be encoded.  
sparse_outputbool, default=False, 

Set to true if output binary array is desired in CSR sparse format.    Returns 
 
Y{ndarray, sparse matrix} of shape (n_samples, n_classes) 

Shape will be (n_samples, 1) for binary problems. Sparse matrix will be of CSR format.      See also  
LabelBinarizer


Class used to wrap the functionality of label_binarize and allow for fitting to classes independently of the transform operation.    Examples >>> from sklearn.preprocessing import label_binarize
>>> label_binarize([1, 6], classes=[1, 2, 4, 6])
array([[1, 0, 0, 0],
       [0, 0, 0, 1]])
 The class ordering is preserved: >>> label_binarize([1, 6], classes=[1, 6, 4, 2])
array([[1, 0, 0, 0],
       [0, 1, 0, 0]])
 Binary targets transform to a column vector >>> label_binarize(['yes', 'no', 'no', 'yes'], classes=['no', 'yes'])
array([[1],
       [0],
       [0],
       [1]])
fit(X, y=None) [source]
 
Compute the maximum absolute value to be used for later scaling.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data used to compute the per-feature minimum and maximum used for later scaling along the features axis.  
yNone 

Ignored.    Returns 
 
selfobject 

Fitted scaler.
inverse_transform(X) [source]
 
Scale back the data to the original representation  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data that should be transformed back.    Returns 
 
X_tr{ndarray, sparse matrix} of shape (n_samples, n_features) 

Transformed array.
partial_fit(X, y=None) [source]
 
Online computation of max absolute value of X for later scaling. All of X is processed as a single batch. This is intended for cases when fit is not feasible due to very large number of n_samples or because X is read from a continuous stream.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data used to compute the mean and standard deviation used for later scaling along the features axis.  
yNone 

Ignored.    Returns 
 
selfobject 

Fitted scaler.
transform(X) [source]
 
Scale the data  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data that should be scaled.    Returns 
 
X_tr{ndarray, sparse matrix} of shape (n_samples, n_features) 

Transformed array.
sklearn.preprocessing.maxabs_scale(X, *, axis=0, copy=True) [source]
 
Scale each feature to the [-1, 1] range without breaking the sparsity. This estimator scales each feature individually such that the maximal absolute value of each feature in the training set will be 1.0. This scaler can also be applied to sparse CSR or CSC matrices.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

The data.  
axisint, default=0 

axis used to scale along. If 0, independently scale each feature, otherwise (if 1) scale each sample.  
copybool, default=True 

Set to False to perform inplace scaling and avoid a copy (if the input is already a numpy array).    Returns 
 
X_tr{ndarray, sparse matrix} of shape (n_samples, n_features) 

The transformed data.    Warning Risk of data leak Do not use maxabs_scale unless you know what you are doing. A common mistake is to apply it to the entire data before splitting into training and test sets. This will bias the model evaluation because information would have leaked from the test set to the training set. In general, we recommend using MaxAbsScaler within a Pipeline in order to prevent most risks of data leaking: pipe = make_pipeline(MaxAbsScaler(), LogisticRegression()).     See also  
MaxAbsScaler


Performs scaling to the [-1, 1] range using the Transformer API (e.g. as part of a preprocessing Pipeline).    Notes NaNs are treated as missing values: disregarded to compute the statistics, and maintained during the data transformation. For a comparison of the different scalers, transformers, and normalizers, see examples/preprocessing/plot_all_scaling.py.
fit(X, y=None) [source]
 
Compute the minimum and maximum to be used for later scaling.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

The data used to compute the per-feature minimum and maximum used for later scaling along the features axis.  
yNone 

Ignored.    Returns 
 
selfobject 

Fitted scaler.
inverse_transform(X) [source]
 
Undo the scaling of X according to feature_range.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Input data that will be transformed. It cannot be sparse.    Returns 
 
Xtndarray of shape (n_samples, n_features) 

Transformed data.