.. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_simple_example_precomputed.py: ========================================================= Simple example precomputed ========================================================= .. code-block:: default print(__doc__) import numpy as np from sklearn.metrics.pairwise import pairwise_kernels from sklearn_rvm import EMRVC # General a toy dataset:s it's just a straight line with some Gaussian noise: n_samples = 100 np.random.seed(0) X = np.random.normal(size=n_samples) y = (X > 0).astype(np.float) X[X > 0] *= 4 X += .3 * np.random.normal(size=n_samples) X = X[:, np.newaxis] K = pairwise_kernels(X) # Fit the classifier clf = EMRVC(kernel="precomputed") clf.fit(K, y) print(clf.predict(K)) print(clf.predict_proba(K)) print(clf.score(K, y)) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_simple_example_precomputed.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download :download:`Download Python source code: simple_example_precomputed.py ` .. container:: sphx-glr-download :download:`Download Jupyter notebook: simple_example_precomputed.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_