| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,7 +38,8 @@ is an estimator object:: | |||
| 38 | 38 | Pipeline(steps=[('reduce_dim', PCA(copy=True, n_components=None, | |
| 39 | 39 | whiten=False)), ('svm', SVC(C=1.0, cache_size=200, class_weight=None, | |
| 40 | 40 | coef0=0.0, degree=3, gamma=0.0, kernel='rbf', max_iter=-1, | |
| 41 | - probability=False, shrinking=True, tol=0.001, verbose=False))]) | ||
| 41 | + probability=False, random_state=None, shrinking=True, tol=0.001, | ||
| 42 | + verbose=False))]) | ||
| 42 | 43 | ||
| 43 | 44 | The estimators of the pipeline are stored as a list in the ``steps`` attribute:: | |
| 44 | 45 | ||
@@ -57,7 +58,8 @@ Parameters of the estimators in the pipeline can be accessed using the | |||
| 57 | 58 | Pipeline(steps=[('reduce_dim', PCA(copy=True, n_components=None, | |
| 58 | 59 | whiten=False)), ('svm', SVC(C=10, cache_size=200, class_weight=None, | |
| 59 | 60 | coef0=0.0, degree=3, gamma=0.0, kernel='rbf', max_iter=-1, | |
| 60 | - probability=False, shrinking=True, tol=0.001, verbose=False))]) | ||
| 61 | + probability=False, random_state=None, shrinking=True, tol=0.001, | ||
| 62 | + verbose=False))]) | ||
| 61 | 63 | ||
| 62 | 64 | This is particularly important for doing grid searches:: | |
| 63 | 65 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -77,8 +77,8 @@ size ``[n_samples]``, holding the class labels for the training samples:: | |||
| 77 | 77 | >>> clf = svm.SVC() | |
| 78 | 78 | >>> clf.fit(X, y) # doctest: +NORMALIZE_WHITESPACE | |
| 79 | 79 | SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, | |
| 80 | - gamma=0.0, kernel='rbf', max_iter=-1, probability=False, shrinking=True, | ||
| 81 | - tol=0.001, verbose=False) | ||
| 80 | + gamma=0.0, kernel='rbf', max_iter=-1, probability=False, random_state=None, | ||
| 81 | + shrinking=True, tol=0.001, verbose=False) | ||
| 82 | 82 | ||
| 83 | 83 | After being fitted, the model can then be used to predict new values:: | |
| 84 | 84 | ||
@@ -116,8 +116,8 @@ classifiers are constructed and each one trains data from two classes:: | |||
| 116 | 116 | >>> clf = svm.SVC() | |
| 117 | 117 | >>> clf.fit(X, Y) # doctest: +NORMALIZE_WHITESPACE | |
| 118 | 118 | SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, | |
| 119 | - gamma=0.0, kernel='rbf', max_iter=-1, probability=False, shrinking=True, | ||
| 120 | - tol=0.001, verbose=False) | ||
| 119 | + gamma=0.0, kernel='rbf', max_iter=-1, probability=False, random_state=None, | ||
| 120 | + shrinking=True, tol=0.001, verbose=False) | ||
| 121 | 121 | >>> dec = clf.decision_function([[1]]) | |
| 122 | 122 | >>> dec.shape[1] # 4 classes: 4*3/2 = 6 | |
| 123 | 123 | 6 | |
@@ -301,7 +301,7 @@ floating point values instead of integer values:: | |||
| 301 | 301 | >>> clf.fit(X, y) # doctest: +NORMALIZE_WHITESPACE | |
| 302 | 302 | SVR(C=1.0, cache_size=200, coef0=0.0, degree=3, | |
| 303 | 303 | epsilon=0.1, gamma=0.0, kernel='rbf', max_iter=-1, probability=False, | |
| 304 | - shrinking=True, tol=0.001, verbose=False) | ||
| 304 | + random_state=None, shrinking=True, tol=0.001, verbose=False) | ||
| 305 | 305 | >>> clf.predict([[1, 1]]) | |
| 306 | 306 | array([ 1.5]) | |
| 307 | 307 | ||
@@ -499,7 +499,7 @@ test vectors must be provided. | |||
| 499 | 499 | >>> clf.fit(gram, y) # doctest: +NORMALIZE_WHITESPACE | |
| 500 | 500 | SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, | |
| 501 | 501 | gamma=0.0, kernel='precomputed', max_iter=-1, probability=False, | |
| 502 | - shrinking=True, tol=0.001, verbose=False) | ||
| 502 | + random_state=None, shrinking=True, tol=0.001, verbose=False) | ||
| 503 | 503 | >>> # predict on training examples | |
| 504 | 504 | >>> clf.predict(gram) | |
| 505 | 505 | array([0, 1]) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -169,8 +169,8 @@ one:: | |||
| 169 | 169 | ||
| 170 | 170 | >>> clf.fit(digits.data[:-1], digits.target[:-1]) # doctest: +NORMALIZE_WHITESPACE | |
| 171 | 171 | SVC(C=100.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, | |
| 172 | - gamma=0.001, kernel='rbf', max_iter=-1, probability=False, shrinking=True, | ||
| 173 | - tol=0.001, verbose=False) | ||
| 172 | + gamma=0.001, kernel='rbf', max_iter=-1, probability=False, | ||
| 173 | + random_state=None, shrinking=True, tol=0.001, verbose=False) | ||
| 174 | 174 | ||
| 175 | 175 | Now you can predict new values, in particular, we can ask to the | |
| 176 | 176 | classifier what is the digit of our last image in the `digits` dataset, | |
@@ -207,8 +207,8 @@ persistence model, namely `pickle <http://docs.python.org/library/pickle.html>`_ | |||
| 207 | 207 | >>> X, y = iris.data, iris.target | |
| 208 | 208 | >>> clf.fit(X, y) # doctest: +NORMALIZE_WHITESPACE | |
| 209 | 209 | SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0, | |
| 210 | - kernel='rbf', max_iter=-1, probability=False, shrinking=True, tol=0.001, | ||
| 211 | - verbose=False) | ||
| 210 | + kernel='rbf', max_iter=-1, probability=False, random_state=None, | ||
| 211 | + shrinking=True, tol=0.001, verbose=False) | ||
| 212 | 212 | ||
| 213 | 213 | >>> import pickle | |
| 214 | 214 | >>> s = pickle.dumps(clf) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -452,8 +452,8 @@ classification --:class:`SVC` (Support Vector Classification). | |||
| 452 | 452 | >>> svc = svm.SVC(kernel='linear') | |
| 453 | 453 | >>> svc.fit(iris_X_train, iris_y_train) # doctest: +NORMALIZE_WHITESPACE | |
| 454 | 454 | SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, gamma=0.0, | |
| 455 | - kernel='linear', max_iter=-1, probability=False, shrinking=True, tol=0.001, | ||
| 456 | - verbose=False) | ||
| 455 | + kernel='linear', max_iter=-1, probability=False, random_state=None, | ||
| 456 | + shrinking=True, tol=0.001, verbose=False) | ||
| 457 | 457 | ||
| 458 | 458 | ||
| 459 | 459 | .. warning:: **Normalizing data** | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -644,7 +644,7 @@ class GridSearchCV(BaseSearchCV): | |||
| 644 | 644 | GridSearchCV(cv=None, | |
| 645 | 645 | estimator=SVC(C=1.0, cache_size=..., coef0=..., degree=..., | |
| 646 | 646 | gamma=..., kernel='rbf', max_iter=-1, probability=False, | |
| 647 | - shrinking=True, tol=...), | ||
| 647 | + random_state=None, shrinking=True, tol=...), | ||
| 648 | 648 | fit_params={}, iid=True, loss_func=None, n_jobs=1, | |
| 649 | 649 | param_grid=..., | |
| 650 | 650 | ...) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -247,8 +247,8 @@ class frequencies. | |||
| 247 | 247 | >>> clf = SVC() | |
| 248 | 248 | >>> clf.fit(X, y) #doctest: +NORMALIZE_WHITESPACE | |
| 249 | 249 | SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0, degree=3, | |
| 250 | - gamma=0.0, kernel='rbf', max_iter=-1, probability=False, | ||
| 251 | - shrinking=True, tol=0.001, verbose=False) | ||
| 250 | + gamma=0.0, kernel='rbf', max_iter=-1, probability=False, | ||
| 251 | + random_state=None, shrinking=True, tol=0.001, verbose=False) | ||
| 252 | 252 | >>> print(clf.predict([[-0.8, -1]])) | |
| 253 | 253 | [1] | |
| 254 | 254 | ||
@@ -371,8 +371,8 @@ class NuSVC(BaseSVC): | |||
| 371 | 371 | >>> clf = NuSVC() | |
| 372 | 372 | >>> clf.fit(X, y) #doctest: +NORMALIZE_WHITESPACE | |
| 373 | 373 | NuSVC(cache_size=200, coef0=0.0, degree=3, gamma=0.0, kernel='rbf', | |
| 374 | - max_iter=-1, nu=0.5, probability=False, shrinking=True, tol=0.001, | ||
| 375 | - verbose=False) | ||
| 374 | + max_iter=-1, nu=0.5, probability=False, random_state=None, | ||
| 375 | + shrinking=True, tol=0.001, verbose=False) | ||
| 376 | 376 | >>> print(clf.predict([[-0.8, -1]])) | |
| 377 | 377 | [1] | |
| 378 | 378 | ||
@@ -490,8 +490,8 @@ class SVR(BaseLibSVM, RegressorMixin): | |||
| 490 | 490 | >>> clf = SVR(C=1.0, epsilon=0.2) | |
| 491 | 491 | >>> clf.fit(X, y) #doctest: +NORMALIZE_WHITESPACE | |
| 492 | 492 | SVR(C=1.0, cache_size=200, coef0=0.0, degree=3, epsilon=0.2, gamma=0.0, | |
| 493 | - kernel='rbf', max_iter=-1, probability=False, shrinking=True, tol=0.001, | ||
| 494 | - verbose=False) | ||
| 493 | + kernel='rbf', max_iter=-1, probability=False, random_state=None, | ||
| 494 | + shrinking=True, tol=0.001, verbose=False) | ||
| 495 | 495 | ||
| 496 | 496 | See also | |
| 497 | 497 | -------- | |
@@ -606,8 +606,8 @@ class NuSVR(BaseLibSVM, RegressorMixin): | |||
| 606 | 606 | >>> clf = NuSVR(C=1.0, nu=0.1) | |
| 607 | 607 | >>> clf.fit(X, y) #doctest: +NORMALIZE_WHITESPACE | |
| 608 | 608 | NuSVR(C=1.0, cache_size=200, coef0=0.0, degree=3, gamma=0.0, kernel='rbf', | |
| 609 | - max_iter=-1, nu=0.1, probability=False, shrinking=True, tol=0.001, | ||
| 610 | - verbose=False) | ||
| 609 | + max_iter=-1, nu=0.1, probability=False, random_state=None, | ||
| 610 | + shrinking=True, tol=0.001, verbose=False) | ||
| 611 | 611 | ||
| 612 | 612 | See also | |
| 613 | 613 | -------- | |
| Back | FazBrowse Home | New Git URL |
0 commit comments