neulab/docprompting-conala huggingface dataset:
sklearn.linear_model.orthogonal_mp_gram(Gram, Xy, *, n_nonzero_coefs=None, tol=None, norms_squared=None, copy_Gram=True, copy_Xy=True, return_path=False, return_n_iter=False) [source]
 
Gram Orthogonal Matching Pursuit (OMP). Solves n_targets Orthogonal Matching Pursuit problems using only the Gram matrix X.T * X and the product X.T * y. Read more in the User Guide.  Parameters 
 
Gramndarray of shape (n_features, n_features) 

Gram matrix of the input data: X.T * X.  
Xyndarray of shape (n_features,) or (n_features, n_targets) 

Input targets multiplied by X: X.T * y.  
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.  
norms_squaredarray-like of shape (n_targets,), default=None 

Squared L2 norms of the lines of y. Required if tol is not None.  
copy_Grambool, default=True 

Whether the gram matrix must be copied by the algorithm. A false value is only helpful if it is already Fortran-ordered, otherwise a copy is made anyway.  
copy_Xybool, default=True 

Whether the covariance vector Xy must be copied by the algorithm. If False, it may be overwritten.  
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


lars_path


sklearn.decomposition.sparse_encode

  Notes Orthogonal matching pursuit was introduced in G. 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
fit(X, y, coef_init=None, intercept_init=None) [source]
 
Fit linear model with Passive Aggressive algorithm.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Training data  
ynumpy array of shape [n_samples] 

Target values  
coef_initarray, shape = [n_classes,n_features] 

The initial coefficients to warm-start the optimization.  
intercept_initarray, shape = [n_classes] 

The initial intercept to warm-start the optimization.    Returns 
 
selfreturns an instance of self.
partial_fit(X, y, classes=None) [source]
 
Fit linear model with Passive Aggressive algorithm.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Subset of the training data  
ynumpy array of shape [n_samples] 

Subset of the target values  
classesarray, shape = [n_classes] 

Classes across all calls to partial_fit. Can be obtained by via np.unique(y_all), where y_all is the target vector of the entire dataset. This argument is required for the first call to partial_fit and can be omitted in the subsequent calls. Note that y doesn’t need to contain all labels in classes.    Returns 
 
selfreturns an instance of self.
set_params(**kwargs) [source]
 
Set and validate the parameters of estimator.  Parameters 
 
**kwargsdict 

Estimator parameters.    Returns 
 
selfobject 

Estimator instance.
fit(X, y, coef_init=None, intercept_init=None, sample_weight=None) [source]
 
Fit linear model with Stochastic Gradient Descent.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

Training data.  
yndarray of shape (n_samples,) 

Target values.  
coef_initndarray of shape (n_classes, n_features), default=None 

The initial coefficients to warm-start the optimization.  
intercept_initndarray of shape (n_classes,), default=None 

The initial intercept to warm-start the optimization.  
sample_weightarray-like, shape (n_samples,), default=None 

Weights applied to individual samples. If not provided, uniform weights are assumed. These weights will be multiplied with class_weight (passed through the constructor) if class_weight is specified.    Returns 
 self :

Returns an instance of self.
partial_fit(X, y, classes=None, sample_weight=None) [source]
 
Perform one epoch of stochastic gradient descent on given samples. Internally, this method uses max_iter = 1. Therefore, it is not guaranteed that a minimum of the cost function is reached after calling it once. Matters such as objective convergence and early stopping should be handled by the user.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

Subset of the training data.  
yndarray of shape (n_samples,) 

Subset of the target values.  
classesndarray of shape (n_classes,), default=None 

Classes across all calls to partial_fit. Can be obtained by via np.unique(y_all), where y_all is the target vector of the entire dataset. This argument is required for the first call to partial_fit and can be omitted in the subsequent calls. Note that y doesn’t need to contain all labels in classes.  
sample_weightarray-like, shape (n_samples,), default=None 

Weights applied to individual samples. If not provided, uniform weights are assumed.    Returns 
 self :

Returns an instance of self.
fit(X, y, sample_weight=None) [source]
 
Fit estimator using RANSAC algorithm.  Parameters 
 
Xarray-like or sparse matrix, shape [n_samples, n_features] 

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

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

Individual weights for each sample raises error if sample_weight is passed and base_estimator fit method does not support it.  New in version 0.18.     Raises 
 ValueError

If no valid consensus set could be found. This occurs if is_data_valid and is_model_valid return False for all max_trials randomly chosen sub-samples.
predict(X) [source]
 
Predict using the estimated model. This is a wrapper for estimator_.predict(X).  Parameters 
 
Xnumpy array of shape [n_samples, n_features] 
  Returns 
 
yarray, shape = [n_samples] or [n_samples, n_targets] 

Returns predicted values.
score(X, y) [source]
 
Returns the score of the prediction. This is a wrapper for estimator_.score(X, y).  Parameters 
 
Xnumpy array or sparse matrix of shape [n_samples, n_features] 

Training data.  
yarray, shape = [n_samples] or [n_samples, n_targets] 

Target values.    Returns 
 
zfloat 

Score of the prediction.
fit(X, y, sample_weight=None) [source]
 
Fit Ridge regression model.  Parameters 
 
X{ndarray, sparse matrix} of shape (n_samples, n_features) 

Training data  
yndarray of shape (n_samples,) or (n_samples, n_targets) 

Target values  
sample_weightfloat or ndarray of shape (n_samples,), default=None 

Individual weights for each sample. If given a float, every sample will have the same weight.    Returns 
 
selfreturns an instance of self.
fit(X, y, sample_weight=None) [source]
 
Fit Ridge classifier model.  Parameters 
 
X{ndarray, sparse matrix} of shape (n_samples, n_features) 

Training data.  
yndarray of shape (n_samples,) 

Target values.  
sample_weightfloat or ndarray of shape (n_samples,), default=None 

Individual weights for each sample. If given a float, every sample will have the same weight.  New in version 0.17: sample_weight support to Classifier.     Returns 
 
selfobject 

Instance of the estimator.
fit(X, y, sample_weight=None) [source]
 
Fit Ridge classifier with cv.  Parameters 
 
Xndarray of shape (n_samples, n_features) 

Training vectors, where n_samples is the number of samples and n_features is the number of features. When using GCV, will be cast to float64 if necessary.  
yndarray of shape (n_samples,) 

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

Individual weights for each sample. If given a float, every sample will have the same weight.    Returns 
 
selfobject
fit(X, y, sample_weight=None) [source]
 
Fit Ridge regression model with cv.  Parameters 
 
Xndarray of shape (n_samples, n_features) 

Training data. If using GCV, will be cast to float64 if necessary.  
yndarray of shape (n_samples,) or (n_samples, n_targets) 

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

Individual weights for each sample. If given a float, every sample will have the same weight.    Returns 
 
selfobject 
   Notes When sample_weight is provided, the selected hyperparameter may depend on whether we use leave-one-out cross-validation (cv=None or cv=’auto’) or another form of cross-validation, because only leave-one-out cross-validation takes the sample weights into account when computing the validation score.
property predict_log_proba  
Log of probability estimates. This method is only available for log loss and modified Huber loss. When loss=”modified_huber”, probability estimates may be hard zeros and ones, so taking the logarithm is not possible. See predict_proba for details.  Parameters 
 
X{array-like, sparse matrix} of shape (n_samples, n_features) 

Input data for prediction.    Returns 
 
Tarray-like, 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_.
property predict_proba  
Probability estimates. This method is only available for log loss and modified Huber loss. Multiclass probability estimates are derived from binary (one-vs.-rest) estimates by simple normalization, as recommended by Zadrozny and Elkan. Binary probability estimates for loss=”modified_huber” are given by (clip(decision_function(X), -1, 1) + 1) / 2. For other loss functions it is necessary to perform proper probability calibration by wrapping the classifier with CalibratedClassifierCV instead.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

Input data for prediction.    Returns 
 ndarray 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_.     References Zadrozny and Elkan, “Transforming classifier scores into multiclass probability estimates”, SIGKDD’02, http://www.research.ibm.com/people/z/zadrozny/kdd2002-Transf.pdf The justification for the formula in the loss=”modified_huber” case is in the appendix B in: http://jmlr.csail.mit.edu/papers/volume2/zhang02c/zhang02c.pdf
fit(X, y, coef_init=None, intercept_init=None, sample_weight=None) [source]
 
Fit linear model with Stochastic Gradient Descent.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

Training data  
yndarray of shape (n_samples,) 

Target values  
coef_initndarray of shape (n_features,), default=None 

The initial coefficients to warm-start the optimization.  
intercept_initndarray of shape (1,), default=None 

The initial intercept to warm-start the optimization.  
sample_weightarray-like, shape (n_samples,), default=None 

Weights applied to individual samples (1. for unweighted).    Returns 
 
selfreturns an instance of self.
partial_fit(X, y, sample_weight=None) [source]
 
Perform one epoch of stochastic gradient descent on given samples. Internally, this method uses max_iter = 1. Therefore, it is not guaranteed that a minimum of the cost function is reached after calling it once. Matters such as objective convergence and early stopping should be handled by the user.  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 

Subset of training data  
ynumpy array of shape (n_samples,) 

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

Weights applied to individual samples. If not provided, uniform weights are assumed.    Returns 
 
selfreturns an instance of self.
predict(X) [source]
 
Predict using the linear model  Parameters 
 
X{array-like, sparse matrix}, shape (n_samples, n_features) 
  Returns 
 ndarray of shape (n_samples,)

Predicted target values per element in X.
fit(X, y) [source]
 
Fit linear model.  Parameters 
 
Xndarray of shape (n_samples, n_features) 

Training data.  
yndarray of shape (n_samples,) 

Target values.    Returns 
 
selfreturns an instance of self.
fit(X, y=None) [source]
 
Compute the embedding vectors for data X  Parameters 
 
X{array-like, sparse graph, BallTree, KDTree, NearestNeighbors} 

Sample data, shape = (n_samples, n_features), in the form of a numpy array, sparse graph, precomputed tree, or NearestNeighbors object.  
yIgnored 
  Returns 
 
selfreturns an instance of self.
fit_transform(X, y=None) [source]
 
Fit the model from data in X and transform X.  Parameters 
 
X{array-like, sparse graph, BallTree, KDTree} 

Training vector, where n_samples in the number of samples and n_features is the number of features.  
yIgnored 
  Returns 
 
X_newarray-like, shape (n_samples, n_components)
reconstruction_error() [source]
 
Compute the reconstruction error for the embedding.  Returns 
 
reconstruction_errorfloat 
   Notes The cost function of an isomap embedding is E = frobenius_norm[K(D) - K(D_fit)] / n_samples Where D is the matrix of distances for the input data X, D_fit is the matrix of distances for the output embedding X_fit, and K is the isomap kernel: K(D) = -0.5 * (I - 1/n_samples) * D^2 * (I - 1/n_samples)
transform(X) [source]
 
Transform X. This is implemented by linking the points X into the graph of geodesic distances of the training data. First the n_neighbors nearest neighbors of X are found in the training data, and from these the shortest geodesic distances from each point in X to each point in the training data are computed in order to construct the kernel. The embedding of X is the projection of this kernel onto the embedding vectors of the training set.  Parameters 
 
Xarray-like, shape (n_queries, n_features) 

If neighbors_algorithm=’precomputed’, X is assumed to be a distance matrix or a sparse graph of shape (n_queries, n_samples_fit).    Returns 
 
X_newarray-like, shape (n_queries, n_components)
fit(X, y=None) [source]
 
Compute the embedding vectors for data X  Parameters 
 
Xarray-like of shape [n_samples, n_features] 

training set.  
yIgnored 
  Returns 
 
selfreturns an instance of self.
fit_transform(X, y=None) [source]
 
Compute the embedding vectors for data X and transform X.  Parameters 
 
Xarray-like of shape [n_samples, n_features] 

training set.  
yIgnored 
  Returns 
 
X_newarray-like, shape (n_samples, n_components)
transform(X) [source]
 
Transform new points into embedding space.  Parameters 
 
Xarray-like of shape (n_samples, n_features) 
  Returns 
 
X_newarray, shape = [n_samples, n_components] 
   Notes Because of scaling performed by this method, it is discouraged to use it together with methods that are not scale-invariant (like SVMs)
fit(X, y=None, init=None) [source]
 
Computes the position of the points in the embedding space.  Parameters 
 
Xarray-like of shape (n_samples, n_features) or (n_samples, n_samples) 

Input data. If dissimilarity=='precomputed', the input should be the dissimilarity matrix.  
yIgnored 

initndarray of shape (n_samples,), default=None 

Starting configuration of the embedding to initialize the SMACOF algorithm. By default, the algorithm is initialized with a randomly chosen array.
fit_transform(X, y=None, init=None) [source]
 
Fit the data from X, and returns the embedded coordinates.  Parameters 
 
Xarray-like of shape (n_samples, n_features) or (n_samples, n_samples) 

Input data. If dissimilarity=='precomputed', the input should be the dissimilarity matrix.  
yIgnored 

initndarray of shape (n_samples,), default=None 

Starting configuration of the embedding to initialize the SMACOF algorithm. By default, the algorithm is initialized with a randomly chosen array.
fit(X, y=None) [source]
 
Fit the model from data in X.  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. If affinity is “precomputed” X : {array-like, sparse matrix}, shape (n_samples, n_samples), Interpret X as precomputed adjacency graph computed from samples.  
yIgnored 
  Returns 
 
selfobject 

Returns the instance itself.
fit_transform(X, y=None) [source]
 
Fit the model from data in X and transform X.  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. If affinity is “precomputed” X : {array-like, sparse matrix} of shape (n_samples, n_samples), Interpret X as precomputed adjacency graph computed from samples.  
yIgnored 
  Returns 
 
X_newarray-like of shape (n_samples, n_components)
sklearn.manifold.spectral_embedding(adjacency, *, n_components=8, eigen_solver=None, random_state=None, eigen_tol=0.0, norm_laplacian=True, drop_first=True) [source]
 
Project the sample on the first eigenvectors of the graph Laplacian. The adjacency matrix is used to compute a normalized graph Laplacian whose spectrum (especially the eigenvectors associated to the smallest eigenvalues) has an interpretation in terms of minimal number of cuts necessary to split the graph into comparably sized components. This embedding can also ‘work’ even if the adjacency variable is not strictly the adjacency matrix of a graph but more generally an affinity or similarity matrix between samples (for instance the heat kernel of a euclidean distance matrix or a k-NN matrix). However care must taken to always make the affinity matrix symmetric so that the eigenvector decomposition works as expected. Note : Laplacian Eigenmaps is the actual algorithm implemented here. Read more in the User Guide.  Parameters 
 
adjacency{array-like, sparse graph} of shape (n_samples, n_samples) 

The adjacency matrix of the graph to embed.  
n_componentsint, default=8 

The dimension of the projection subspace.  
eigen_solver{‘arpack’, ‘lobpcg’, ‘amg’}, default=None 

The eigenvalue decomposition strategy to use. AMG requires pyamg to be installed. It can be faster on very large, sparse problems, but may also lead to instabilities. If None, then 'arpack' is used.  
random_stateint, RandomState instance or None, default=None 

Determines the random number generator used for the initialization of the lobpcg eigenvectors decomposition when solver == ‘amg’. Pass an int for reproducible results across multiple function calls. See :term: Glossary <random_state>.  
eigen_tolfloat, default=0.0 

Stopping criterion for eigendecomposition of the Laplacian matrix when using arpack eigen_solver.  
norm_laplacianbool, default=True 

If True, then compute normalized Laplacian.  
drop_firstbool, default=True 

Whether to drop the first eigenvector. For spectral embedding, this should be True as the first eigenvector should be constant vector for connected graph, but for spectral clustering, this should be kept as False to retain the first eigenvector.    Returns 
 
embeddingndarray of shape (n_samples, n_components) 

The reduced samples.     Notes Spectral Embedding (Laplacian Eigenmaps) is most useful when the graph has one connected component. If there graph has many components, the first few eigenvectors will simply uncover the connected components of the graph. References  https://en.wikipedia.org/wiki/LOBPCG Toward the Optimal Preconditioned Eigensolver: Locally Optimal Block Preconditioned Conjugate Gradient Method Andrew V. Knyazev https://doi.org/10.1137%2FS1064827500366124
sklearn.manifold.trustworthiness(X, X_embedded, *, n_neighbors=5, metric='euclidean') [source]
 
Expresses to what extent the local structure is retained. The trustworthiness is within [0, 1]. It is defined as  \[T(k) = 1 - \frac{2}{nk (2n - 3k - 1)} \sum^n_{i=1} \sum_{j \in \mathcal{N}_{i}^{k}} \max(0, (r(i, j) - k))\] where for each sample i, \(\mathcal{N}_{i}^{k}\) are its k nearest neighbors in the output space, and every sample j is its \(r(i, j)\)-th nearest neighbor in the input space. In other words, any unexpected nearest neighbors in the output space are penalised in proportion to their rank in the input space.  “Neighborhood Preservation in Nonlinear Projection Methods: An Experimental Study” J. Venna, S. Kaski “Learning a Parametric Embedding by Preserving Local Structure” L.J.P. van der Maaten   Parameters 
 
Xndarray of shape (n_samples, n_features) or (n_samples, n_samples) 

If the metric is ‘precomputed’ X must be a square distance matrix. Otherwise it contains a sample per row.  
X_embeddedndarray of shape (n_samples, n_components) 

Embedding of the training data in low-dimensional space.  
n_neighborsint, default=5 

Number of neighbors k that will be considered.  
metricstr or callable, default=’euclidean’ 

Which metric to use for computing pairwise distances between samples from the original input space. If metric is ‘precomputed’, X must be a matrix of pairwise distances or squared distances. Otherwise, see the documentation of argument metric in sklearn.pairwise.pairwise_distances for a list of available metrics.  New in version 0.20.     Returns 
 
trustworthinessfloat 

Trustworthiness of the low-dimensional embedding.
fit(X, y=None) [source]
 
Fit X into an embedded space.  Parameters 
 
Xndarray of shape (n_samples, n_features) or (n_samples, n_samples) 

If the metric is ‘precomputed’ X must be a square distance matrix. Otherwise it contains a sample per row. If the method is ‘exact’, X may be a sparse matrix of type ‘csr’, ‘csc’ or ‘coo’. If the method is ‘barnes_hut’ and the metric is ‘precomputed’, X may be a precomputed sparse graph.  
yIgnored
fit_transform(X, y=None) [source]
 
Fit X into an embedded space and return that transformed output.  Parameters 
 
Xndarray of shape (n_samples, n_features) or (n_samples, n_samples) 

If the metric is ‘precomputed’ X must be a square distance matrix. Otherwise it contains a sample per row. If the method is ‘exact’, X may be a sparse matrix of type ‘csr’, ‘csc’ or ‘coo’. If the method is ‘barnes_hut’ and the metric is ‘precomputed’, X may be a precomputed sparse graph.  
yIgnored 
  Returns 
 
X_newndarray of shape (n_samples, n_components) 

Embedding of the training data in low-dimensional space.