.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_transformer.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. 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_plot_transformer.py: =================== Transform example =================== Rank similarity transform makes an unsupervised non-linear transform, here on the digits dataset. By plotting the first two dimensions, e.g. responses of the first two filters you can see which digits they are sensitive to. .. GENERATED FROM PYTHON SOURCE LINES 13-29 .. image-sg:: /auto_examples/images/sphx_glr_plot_transformer_001.png :alt: plot transformer :srcset: /auto_examples/images/sphx_glr_plot_transformer_001.png :class: sphx-glr-single-img .. code-block:: default import numpy as np from matplotlib import pyplot as plt from ranksim import RankSimilarityTransform from sklearn.datasets import load_digits X, y = load_digits(return_X_y=True) embedding = RankSimilarityTransform(n_filters=10, n_iter=20, random_state=0) X_transformed = embedding.fit_transform(X) plt.figure(figsize=(10,8)) plt.scatter(X_transformed[:,0], X_transformed[:,1], c=y, cmap='tab10') plt.colorbar(boundaries=np.arange(11)-0.5).set_ticks(np.arange(10)) plt.show() .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.379 seconds) .. _sphx_glr_download_auto_examples_plot_transformer.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_transformer.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_transformer.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_