neulab/docprompting-conala huggingface dataset:
class sklearn.gaussian_process.kernels.Hyperparameter(name, value_type, bounds, n_elements=1, fixed=None) [source]
 
A kernel hyperparameter’s specification in form of a namedtuple.  New in version 0.18.   Attributes 
 
namestr 

The name of the hyperparameter. Note that a kernel using a hyperparameter with name “x” must have the attributes self.x and self.x_bounds  
value_typestr 

The type of the hyperparameter. Currently, only “numeric” hyperparameters are supported.  
boundspair of floats >= 0 or “fixed” 

The lower and upper bound on the parameter. If n_elements>1, a pair of 1d array with n_elements each may be given alternatively. If the string “fixed” is passed as bounds, the hyperparameter’s value cannot be changed.  
n_elementsint, default=1 

The number of elements of the hyperparameter value. Defaults to 1, which corresponds to a scalar hyperparameter. n_elements > 1 corresponds to a hyperparameter which is vector-valued, such as, e.g., anisotropic length-scales.  
fixedbool, default=None 

Whether the value of this hyperparameter is fixed, i.e., cannot be changed during hyperparameter tuning. If None is passed, the “fixed” is derived based on the given bounds.     Examples >>> from sklearn.gaussian_process.kernels import ConstantKernel
>>> from sklearn.datasets import make_friedman2
>>> from sklearn.gaussian_process import GaussianProcessRegressor
>>> from sklearn.gaussian_process.kernels import Hyperparameter
>>> X, y = make_friedman2(n_samples=50, noise=0, random_state=0)
>>> kernel = ConstantKernel(constant_value=1.0,
...    constant_value_bounds=(0.0, 10.0))
 We can access each hyperparameter: >>> for hyperparameter in kernel.hyperparameters:
...    print(hyperparameter)
Hyperparameter(name='constant_value', value_type='numeric',
bounds=array([[ 0., 10.]]), n_elements=1, fixed=False)
 >>> params = kernel.get_params()
>>> for key in sorted(params): print(f"{key} : {params[key]}")
constant_value : 1.0
constant_value_bounds : (0.0, 10.0)
 Methods  
count(value, /) Return number of occurrences of value.  
index(value[, start, stop]) Return first index of value.    
__call__(*args, **kwargs)  
Call self as a function. 
  
bounds  
Alias for field number 2 
  
count(value, /)  
Return number of occurrences of value. 
  
fixed  
Alias for field number 4 
  
index(value, start=0, stop=sys.maxsize, /)  
Return first index of value. Raises ValueError if the value is not present. 
  
n_elements  
Alias for field number 3 
  
name  
Alias for field number 0 
  
value_type  
Alias for field number 1
sklearn.gaussian_process.kernels.Hyperparameter  
class sklearn.gaussian_process.kernels.Hyperparameter(name, value_type, bounds, n_elements=1, fixed=None) [source]
 
A kernel hyperparameter’s specification in form of a namedtuple.  New in version 0.18.   Attributes 
 
namestr 

The name of the hyperparameter. Note that a kernel using a hyperparameter with name “x” must have the attributes self.x and self.x_bounds  
value_typestr 

The type of the hyperparameter. Currently, only “numeric” hyperparameters are supported.  
boundspair of floats >= 0 or “fixed” 

The lower and upper bound on the parameter. If n_elements>1, a pair of 1d array with n_elements each may be given alternatively. If the string “fixed” is passed as bounds, the hyperparameter’s value cannot be changed.  
n_elementsint, default=1 

The number of elements of the hyperparameter value. Defaults to 1, which corresponds to a scalar hyperparameter. n_elements > 1 corresponds to a hyperparameter which is vector-valued, such as, e.g., anisotropic length-scales.  
fixedbool, default=None 

Whether the value of this hyperparameter is fixed, i.e., cannot be changed during hyperparameter tuning. If None is passed, the “fixed” is derived based on the given bounds.     Examples >>> from sklearn.gaussian_process.kernels import ConstantKernel
>>> from sklearn.datasets import make_friedman2
>>> from sklearn.gaussian_process import GaussianProcessRegressor
>>> from sklearn.gaussian_process.kernels import Hyperparameter
>>> X, y = make_friedman2(n_samples=50, noise=0, random_state=0)
>>> kernel = ConstantKernel(constant_value=1.0,
...    constant_value_bounds=(0.0, 10.0))
 We can access each hyperparameter: >>> for hyperparameter in kernel.hyperparameters:
...    print(hyperparameter)
Hyperparameter(name='constant_value', value_type='numeric',
bounds=array([[ 0., 10.]]), n_elements=1, fixed=False)
 >>> params = kernel.get_params()
>>> for key in sorted(params): print(f"{key} : {params[key]}")
constant_value : 1.0
constant_value_bounds : (0.0, 10.0)
 Methods  
count(value, /) Return number of occurrences of value.  
index(value[, start, stop]) Return first index of value.    
__call__(*args, **kwargs)  
Call self as a function. 
  
bounds  
Alias for field number 2 
  
count(value, /)  
Return number of occurrences of value. 
  
fixed  
Alias for field number 4 
  
index(value, start=0, stop=sys.maxsize, /)  
Return first index of value. Raises ValueError if the value is not present. 
  
n_elements  
Alias for field number 3 
  
name  
Alias for field number 0 
  
value_type  
Alias for field number 1 
 
 Examples using sklearn.gaussian_process.kernels.Hyperparameter
 
  Gaussian processes on discrete data structures
index(value, start=0, stop=sys.maxsize, /)  
Return first index of value. Raises ValueError if the value is not present.
class sklearn.gaussian_process.kernels.Kernel [source]
 
Base class for all kernels.  New in version 0.18.   Attributes 
 
bounds


Returns the log-transformed bounds on the theta.  
hyperparameters


Returns a list of all hyperparameter specifications.  
n_dims


Returns the number of non-fixed hyperparameters of the kernel.  
requires_vector_input


Returns whether the kernel is defined on fixed-length feature vectors or generic objects.  
theta


Returns the (flattened, log-transformed) non-fixed hyperparameters.     Methods  
__call__(X[, Y, eval_gradient]) Evaluate the kernel.  
clone_with_theta(theta) Returns a clone of self with given hyperparameters theta.  
diag(X) Returns the diagonal of the kernel k(X, X).  
get_params([deep]) Get parameters of this kernel.  
is_stationary() Returns whether the kernel is stationary.  
set_params(**params) Set the parameters of this kernel.    
abstract __call__(X, Y=None, eval_gradient=False) [source]
 
Evaluate the kernel. 
  
property bounds  
Returns the log-transformed bounds on the theta.  Returns 
 
boundsndarray of shape (n_dims, 2) 

The log-transformed bounds on the kernel’s hyperparameters theta     
  
clone_with_theta(theta) [source]
 
Returns a clone of self with given hyperparameters theta.  Parameters 
 
thetandarray of shape (n_dims,) 

The hyperparameters     
  
abstract diag(X) [source]
 
Returns the diagonal of the kernel k(X, X). The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.  Parameters 
 
Xarray-like of shape (n_samples,) 

Left argument of the returned kernel k(X, Y)    Returns 
 
K_diagndarray of shape (n_samples_X,) 

Diagonal of kernel k(X, X)     
  
get_params(deep=True) [source]
 
Get parameters of this kernel.  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.     
  
property hyperparameters  
Returns a list of all hyperparameter specifications. 
  
abstract is_stationary() [source]
 
Returns whether the kernel is stationary. 
  
property n_dims  
Returns the number of non-fixed hyperparameters of the kernel. 
  
property requires_vector_input  
Returns whether the kernel is defined on fixed-length feature vectors or generic objects. Defaults to True for backward compatibility. 
  
set_params(**params) [source]
 
Set the parameters of this kernel. The method works on simple kernels as well as on nested kernels. The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.  Returns 
 self
   
  
property theta  
Returns the (flattened, log-transformed) non-fixed hyperparameters. Note that theta are typically the log-transformed values of the kernel’s hyperparameters as this representation of the search space is more amenable for hyperparameter search, as hyperparameters like length-scales naturally live on a log-scale.  Returns 
 
thetandarray of shape (n_dims,) 

The non-fixed, log-transformed hyperparameters of the kernel
abstract diag(X) [source]
 
Returns the diagonal of the kernel k(X, X). The result of this method is identical to np.diag(self(X)); however, it can be evaluated more efficiently since only the diagonal is evaluated.  Parameters 
 
Xarray-like of shape (n_samples,) 

Left argument of the returned kernel k(X, Y)    Returns 
 
K_diagndarray of shape (n_samples_X,) 

Diagonal of kernel k(X, X)
abstract __call__(X, Y=None, eval_gradient=False) [source]
 
Evaluate the kernel.
__call__(X, Y=None, eval_gradient=False) [source]
 
Return the kernel k(X, Y) and optionally its gradient.  Parameters 
 
Xndarray of shape (n_samples_X, n_features) 

Left argument of the returned kernel k(X, Y)  
Yndarray of shape (n_samples_Y, n_features), default=None 

Right argument of the returned kernel k(X, Y). If None, k(X, X) if evaluated instead.  
eval_gradientbool, default=False 

Determines whether the gradient with respect to the log of the kernel hyperparameter is computed. Only supported when Y is None.    Returns 
 
Kndarray of shape (n_samples_X, n_samples_Y) 

Kernel k(X, Y)  
K_gradientndarray of shape (n_samples_X, n_samples_X, n_dims) 

The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
__call__(X, Y=None, eval_gradient=False) [source]
 
Return the kernel k(X, Y) and optionally its gradient.  Parameters 
 
Xarray-like of shape (n_samples_X, n_features) or list of object 

Left argument of the returned kernel k(X, Y)  
Yarray-like of shape (n_samples_X, n_features) or list of object, default=None 

Right argument of the returned kernel k(X, Y). If None, k(X, X) is evaluated instead.  
eval_gradientbool, default=False 

Determines whether the gradient with respect to the log of the kernel hyperparameter is computed.    Returns 
 
Kndarray of shape (n_samples_X, n_samples_Y) 

Kernel k(X, Y)  
K_gradientndarray of shape (n_samples_X, n_samples_X, n_dims), optional 

The gradient of the kernel k(X, X) with respect to the log of the hyperparameter of the kernel. Only returned when eval_gradient is True.
sklearn.get_config() [source]
 
Retrieve current values for configuration set by set_config  Returns 
 
configdict 

Keys are parameter names that can be passed to set_config.      See also  
config_context


Context manager for global scikit-learn configuration.  
set_config


Set global scikit-learn configuration.
fit(X, y=None) [source]
 
Fits the imputer on X and return self.  Parameters 
 
Xarray-like, shape (n_samples, n_features) 

Input data, where “n_samples” is the number of samples and “n_features” is the number of features.  
yignored 
  Returns 
 
selfobject 

Returns self.
fit_transform(X, y=None) [source]
 
Fits the imputer on X and return the transformed X.  Parameters 
 
Xarray-like, shape (n_samples, n_features) 

Input data, where “n_samples” is the number of samples and “n_features” is the number of features.  
yignored. 
  Returns 
 
Xtarray-like, shape (n_samples, n_features) 

The imputed input data.
transform(X) [source]
 
Imputes all missing values in X. Note that this is stochastic, and that if random_state is not fixed, repeated calls, or permuted input, will yield different results.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

The input data to complete.    Returns 
 
Xtarray-like, shape (n_samples, n_features) 

The imputed input data.
fit(X, y=None) [source]
 
Fit the imputer on X.  Parameters 
 
Xarray-like shape of (n_samples, n_features) 

Input data, where n_samples is the number of samples and n_features is the number of features.    Returns 
 
selfobject
transform(X) [source]
 
Impute all missing values in X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

The input data to complete.    Returns 
 
Xarray-like of shape (n_samples, n_output_features) 

The imputed dataset. n_output_features is the number of features that is not always missing during fit.
fit(X, y=None) [source]
 
Fit the transformer on X.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

Input data, where n_samples is the number of samples and n_features is the number of features.    Returns 
 
selfobject 

Returns self.
fit_transform(X, y=None) [source]
 
Generate missing values indicator for X.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

The input data to complete.    Returns 
 
Xt{ndarray or sparse matrix}, shape (n_samples, n_features) or (n_samples, n_features_with_missing) 

The missing indicator for input data. The data type of Xt will be boolean.
transform(X) [source]
 
Generate missing values indicator for X.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

The input data to complete.    Returns 
 
Xt{ndarray or sparse matrix}, shape (n_samples, n_features) or (n_samples, n_features_with_missing) 

The missing indicator for input data. The data type of Xt will be boolean.
fit(X, y=None) [source]
 
Fit the imputer on X.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

Input data, where n_samples is the number of samples and n_features is the number of features.    Returns 
 
selfSimpleImputer
inverse_transform(X) [source]
 
Convert the data back to the original representation. Inverts the transform operation performed on an array. This operation can only be performed after SimpleImputer is instantiated with add_indicator=True. Note that inverse_transform can only invert the transform in features that have binary indicators for missing values. If a feature has no missing values at fit time, the feature won’t have a binary indicator, and the imputation done at transform time won’t be inverted.  New in version 0.24.   Parameters 
 
Xarray-like of shape (n_samples, n_features + n_features_missing_indicator) 

The imputed data to be reverted to original data. It has to be an augmented array of imputed data and the missing indicator mask.    Returns 
 
X_originalndarray of shape (n_samples, n_features) 

The original X with missing values as it was prior to imputation.
transform(X) [source]
 
Impute all missing values in X.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

The input data to complete.
plot(*, ax=None, n_cols=3, line_kw=None, contour_kw=None) [source]
 
Plot partial dependence plots.  Parameters 
 
axMatplotlib axes or array-like of Matplotlib axes, default=None 

 
 If a single axis is passed in, it is treated as a bounding axes

and a grid of partial dependence plots will be drawn within these bounds. The n_cols parameter controls the number of columns in the grid.    
 If an array-like of axes are passed in, the partial dependence

plots will be drawn directly into these axes.    
 
If None, a figure and a bounding axes is created and treated 

as the single axes case.      
n_colsint, default=3 

The maximum number of columns in the grid plot. Only active when ax is a single axes or None.  
line_kwdict, default=None 

Dict with keywords passed to the matplotlib.pyplot.plot call. For one-way partial dependence plots.  
contour_kwdict, default=None 

Dict with keywords passed to the matplotlib.pyplot.contourf call for two-way partial dependence plots.    Returns 
 
displayPartialDependenceDisplay
sklearn.inspection.permutation_importance(estimator, X, y, *, scoring=None, n_repeats=5, n_jobs=None, random_state=None, sample_weight=None) [source]
 
Permutation importance for feature evaluation [BRE]. The estimator is required to be a fitted estimator. X can be the data set used to train the estimator or a hold-out set. The permutation importance of a feature is calculated as follows. First, a baseline metric, defined by scoring, is evaluated on a (potentially different) dataset defined by the X. Next, a feature column from the validation set is permuted and the metric is evaluated again. The permutation importance is defined to be the difference between the baseline metric and metric from permutating the feature column. Read more in the User Guide.  Parameters 
 
estimatorobject 

An estimator that has already been fitted and is compatible with scorer.  
Xndarray or DataFrame, shape (n_samples, n_features) 

Data on which permutation importance will be computed.  
yarray-like or None, shape (n_samples, ) or (n_samples, n_classes) 

Targets for supervised or None for unsupervised.  
scoringstring, callable or None, default=None 

Scorer to use. It can be a single string (see The scoring parameter: defining model evaluation rules) or a callable (see Defining your scoring strategy from metric functions). If None, the estimator’s default scorer is used.  
n_repeatsint, default=5 

Number of times to permute a feature.  
n_jobsint or None, default=None 

Number of jobs to run in parallel. The computation is done by computing permutation score for each columns and parallelized over the columns. None means 1 unless in a joblib.parallel_backend context. -1 means using all processors. See Glossary for more details.  
random_stateint, RandomState instance, default=None 

Pseudo-random number generator to control the permutations of each feature. Pass an int to get reproducible results across function calls. See :term: Glossary <random_state>.  
sample_weightarray-like of shape (n_samples,), default=None 

Sample weights used in scoring.  New in version 0.24.     Returns 
 
resultBunch 

Dictionary-like object, with the following attributes.  
importances_meanndarray, shape (n_features, ) 

Mean of feature importance over n_repeats.  
importances_stdndarray, shape (n_features, ) 

Standard deviation over n_repeats.  
importancesndarray, shape (n_features, n_repeats) 

Raw permutation importance scores.       References  
BRE  
L. Breiman, “Random Forests”, Machine Learning, 45(1), 5-32, 2001. https://doi.org/10.1023/A:1010933404324   Examples >>> from sklearn.linear_model import LogisticRegression
>>> from sklearn.inspection import permutation_importance
>>> X = [[1, 9, 9],[1, 9, 9],[1, 9, 9],
...      [0, 9, 9],[0, 9, 9],[0, 9, 9]]
>>> y = [1, 1, 1, 0, 0, 0]
>>> clf = LogisticRegression().fit(X, y)
>>> result = permutation_importance(clf, X, y, n_repeats=10,
...                                 random_state=0)
>>> result.importances_mean
array([0.4666..., 0.       , 0.       ])
>>> result.importances_std
array([0.2211..., 0.       , 0.       ])
sklearn.isotonic.check_increasing(x, y) [source]
 
Determine whether y is monotonically correlated with x. y is found increasing or decreasing with respect to x based on a Spearman correlation test.  Parameters 
 
xarray-like of shape (n_samples,) 

Training data.  
yarray-like of shape (n_samples,) 

Training target.    Returns 
 
increasing_boolboolean 

Whether the relationship is increasing or decreasing.     Notes The Spearman correlation coefficient is estimated from the data, and the sign of the resulting estimate is used as the result. In the event that the 95% confidence interval based on Fisher transform spans zero, a warning is raised. References Fisher transformation. Wikipedia. https://en.wikipedia.org/wiki/Fisher_transformation
fit(X, y, sample_weight=None) [source]
 
Fit the model using X, y as training data.  Parameters 
 
Xarray-like of shape (n_samples,) or (n_samples, 1) 

Training data.  Changed in version 0.24: Also accepts 2d array with 1 feature.   
yarray-like of shape (n_samples,) 

Training target.  
sample_weightarray-like of shape (n_samples,), default=None 

Weights. If set to None, all weights will be set to 1 (equal weights).    Returns 
 
selfobject 

Returns an instance of self.     Notes X is stored for future use, as transform needs X to interpolate new input data.
predict(T) [source]
 
Predict new data by linear interpolation.  Parameters 
 
Tarray-like of shape (n_samples,) or (n_samples, 1) 

Data to transform.    Returns 
 
y_predndarray of shape (n_samples,) 

Transformed data.
transform(T) [source]
 
Transform new data by linear interpolation  Parameters 
 
Tarray-like of shape (n_samples,) or (n_samples, 1) 

Data to transform.  Changed in version 0.24: Also accepts 2d array with 1 feature.     Returns 
 
y_predndarray of shape (n_samples,) 

The transformed data
sklearn.isotonic.isotonic_regression(y, *, sample_weight=None, y_min=None, y_max=None, increasing=True) [source]
 
Solve the isotonic regression model. Read more in the User Guide.  Parameters 
 
yarray-like of shape (n_samples,) 

The data.  
sample_weightarray-like of shape (n_samples,), default=None 

Weights on each point of the regression. If None, weight is set to 1 (equal weights).  
y_minfloat, default=None 

Lower bound on the lowest predicted value (the minimum value may still be higher). If not set, defaults to -inf.  
y_maxfloat, default=None 

Upper bound on the highest predicted value (the maximum may still be lower). If not set, defaults to +inf.  
increasingbool, default=True 

Whether to compute y_ is increasing (if set to True) or decreasing (if set to False)    Returns 
 
y_list of floats 

Isotonic fit of y.     References “Active set algorithms for isotonic regression; A unifying framework” by Michael J. Best and Nilotpal Chakravarti, section 3.
fit(X, y=None) [source]
 
Set the parameters  Parameters 
 
Xarray-like, shape (n_samples, n_features) 

Training data, where n_samples in the number of samples and n_features is the number of features.    Returns 
 
selfobject 

Returns the transformer.
transform(X) [source]
 
Apply approximate feature map to X.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 
  Returns 
 
X_new{ndarray, sparse matrix}, shape = (n_samples, n_features * (2*sample_steps + 1)) 

Whether the return value is an array of sparse matrix depends on the type of the input X.
fit(X, y=None) [source]
 
Fit estimator to data. Samples a subset of training points, computes kernel on these and computes normalization matrix.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Training data.
transform(X) [source]
 
Apply feature map to X. Computes an approximate feature map using the kernel between some training points and X.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Data to transform.    Returns 
 
X_transformedndarray of shape (n_samples, n_components) 

Transformed data.
fit(X, y=None) [source]
 
Fit the model with X. Initializes the internal variables. The method needs no information about the distribution of data, so we only care about n_features in X.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training data, where n_samples in the number of samples and n_features is the number of features.    Returns 
 
selfobject 

Returns the transformer.
transform(X) [source]
 
Generate the feature map approximation for X.  Parameters 
 
X{array-like}, shape (n_samples, n_features) 

New data, where n_samples in the number of samples and n_features is the number of features.    Returns 
 
X_newarray-like, shape (n_samples, n_components)
fit(X, y=None) [source]
 
Fit the model with X. Samples random projection according to n_features.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

Training data, where n_samples in the number of samples and n_features is the number of features.    Returns 
 
selfobject 

Returns the transformer.
transform(X) [source]
 
Apply the approximate feature map to X.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

New data, where n_samples in the number of samples and n_features is the number of features.    Returns 
 
X_newarray-like, shape (n_samples, n_components)