Skip to content

Commit d3bea37

Browse files
committed
Pushing the docs to dev/ for branch: master, commit c298cb771dfcc607d44c8219710f7cefaead39ea
1 parent b71cc90 commit d3bea37

File tree

1,945 files changed

+3731
-3668
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,945 files changed

+3731
-3668
lines changed
Binary file not shown.

dev/_downloads/4ee88a807e060ca374ab95e0d8d819ed/plot_ica_vs_pca.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
},
2727
"outputs": [],
2828
"source": [
29-
"print(__doc__)\n\n# Authors: Alexandre Gramfort, Gael Varoquaux\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.decomposition import PCA, FastICA\n\n# #############################################################################\n# Generate sample data\nrng = np.random.RandomState(42)\nS = rng.standard_t(1.5, size=(20000, 2))\nS[:, 0] *= 2.\n\n# Mix data\nA = np.array([[1, 1], [0, 2]]) # Mixing matrix\n\nX = np.dot(S, A.T) # Generate observations\n\npca = PCA()\nS_pca_ = pca.fit(X).transform(X)\n\nica = FastICA(random_state=rng)\nS_ica_ = ica.fit(X).transform(X) # Estimate the sources\n\nS_ica_ /= S_ica_.std(axis=0)\n\n\n# #############################################################################\n# Plot results\n\ndef plot_samples(S, axis_list=None):\n plt.scatter(S[:, 0], S[:, 1], s=2, marker='o', zorder=10,\n color='steelblue', alpha=0.5)\n if axis_list is not None:\n colors = ['orange', 'red']\n for color, axis in zip(colors, axis_list):\n axis /= axis.std()\n x_axis, y_axis = axis\n # Trick to get legend to work\n plt.plot(0.1 * x_axis, 0.1 * y_axis, linewidth=2, color=color)\n plt.quiver(0, 0, x_axis, y_axis, zorder=11, width=0.01, scale=6,\n color=color)\n\n plt.hlines(0, -3, 3)\n plt.vlines(0, -3, 3)\n plt.xlim(-3, 3)\n plt.ylim(-3, 3)\n plt.xlabel('x')\n plt.ylabel('y')\n\nplt.figure()\nplt.subplot(2, 2, 1)\nplot_samples(S / S.std())\nplt.title('True Independent Sources')\n\naxis_list = [pca.components_.T, ica.mixing_]\nplt.subplot(2, 2, 2)\nplot_samples(X / np.std(X), axis_list=axis_list)\nlegend = plt.legend(['PCA', 'ICA'], loc='upper right')\nlegend.set_zorder(100)\n\nplt.title('Observations')\n\nplt.subplot(2, 2, 3)\nplot_samples(S_pca_ / np.std(S_pca_, axis=0))\nplt.title('PCA recovered signals')\n\nplt.subplot(2, 2, 4)\nplot_samples(S_ica_ / np.std(S_ica_))\nplt.title('ICA recovered signals')\n\nplt.subplots_adjust(0.09, 0.04, 0.94, 0.94, 0.26, 0.36)\nplt.show()"
29+
"print(__doc__)\n\n# Authors: Alexandre Gramfort, Gael Varoquaux\n# License: BSD 3 clause\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom sklearn.decomposition import PCA, FastICA\n\n# #############################################################################\n# Generate sample data\nrng = np.random.RandomState(42)\nS = rng.standard_t(1.5, size=(20000, 2))\nS[:, 0] *= 2.\n\n# Mix data\nA = np.array([[1, 1], [0, 2]]) # Mixing matrix\n\nX = np.dot(S, A.T) # Generate observations\n\npca = PCA()\nS_pca_ = pca.fit(X).transform(X)\n\nica = FastICA(random_state=rng)\nS_ica_ = ica.fit(X).transform(X) # Estimate the sources\n\nS_ica_ /= S_ica_.std(axis=0)\n\n\n# #############################################################################\n# Plot results\n\ndef plot_samples(S, axis_list=None):\n plt.scatter(S[:, 0], S[:, 1], s=2, marker='o', zorder=10,\n color='steelblue', alpha=0.5)\n if axis_list is not None:\n colors = ['orange', 'red']\n for color, axis in zip(colors, axis_list):\n axis /= axis.std()\n x_axis, y_axis = axis\n # Trick to get legend to work\n plt.plot(0.1 * x_axis, 0.1 * y_axis, linewidth=2, color=color)\n plt.quiver((0, 0), (0, 0), x_axis, y_axis, zorder=11, width=0.01,\n scale=6, color=color)\n\n plt.hlines(0, -3, 3)\n plt.vlines(0, -3, 3)\n plt.xlim(-3, 3)\n plt.ylim(-3, 3)\n plt.xlabel('x')\n plt.ylabel('y')\n\nplt.figure()\nplt.subplot(2, 2, 1)\nplot_samples(S / S.std())\nplt.title('True Independent Sources')\n\naxis_list = [pca.components_.T, ica.mixing_]\nplt.subplot(2, 2, 2)\nplot_samples(X / np.std(X), axis_list=axis_list)\nlegend = plt.legend(['PCA', 'ICA'], loc='upper right')\nlegend.set_zorder(100)\n\nplt.title('Observations')\n\nplt.subplot(2, 2, 3)\nplot_samples(S_pca_ / np.std(S_pca_, axis=0))\nplt.title('PCA recovered signals')\n\nplt.subplot(2, 2, 4)\nplot_samples(S_ica_ / np.std(S_ica_))\nplt.title('ICA recovered signals')\n\nplt.subplots_adjust(0.09, 0.04, 0.94, 0.94, 0.26, 0.36)\nplt.show()"
3030
]
3131
}
3232
],
Binary file not shown.

dev/_downloads/dc313f6a0617a04ceea6108f4cde71b6/plot_ica_vs_pca.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def plot_samples(S, axis_list=None):
7070
x_axis, y_axis = axis
7171
# Trick to get legend to work
7272
plt.plot(0.1 * x_axis, 0.1 * y_axis, linewidth=2, color=color)
73-
plt.quiver(0, 0, x_axis, y_axis, zorder=11, width=0.01, scale=6,
74-
color=color)
73+
plt.quiver((0, 0), (0, 0), x_axis, y_axis, zorder=11, width=0.01,
74+
scale=6, color=color)
7575

7676
plt.hlines(0, -3, 3)
7777
plt.vlines(0, -3, 3)

dev/_downloads/scikit-learn-docs.pdf

1.42 MB
Binary file not shown.

dev/_images/iris.png

0 Bytes

0 commit comments

Comments
 (0)