Skip to content

Instantly share code, notes, and snippets.

@Radi4
Created February 4, 2018 17:02
Show Gist options
  • Save Radi4/c4d41e032c707ec043a535dcbff9c221 to your computer and use it in GitHub Desktop.
Save Radi4/c4d41e032c707ec043a535dcbff9c221 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 28,
"metadata": {},
"outputs": [],
"source": [
"from keras.models import Model\n",
"from keras.layers import Dense, Input\n",
"import numpy as np\n",
"import mne\n",
"import os\n",
"from sklearn.preprocessing import StandardScaler\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": 29,
"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": 30,
"metadata": {
"scrolled": true
},
"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",
"2\n"
]
}
],
"source": [
"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",
" data = np.append(data, eeg_data, axis = 0)\n",
" except:\n",
" fail_count += 1\n",
" continue\n",
"\n",
"print(fail_count)"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"scaler = StandardScaler()\n",
"scaled_data = scaler.fit_transform(data)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Петр и Девушки. Обе команды использовали StandartScaller"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Девушки"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import keras"
]
},
{
"cell_type": "code",
"execution_count": 8,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/anaconda3/lib/python3.6/site-packages/keras/models.py:245: UserWarning: No training configuration found in save file: the model was *not* compiled. Compile it manually.\n",
" warnings.warn('No training configuration found in save file: '\n"
]
}
],
"source": [
"encoder = keras.models.load_model('./catherineglazkova_tasssshhhha/encoder.p')\n",
"decoder = keras.models.load_model('./catherineglazkova_tasssshhhha/decoder.p')"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.24630945127079723"
]
},
"execution_count": 10,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_encoded = encoder.predict(scaled_data)\n",
"alpha = data_encoded.shape[1] / 61\n",
"data_decoded = decoder.predict(data_encoded)\n",
"data_pred = scaler.inverse_transform(data_decoded)\n",
"mse = mean_squared_error(data, data_pred)\n",
"score = (1 + mse) * alpha\n",
"score"
]
},
{
"cell_type": "code",
"execution_count": 11,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0016584351679086453"
]
},
"execution_count": 11,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mse"
]
},
{
"cell_type": "code",
"execution_count": 13,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(50462050, 15)"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_encoded.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Петр"
]
},
{
"cell_type": "code",
"execution_count": 12,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import pickle"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"import tempfile\n",
"def make_keras_picklable():\n",
" def __getstate__(self):\n",
" model_str = \"\"\n",
" with tempfile.NamedTemporaryFile(suffix='.hdf5', delete=True) as fd:\n",
" keras.models.save_model(self, fd.name, overwrite=True)\n",
" model_str = fd.read()\n",
" d = { 'model_str': model_str }\n",
" return d\n",
"\n",
" def __setstate__(self, state):\n",
" with tempfile.NamedTemporaryFile(suffix='.hdf5', delete=True) as fd:\n",
" fd.write(state['model_str'])\n",
" fd.flush()\n",
" model = keras.models.load_model(fd.name)\n",
" self.__dict__ = model.__dict__\n",
"\n",
"\n",
" cls = keras.models.Model\n",
" cls.__getstate__ = __getstate__\n",
" cls.__setstate__ = __setstate__\n",
"make_keras_picklable()"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/anaconda3/lib/python3.6/site-packages/keras/models.py:245: UserWarning: No training configuration found in save file: the model was *not* compiled. Compile it manually.\n",
" warnings.warn('No training configuration found in save file: '\n"
]
}
],
"source": [
"load_encoder = pickle.load(open(\"./Petr/encoder.pkl\", \"rb\"))\n",
"load_decoder = pickle.load(open(\"./Petr/decoder.pkl\", \"rb\"))"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.9195437515270669"
]
},
"execution_count": 19,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_encoded = load_encoder.predict(scaled_data)\n",
"alpha = data_encoded.shape[1] / 61\n",
"data_decoded = load_decoder.predict(data_encoded)\n",
"data_pred = scaler.inverse_transform(data_decoded)\n",
"mse = mean_squared_error(data, data_pred)\n",
"score = (1 + mse) * alpha\n",
"score"
]
},
{
"cell_type": "code",
"execution_count": 20,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.0016458721991263316"
]
},
"execution_count": 20,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mse"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(50462050, 56)"
]
},
"execution_count": 21,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_encoded.shape"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Комадна Валентин, Валерия, Костя"
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"from os import walk\n",
"\n",
"mne.set_log_level('WARNING')\n",
"data_path = u\"./data/new_data/\""
]
},
{
"cell_type": "code",
"execution_count": 48,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def getBatches(arr, batch_size=50, axis=0):\n",
" n = arr.shape[axis] // batch_size\n",
" return np.array_split(arr, n, axis=axis)\n",
"\n",
"def prepareData(file_path):\n",
" raw = np.array(mne.io.read_raw_brainvision(file_path, preload=True).to_data_frame())\n",
" batches = np.array(getBatches(raw))\n",
" del raw\n",
" \n",
" return batches"
]
},
{
"cell_type": "code",
"execution_count": 49,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"files = []\n",
"data = []\n",
"for elem in walk(data_path):\n",
" for file in elem[-1]:\n",
" if file[-4:] == \"vhdr\":\n",
" files.append(file)\n",
"\n",
"data = np.ndarray(shape=(0, 50, 61))\n",
"flag = False\n",
"for file in files:\n",
" file_name = data_path + file\n",
" \n",
" try:\n",
" batches = prepareData(file_name)\n",
" data = np.concatenate((data, batches), axis=0)\n",
" except:\n",
" continue"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"/opt/conda/anaconda3/lib/python3.6/site-packages/keras/models.py:245: UserWarning: No training configuration found in save file: the model was *not* compiled. Compile it manually.\n",
" warnings.warn('No training configuration found in save file: '\n"
]
}
],
"source": [
"encoder = keras.models.load_model('./biryuk_v_nyaaak_erreth_akbe/encoder_elu.h5')\n",
"decoder = keras.models.load_model('./biryuk_v_nyaaak_erreth_akbe/decoder_elu.h5')"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1009241, 50, 61)"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data.shape"
]
},
{
"cell_type": "code",
"execution_count": 52,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1009241, 1000)"
]
},
"execution_count": 52,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_encoded = encoder.predict(data)\n",
"data_encoded.shape"
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(1009241, 50, 61)"
]
},
"execution_count": 53,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data_pred = decoder.predict(data_encoded)\n",
"data_pred.shape"
]
},
{
"cell_type": "code",
"execution_count": 54,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"0.32786885245901637"
]
},
"execution_count": 54,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"alpha = 1000 / (50 * 61)\n",
"alpha"
]
},
{
"cell_type": "code",
"execution_count": 55,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"data_original = data.reshape((1009241 * 50, 61))\n",
"data_original_pred = data_pred.reshape((1009241 * 50, 61))\n",
"mse = mean_squared_error(data_original, data_original_pred)"
]
},
{
"cell_type": "code",
"execution_count": 56,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"14357335228541.21"
]
},
"execution_count": 56,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"mse"
]
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4707323025751.544"
]
},
"execution_count": 57,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"score = (1 + mse) * alpha\n",
"score"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Последняя команда делала так как сказано в начале статьи(делили еег по времени на группы размера 50). У них самый худший результат, но взоможно из-за того, что они не делала Scaller. У первой команды(девушки), в коде есть перебо размерности закодированных данных и там видно, что mse почти не меняется. Итоговый результат такой\n",
"1) Девушки\n",
"2) Петр и Марк\n",
"3) Валентин, Валерия и Константин"
]
},
{
"cell_type": "code",
"execution_count": 9,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<table>\n",
"<thead>\n",
"<tr><th>Team </th><th style=\"text-align: right;\"> Alpha</th><th style=\"text-align: right;\"> Mse</th></tr>\n",
"</thead>\n",
"<tbody>\n",
"<tr><td>Девушки </td><td style=\"text-align: right;\"> 0.246 </td><td style=\"text-align: right;\">0.0016 </td></tr>\n",
"<tr><td>Петр </td><td style=\"text-align: right;\"> 0.91 </td><td style=\"text-align: right;\">0.00165 </td></tr>\n",
"<tr><td>Валентин, Валерия, Костя</td><td style=\"text-align: right;\"> 0.3279</td><td style=\"text-align: right;\">1.43573e+13</td></tr>\n",
"</tbody>\n",
"</table>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"execution_count": 9,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"from tabulate import tabulate\n",
"from IPython.display import HTML\n",
"HTML(tabulate([[\"Девушки\", 0.246, 0.0016], [\"Петр\", 0.91, 0.00165], [\"Валентин, Валерия, Костя\", 0.3279, 14357335228541.21]],\n",
" headers= ['Team', 'Alpha', 'Mse'], tablefmt='html'))"
]
},
{
"cell_type": "code",
"execution_count": 15,
"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": [
"batch_size = 256\n",
"epoch_num = 7\n",
"\n",
"channels_num = 61\n",
"encoding_dim_vars = [50,40,35,30,25,20,15]\n",
"\n",
"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",
"train_data = np.zeros((0,channels_num))\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",
" train_data = np.append(train_data, eeg_data, axis = 0)"
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [],
"source": [
"scaler = StandardScaler()\n",
"train_data_scaled = scaler.fit_transform(train_data)"
]
},
{
"cell_type": "code",
"execution_count": 31,
"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_eeg_dir = \"./data/new_data/\"\n",
"test_eeg_names = [x for x in os.listdir(test_eeg_dir) \n",
" if x[-5:] == \".vhdr\"]\n",
"test_data = np.zeros((0,61))\n",
"\n",
"for eeg_name in test_eeg_names:\n",
" try:\n",
" eeg_data = mne.io.read_raw_brainvision(test_eeg_dir + eeg_name, preload=True).get_data().T\n",
" test_data = np.append(test_data, eeg_data, axis = 0)\n",
" except FileNotFoundError:\n",
" continue"
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"test_data_scaled = scaler.fit_transform(test_data)"
]
},
{
"cell_type": "code",
"execution_count": 40,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(18411000, 61)"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"train_data.shape"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(50462050, 61)"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"test_data.shape"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"X_train, X_test, _, _ = train_test_split(train_data_scaled, train_data_scaled, test_size=0.1, random_state = 123)"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"def create_ae(encoding_dim = 30, channels_num = 61):\n",
" input_data = Input(shape=(channels_num,))\n",
" encoded = Dense(encoding_dim, activation='relu')(input_data)\n",
"\n",
" input_encoded = Input(shape=(encoding_dim,))\n",
" decoded = Dense(channels_num, activation='sigmoid')(input_encoded)\n",
"\n",
" encoder = Model(input_data, encoded, name=\"encoder\")\n",
" decoder = Model(input_encoded, decoded, name=\"decoder\")\n",
"\n",
" autoencoder = Model(input_data, decoder(encoder(input_data)), name=\"autoencoder\")\n",
"\n",
" autoencoder.compile(optimizer='adam', loss='mean_squared_error')\n",
" #autoencoder.summary()\n",
" return encoder, decoder, autoencoder"
]
},
{
"cell_type": "code",
"execution_count": 38,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(16569900, 61)"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"batch_size = 256\n",
"epoch_num = 7\n",
"\n",
"channels_num = 61\n",
"encoding_dim_vars = [55, 50, 45, 40, 35, 30, 25, 20, 15]\n",
"X_train.shape"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 189s - loss: 0.5858 - val_loss: 0.5845\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 185s - loss: 0.5844 - val_loss: 0.5844\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 184s - loss: 0.5843 - val_loss: 0.5844\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 186s - loss: 0.5842 - val_loss: 0.5842\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 184s - loss: 0.5842 - val_loss: 0.5842\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 183s - loss: 0.5842 - val_loss: 0.5842\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 183s - loss: 0.5842 - val_loss: 0.5842\n",
"55 0.0016191434877703033\n",
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 183s - loss: 0.5844 - val_loss: 0.5831\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 182s - loss: 0.5829 - val_loss: 0.5828\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 185s - loss: 0.5828 - val_loss: 0.5828\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 186s - loss: 0.5827 - val_loss: 0.5828\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 185s - loss: 0.5827 - val_loss: 0.5828\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 184s - loss: 0.5827 - val_loss: 0.5828\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 184s - loss: 0.5827 - val_loss: 0.5828\n",
"50 0.0016000174893919046\n",
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 175s - loss: 0.5859 - val_loss: 0.5841\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 173s - loss: 0.5838 - val_loss: 0.5838\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 174s - loss: 0.5837 - val_loss: 0.5837\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 176s - loss: 0.5837 - val_loss: 0.5837\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 176s - loss: 0.5836 - val_loss: 0.5837\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 177s - loss: 0.5836 - val_loss: 0.5837\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 176s - loss: 0.5836 - val_loss: 0.5836\n",
"45 0.0016036925670046172\n",
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 172s - loss: 0.5853 - val_loss: 0.5837\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 174s - loss: 0.5836 - val_loss: 0.5836\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 175s - loss: 0.5836 - val_loss: 0.5836\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 174s - loss: 0.5836 - val_loss: 0.5836\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 171s - loss: 0.5834 - val_loss: 0.5831\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 169s - loss: 0.5830 - val_loss: 0.5831\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 173s - loss: 0.5830 - val_loss: 0.5831\n",
"40 0.0016194642290537295\n",
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 172s - loss: 0.5874 - val_loss: 0.5849\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 172s - loss: 0.5848 - val_loss: 0.5848\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 179s - loss: 0.5847 - val_loss: 0.5848\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 175s - loss: 0.5845 - val_loss: 0.5839\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 177s - loss: 0.5838 - val_loss: 0.5838\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 179s - loss: 0.5838 - val_loss: 0.5838\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 177s - loss: 0.5838 - val_loss: 0.5838\n",
"35 0.0016373105322479613\n",
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 175s - loss: 0.5861 - val_loss: 0.5843\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 175s - loss: 0.5834 - val_loss: 0.5833\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 173s - loss: 0.5832 - val_loss: 0.5833\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 169s - loss: 0.5832 - val_loss: 0.5833\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 169s - loss: 0.5832 - val_loss: 0.5832\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 169s - loss: 0.5832 - val_loss: 0.5832\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 168s - loss: 0.5831 - val_loss: 0.5831\n",
"30 0.0016457742816988015\n",
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 163s - loss: 0.5902 - val_loss: 0.5882\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 164s - loss: 0.5881 - val_loss: 0.5881\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 167s - loss: 0.5881 - val_loss: 0.5881\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 166s - loss: 0.5879 - val_loss: 0.5879\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 164s - loss: 0.5876 - val_loss: 0.5876\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 162s - loss: 0.5876 - val_loss: 0.5876\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 164s - loss: 0.5875 - val_loss: 0.5876\n",
"25 0.0016772023516865354\n",
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 160s - loss: 0.5907 - val_loss: 0.5881\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 160s - loss: 0.5879 - val_loss: 0.5879\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 159s - loss: 0.5879 - val_loss: 0.5879\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 160s - loss: 0.5878 - val_loss: 0.5878\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 162s - loss: 0.5878 - val_loss: 0.5878\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 160s - loss: 0.5875 - val_loss: 0.5874\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 161s - loss: 0.5874 - val_loss: 0.5874\n",
"20 0.0016114161782412179\n",
"Train on 16569900 samples, validate on 1841100 samples\n",
"Epoch 1/7\n",
"16569900/16569900 [==============================] - 158s - loss: 0.5994 - val_loss: 0.5959\n",
"Epoch 2/7\n",
"16569900/16569900 [==============================] - 159s - loss: 0.5958 - val_loss: 0.5952\n",
"Epoch 3/7\n",
"16569900/16569900 [==============================] - 159s - loss: 0.5951 - val_loss: 0.5951\n",
"Epoch 4/7\n",
"16569900/16569900 [==============================] - 160s - loss: 0.5950 - val_loss: 0.5950\n",
"Epoch 5/7\n",
"16569900/16569900 [==============================] - 165s - loss: 0.5949 - val_loss: 0.5949\n",
"Epoch 6/7\n",
"16569900/16569900 [==============================] - 166s - loss: 0.5949 - val_loss: 0.5949\n",
"Epoch 7/7\n",
"16569900/16569900 [==============================] - 165s - loss: 0.5945 - val_loss: 0.5944\n",
"15 0.0016173533817821755\n"
]
}
],
"source": [
"mse_vars = []\n",
"\n",
"for enc_dim in encoding_dim_vars:\n",
" encoder, decoder, autoencoder = create_ae(enc_dim)\n",
" hist = autoencoder.fit(X_train, X_train,\n",
" epochs=epoch_num,\n",
" batch_size = batch_size,\n",
" verbose=1, #Verbosity mode. 0 = silent, 1 = progress bar, 2 = one line per epoch.\n",
" validation_data=(X_test, X_test))\n",
" test_data_decoded = autoencoder.predict(test_data_scaled)\n",
" test_data_predict = scaler.inverse_transform(test_data_decoded)\n",
" mse = mean_squared_error(test_data, test_data_predict)\n",
" mse_vars.append(mse)\n",
" print(enc_dim, mse)"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {},
"outputs": [],
"source": [
"import matplotlib.pyplot as plt\n",
"x = np.array(encoding_dim_vars)\n",
"y = np.array(mse_vars)\n",
"y *= 100;\n",
"x = x / 61."
]
},
{
"cell_type": "code",
"execution_count": 53,
"metadata": {},
"outputs": [
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAZIAAAEWCAYAAABMoxE0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAHfpJREFUeJzt3X2UXXV97/H35ybkGpAYMFMeQjRxNRIiatSBq9XlVRF5\n8NYEpRp8AnUVaAXELrhGe31s75UqLrU1hQs0ilhFRR6iVZDCwva6qOZEgjwZjZGYjIEMIqJIISGf\n+8feQw6HmTNnsmfPOZP5vNY6a/b+7d/e53tmJvPJfvpt2SYiImJ3/ZduFxAREZNbgiQiIipJkERE\nRCUJkoiIqCRBEhERlSRIIiKikgRJxCQlab4kS5o+nn0jxipBEns8SXdLelTSnJb2W8o/rvPL+UMk\nfUPSfZJ+K+l2SaeUy4b+EP++5fWmCaj/FeV7v6/u94rYHQmSmCp+AZw0NCPpucDeLX0uAzYDzwSe\nDrwNuLelz2zbT216fbXGmoecDNwPvH0C3itizBIkMVVcxhP/EJ8MfLGlzxHAF2w/ZHuH7Vtsf2es\nbyTpTZIaLW3vlbS6nD5e0p2SfidpQNI5bba1D3Ai8G5goaT+Nn1vkvRxST+U9KCkayTt39LtLZJ+\nWe51/XXTukdKulnSA5K2SvqcpBlj/ewxNSVIYqr4D2CWpMMkTQOWA18aps9KScslPaPCe30TOFTS\nwqa2NwNfLqf/CTjN9r7A4cCNbbb1euD3wNeB6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xnrJHEhERlWSPJCIiKskeSUREVJIgiYiIShIkERFRSYIkIiIqSZBEREQl/x/a0aeI\nQAJw9gAAAABJRU5ErkJggg==\n",
"text/plain": [
"<matplotlib.figure.Figure at 0x7fa7deebd278>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"plt.scatter(x, y)\n",
"plt.title(\"MSE vs Alpha\")\n",
"plt.xlabel(\"Alpha\")\n",
"plt.ylabel(\"MSE * 100\")\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"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.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment