Skip to content

Instantly share code, notes, and snippets.

@Radi4
Last active February 24, 2018 22:39
Show Gist options
  • Save Radi4/9b1c8f014d9e8f5747dc83c8e6489926 to your computer and use it in GitHub Desktop.
Save Radi4/9b1c8f014d9e8f5747dc83c8e6489926 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"import mne\n",
"import os\n",
"from sklearn.model_selection import train_test_split\n",
"import h5py\n",
"from sklearn.metrics import mean_squared_error"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def mean_absolute_percentage_error(y_true, y_pred):\n",
" return np.mean(np.mean(np.abs(y_true - y_pred), axis = 0) / np.abs(np.mean(y_true, axis = 0))) * 100"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Extracting parameters from ./data/resting_state/pre_egg_petuhova3103.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602749 = 0.000 ... 602.749 secs...\n",
"Extracting parameters from ./data/resting_state/2205_miloslavov_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 623249 = 0.000 ... 623.249 secs...\n",
"Extracting parameters from ./data/resting_state/kozunova_pre_eeg_2103.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602849 = 0.000 ... 602.849 secs...\n",
"Extracting parameters from ./data/resting_state/2505_shirokova_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 606599 = 0.000 ... 606.599 secs...\n",
"Extracting parameters from ./data/resting_state/gorbacheva_03021300_rest_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 625249 = 0.000 ... 625.249 secs...\n",
"Extracting parameters from ./data/resting_state/200317_ivanova_pre_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602099 = 0.000 ... 602.099 secs...\n",
"Extracting parameters from ./data/resting_state/2403_kutuzova_posteeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604199 = 0.000 ... 604.199 secs...\n",
"Extracting parameters from ./data/resting_state/3103_petuhova_posteeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 630049 = 0.000 ... 630.049 secs...\n",
"Extracting parameters from ./data/resting_state/2103_glebko_posteeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 633899 = 0.000 ... 633.899 secs...\n",
"Extracting parameters from ./data/resting_state/glebko_2103_pre_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 643749 = 0.000 ... 643.749 secs...\n",
"Extracting parameters from ./data/resting_state/gorin_310117_rest_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 609999 = 0.000 ... 609.999 secs...\n",
"Extracting parameters from ./data/resting_state/zavrib_post_eeg_eyesopen15021500.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 321599 = 0.000 ... 321.599 secs...\n",
"Extracting parameters from ./data/resting_state/gorbacheva_03_02_2017_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 603949 = 0.000 ... 603.949 secs...\n",
"Extracting parameters from ./data/resting_state/post_eeg_tsoy_2504.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604949 = 0.000 ... 604.949 secs...\n",
"Extracting parameters from ./data/resting_state/2403_kutuzova_pre_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602849 = 0.000 ... 602.849 secs...\n",
"Extracting parameters from ./data/resting_state/2505_shirokova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604799 = 0.000 ... 604.799 secs...\n",
"Extracting parameters from ./data/resting_state/dagaev_post_rest_eeg_30011600.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 603799 = 0.000 ... 603.799 secs...\n",
"Extracting parameters from ./data/resting_state/zagirova_pre_eeg_2704.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 607549 = 0.000 ... 607.549 secs...\n",
"Extracting parameters from ./data/resting_state/08021400_post_eeg_shuhova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 607199 = 0.000 ... 607.199 secs...\n",
"Extracting parameters from ./data/resting_state/2704_zagirova_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604549 = 0.000 ... 604.549 secs...\n",
"Extracting parameters from ./data/resting_state/shuhova_08022017_rest_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 637949 = 0.000 ... 637.949 secs...\n",
"Extracting parameters from ./data/resting_state/zavrin_open_eyes_eeg_15021500.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 301999 = 0.000 ... 301.999 secs...\n",
"Extracting parameters from ./data/resting_state/zavrin_eyes_closed_eeg_15021500.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 302749 = 0.000 ... 302.749 secs...\n",
"Extracting parameters from ./data/resting_state/tsoy_pre_eeg_2504.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 652699 = 0.000 ... 652.699 secs...\n",
"Extracting parameters from ./data/resting_state/2003_ivanova_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 616599 = 0.000 ... 616.599 secs...\n",
"Extracting parameters from ./data/resting_state/bagaeva_post_eeg_13031500.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 603899 = 0.000 ... 603.899 secs...\n",
"Extracting parameters from ./data/resting_state/gorin_rest_eeg_post_31011200.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 603699 = 0.000 ... 603.699 secs...\n",
"Extracting parameters from ./data/resting_state/bagaeva_13021500_rest_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 603949 = 0.000 ... 603.949 secs...\n",
"Extracting parameters from ./data/resting_state/miloslavov_22_05_pre_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 603399 = 0.000 ... 603.399 secs...\n",
"Extracting parameters from ./data/resting_state/300120171600_dagaev_rest_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 615599 = 0.000 ... 615.599 secs...\n",
"Extracting parameters from ./data/resting_state/zavrin_15021500_eyesclosed_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 319299 = 0.000 ... 319.299 secs...\n",
"Extracting parameters from ./data/resting_state/2103_kozunova_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 603199 = 0.000 ... 603.199 secs...\n"
]
}
],
"source": [
"train_eeg_dir = \"./data/resting_state/\"\n",
"train_eeg_names = [x for x in os.listdir(train_eeg_dir) \n",
" if x[-5:] == \".vhdr\"]\n",
"\n",
"\n",
"data = np.zeros((0, 61))\n",
"\n",
"for eeg_name in train_eeg_names:\n",
" eeg_data = mne.io.read_raw_brainvision(train_eeg_dir + eeg_name, preload=True).get_data().T\n",
" data = np.append(data, eeg_data, axis = 0)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(16569900, 61)"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"X_train, X_test, _, _ = train_test_split(data, data, test_size=0.1, random_state = 123)\n",
"X_train.shape"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from sklearn.decomposition import PCA"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"pca = PCA()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"PCA(copy=True, iterated_power='auto', n_components=None, random_state=None,\n",
" svd_solver='auto', tol=0.0, whiten=False)"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pca.fit(X_train)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"array([8.60501206e-01, 4.50064918e-02, 1.96728939e-02, 1.32136598e-02,\n",
" 1.04975082e-02, 8.72080965e-03, 7.62335116e-03, 6.18126786e-03,\n",
" 5.67043513e-03, 4.47648307e-03, 3.60945585e-03, 3.14652398e-03,\n",
" 2.39228930e-03, 1.80131636e-03, 1.70855324e-03, 1.02205207e-03,\n",
" 8.56411536e-04, 7.16579942e-04, 5.79405287e-04, 4.55820757e-04,\n",
" 3.82103135e-04, 3.16569681e-04, 2.85133222e-04, 2.29655140e-04,\n",
" 2.04059298e-04, 1.75203243e-04, 1.37317351e-04, 1.10815493e-04,\n",
" 1.07661772e-04, 6.06199959e-05, 4.45915540e-05, 3.02155660e-05,\n",
" 1.35079571e-05, 1.01596334e-05, 8.84664590e-06, 5.20703831e-06,\n",
" 4.73173173e-06, 3.48769419e-06, 2.89469779e-06, 2.04873226e-06,\n",
" 1.96094774e-06, 1.75111927e-06, 1.46673460e-06, 1.33033908e-06,\n",
" 1.07091778e-06, 9.55877007e-07, 7.52438532e-07, 5.92499937e-07,\n",
" 5.42740492e-07, 4.09476932e-07, 3.70516426e-07, 3.20656854e-07,\n",
" 2.61712216e-07, 1.94464044e-07, 1.73691897e-07, 1.37400176e-07,\n",
" 1.18904211e-07, 9.71608336e-08, 7.81569206e-08, 6.95013218e-08,\n",
" 6.41651813e-33])"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"pca.explained_variance_ratio_ "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Variance_ratio\n",
"\n",
"90 % информации - в первых 2 координатах \n",
"\n",
"95 % информации - в первых 6\n",
"\n",
"98 % информации - в первых 10\n",
"\n",
"99% информации - в первых 13"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"eeg_dir = \"./data/new_data/\"\n",
"eeg_names = [x for x in os.listdir(eeg_dir) \n",
" if x[-5:] == \".vhdr\"]"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Extracting parameters from ./data/new_data/0311_pre_eeg_popova.vhdr...\n",
"Setting channel info structure...\n",
"Extracting parameters from ./data/new_data/2509_post_eeg_rinata.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 601549 = 0.000 ... 601.549 secs...\n",
"Extracting parameters from ./data/new_data/2510_post_eeg_osipova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602949 = 0.000 ... 602.949 secs...\n",
"Extracting parameters from ./data/new_data/0311_post_eeg_mazurova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 603349 = 0.000 ... 603.349 secs...\n",
"Extracting parameters from ./data/new_data/3111_post_eeg_popova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 612499 = 0.000 ... 612.499 secs...\n",
"Extracting parameters from ./data/new_data/1909_pre_eeg_eliseev.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 608399 = 0.000 ... 608.399 secs...\n",
"Extracting parameters from ./data/new_data/14071200_limanskaya_pre_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604549 = 0.000 ... 604.549 secs...\n",
"Extracting parameters from ./data/new_data/3010_pre_eeg_suhareva.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 609899 = 0.000 ... 609.899 secs...\n",
"Extracting parameters from ./data/new_data/2809_pre_eeg_lukyanov.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 615899 = 0.000 ... 615.899 secs...\n",
"Extracting parameters from ./data/new_data/1207_shevchenko_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602849 = 0.000 ... 602.849 secs...\n",
"Extracting parameters from ./data/new_data/0708_pre_eeg_krasovskaya.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604049 = 0.000 ... 604.049 secs...\n",
"Extracting parameters from ./data/new_data/1207_shevchenko.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2132749 = 0.000 ... 2132.749 secs...\n",
"Extracting parameters from ./data/new_data/0311_eeg_mazurova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2048799 = 0.000 ... 2048.799 secs...\n",
"Extracting parameters from ./data/new_data/3010_post_eeg_suhareva.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 605799 = 0.000 ... 605.799 secs...\n",
"Extracting parameters from ./data/new_data/2809_lukyanov.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2085449 = 0.000 ... 2085.449 secs...\n",
"Extracting parameters from ./data/new_data/1608_post_eeg_polshina.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 632899 = 0.000 ... 632.899 secs...\n",
"Extracting parameters from ./data/new_data/17_11_pre_eeg_bachurina.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602149 = 0.000 ... 602.149 secs...\n",
"Extracting parameters from ./data/new_data/3110_maistrenko.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 1914399 = 0.000 ... 1914.399 secs...\n",
"Extracting parameters from ./data/new_data/1509_pre_eeg_zvyagincev.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 606799 = 0.000 ... 606.799 secs...\n",
"Extracting parameters from ./data/new_data/2306_patrakeeva_post_eeg_rest.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 605199 = 0.000 ... 605.199 secs...\n",
"Extracting parameters from ./data/new_data/3010_eeg_suhareva.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 1572349 = 0.000 ... 1572.349 secs...\n",
"Extracting parameters from ./data/new_data/1909_eliseev.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2093299 = 0.000 ... 2093.299 secs...\n",
"Extracting parameters from ./data/new_data/1909_post_eeg_eliseev.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 842249 = 0.000 ... 842.249 secs...\n",
"Extracting parameters from ./data/new_data/0307_STRELKOVA.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2103349 = 0.000 ... 2103.349 secs...\n",
"Extracting parameters from ./data/new_data/3110_post_eeg_maistrenko.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 620899 = 0.000 ... 620.899 secs...\n",
"Extracting parameters from ./data/new_data/2606_patrakeeva_main_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2106049 = 0.000 ... 2106.049 secs...\n",
"Extracting parameters from ./data/new_data/1608_rpre_eeg_polshina.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 629449 = 0.000 ... 629.449 secs...\n",
"Extracting parameters from ./data/new_data/2510_pre_eeg_osipova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604099 = 0.000 ... 604.099 secs...\n",
"Extracting parameters from ./data/new_data/0311_eeg_popova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 1977699 = 0.000 ... 1977.699 secs...\n",
"Extracting parameters from ./data/new_data/0708_post_eeg_krasovskaya.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 614349 = 0.000 ... 614.349 secs...\n",
"Extracting parameters from ./data/new_data/14071200_limaskaya_post_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604849 = 0.000 ... 604.849 secs...\n",
"Extracting parameters from ./data/new_data/2510_osipova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 1958699 = 0.000 ... 1958.699 secs...\n",
"Extracting parameters from ./data/new_data/2809_post_eeg_lukyanov.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602149 = 0.000 ... 602.149 secs...\n",
"Extracting parameters from ./data/new_data/1207_shevchenko_pre_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 614199 = 0.000 ... 614.199 secs...\n",
"Extracting parameters from ./data/new_data/0708_eeg_krasovskaya.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2023149 = 0.000 ... 2023.149 secs...\n",
"Extracting parameters from ./data/new_data/2306_patrakeeva_pre_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Extracting parameters from ./data/new_data/0307_POST_EEG_sTRELKOVA.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 602149 = 0.000 ... 602.149 secs...\n",
"Extracting parameters from ./data/new_data/2509_eeg_rinata.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2129299 = 0.000 ... 2129.299 secs...\n",
"Extracting parameters from ./data/new_data/2509-pre_eeg_rinata.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 724899 = 0.000 ... 724.899 secs...\n",
"Extracting parameters from ./data/new_data/17_11_post_eeg_bachurina.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 610499 = 0.000 ... 610.499 secs...\n",
"Extracting parameters from ./data/new_data/1608_eeg_polshina.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 1961799 = 0.000 ... 1961.799 secs...\n",
"Extracting parameters from ./data/new_data/311_pre_eeg_mazurova.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 604349 = 0.000 ... 604.349 secs...\n",
"Extracting parameters from ./data/new_data/1509_zvyagincev.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 1910849 = 0.000 ... 1910.849 secs...\n",
"Extracting parameters from ./data/new_data/1407_limanskaya_eeg.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 2406349 = 0.000 ... 2406.349 secs...\n",
"Extracting parameters from ./data/new_data/3110_pre_eeg_maistrenko.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 663199 = 0.000 ... 663.199 secs...\n",
"Extracting parameters from ./data/new_data/17_11_bachurina.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 1979549 = 0.000 ... 1979.549 secs...\n",
"Extracting parameters from ./data/new_data/0307_STRELKOVA_PRE_EEG.vhdr...\n",
"Setting channel info structure...\n",
"Reading 0 ... 601999 = 0.000 ... 601.999 secs...\n"
]
}
],
"source": [
"test_data = np.zeros((0,61))\n",
"\n",
"fail_count = 0\n",
"\n",
"for eeg_name in eeg_names:\n",
" try:\n",
" eeg_data = mne.io.read_raw_brainvision(eeg_dir + eeg_name, preload=True).get_data().T\n",
" test_data = np.append(test_data, eeg_data, axis = 0)\n",
" except FileNotFoundError:\n",
" fail_count += 1\n",
" continue"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {},
"outputs": [],
"source": [
"components_count = [1, 2, 4, 5, 6, 7, 8, 9, 10, 12, 40, 45, 50, 55, 61]"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"944.3816370159668\n",
"730.3861574688534\n",
"513.8760089270451\n",
"252.50333132341444\n",
"2.887346416340305e-12\n"
]
}
],
"source": [
"for component in components_count:\n",
" pca = PCA(n_components= component)\n",
" pca.fit(X_train)\n",
" mpe = mean_absolute_percentage_error(test_data, pca.inverse_transform(pca.transform(test_data)))\n",
" print(mpe)"
]
},
{
"cell_type": "code",
"execution_count": 43,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[942.0808953154711,\n",
" 872.3344151492266,\n",
" 874.9637985353154,\n",
" 889.6565415207315,\n",
" 907.8391569944413,\n",
" 909.1332226860354,\n",
" 884.1113909588582,\n",
" 887.8328095567409,\n",
" 881.3496461942931,\n",
" 925.4499352925958,\n",
" 944.3816370159668,\n",
" 730.3861574688534,\n",
" 513.8760089270451,\n",
" 252.50333132341444,\n",
" 2.887346416340305e-12]"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mpe_vars"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0.0016314035042201565\n",
"0.0016102983279754294\n",
"0.0016019980084192942\n",
"0.0015971624333699828\n",
"0.0015894735352078237\n",
"0.0015882914363946757\n",
"0.0015719374634677284\n",
"0.001565565903113536\n",
"0.0015613648299206107\n",
"0.0015451522477676401\n",
"0.001346346235438015\n",
"0.0012655422074663765\n",
"0.0011972963641907223\n",
"0.0011434864579471342\n",
"1.6767685391527792e-33\n"
]
}
],
"source": [
"mse_vars = []\n",
"for component in components_count:\n",
" pca = PCA(n_components= component)\n",
" pca.fit(X_train)\n",
" mse = mean_squared_error(test_data, pca.inverse_transform(pca.transform(test_data)))\n",
" print(mse)\n",
" mse_vars.append(mse)"
]
},
{
"cell_type": "code",
"execution_count": 14,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"[0.0016314035042201565,\n",
" 0.0016102983279754294,\n",
" 0.0016019980084192942,\n",
" 0.0015971624333699828,\n",
" 0.0015894735352078237,\n",
" 0.0015882914363946757,\n",
" 0.0015719374634677284,\n",
" 0.001565565903113536,\n",
" 0.0015613648299206107,\n",
" 0.0015451522477676401,\n",
" 0.001346346235438015,\n",
" 0.0012655422074663765,\n",
" 0.0011972963641907223,\n",
" 0.0011434864579471342,\n",
" 1.6767685391527792e-33]"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mse_vars"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"components_count = [1, 2, 4, 5, 6, 7, 8, 9, 10, 12, 40, 45, 50, 55, 61]"
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"import seaborn as sb"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/anaconda3/lib/python3.6/site-packages/matplotlib/font_manager.py:1297: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans\n",
" (prop.get_family(), self.defaultFamily[fontext]))\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAfQAAAFoCAY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wsy5Ufqf//xnpaamKikpqdX606dP6913\n31Vubq66dOmirKysC6axd+/ereHDh+uWW26RzWbT4sWLFRcXJ0mqqqrS8OHDW/07derUBXX06dNH\n1113nTsQt2/frq5du2ro0KGSzo7+9+/fr8bGRiUmJmrgwIFtPqfi4mJNnDhRkjRx4sSLTrv/6Ec/\n0pVXXqkePXrooYceavU1RGRkpB555BF16dJFo0aNUkxMjL744gtJ0j/8wz9o0KBBioiI0LXXXquc\nnBzt2LHD62MBRhEZ6gIAtDZp0iTde++9OnLkiCZNmnTB+g0bNigyMtJ9tHdubq7y8/N17NgxJSQk\nSJLS09P1xhtveNx/YmKitmzZ4lMtEydO1Nq1a5WXl6e1a9e6QzkmJka/+c1v9Nprr2nu3LkaNmyY\nfvGLXyg1NfWCfezatUtHjhxRTk6Oe5+/+c1v9Nlnn7U5qr/yyivdf/fu3VtVVVXu2z169FBk5Ldv\nXVdccYX7A8nu3bv14osvav/+/WpublZTU5Nuv/12n54r0NExQgfCTJ8+fdS3b19t3rxZ48ePv2B9\nUVGRTp06pdGjR+uWW27Rz372MzU3N190GvtyZGdna8eOHaqsrNSGDRuUm5vrXjdixAj913/9lz74\n4AP1799fzzzzjMd9FBUVyeVyKS8vT7fccovuuusuSWe/NmjLN9984/7766+/VmJiok/1PvbYYxoz\nZow2b96sXbt2afr06eKCkugsGKEDYWjhwoWqq6tTTEyMzpw5415ut9u1bds2vfrqqxo0aJB7+R//\n+EcVFxfrgQceaNc6EhISdNNNN2nOnDnq27evewR+9OhR/eUvf9EPfvADde3aVTExMYqIuHB84HA4\n9Kc//UnPPvusbrvtNvfy9evXa/HixXryySc9Pu7y5cs1evRode3aVb///e81YcIEn+o9efKkunfv\nrujoaJWXl2vt2rW65ZZbLv2JAx0QI3QgDF111VW64YYbLlheXFyswYMH69Zbb5XFYnH/u++++7R3\n717t27fvovuuqqq64Hfo7733XpvbT5w4UR9++KF7ul2SWlpatGzZMo0YMUI33XSTPv74Y/3Lv/zL\nBfctKSlR165dl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dKCTW7t2\nrdLT02Wz2dTU1BTqcgBcJgId6ORWrlyphx9+WIMGDfJ49bdVq1YpPz9fP/nJTzRhwgTdf//9rS4y\n0dDQoNmzZysnJ0fTp09XdXW1JGnv3r265557dOedd2rChAlatmxZsJ4S0CkR6EAntmfPHh0/flw3\n33yzJk+erJUrV3rcbteuXXryySe1bt063XTTTVq4cKF73V//+lf94he/kM1m04ABA/Q///M/kqQ+\nffpo2bJlWr16td5++2299dZbOnDgQFCeF9AZEehAJ1ZYWKhJkybJZDJp/PjxKi8v93iJx+9///vq\n37+/JOmHP/yhtm/f7l43bNgwXXnllZKk9PR0HTp0SJLU2Niop556Srm5ubr77rtVVVWlPXv2BOFZ\nAZ1TpziXO4ALNTU1ae3atYqKilJxcbEkqbm5+ZLPvx8dHe3+22w2y+l0SpJeeuklWSwW/du//Zsi\nIyM1Y8YMORyO9nsCAFphhA50UqWlpbrmmmu0ZcsW9xXeXnvtNa1evfqCbT/55BMdPHhQ0tnv3G++\n+eaL7r++vl7JycmKjIzUvn37tHPnzvZ+CgDOwwgd6KRWrlyp3NzcVssyMjLU0tKiHTt26Prrr3cv\nHzZsmJ5//nl9+eWX6tWrl/793//9ovt/6KGH9OSTT6qwsFDXXHONbrzxxnZ/DgC+xdXWAHi1atUq\nbdq0SS+//HKoSwHgBVPuAAAYACN0AAAMgBE6AAAGQKADAGAABDoAAAZAoAMAYAAEOgAABkCgAwBg\nAP8f9cbYfMPApCwAAAAASUVORK5CYII=\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7fab778d9710>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x = np.array(components_count) / 61.\n",
"y = np.array(mpe_vars)\n",
"plt.scatter(x, y, label = \"PCA\")\n",
"plt.title(\"MAPE vs Alpha\")\n",
"plt.xlabel(\"Alpha\")\n",
"plt.ylabel(\"MAPE\")\n",
"plt.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/anaconda3/lib/python3.6/site-packages/matplotlib/font_manager.py:1297: UserWarning: findfont: Font family ['sans-serif'] not found. Falling back to DejaVu Sans\n",
" (prop.get_family(), self.defaultFamily[fontext]))\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAf4AAAFoCAYAAAC2UJl7AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3X9YVHXe//HXwIg/glVAGBJZvqFQrb9Nt7xbtUbRTSRI\n9DYr95bVy8zKzK3dzF3XJTU3v+1q7d7dN5ulu97RD1Msx7v1Bu+gbTO30qi+kYlRWjEgIooo6Hi+\nf7hMIjCgM8Mg5/m4Lq9mzudzznzOOy9fcz7nzDkWwzAMAQAAUwgK9AAAAED7IfgBADARgh8AABMh\n+AEAMBGCHwAAEyH4AQAwEYIfQId06NAhXX311Tpz5oxP+wJmR/ADlzm73a6BAwfqyJEjjZanp6fr\n6quv1qFDhyRJZWVluv/++3X99dfruuuu0+TJk7V582ZJ3wXnsGHDGv3Zvn2738f/7rvv6uqrr1Z2\ndrbfPwuAZA30AAB4LzY2Vg6HQzNnzpQkffbZZzp58mSjPg8//LCuueYa/e///q9CQkK0b98+VVRU\nNOrzj3/8Q1Zr+/6zkJubq169emnr1q2aO3duu342YEYc8QOdQFpamnJzc93vc3NzlZ6e3qjPxx9/\nrClTpqhHjx6yWq36wQ9+oLFjx170Z23fvl1TpkxptGz9+vWaN2+eJKmgoECTJk3SsGHDNHr0aK1b\nt67FbdXW1uqNN97Q0qVL9eWXX+qjjz5qse/MmTP15JNPaurUqRo+fLjuueceHT16tFGf119/XTfd\ndJOuv/56PfPMM+7lRUVFmj59ukaMGKEf/ehHysrKUn19/UXvO9AZEPxAJzB06FDV1NSopKRELpdL\nDodDt956a6M+Q4YM0W9+8xs5HA598803l/xZN998s7744guVlpa6l73++utKTU2VJC1ZskRZWVna\ns2ePtm3bphtuuKHFbe3YsUNXXHGFfvzjH+tHP/pRoy8vzcnNzdXKlSv1t7/9TVarVcuXL2/U/v77\n7+uNN97Qhg0b9Mc//lElJSWSpKCgIC1evFi7du3Siy++qHfeeUcvvPDCJVYAuLwR/EAn0XDU//bb\nb6tfv36y2WyN2teuXasRI0bo3//93zVu3DilpaWpqKioUZ8bbrhBI0aMcP9pCM7zde/eXePGjdO2\nbdskSaWlpTpw4IDsdrskyWq1av/+/aqpqVHPnj01YMCAFsecm5urW265RcHBwZo8ebIcDodOnz7t\ncR+TkpLUo0cPPfDAA3rjjTfkcrnc7ffdd5+6deuma665Rtdcc42Ki4slSQMHDtTQoUNltVrVt29f\nTZ8+Xf/4xz9aqSjQORH8QCeRlpambdu2acuWLUpLS2vS3rNnTz300ENyOBx6++23de211+ree+/V\n+c/p2rVrl9577z33n379+jX7WampqXI4HJKkbdu2afz48erevbsk6amnnlJBQYFuvvlm3XXXXdqz\nZ0+z2/j222/17rvvumcKxo0bp7q6OhUUFLS4j1deeaX7dZ8+fXT69GlVVVW5l/Xu3dv9unv37qqt\nrZUkffHFF7r77rt14403avjw4fr973/faD3ATAh+oJOIjY1V3759VVBQoAkTJnjsGxERoZ/+9Kcq\nLy9vcp68Lf7lX/5FR44c0aeffqpt27Zp8uTJ7rbBgwfrmWee0d///neNHz9eCxcubHYbW7du1dmz\nZ3XPPffoxhtv1Pjx41VfX68tW7a0+Lnffvtto9ddunRReHh4q+NdtmyZEhIS9Ne//lUffPCBHnzw\nQfFgUpgVV/UDnciKFStUXV2tHj16NPlN++rVq5WWlqaEhASdOnVKOTk5io+PV3h4uE6cOHFRn9Ol\nSxf9+Mc/1hNPPKHq6mrdeOONkqT6+nq98cYbuvnmmxUWFqYrrrhCQUHNH19s2bJF9913n26//Xb3\nsqKiIj3wwAMtHo2/9tprSk9PV2xsrNauXauJEycqODi41fGeOHFCV1xxha644gqVlJQoJydHERER\nF7XPQGdB8AOdyPe///0W206dOqX77rtPFRUV6tq1q4YMGdLoynd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0pNTW20bNiwYTp7\n9qx2796tgQMHupcPHz5cv/3tb/Xll1+qd+/eWr16davbv+eee/Tzn/9cmzZt0lVXXaWRI0f6fB8A\nfIen8wHwic2bN+vNN9/UU089FeihAPCAqX4AAEyEI34AAEyEI34AAEyE4AcAwEQIfgAATITgBwDA\nRAh+AABMhOAHAMBE/j9IekHRGc9nWwAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7f076c3869b0>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"x = np.array(components_count) / 61.\n",
"y = np.array(mse_vars) * 100\n",
"plt.scatter(x, y, label = \"PCA\")\n",
"plt.title(\"MSE vs Alpha\")\n",
"plt.xlabel(\"Alpha\")\n",
"plt.ylabel(\"MSE\")\n",
"plt.legend()\n",
"plt.show()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment