Skip to content

# scikit-learn/scikit-learn

### Subversion checkout URL

You can clone with
or
.

# Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also compare across forks.

# Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
...
• 6 commits
• 24 files changed
• 0 commit comments
• 2 contributors
Commits on Aug 24, 2011
 JeanKossaifi Sorting parameters in BaseEstimtor.__repr__ c1227f0 ogrisel Merge remote-tracking branch 'JeanKossaifi/sorted_repr' into JeanKoss… …aifi-sorted_repr c6300d8 ogrisel FIX NMF doctests 3aa87a6 ogrisel ENH: pipeline doctest style improvements d53352f ogrisel FIX: updating doctests in gaussian_process.rst and linear_model.rst 79a4a60 ogrisel FIX: remaining broken doctests c57950b
26 doc/modules/gaussian_process.rst
 @@ -14,7 +14,7 @@ been extended to *probabilistic classification*, but in the present implementation, this is only a post-processing of the *regression* exercise. The advantages of Gaussian Processes for Machine Learning are: - + - The prediction interpolates the observations (at least for regular correlation models). @@ -65,19 +65,19 @@ parameters or alternatively it uses the given parameters. >>> import numpy as np >>> from scikits.learn import gaussian_process - >>> def f(x): + >>> def f(x): ... return x * np.sin(x) >>> X = np.atleast_2d([1., 3., 5., 6., 7., 8.]).T >>> y = f(X).ravel() >>> x = np.atleast_2d(np.linspace(0, 10, 1000)).T >>> gp = gaussian_process.GaussianProcess(theta0=1e-2, thetaL=1e-4, thetaU=1e-1) - >>> gp.fit(X, y) # doctest: +ELLIPSIS - GaussianProcess(normalize=True, theta0=array([[ 0.01]]), - optimizer='fmin_cobyla', verbose=False, storage_mode='full', - nugget=2.2204460492503131e-15, thetaU=array([[ 0.1]]), - regr=, random_start=1, - corr=, beta0=None, - thetaL=array([[ 0.0001]])) + >>> gp.fit(X, y) # doctest: +ELLIPSIS + GaussianProcess(beta0=None, corr=, + normalize=True, nugget=2.22...-15, + optimizer='fmin_cobyla', random_start=1, + regr=, storage_mode='full', + theta0=array([[ 0.01]]), thetaL=array([[ 0.0001]]), + thetaU=array([[ 0.1]]), verbose=False) >>> y_pred, sigma2_pred = gp.predict(x, eval_MSE=True) .. topic:: Other examples @@ -266,18 +266,18 @@ Processes for Machine Learning, please refer to the references below: * DACE, A Matlab Kriging Toolbox _ S Lophaven, HB Nielsen, J Sondergaard 2002 - + * Screening, predicting, and computer experiments _ WJ Welch, RJ Buck, J Sacks, HP Wynn, TJ Mitchell, and MD Morris Technometrics 34(1) 15--25, 1992 - + * Gaussian Processes for Machine Learning _ CE Rasmussen, CKI Williams MIT Press, 2006 (Ed. T Diettrich) - + * The design and analysis of computer experiments _ TJ Santner, BJ @@ -331,4 +331,4 @@ toolbox. * DACE, A Matlab Kriging Toolbox _ S Lophaven, HB Nielsen, J Sondergaard 2002, - +
51 doc/modules/linear_model.rst
 @@ -20,6 +20,7 @@ Across the module, we designate the vector :math:w = (w_1, To perform classification with generalized linear models, see :ref:Logistic_regression. + .. _ordinary_least_squares: Ordinary Least Squares @@ -37,17 +38,15 @@ responses predicted by the linear approximation. :class:LinearRegression will take in its fit method arrays X, y and will store the coefficients :math:w of the linear model in its -coef\_ member. - +coef\_ member:: >>> from scikits.learn import linear_model >>> clf = linear_model.LinearRegression() >>> clf.fit ([[0, 0], [1, 1], [2, 2]], [0, 1, 2]) - LinearRegression(fit_intercept=True) + LinearRegression(fit_intercept=True, normalize=False, overwrite_X=False) >>> clf.coef_ array([ 0.5, 0.5]) - However, coefficient estimates for Ordinary Least Squares rely on the independence of the model terms. When terms are correlated and the columns of the design matrix :math:X have an approximate linear @@ -96,12 +95,13 @@ of shrinkage and thus the coefficients become more robust to collinearity. As with other linear models, :class:Ridge will take in its fit method arrays X, y and will store the coefficients :math:w of the linear model in -its coef\_ member. +its coef\_ member:: >>> from scikits.learn import linear_model >>> clf = linear_model.Ridge (alpha = .5) >>> clf.fit ([[0, 0], [0, 0], [1, 1]], [0, .1, 1]) - Ridge(alpha=0.5, tol=0.001, fit_intercept=True) + Ridge(alpha=0.5, fit_intercept=True, normalize=False, overwrite_X=False, + tol=0.001) >>> clf.coef_ array([ 0.34545455, 0.34545455]) >>> clf.intercept_ #doctest: +ELLIPSIS @@ -131,15 +131,15 @@ Setting alpha: generalized Cross-Validation :class:RidgeCV implements ridge regression with built-in cross-validation of the alpha parameter. The object works in the same way as GridSearchCV except that it defaults to Generalized Cross-Validation -(GCV), an efficient form of leave-one-out cross-validation. +(GCV), an efficient form of leave-one-out cross-validation:: >>> from scikits.learn import linear_model >>> clf = linear_model.RidgeCV(alphas=[0.1, 1.0, 10.0]) - >>> clf.fit ([[0, 0], [0, 0], [1, 1]], [0, .1, 1]) # doctest: +SKIP - RidgeCV(alphas=[0.1, 1.0, 10.0], loss_func=None, cv=None, score_func=None, - fit_intercept=True) - >>> clf.best_alpha # doctest: +SKIP - 0.10000000000000001 + >>> clf.fit([[0, 0], [0, 0], [1, 1]], [0, .1, 1]) + RidgeCV(alphas=[0.1, 1.0, 10.0], cv=None, fit_intercept=True, loss_func=None, + normalize=False, score_func=None) + >>> clf.best_alpha # doctest: +ELLIPSIS + 0.1... .. topic:: References @@ -172,13 +172,13 @@ parameter vector. The implementation in the class :class:Lasso uses coordinate descent as the algorithm to fit the coefficients. See :ref:least_angle_regression -for another implementation. +for another implementation:: >>> clf = linear_model.Lasso(alpha = 0.1) - >>> clf.fit ([[0, 0], [1, 1]], [0, 1]) - Lasso(precompute='auto', alpha=0.1, max_iter=1000, tol=0.0001, - fit_intercept=True) - >>> clf.predict ([[1, 1]]) + >>> clf.fit([[0, 0], [1, 1]], [0, 1]) + Lasso(alpha=0.1, fit_intercept=True, max_iter=1000, normalize=False, + overwrite_X=False, precompute='auto', tol=0.0001) + >>> clf.predict([[1, 1]]) array([ 0.8]) Also useful for lower-level tasks is the function :func:lasso_path that @@ -323,9 +323,10 @@ function of the norm of its coefficients. >>> from scikits.learn import linear_model >>> clf = linear_model.LassoLars(alpha=.1) - >>> clf.fit ([[0, 0], [1, 1]], [0, 1]) # doctest: +ELLIPSIS - LassoLars(normalize=True, verbose=False, fit_intercept=True, max_iter=500, - eps=..., precompute='auto', alpha=0.1) + >>> clf.fit ([[0, 0], [1, 1]], [0, 1]) # doctest: +ELLIPSIS + LassoLars(alpha=0.1, eps=..., fit_intercept=True, + max_iter=500, normalize=True, overwrite_X=False, precompute='auto', + verbose=False) >>> clf.coef_ array([ 0.71715729, 0. ]) @@ -458,16 +459,16 @@ By default :math:\alpha_1 = \alpha_2 = \lambda_1 = \lambda_2 = 1.e^{-6}, *i.e :align: center -*Bayesian Ridge Regression* is used for regression: +*Bayesian Ridge Regression* is used for regression:: >>> from scikits.learn import linear_model >>> X = [[0., 0.], [1., 1.], [2., 2.], [3., 3.]] >>> Y = [0., 1., 2., 3.] >>> clf = linear_model.BayesianRidge() >>> clf.fit (X, Y) - BayesianRidge(n_iter=300, verbose=False, lambda_1=1e-06, lambda_2=1e-06, - fit_intercept=True, alpha_2=1e-06, tol=0.001, alpha_1=1e-06, - compute_score=False) + BayesianRidge(alpha_1=1e-06, alpha_2=1e-06, compute_score=False, + fit_intercept=True, lambda_1=1e-06, lambda_2=1e-06, n_iter=300, + normalize=False, overwrite_X=False, tol=0.001, verbose=False) After being fitted, the model can then be used to predict new values:: @@ -475,7 +476,7 @@ After being fitted, the model can then be used to predict new values:: array([ 0.50000013]) -The weights :math:\beta of the model can be access: +The weights :math:\beta of the model can be access:: >>> clf.coef_ array([ 0.49999993, 0.49999993])
2  doc/modules/preprocessing.rst
 @@ -201,7 +201,7 @@ as each sample is treated independently of others:: >>> binarizer = preprocessing.Binarizer().fit(X) # fit does nothing >>> binarizer - Binarizer(threshold=0.0, copy=True) + Binarizer(copy=True, threshold=0.0) >>> binarizer.transform(X) array([[ 1., 0., 1.],
7 doc/modules/sgd.rst
 @@ -59,9 +59,10 @@ for the training samples:: >>> y = [0, 1] >>> clf = SGDClassifier(loss="hinge", penalty="l2") >>> clf.fit(X, y) - SGDClassifier(loss='hinge', n_jobs=1, shuffle=False, verbose=0, n_iter=5, - learning_rate='optimal', fit_intercept=True, penalty='l2', - power_t=0.5, seed=0, eta0=0.0, rho=1.0, alpha=0.0001) + SGDClassifier(alpha=0.0001, eta0=0.0, fit_intercept=True, + learning_rate='optimal', loss='hinge', n_iter=5, n_jobs=1, + penalty='l2', power_t=0.5, rho=1.0, seed=0, shuffle=False, + verbose=0) After being fitted, the model can then be used to predict new values::
17 doc/modules/svm.rst
 @@ -79,8 +79,8 @@ training samples:: >>> Y = [0, 1] >>> clf = svm.SVC() >>> clf.fit(X, Y) - SVC(kernel='rbf', C=1.0, probability=False, degree=3, coef0=0.0, tol=0.001, - shrinking=True, gamma=0.5) + SVC(C=1.0, coef0=0.0, degree=3, gamma=0.5, kernel='rbf', probability=False, + shrinking=True, tol=0.001) After being fitted, the model can then be used to predict new values:: @@ -116,8 +116,8 @@ classifiers are constructed and each one trains data from two classes:: >>> Y = [0, 1, 2, 3] >>> clf = svm.SVC() >>> clf.fit(X, Y) - SVC(kernel='rbf', C=1.0, probability=False, degree=3, coef0=0.0, tol=0.001, - shrinking=True, gamma=0.25) + SVC(C=1.0, coef0=0.0, degree=3, gamma=0.25, kernel='rbf', probability=False, + shrinking=True, tol=0.001) >>> dec = clf.decision_function([[1]]) >>> dec.shape[1] # 4 classes: 4*3/2 = 6 6 @@ -128,13 +128,12 @@ two classes, only one model is trained:: >>> lin_clf = svm.LinearSVC() >>> lin_clf.fit(X, Y) - LinearSVC(loss='l2', C=1.0, dual=True, fit_intercept=True, penalty='l2', - multi_class=False, tol=0.0001, intercept_scaling=1) + LinearSVC(C=1.0, dual=True, fit_intercept=True, intercept_scaling=1, + loss='l2', multi_class=False, penalty='l2', tol=0.0001) >>> dec = lin_clf.decision_function([[1]]) >>> dec.shape[1] 4 - See :ref:svm_mathematical_formulation` for a complete description of the decision function. @@ -206,8 +205,8 @@ floating point values instead of integer values:: >>> y = [0.5, 2.5] >>> clf = svm.SVR() >>> clf.fit(X, y) - SVR(kernel='rbf', C=1.0, probability=False, degree=3, epsilon=0.1, - shrinking=True, tol=0.001, coef0=0.0, gamma=0.5) + SVR(C=1.0, coef0=0.0, degree=3, epsilon=0.1, gamma=0.5, kernel='rbf', + probability=False, shrinking=True, tol=0.001) >>> clf.predict([[1, 1]]) array([ 1.5])
4 scikits/learn/base.py
 @@ -9,7 +9,6 @@ import warnings from .metrics import r2_score -from .utils import deprecated ############################################################################### @@ -96,7 +95,7 @@ def _pprint(params, offset=0, printer=repr): params_list = list() this_line_length = offset line_sep = ',\n' + (1 + offset // 2) * ' ' - for i, (k, v) in enumerate(params.iteritems()): + for i, (k, v) in enumerate(sorted(params.iteritems())): if type(v) is float: # use str for representing floating point numbers # this way we get consistent representation across @@ -154,6 +153,7 @@ def _get_param_names(cls): except TypeError: # No explicit __init__ args = [] + args.sort() return args def _get_params(self, deep=True):
13 scikits/learn/decomposition/nmf.py
 @@ -294,9 +294,9 @@ class ProjectedGradientNMF(BaseEstimator, TransformerMixin): >>> from scikits.learn.decomposition import ProjectedGradientNMF >>> model = ProjectedGradientNMF(n_components=2, init=0) >>> model.fit(X) #doctest: +ELLIPSIS - ProjectedGradientNMF(nls_max_iter=2000, eta=0.1, max_iter=200, - init=, beta=1, - sparseness=None, n_components=2, tol=0.0001) + ProjectedGradientNMF(beta=1, eta=0.1, + init=, max_iter=200, + n_components=2, nls_max_iter=2000, sparseness=None, tol=0.0001) >>> model.components_ array([[ 0.77032744, 0.11118662], [ 0.38526873, 0.38228063]]) @@ -305,9 +305,10 @@ class ProjectedGradientNMF(BaseEstimator, TransformerMixin): >>> model = ProjectedGradientNMF(n_components=2, init=0, ... sparseness='components') >>> model.fit(X) #doctest: +ELLIPSIS - ProjectedGradientNMF(nls_max_iter=2000, eta=0.1, max_iter=200, - init=, beta=1, - sparseness='components', n_components=2, tol=0.0001) + ProjectedGradientNMF(beta=1, eta=0.1, + init=, max_iter=200, + n_components=2, nls_max_iter=2000, sparseness='components', + tol=0.0001) >>> model.components_ array([[ 1.67481991, 0.29614922], [-0. , 0.4681982 ]])
2  scikits/learn/decomposition/pca.py
 @@ -394,7 +394,7 @@ class RandomizedPCA(BaseEstimator, TransformerMixin): >>> X = np.array([[-1, -1], [-2, -1], [-3, -2], [1, 1], [2, 1], [3, 2]]) >>> pca = RandomizedPCA(n_components=2) >>> pca.fit(X) - RandomizedPCA(copy=True, n_components=2, iterated_power=3, whiten=False) + RandomizedPCA(copy=True, iterated_power=3, n_components=2, whiten=False) >>> print pca.explained_variance_ratio_ [ 0.99244289 0.00755711]
4 scikits/learn/gaussian_process/gaussian_process.py
 @@ -163,7 +163,9 @@ class GaussianProcess(BaseEstimator, RegressorMixin): >>> y = (X * np.sin(X)).ravel() >>> gp = GaussianProcess(theta0=0.1, thetaL=.001, thetaU=1.) >>> gp.fit(X, y) # doctest: +ELLIPSIS - GaussianProcess(normalize=True, ...) + GaussianProcess(beta0=None, corr=..., + normalize=..., nugget=..., + ... Implementation details ----------------------
10 scikits/learn/grid_search.py
 @@ -199,10 +199,12 @@ class GridSearchCV(BaseEstimator): >>> svr = svm.SVR() >>> clf = grid_search.GridSearchCV(svr, parameters) >>> clf.fit(iris.data, iris.target) # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS - GridSearchCV(n_jobs=1, verbose=0, fit_params={}, loss_func=None, - refit=True, cv=None, iid=True, - estimator=SVR(kernel='rbf', C=1.0, probability=False, ... - ... + GridSearchCV(cv=None, + estimator=SVR(C=1.0, coef0=..., degree=..., epsilon=..., gamma=..., kernel='rbf', + probability=False, shrinking=True, tol=...), + fit_params={}, iid=True, loss_func=None, n_jobs=1, + param_grid=..., + ...) Notes ------
26 scikits/learn/hmm.py
 @@ -580,12 +580,12 @@ class GaussianHMM(_BaseHMM): -------- >>> from scikits.learn.hmm import GaussianHMM >>> GaussianHMM(n_components=2) - GaussianHMM(cvtype='diag', means_weight=0, startprob_prior=1.0, - startprob=array([ 0.5, 0.5]), + GaussianHMM(covars_prior=0.01, covars_weight=1, cvtype='diag', + means_prior=None, means_weight=0, n_components=2, + startprob=array([ 0.5, 0.5]), startprob_prior=1.0, transmat=array([[ 0.5, 0.5], [ 0.5, 0.5]]), - transmat_prior=1.0, means_prior=None, n_components=2, - covars_weight=1, covars_prior=0.01) + transmat_prior=1.0) See Also @@ -826,10 +826,11 @@ class MultinomialHMM(_BaseHMM): >>> from scikits.learn.hmm import MultinomialHMM >>> MultinomialHMM(n_components=2) ... #doctest: +ELLIPSIS +NORMALIZE_WHITESPACE - MultinomialHMM(transmat=array([[ 0.5, 0.5], - [ 0.5, 0.5]]), - startprob_prior=1.0, startprob=array([ 0.5, 0.5]), n_components=2, - transmat_prior=1.0) + MultinomialHMM(n_components=2, startprob=array([ 0.5, 0.5]), + startprob_prior=1.0, + transmat=array([[ 0.5, 0.5], + [ 0.5, 0.5]]), + transmat_prior=1.0) See Also -------- @@ -944,12 +945,13 @@ class GMMHMM(_BaseHMM): >>> from scikits.learn.hmm import GMMHMM >>> GMMHMM(n_components=2, n_mix=10, cvtype='diag') ... # doctest: +ELLIPSIS, +NORMALIZE_WHITESPACE - GMMHMM(n_mix=10, cvtype='diag', startprob_prior=1.0, - startprob=array([ 0.5, 0.5]), + GMMHMM(cvtype='diag', + gmms=[GMM(cvtype='diag', n_components=10), GMM(cvtype='diag', n_components=10)], + n_components=2, n_mix=10, startprob=array([ 0.5, 0.5]), + startprob_prior=1.0, transmat=array([[ 0.5, 0.5], [ 0.5, 0.5]]), - transmat_prior=1.0, n_components=2, - gmms=[GMM(cvtype='diag', n_components=10), GMM(cvtype='diag', n_components=10)]) + transmat_prior=1.0) See Also
2  scikits/learn/lda.py
 @@ -45,7 +45,7 @@ class LDA(BaseEstimator, ClassifierMixin, TransformerMixin): >>> y = np.array([1, 1, 1, 2, 2, 2]) >>> clf = LDA() >>> clf.fit(X, y) - LDA(priors=None, n_components=None) + LDA(n_components=None, priors=None) >>> print clf.predict([[-0.8, -1]]) [1]
14 scikits/learn/linear_model/bayes.py
 @@ -104,9 +104,9 @@ class BayesianRidge(LinearModel): >>> from scikits.learn import linear_model >>> clf = linear_model.BayesianRidge() >>> clf.fit([[0,0], [1, 1], [2, 2]], [0, 1, 2]) - BayesianRidge(normalize=False, n_iter=300, verbose=False, lambda_1=1e-06, - lambda_2=1e-06, fit_intercept=True, alpha_2=1e-06, tol=0.001, - alpha_1=1e-06, overwrite_X=False, compute_score=False) + BayesianRidge(alpha_1=1e-06, alpha_2=1e-06, compute_score=False, + fit_intercept=True, lambda_1=1e-06, lambda_2=1e-06, n_iter=300, + normalize=False, overwrite_X=False, tol=0.001, verbose=False) >>> clf.predict([[1, 1]]) array([ 1.]) @@ -324,10 +324,10 @@ class ARDRegression(LinearModel): >>> from scikits.learn import linear_model >>> clf = linear_model.ARDRegression() >>> clf.fit([[0,0], [1, 1], [2, 2]], [0, 1, 2]) - ARDRegression(normalize=False, n_iter=300, verbose=False, lambda_1=1e-06, - lambda_2=1e-06, fit_intercept=True, threshold_lambda=10000.0, - alpha_2=1e-06, tol=0.001, alpha_1=1e-06, overwrite_X=False, - compute_score=False) + ARDRegression(alpha_1=1e-06, alpha_2=1e-06, compute_score=False, + fit_intercept=True, lambda_1=1e-06, lambda_2=1e-06, n_iter=300, + normalize=False, overwrite_X=False, threshold_lambda=10000.0, + tol=0.001, verbose=False) >>> clf.predict([[1, 1]]) array([ 1.])
4 scikits/learn/linear_model/coordinate_descent.py
 @@ -229,8 +229,8 @@ class Lasso(ElasticNet): >>> from scikits.learn import linear_model >>> clf = linear_model.Lasso(alpha=0.1) >>> clf.fit([[0,0], [1, 1], [2, 2]], [0, 1, 2]) - Lasso(normalize=False, fit_intercept=True, max_iter=1000, precompute='auto', - tol=0.0001, alpha=0.1, overwrite_X=False) + Lasso(alpha=0.1, fit_intercept=True, max_iter=1000, normalize=False, + overwrite_X=False, precompute='auto', tol=0.0001) >>> print clf.coef_ [ 0.85 0. ] >>> print clf.intercept_
16 scikits/learn/linear_model/least_angle.py
 @@ -346,8 +346,8 @@ class Lars(LinearModel): >>> from scikits.learn import linear_model >>> clf = linear_model.Lars(n_nonzero_coefs=1) >>> clf.fit([[-1, 1], [0, 0], [1, 1]], [-1.1111, 0, -1.1111]) # doctest: +ELLIPSIS - Lars(normalize=True, n_nonzero_coefs=1, verbose=False, fit_intercept=True, - eps=2.2204460492503131e-16, precompute='auto', overwrite_X=False) + Lars(eps=..., fit_intercept=True, n_nonzero_coefs=1, + normalize=True, overwrite_X=False, precompute='auto', verbose=False) >>> print clf.coef_ # doctest: +ELLIPSIS [ 0. ... -1.1111...] @@ -482,9 +482,9 @@ class LassoLars(Lars): >>> from scikits.learn import linear_model >>> clf = linear_model.LassoLars(alpha=0.01) >>> clf.fit([[-1, 1], [0, 0], [1, 1]], [-1, 0, -1]) # doctest: +ELLIPSIS - LassoLars(normalize=True, verbose=False, fit_intercept=True, max_iter=500, - eps=2.2204460492503131e-16, precompute='auto', alpha=0.01, - overwrite_X=False) + LassoLars(alpha=0.01, eps=..., fit_intercept=True, + max_iter=500, normalize=True, overwrite_X=False, precompute='auto', + verbose=False) >>> print clf.coef_ # doctest: +ELLIPSIS [ 0. -0.963257...] @@ -893,9 +893,9 @@ class LassoLarsIC(LassoLars): >>> from scikits.learn import linear_model >>> clf = linear_model.LassoLarsIC(criterion='bic') >>> clf.fit([[-1, 1], [0, 0], [1, 1]], [-1.1111, 0, -1.1111]) # doctest: +ELLIPSIS - LassoLarsIC(normalize=True, verbose=False, fit_intercept=True, max_iter=500, - eps=... precompute='auto', criterion='bic', - overwrite_X=False) + LassoLarsIC(criterion='bic', eps=..., fit_intercept=True, + max_iter=500, normalize=True, overwrite_X=False, precompute='auto', + verbose=False) >>> print clf.coef_ # doctest: +ELLIPSIS [ 0. ... -1.1111...]
4 scikits/learn/linear_model/ridge.py
 @@ -163,8 +163,8 @@ class Ridge(LinearModel): >>> X = np.random.randn(n_samples, n_features) >>> clf = Ridge(alpha=1.0) >>> clf.fit(X, y) - Ridge(normalize=False, alpha=1.0, overwrite_X=False, tol=0.001, - fit_intercept=True) + Ridge(alpha=1.0, fit_intercept=True, normalize=False, overwrite_X=False, + tol=0.001) """ def __init__(self, alpha=1.0, fit_intercept=True, normalize=False,
14 scikits/learn/linear_model/sparse/stochastic_gradient.py
 @@ -110,9 +110,10 @@ class SGDClassifier(BaseSGDClassifier): >>> y = np.array([1, 1, 2, 2]) >>> clf = linear_model.sparse.SGDClassifier() >>> clf.fit(X, y) - SGDClassifier(loss='hinge', n_jobs=1, shuffle=False, verbose=0, n_iter=5, - learning_rate='optimal', fit_intercept=True, penalty='l2', - power_t=0.5, seed=0, eta0=0.0, rho=1.0, alpha=0.0001) + SGDClassifier(alpha=0.0001, eta0=0.0, fit_intercept=True, + learning_rate='optimal', loss='hinge', n_iter=5, n_jobs=1, + penalty='l2', power_t=0.5, rho=1.0, seed=0, shuffle=False, + verbose=0) >>> print clf.predict([[-0.8, -1]]) [ 1.] @@ -337,9 +338,10 @@ class SGDRegressor(BaseSGDRegressor): >>> X = np.random.randn(n_samples, n_features) >>> clf = linear_model.sparse.SGDRegressor() >>> clf.fit(X, y) - SGDRegressor(loss='squared_loss', power_t=0.25, shuffle=False, verbose=0, - n_iter=5, learning_rate='invscaling', fit_intercept=True, - penalty='l2', p=0.1, seed=0, eta0=0.01, rho=1.0, alpha=0.0001) + SGDRegressor(alpha=0.0001, eta0=0.01, fit_intercept=True, + learning_rate='invscaling', loss='squared_loss', n_iter=5, p=0.1, + penalty='l2', power_t=0.25, rho=1.0, seed=0, shuffle=False, + verbose=0) See also --------
14 scikits/learn/linear_model/stochastic_gradient.py
 @@ -103,9 +103,10 @@ class SGDClassifier(BaseSGDClassifier): >>> Y = np.array([1, 1, 2, 2]) >>> clf = linear_model.SGDClassifier() >>> clf.fit(X, Y) - SGDClassifier(loss='hinge', n_jobs=1, shuffle=False, verbose=0, n_iter=5, - learning_rate='optimal', fit_intercept=True, penalty='l2', - power_t=0.5, seed=0, eta0=0.0, rho=1.0, alpha=0.0001) + SGDClassifier(alpha=0.0001, eta0=0.0, fit_intercept=True, + learning_rate='optimal', loss='hinge', n_iter=5, n_jobs=1, + penalty='l2', power_t=0.5, rho=1.0, seed=0, shuffle=False, + verbose=0) >>> print clf.predict([[-0.8, -1]]) [ 1.] @@ -299,9 +300,10 @@ class SGDRegressor(BaseSGDRegressor): >>> X = np.random.randn(n_samples, n_features) >>> clf = linear_model.SGDRegressor() >>> clf.fit(X, y) - SGDRegressor(loss='squared_loss', power_t=0.25, shuffle=False, verbose=0, - n_iter=5, learning_rate='invscaling', fit_intercept=True, - penalty='l2', p=0.1, seed=0, eta0=0.01, rho=1.0, alpha=0.0001) + SGDRegressor(alpha=0.0001, eta0=0.01, fit_intercept=True, + learning_rate='invscaling', loss='squared_loss', n_iter=5, p=0.1, + penalty='l2', power_t=0.25, rho=1.0, seed=0, shuffle=False, + verbose=0) See also --------
2  scikits/learn/naive_bayes.py
 @@ -451,7 +451,7 @@ class BernoulliNB(BaseDiscreteNB): >>> from scikits.learn.naive_bayes import BernoulliNB >>> clf = BernoulliNB() >>> clf.fit(X, Y) - BernoulliNB(binarize=0.0, alpha=1.0, fit_prior=True) + BernoulliNB(alpha=1.0, binarize=0.0, fit_prior=True) >>> print clf.predict(X[2]) [3]
6 scikits/learn/neighbors.py
 @@ -44,7 +44,7 @@ class NeighborsClassifier(BaseEstimator, ClassifierMixin): >>> from scikits.learn.neighbors import NeighborsClassifier >>> neigh = NeighborsClassifier(n_neighbors=1) >>> neigh.fit(samples, labels) - NeighborsClassifier(n_neighbors=1, leaf_size=20, algorithm='auto') + NeighborsClassifier(algorithm='auto', leaf_size=20, n_neighbors=1) >>> print neigh.predict([[0,0,0]]) [1] @@ -176,7 +176,7 @@ class from an array representing our data set and ask who's >>> from scikits.learn.neighbors import NeighborsClassifier >>> neigh = NeighborsClassifier(n_neighbors=1) >>> neigh.fit(samples, labels) - NeighborsClassifier(n_neighbors=1, leaf_size=20, algorithm='auto') + NeighborsClassifier(algorithm='auto', leaf_size=20, n_neighbors=1) >>> print neigh.kneighbors([1., 1., 1.]) # doctest: +ELLIPSIS (array([[ 0.5]]), array([[2]]...)) @@ -274,7 +274,7 @@ class NeighborsRegressor(NeighborsClassifier, RegressorMixin): >>> from scikits.learn.neighbors import NeighborsRegressor >>> neigh = NeighborsRegressor(n_neighbors=2) >>> neigh.fit(X, y) - NeighborsRegressor(n_neighbors=2, mode='mean', algorithm='auto', leaf_size=20) + NeighborsRegressor(algorithm='auto', leaf_size=20, mode='mean', n_neighbors=2) >>> print neigh.predict([[1.5]]) [ 0.5]
15 scikits/learn/pipeline.py
 @@ -59,11 +59,13 @@ class Pipeline(BaseEstimator): >>> from scikits.learn import svm >>> from scikits.learn.datasets import samples_generator - >>> from scikits.learn.feature_selection import SelectKBest, f_regression + >>> from scikits.learn.feature_selection import SelectKBest + >>> from scikits.learn.feature_selection import f_regression >>> from scikits.learn.pipeline import Pipeline >>> # generate some data to play with - >>> X, y = samples_generator.make_classification(n_informative=5, n_redundant=0) + >>> X, y = samples_generator.make_classification( + ... n_informative=5, n_redundant=0, random_state=42) >>> # ANOVA SVM-C >>> anova_filter = SelectKBest(f_regression, k=5) @@ -73,14 +75,13 @@ class Pipeline(BaseEstimator): >>> # You can set the parameters using the names issued >>> # For instance, fit using a k of 10 in the SelectKBest >>> # and a parameter 'C' of the svn - >>> anova_svm.set_params(anova__k=10, svc__C=.1) #doctest: +ELLIPSIS - Pipeline(steps=[...]) - - >>> anova_svm.fit(X, y) #doctest: +ELLIPSIS + >>> anova_svm.set_params(anova__k=10, svc__C=.1).fit(X, y) + ... # doctest: +ELLIPSIS Pipeline(steps=[...]) >>> prediction = anova_svm.predict(X) - >>> score = anova_svm.score(X) + >>> anova_svm.score(X, y) + 0.75 """ #--------------------------------------------------------------------------
12 scikits/learn/pls.py
 @@ -473,8 +473,8 @@ class PLSRegression(_PLS): >>> Y = [[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]] >>> pls2 = PLSRegression(n_components=2) >>> pls2.fit(X, Y) - PLSRegression(scale=True, algorithm='nipals', max_iter=500, n_components=2, - tol=1e-06, copy=True) + PLSRegression(algorithm='nipals', copy=True, max_iter=500, n_components=2, + scale=True, tol=1e-06) >>> Y_pred = pls2.predict(X) References @@ -578,8 +578,8 @@ class PLSCanonical(_PLS): >>> Y = [[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]] >>> plsca = PLSCanonical(n_components=2) >>> plsca.fit(X, Y) - PLSCanonical(scale=True, algorithm='nipals', max_iter=500, n_components=2, - tol=1e-06, copy=True) + PLSCanonical(algorithm='nipals', copy=True, max_iter=500, n_components=2, + scale=True, tol=1e-06) >>> X_c, Y_c = plsca.transform(X, Y) References @@ -686,8 +686,8 @@ class CCA(_PLS): >>> Y = [[0.1, -0.2], [0.9, 1.1], [6.2, 5.9], [11.9, 12.3]] >>> cca = CCA(n_components=1) >>> cca.fit(X, Y) - CCA(scale=True, algorithm='nipals', max_iter=500, n_components=1, tol=1e-06, - copy=True) + CCA(algorithm='nipals', copy=True, max_iter=500, n_components=1, scale=True, + tol=1e-06) >>> X_c, Y_c = cca.transform(X, Y) References
16 scikits/learn/svm/classes.py
 @@ -144,8 +144,8 @@ class SVC(BaseLibSVM, ClassifierMixin): >>> from scikits.learn.svm import SVC >>> clf = SVC() >>> clf.fit(X, y) - SVC(kernel='rbf', C=1.0, probability=False, degree=3, coef0=0.0, tol=0.001, - shrinking=True, gamma=0.25) + SVC(C=1.0, coef0=0.0, degree=3, gamma=0.25, kernel='rbf', probability=False, + shrinking=True, tol=0.001) >>> print clf.predict([[-0.8, -1]]) [ 1.] @@ -245,8 +245,8 @@ class NuSVC(BaseLibSVM, ClassifierMixin): >>> from scikits.learn.svm import NuSVC >>> clf = NuSVC() >>> clf.fit(X, y) - NuSVC(kernel='rbf', probability=False, degree=3, coef0=0.0, tol=0.001, - shrinking=True, nu=0.5, gamma=0.25) + NuSVC(coef0=0.0, degree=3, gamma=0.25, kernel='rbf', nu=0.5, + probability=False, shrinking=True, tol=0.001) >>> print clf.predict([[-0.8, -1]]) [ 1.] @@ -335,8 +335,8 @@ class SVR(BaseLibSVM, RegressorMixin): >>> X = np.random.randn(n_samples, n_features) >>> clf = SVR(C=1.0, epsilon=0.2) >>> clf.fit(X, y) - SVR(kernel='rbf', C=1.0, probability=False, degree=3, epsilon=0.2, - shrinking=True, tol=0.001, coef0=0.0, gamma=0.1) + SVR(C=1.0, coef0=0.0, degree=3, epsilon=0.2, gamma=0.1, kernel='rbf', + probability=False, shrinking=True, tol=0.001) See also -------- @@ -443,8 +443,8 @@ class NuSVR(BaseLibSVM, RegressorMixin): >>> X = np.random.randn(n_samples, n_features) >>> clf = NuSVR(C=1.0, nu=0.1) >>> clf.fit(X, y) - NuSVR(kernel='rbf', C=1.0, probability=False, degree=3, shrinking=True, - tol=0.001, coef0=0.0, nu=0.1, gamma=0.1) + NuSVR(C=1.0, coef0=0.0, degree=3, gamma=0.1, kernel='rbf', nu=0.1, + probability=False, shrinking=True, tol=0.001) See also --------
16 scikits/learn/svm/sparse/classes.py
 @@ -23,8 +23,8 @@ class SVC(SparseBaseLibSVM, ClassifierMixin): >>> from scikits.learn.svm.sparse import SVC >>> clf = SVC() >>> clf.fit(X, y) - SVC(kernel='rbf', C=1.0, probability=False, degree=3, coef0=0.0, tol=0.001, - shrinking=True, gamma=0.25) + SVC(C=1.0, coef0=0.0, degree=3, gamma=0.25, kernel='rbf', probability=False, + shrinking=True, tol=0.001) >>> print clf.predict([[-0.8, -1]]) [ 1.] """ @@ -58,8 +58,8 @@ class NuSVC (SparseBaseLibSVM, ClassifierMixin): >>> from scikits.learn.svm.sparse import NuSVC >>> clf = NuSVC() >>> clf.fit(X, y) - NuSVC(kernel='rbf', probability=False, degree=3, coef0=0.0, tol=0.001, - shrinking=True, nu=0.5, gamma=0.25) + NuSVC(coef0=0.0, degree=3, gamma=0.25, kernel='rbf', nu=0.5, + probability=False, shrinking=True, tol=0.001) >>> print clf.predict([[-0.8, -1]]) [ 1.] """ @@ -97,8 +97,8 @@ class SVR (SparseBaseLibSVM, RegressorMixin): >>> X = np.random.randn(n_samples, n_features) >>> clf = SVR(C=1.0, epsilon=0.2) >>> clf.fit(X, y) - SVR(kernel='rbf', C=1.0, probability=False, degree=3, epsilon=0.2, - shrinking=True, tol=0.001, coef0=0.0, nu=0.5, gamma=0.1) + SVR(C=1.0, coef0=0.0, degree=3, epsilon=0.2, gamma=0.1, kernel='rbf', nu=0.5, + probability=False, shrinking=True, tol=0.001) """ def __init__(self, kernel='rbf', degree=3, gamma=0.0, coef0=0.0, @@ -134,8 +134,8 @@ class NuSVR (SparseBaseLibSVM, RegressorMixin): >>> X = np.random.randn(n_samples, n_features) >>> clf = NuSVR(nu=0.1, C=1.0) >>> clf.fit(X, y) - NuSVR(kernel='rbf', C=1.0, probability=False, degree=3, shrinking=True, - tol=0.001, epsilon=0.1, coef0=0.0, nu=0.1, gamma=0.1) + NuSVR(C=1.0, coef0=0.0, degree=3, epsilon=0.1, gamma=0.1, kernel='rbf', + nu=0.1, probability=False, shrinking=True, tol=0.001) """ def __init__(self, nu=0.5, C=1.0, kernel='rbf', degree=3,

### No commit comments for this range

Something went wrong with that request. Please try again.