Skip to content

Commit ef18928

Browse files
committed
Pushing the docs to dev/ for branch: master, commit 3ab22f973fb1ff1643fb980075559316478f7bd4
1 parent 79b9c49 commit ef18928

File tree

1,079 files changed

+3310
-3310
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,079 files changed

+3310
-3310
lines changed
-37 Bytes
Binary file not shown.
-37 Bytes
Binary file not shown.

dev/_downloads/plot_ica_blind_source_separation.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\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy import signal\n\nfrom sklearn.decomposition import FastICA, PCA\n\n# #############################################################################\n# Generate sample data\nnp.random.seed(0)\nn_samples = 2000\ntime = np.linspace(0, 8, n_samples)\n\ns1 = np.sin(2 * time) # Signal 1 : sinusoidal signal\ns2 = np.sign(np.sin(3 * time)) # Signal 2 : square signal\ns3 = signal.sawtooth(2 * np.pi * time) # Signal 3: saw tooth signal\n\nS = np.c_[s1, s2, s3]\nS += 0.2 * np.random.normal(size=S.shape) # Add noise\n\nS /= S.std(axis=0) # Standardize data\n# Mix data\nA = np.array([[1, 1, 1], [0.5, 2, 1.0], [1.5, 1.0, 2.0]]) # Mixing matrix\nX = np.dot(S, A.T) # Generate observations\n\n# Compute ICA\nica = FastICA(n_components=3)\nS_ = ica.fit_transform(X) # Reconstruct signals\nA_ = ica.mixing_ # Get estimated mixing matrix\n\n# We can `prove` that the ICA model applies by reverting the unmixing.\nassert np.allclose(X, np.dot(S_, A_.T) + ica.mean_)\n\n# For comparison, compute PCA\npca = PCA(n_components=3)\nH = pca.fit_transform(X) # Reconstruct signals based on orthogonal components\n\n# #############################################################################\n# Plot results\n\nplt.figure()\n\nmodels = [X, S, S_, H]\nnames = ['Observations (mixed signal)',\n 'True Sources',\n 'ICA recovered signals', \n 'PCA recovered signals']\ncolors = ['red', 'steelblue', 'orange']\n\nfor ii, (model, name) in enumerate(zip(models, names), 1):\n plt.subplot(4, 1, ii)\n plt.title(name)\n for sig, color in zip(model.T, colors):\n plt.plot(sig, color=color)\n\nplt.subplots_adjust(0.09, 0.04, 0.94, 0.94, 0.26, 0.46)\nplt.show()"
29+
"print(__doc__)\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom scipy import signal\n\nfrom sklearn.decomposition import FastICA, PCA\n\n# #############################################################################\n# Generate sample data\nnp.random.seed(0)\nn_samples = 2000\ntime = np.linspace(0, 8, n_samples)\n\ns1 = np.sin(2 * time) # Signal 1 : sinusoidal signal\ns2 = np.sign(np.sin(3 * time)) # Signal 2 : square signal\ns3 = signal.sawtooth(2 * np.pi * time) # Signal 3: saw tooth signal\n\nS = np.c_[s1, s2, s3]\nS += 0.2 * np.random.normal(size=S.shape) # Add noise\n\nS /= S.std(axis=0) # Standardize data\n# Mix data\nA = np.array([[1, 1, 1], [0.5, 2, 1.0], [1.5, 1.0, 2.0]]) # Mixing matrix\nX = np.dot(S, A.T) # Generate observations\n\n# Compute ICA\nica = FastICA(n_components=3)\nS_ = ica.fit_transform(X) # Reconstruct signals\nA_ = ica.mixing_ # Get estimated mixing matrix\n\n# We can `prove` that the ICA model applies by reverting the unmixing.\nassert np.allclose(X, np.dot(S_, A_.T) + ica.mean_)\n\n# For comparison, compute PCA\npca = PCA(n_components=3)\nH = pca.fit_transform(X) # Reconstruct signals based on orthogonal components\n\n# #############################################################################\n# Plot results\n\nplt.figure()\n\nmodels = [X, S, S_, H]\nnames = ['Observations (mixed signal)',\n 'True Sources',\n 'ICA recovered signals', \n 'PCA recovered signals']\ncolors = ['red', 'steelblue', 'orange']\n\nfor ii, (model, name) in enumerate(zip(models, names), 1):\n plt.subplot(4, 1, ii)\n plt.title(name)\n for sig, color in zip(model.T, colors):\n plt.plot(sig, color=color)\n\nplt.tight_layout()\nplt.show()"
3030
]
3131
}
3232
],

dev/_downloads/plot_ica_blind_source_separation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,5 @@
6969
for sig, color in zip(model.T, colors):
7070
plt.plot(sig, color=color)
7171

72-
plt.subplots_adjust(0.09, 0.04, 0.94, 0.94, 0.26, 0.46)
72+
plt.tight_layout()
7373
plt.show()

dev/_downloads/scikit-learn-docs.pdf

11.7 KB
Binary file not shown.

dev/_images/iris.png

0 Bytes
371 Bytes
371 Bytes
22 Bytes
22 Bytes

0 commit comments

Comments
 (0)