neulab/docprompting-conala huggingface dataset:
fit(X, y=None) [source]
 
Fit the model with X. Samples random projection according to n_features.  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 the approximate feature map to X.  Parameters 
 
Xarray-like, shape (n_samples, n_features) 

New data, where n_samples in the number of samples and n_features is the number of features. All values of X must be strictly greater than “-skewedness”.    Returns 
 
X_newarray-like, shape (n_samples, n_components)
fit(X, y, sample_weight=None) [source]
 
Fit Kernel Ridge regression model  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training data. If kernel == “precomputed” this is instead a precomputed kernel matrix, of shape (n_samples, n_samples).  
yarray-like of shape (n_samples,) or (n_samples, n_targets) 

Target values  
sample_weightfloat or array-like of shape (n_samples,), default=None 

Individual weights for each sample, ignored if None is passed.    Returns 
 
selfreturns an instance of self.
predict(X) [source]
 
Predict using the kernel ridge model  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Samples. If kernel == “precomputed” this is instead a precomputed kernel matrix, shape = [n_samples, n_samples_fitted], where n_samples_fitted is the number of samples used in the fitting for this estimator.    Returns 
 
Cndarray of shape (n_samples,) or (n_samples, n_targets) 

Returns predicted values.
fit(X, y) [source]
 
Fit the ARDRegression model according to the given training data and parameters. Iterative procedure to maximize the evidence  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

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

Target values (integers). Will be cast to X’s dtype if necessary    Returns 
 
selfreturns an instance of self.
predict(X, return_std=False) [source]
 
Predict using the linear model. In addition to the mean of the predictive distribution, also its standard deviation can be returned.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Samples.  
return_stdbool, default=False 

Whether to return the standard deviation of posterior prediction.    Returns 
 
y_meanarray-like of shape (n_samples,) 

Mean of predictive distribution of query points.  
y_stdarray-like of shape (n_samples,) 

Standard deviation of predictive distribution of query points.
fit(X, y, sample_weight=None) [source]
 
Fit the model  Parameters 
 
Xndarray of shape (n_samples, n_features) 

Training data  
yndarray of shape (n_samples,) 

Target values. Will be cast to X’s dtype if necessary  
sample_weightndarray of shape (n_samples,), default=None 

Individual weights for each sample  New in version 0.20: parameter sample_weight support to BayesianRidge.     Returns 
 
selfreturns an instance of self.
fit(X, y, sample_weight=None, check_input=True) [source]
 
Fit model with coordinate descent.  Parameters 
 
X{ndarray, sparse matrix} of (n_samples, n_features) 

Data.  
y{ndarray, sparse matrix} of shape (n_samples,) or (n_samples, n_targets) 

Target. Will be cast to X’s dtype if necessary.  
sample_weightfloat or array-like of shape (n_samples,), default=None 

Sample weight.  New in version 0.23.   
check_inputbool, default=True 

Allow to bypass several input checking. Don’t use this parameter unless you know what you do.     Notes Coordinate descent is an algorithm that considers each column of data at a time hence it will automatically convert the X input as a Fortran-contiguous numpy array if necessary. To avoid memory re-allocation it is advised to allocate the initial data in memory directly using that format.
static path(*args, **kwargs) [source]
 
Compute elastic net path with coordinate descent. The elastic net optimization function varies for mono and multi-outputs. For mono-output tasks it is: 1 / (2 * n_samples) * ||y - Xw||^2_2
+ alpha * l1_ratio * ||w||_1
+ 0.5 * alpha * (1 - l1_ratio) * ||w||^2_2
 For multi-output tasks it is: (1 / (2 * n_samples)) * ||Y - XW||^Fro_2
+ alpha * l1_ratio * ||W||_21
+ 0.5 * alpha * (1 - l1_ratio) * ||W||_Fro^2
 Where: ||W||_21 = \sum_i \sqrt{\sum_j w_{ij}^2}
 i.e. the sum of norm of each row. Read more in the User Guide.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training data. Pass directly as Fortran-contiguous data to avoid unnecessary memory duplication. If y is mono-output then X can be sparse.  
y{array-like, sparse matrix} of shape (n_samples,) or (n_samples, n_outputs) 

Target values.  
l1_ratiofloat, default=0.5 

Number between 0 and 1 passed to elastic net (scaling between l1 and l2 penalties). l1_ratio=1 corresponds to the Lasso.  
epsfloat, default=1e-3 

Length of the path. eps=1e-3 means that alpha_min / alpha_max = 1e-3.  
n_alphasint, default=100 

Number of alphas along the regularization path.  
alphasndarray, default=None 

List of alphas where to compute the models. If None alphas are set automatically.  
precompute‘auto’, bool or array-like of shape (n_features, n_features), default=’auto’ 

Whether to use a precomputed Gram matrix to speed up calculations. If set to 'auto' let us decide. The Gram matrix can also be passed as argument.  
Xyarray-like of shape (n_features,) or (n_features, n_outputs), default=None 

Xy = np.dot(X.T, y) that can be precomputed. It is useful only when the Gram matrix is precomputed.  
copy_Xbool, default=True 

If True, X will be copied; else, it may be overwritten.  
coef_initndarray of shape (n_features, ), default=None 

The initial values of the coefficients.  
verbosebool or int, default=False 

Amount of verbosity.  
return_n_iterbool, default=False 

Whether to return the number of iterations or not.  
positivebool, default=False 

If set to True, forces coefficients to be positive. (Only allowed when y.ndim == 1).  
check_inputbool, default=True 

If set to False, the input validation checks are skipped (including the Gram matrix when provided). It is assumed that they are handled by the caller.  
**paramskwargs 

Keyword arguments passed to the coordinate descent solver.    Returns 
 
alphasndarray of shape (n_alphas,) 

The alphas along the path where models are computed.  
coefsndarray of shape (n_features, n_alphas) or (n_outputs, n_features, n_alphas) 

Coefficients along the path.  
dual_gapsndarray of shape (n_alphas,) 

The dual gaps at the end of the optimization for each alpha.  
n_iterslist of int 

The number of iterations taken by the coordinate descent optimizer to reach the specified tolerance for each alpha. (Is returned when return_n_iter is set to True).      See also  
MultiTaskElasticNet


MultiTaskElasticNetCV


ElasticNet


ElasticNetCV

  Notes For an example, see examples/linear_model/plot_lasso_coordinate_descent_path.py.
predict(X) [source]
 
Predict using the linear model.  Parameters 
 
Xarray-like or sparse matrix, shape (n_samples, n_features) 

Samples.    Returns 
 
Carray, shape (n_samples,) 

Returns predicted values.
fit(X, y) [source]
 
Fit linear model with coordinate descent. Fit is on grid of alphas and best alpha estimated by cross-validation.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training data. Pass directly as Fortran-contiguous data to avoid unnecessary memory duplication. If y is mono-output, X can be sparse.  
yarray-like of shape (n_samples,) or (n_samples, n_targets) 

Target values.
fit(X, y, sample_weight=None) [source]
 
Fit a Generalized Linear Model.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

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

Target values.  
sample_weightarray-like of shape (n_samples,), default=None 

Sample weights.    Returns 
 
selfreturns an instance of self.
predict(X) [source]
 
Predict using GLM with feature matrix X.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Samples.    Returns 
 
y_predarray of shape (n_samples,) 

Returns predicted values.
score(X, y, sample_weight=None) [source]
 
Compute D^2, the percentage of deviance explained. D^2 is a generalization of the coefficient of determination R^2. R^2 uses squared error and D^2 deviance. Note that those two are equal for family='normal'. D^2 is defined as \(D^2 = 1-\frac{D(y_{true},y_{pred})}{D_{null}}\), \(D_{null}\) is the null deviance, i.e. the deviance of a model with intercept alone, which corresponds to \(y_{pred} = \bar{y}\). The mean \(\bar{y}\) is averaged by sample_weight. Best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse).  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

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

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

Sample weights.    Returns 
 
scorefloat 

D^2 of self.predict(X) w.r.t. y.
fit(X, y, sample_weight=None) [source]
 
Fit the model according to the given training data.  Parameters 
 
Xarray-like, shape (n_samples, n_features) 

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

Target vector relative to X.  
sample_weightarray-like, shape (n_samples,) 

Weight given to each sample.    Returns 
 
selfobject
fit(X, y, Xy=None) [source]
 
Fit the model using X, y as training data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

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

Target values.  
Xyarray-like of shape (n_samples,) or (n_samples, n_targets), default=None 

Xy = np.dot(X.T, y) that can be precomputed. It is useful only when the Gram matrix is precomputed.    Returns 
 
selfobject 

returns an instance of self.
fit(X, y) [source]
 
Fit the model using X, y as training data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

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

Target values.    Returns 
 
selfobject 

returns an instance of self.
sklearn.linear_model.lars_path_gram(Xy, Gram, *, n_samples, max_iter=500, alpha_min=0, method='lar', copy_X=True, eps=2.220446049250313e-16, copy_Gram=True, verbose=0, return_path=True, return_n_iter=False, positive=False) [source]
 
lars_path in the sufficient stats mode [1] The optimization objective for the case method=’lasso’ is: (1 / (2 * n_samples)) * ||y - Xw||^2_2 + alpha * ||w||_1
 in the case of method=’lars’, the objective function is only known in the form of an implicit equation (see discussion in [1]) Read more in the User Guide.  Parameters 
 
Xyarray-like of shape (n_samples,) or (n_samples, n_targets) 

Xy = np.dot(X.T, y).  
Gramarray-like of shape (n_features, n_features) 

Gram = np.dot(X.T * X).  
n_samplesint or float 

Equivalent size of sample.  
max_iterint, default=500 

Maximum number of iterations to perform, set to infinity for no limit.  
alpha_minfloat, default=0 

Minimum correlation along the path. It corresponds to the regularization parameter alpha parameter in the Lasso.  
method{‘lar’, ‘lasso’}, default=’lar’ 

Specifies the returned model. Select 'lar' for Least Angle Regression, 'lasso' for the Lasso.  
copy_Xbool, default=True 

If False, X is overwritten.  
epsfloat, default=np.finfo(float).eps 

The machine-precision regularization in the computation of the Cholesky diagonal factors. Increase this for very ill-conditioned systems. Unlike the tol parameter in some iterative optimization-based algorithms, this parameter does not control the tolerance of the optimization.  
copy_Grambool, default=True 

If False, Gram is overwritten.  
verboseint, default=0 

Controls output verbosity.  
return_pathbool, default=True 

If return_path==True returns the entire path, else returns only the last point of the path.  
return_n_iterbool, default=False 

Whether to return the number of iterations.  
positivebool, default=False 

Restrict coefficients to be >= 0. This option is only allowed with method ‘lasso’. Note that the model coefficients will not converge to the ordinary-least-squares solution for small values of alpha. Only coefficients up to the smallest alpha value (alphas_[alphas_ > 0.].min() when fit_path=True) reached by the stepwise Lars-Lasso algorithm are typically in congruence with the solution of the coordinate descent lasso_path function.    Returns 
 
alphasarray-like of shape (n_alphas + 1,) 

Maximum of covariances (in absolute value) at each iteration. n_alphas is either max_iter, n_features or the number of nodes in the path with alpha >= alpha_min, whichever is smaller.  
activearray-like of shape (n_alphas,) 

Indices of active variables at the end of the path.  
coefsarray-like of shape (n_features, n_alphas + 1) 

Coefficients along the path  
n_iterint 

Number of iterations run. Returned only if return_n_iter is set to True.      See also  
lars_path


lasso_path


lasso_path_gram 

LassoLars


Lars


LassoLarsCV


LarsCV


sklearn.decomposition.sparse_encode

  References  
1  
“Least Angle Regression”, Efron et al. http://statweb.stanford.edu/~tibs/ftp/lars.pdf  
2  
Wikipedia entry on the Least-angle regression  
3  
Wikipedia entry on the Lasso
fit(X, y, copy_X=None) [source]
 
Fit the model using X, y as training data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

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

target values. Will be cast to X’s dtype if necessary  
copy_Xbool, default=None 

If provided, this parameter will override the choice of copy_X made at instance creation. If True, X will be copied; else, it may be overwritten.    Returns 
 
selfobject 

returns an instance of self.
fit(X, y, sample_weight=None) [source]
 
Fit linear model.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training data  
yarray-like of shape (n_samples,) or (n_samples, n_targets) 

Target values. Will be cast to X’s dtype if necessary  
sample_weightarray-like of shape (n_samples,), default=None 

Individual weights for each sample  New in version 0.17: parameter sample_weight support to LinearRegression.     Returns 
 
selfreturns an instance of self.
decision_function(X) [source]
 
Predict confidence scores for samples. The confidence score for a sample is proportional to the signed distance of that sample to the hyperplane.  Parameters 
 
Xarray-like or sparse matrix, shape (n_samples, n_features) 

Samples.    Returns 
 array, shape=(n_samples,) if n_classes == 2 else (n_samples, n_classes)

Confidence scores per (sample, class) combination. In the binary case, confidence score for self.classes_[1] where >0 means this class would be predicted.
densify() [source]
 
Convert coefficient matrix to dense array format. Converts the coef_ member (back) to a numpy.ndarray. This is the default format of coef_ and is required for fitting, so calling this method is only required on models that have previously been sparsified; otherwise, it is a no-op.  Returns 
 self

Fitted estimator.
fit(X, y, sample_weight=None) [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 vector relative to X.  
sample_weightarray-like of shape (n_samples,) default=None 

Array of weights that are assigned to individual samples. If not provided, then each sample is given unit weight.  New in version 0.17: sample_weight support to LogisticRegression.     Returns 
 self

Fitted estimator.     Notes The SAGA solver supports both float64 and float32 bit arrays.
predict_log_proba(X) [source]
 
Predict logarithm of probability estimates. The returned estimates for all classes are ordered by the label of classes.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Vector to be scored, where n_samples is the number of samples and n_features is the number of features.    Returns 
 
Tarray-like of shape (n_samples, n_classes) 

Returns the log-probability of the sample for each class in the model, where classes are ordered as they are in self.classes_.
predict_proba(X) [source]
 
Probability estimates. The returned estimates for all classes are ordered by the label of classes. For a multi_class problem, if multi_class is set to be “multinomial” the softmax function is used to find the predicted probability of each class. Else use a one-vs-rest approach, i.e calculate the probability of each class assuming it to be positive using the logistic function. and normalize these values across all the classes.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

Vector to be scored, where n_samples is the number of samples and n_features is the number of features.    Returns 
 
Tarray-like of shape (n_samples, n_classes) 

Returns the probability of the sample for each class in the model, where classes are ordered as they are in self.classes_.
sparsify() [source]
 
Convert coefficient matrix to sparse format. Converts the coef_ member to a scipy.sparse matrix, which for L1-regularized models can be much more memory- and storage-efficient than the usual numpy.ndarray representation. The intercept_ member is not converted.  Returns 
 self

Fitted estimator.     Notes For non-sparse models, i.e. when there are not many zeros in coef_, this may actually increase memory usage, so use this method with care. A rule of thumb is that the number of zero elements, which can be computed with (coef_ == 0).sum(), must be more than 50% for this to provide significant benefits. After calling this method, further fitting with the partial_fit method (if any) will not work until you call densify.
fit(X, y, sample_weight=None) [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 vector relative to X.  
sample_weightarray-like of shape (n_samples,) default=None 

Array of weights that are assigned to individual samples. If not provided, then each sample is given unit weight.    Returns 
 
selfobject
score(X, y, sample_weight=None) [source]
 
Returns the score using the scoring option on the given test data and labels.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

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

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

Sample weights.    Returns 
 
scorefloat 

Score of self.predict(X) wrt. y.
fit(X, y) [source]
 
Fit MultiTaskElasticNet model with coordinate descent  Parameters 
 
Xndarray of shape (n_samples, n_features) 

Data.  
yndarray of shape (n_samples, n_tasks) 

Target. Will be cast to X’s dtype if necessary.     Notes Coordinate descent is an algorithm that considers each column of data at a time hence it will automatically convert the X input as a Fortran-contiguous numpy array if necessary. To avoid memory re-allocation it is advised to allocate the initial data in memory directly using that format.
fit(X, y) [source]
 
Fit the model using X, y as training data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

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

Target values. Will be cast to X’s dtype if necessary    Returns 
 
selfobject 

returns an instance of self.
fit(X, y) [source]
 
Fit the model using X, y as training data.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 

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

Target values. Will be cast to X’s dtype if necessary.    Returns 
 
selfobject 

returns an instance of self.
sklearn.linear_model.orthogonal_mp(X, y, *, n_nonzero_coefs=None, tol=None, precompute=False, copy_X=True, return_path=False, return_n_iter=False) [source]
 
Orthogonal Matching Pursuit (OMP). Solves n_targets Orthogonal Matching Pursuit problems. An instance of the problem has the form: When parametrized by the number of non-zero coefficients using n_nonzero_coefs: argmin ||y - Xgamma||^2 subject to ||gamma||_0 <= n_{nonzero coefs} When parametrized by error using the parameter tol: argmin ||gamma||_0 subject to ||y - Xgamma||^2 <= tol Read more in the User Guide.  Parameters 
 
Xndarray of shape (n_samples, n_features) 

Input data. Columns are assumed to have unit norm.  
yndarray of shape (n_samples,) or (n_samples, n_targets) 

Input targets.  
n_nonzero_coefsint, default=None 

Desired number of non-zero entries in the solution. If None (by default) this value is set to 10% of n_features.  
tolfloat, default=None 

Maximum norm of the residual. If not None, overrides n_nonzero_coefs.  
precompute‘auto’ or bool, default=False 

Whether to perform precomputations. Improves performance when n_targets or n_samples is very large.  
copy_Xbool, default=True 

Whether the design matrix X must be copied by the algorithm. A false value is only helpful if X is already Fortran-ordered, otherwise a copy is made anyway.  
return_pathbool, default=False 

Whether to return every value of the nonzero coefficients along the forward path. Useful for cross-validation.  
return_n_iterbool, default=False 

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

Coefficients of the OMP solution. If return_path=True, this contains the whole coefficient path. In this case its shape is (n_features, n_features) or (n_features, n_targets, n_features) and iterating over the last axis yields coefficients in increasing order of active features.  
n_itersarray-like or int 

Number of active features across every target. Returned only if return_n_iter is set to True.      See also  
OrthogonalMatchingPursuit


orthogonal_mp_gram


lars_path


sklearn.decomposition.sparse_encode

  Notes Orthogonal matching pursuit was introduced in S. Mallat, Z. Zhang, Matching pursuits with time-frequency dictionaries, IEEE Transactions on Signal Processing, Vol. 41, No. 12. (December 1993), pp. 3397-3415. (http://blanche.polytechnique.fr/~mallat/papiers/MallatPursuit93.pdf) This implementation is based on Rubinstein, R., Zibulevsky, M. and Elad, M., Efficient Implementation of the K-SVD Algorithm using Batch Orthogonal Matching Pursuit Technical Report - CS Technion, April 2008. https://www.cs.technion.ac.il/~ronrubin/Publications/KSVD-OMP-v2.pdf