DOC Add AdditiveChi2Sampler example to docstring
@@ -274,6 +274,25 @@ class AdditiveChi2Sampler(BaseEstimator, TransformerMixin):
sample_interval : float, optional
Sampling interval. Must be specified when sample_steps not in {1,2,3}.
+ Examples
+ --------
+ >>> from sklearn.datasets import load_digits
+ >>> from sklearn.linear_model import SGDClassifier
+ >>> from sklearn.kernel_approximation import AdditiveChi2Sampler
+ >>> X, y = load_digits(return_X_y=True)
+ >>> chi2sampler = AdditiveChi2Sampler(sample_steps=2)
+ >>> X_transformed = chi2sampler.fit_transform(X, y)
+ >>> clf = SGDClassifier(max_iter=5, random_state=0)
+ >>> clf.fit(X_transformed, y)
+ SGDClassifier(alpha=0.0001, average=False, class_weight=None,
+ early_stopping=False, epsilon=0.1, eta0=0.0, fit_intercept=True,
+ l1_ratio=0.15, learning_rate='optimal', loss='hinge', max_iter=5,
+ n_iter=None, n_iter_no_change=5, n_jobs=1, penalty='l2',
+ power_t=0.5, random_state=0, shuffle=True, tol=None,
+ validation_fraction=0.1, verbose=0, warm_start=False)
+ >>> clf.score(X_transformed, y) # doctest: +ELLIPSIS
+ 0.9543...
+
Notes
-----
This estimator approximates a slightly different version of the additive
