hexsha
stringlengths 40
40
| size
int64 6
14.9M
| ext
stringclasses 1
value | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 6
260
| max_stars_repo_name
stringlengths 6
119
| max_stars_repo_head_hexsha
stringlengths 40
41
| max_stars_repo_licenses
sequence | max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 6
260
| max_issues_repo_name
stringlengths 6
119
| max_issues_repo_head_hexsha
stringlengths 40
41
| max_issues_repo_licenses
sequence | max_issues_count
int64 1
67k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 6
260
| max_forks_repo_name
stringlengths 6
119
| max_forks_repo_head_hexsha
stringlengths 40
41
| max_forks_repo_licenses
sequence | max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | avg_line_length
float64 2
1.04M
| max_line_length
int64 2
11.2M
| alphanum_fraction
float64 0
1
| cells
sequence | cell_types
sequence | cell_type_groups
sequence |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d0c9708e5af1b97645062a267cc90c1a1107120d | 2,705 | ipynb | Jupyter Notebook | Módulo07Aula24.ipynb | julianovale/pythonparatodos | 09c851f695b50a2810b927611a8a10b15b23af2b | [
"MIT"
] | null | null | null | Módulo07Aula24.ipynb | julianovale/pythonparatodos | 09c851f695b50a2810b927611a8a10b15b23af2b | [
"MIT"
] | null | null | null | Módulo07Aula24.ipynb | julianovale/pythonparatodos | 09c851f695b50a2810b927611a8a10b15b23af2b | [
"MIT"
] | null | null | null | 26.262136 | 243 | 0.436969 | [
[
[
"<a href=\"https://colab.research.google.com/github/julianovale/pythonparatodos/blob/main/M%C3%B3dulo07Aula24.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
],
[
"PDF da apresentação:\r\n\r\nhttps://drive.google.com/file/d/1k5xfHrWnjPJJc05kB3op_05PAZpZpAfO/view\r\n",
"_____no_output_____"
]
],
[
[
"def ma(lista):\r\n soma = 0\r\n cont = 0\r\n for i in lista:\r\n soma = soma + i\r\n cont = cont + 1\r\n return soma/cont\r\n\r\ndef mg(lista):\r\n prod = 1\r\n cont = 0\r\n for i in lista:\r\n prod = prod*i\r\n cont = cont + 1\r\n return prod**(1/cont)\r\n\r\ndef mediaAG(lista, tip = 0):\r\n if (tip == 0):\r\n r = ma(lista)\r\n else:\r\n r = mg(lista)\r\n return r",
"_____no_output_____"
],
[
"l1 = [7,8,9]\r\nt = 0\r\nm1 = mediaAG(tip = t, lista = l1)\r\nprint(\"A média aritmética é: {0:.2f}\".format(m1))\r\n\r\nt = 1\r\nm2 = mediaAG(tip = t, lista = l1)\r\nprint(\"A média geométrica é: {0:.2f}\".format(m2))",
"A média aritmética é: 8.00\nA média geométrica é: 7.96\n"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code",
"code"
]
] |
d0c97e64839100679d2b329ee62ea3fcfc76bafb | 481,208 | ipynb | Jupyter Notebook | _doc/notebooks/td2a_ml/seasonal_timeseries.ipynb | Jerome-maker/ensae_teaching_cs | 43ea044361ee60c00c85aea354a7b25c21c0fd07 | [
"MIT"
] | null | null | null | _doc/notebooks/td2a_ml/seasonal_timeseries.ipynb | Jerome-maker/ensae_teaching_cs | 43ea044361ee60c00c85aea354a7b25c21c0fd07 | [
"MIT"
] | null | null | null | _doc/notebooks/td2a_ml/seasonal_timeseries.ipynb | Jerome-maker/ensae_teaching_cs | 43ea044361ee60c00c85aea354a7b25c21c0fd07 | [
"MIT"
] | null | null | null | 250.629167 | 92,074 | 0.881033 | [
[
[
"# Timeseries\n\nCe notebook présente quelques étapes simples pour une série temporelle. La plupart utilise le module [statsmodels.tsa](https://www.statsmodels.org/stable/tsa.html#module-statsmodels.tsa).",
"_____no_output_____"
]
],
[
[
"from jyquickhelper import add_notebook_menu\nadd_notebook_menu()",
"_____no_output_____"
],
[
"%matplotlib inline",
"_____no_output_____"
]
],
[
[
"## Données\n\nLes données sont artificielles mais simulent ce que pourraient être le chiffre d'affaires d'un magasin de quartier, des samedi très forts, une semaine morne, un Noël chargé, un été plat.",
"_____no_output_____"
]
],
[
[
"from ensae_teaching_cs.data import generate_sells\nimport pandas\ndf = pandas.DataFrame(generate_sells())\ndf.head()",
"_____no_output_____"
]
],
[
[
"## Premiers graphiques\n\nLa série a deux saisonnalités, hebdomadaire, mensuelle.",
"_____no_output_____"
]
],
[
[
"import matplotlib.pyplot as plt\nfig, ax = plt.subplots(1, 2, figsize=(14, 4))\ndf.iloc[-30:].set_index('date').plot(ax=ax[0])\ndf.set_index('date').plot(ax=ax[1])\nax[0].set_title(\"chiffre d'affaire sur le dernier mois\")\nax[1].set_title(\"chiffre d'affaire sur deux ans\");",
"_____no_output_____"
]
],
[
[
"Elle a une vague tendance, on peut calculer un tendance à l'ordre 1, 2, ...",
"_____no_output_____"
]
],
[
[
"from statsmodels.tsa.tsatools import detrend\nnotrend = detrend(df.value, order=1)\ndf[\"notrend\"] = notrend\ndf[\"trend\"] = df['value'] - notrend\nax = df.plot(x=\"date\", y=[\"value\", \"trend\"], figsize=(14,4))\nax.set_title('tendance');",
"_____no_output_____"
]
],
[
[
"Autocorrélations...",
"_____no_output_____"
]
],
[
[
"from statsmodels.tsa.stattools import acf\ncor = acf(df.value)\ncor",
"_____no_output_____"
],
[
"fig, ax = plt.subplots(1, 1, figsize=(14,2))\nax.plot(cor)\nax.set_title(\"Autocorrélogramme\");",
"_____no_output_____"
]
],
[
[
"La première saisonalité apparaît, 7, 14, 21... Les autocorrélations partielles confirment cela, plutôt 7 jours.",
"_____no_output_____"
]
],
[
[
"from statsmodels.tsa.stattools import pacf\nfrom statsmodels.graphics.tsaplots import plot_pacf\nplot_pacf(df.value, lags=50);",
"_____no_output_____"
]
],
[
[
"Comme il n'y a rien le dimanche, il vaut mieux les enlever. Garder des zéros nous priverait de modèles multiplicatifs.",
"_____no_output_____"
]
],
[
[
"df[\"weekday\"] = df.date.dt.weekday\ndf.head()",
"_____no_output_____"
],
[
"df_nosunday = df[df.weekday != 6]\ndf_nosunday.head(n=10)",
"_____no_output_____"
],
[
"fig, ax = plt.subplots(1, 1, figsize=(14,2))\ncor = acf(df_nosunday.value)\nax.plot(cor)\nax.set_title(\"Autocorrélogramme\");",
"_____no_output_____"
],
[
"plot_pacf(df_nosunday.value, lags=50);",
"_____no_output_____"
]
],
[
[
"On décompose la série en tendance + saisonnalité. Les étés et Noël apparaissent.",
"_____no_output_____"
]
],
[
[
"from statsmodels.tsa.seasonal import seasonal_decompose\nres = seasonal_decompose(df_nosunday.value, freq=7)\nres.plot();",
"_____no_output_____"
],
[
"plt.plot(res.seasonal[-30:])\nplt.title(\"Saisonnalité\");",
"_____no_output_____"
],
[
"cor = acf(res.trend[5:-5]);\nplt.plot(cor);",
"_____no_output_____"
]
],
[
[
"On cherche maintenant la saisonnalité de la série débarrassée de sa tendance herbdomadaire. On retrouve la saisonnalité mensuelle.",
"_____no_output_____"
]
],
[
[
"res_year = seasonal_decompose(res.trend[5:-5], freq=25)\nres_year.plot();",
"_____no_output_____"
]
],
[
[
"## Test de stationnarité\n\nLe test [KPSS](https://en.wikipedia.org/wiki/KPSS_test) permet de tester la stationnarité d'une série.",
"_____no_output_____"
]
],
[
[
"from statsmodels.tsa.stattools import kpss\nkpss(res.trend[5:-5])",
"c:\\python372_x64\\lib\\site-packages\\statsmodels\\tsa\\stattools.py:1276: InterpolationWarning: p-value is smaller than the indicated p-value\n warn(\"p-value is smaller than the indicated p-value\", InterpolationWarning)\n"
]
],
[
[
"Comme ce n'est pas toujours facile à interpréter, on simule une variable aléatoire gaussienne donc sans tendance.",
"_____no_output_____"
]
],
[
[
"from numpy.random import randn\nbruit = randn(1000)\nkpss(bruit)",
"c:\\python372_x64\\lib\\site-packages\\statsmodels\\tsa\\stattools.py:1278: InterpolationWarning: p-value is greater than the indicated p-value\n warn(\"p-value is greater than the indicated p-value\", InterpolationWarning)\n"
]
],
[
[
"Et puis une série avec une tendance forte.",
"_____no_output_____"
]
],
[
[
"from numpy.random import randn\nfrom numpy import arange\nbruit = randn(1000) * 100 + arange(1000) / 10\nkpss(bruit)",
"_____no_output_____"
]
],
[
[
"Une valeur forte indique une tendance et la série en a clairement une.",
"_____no_output_____"
],
[
"## Prédiction\n\nLes modèles *AR*, *ARMA*, *ARIMA* se concentrent sur une série à une dimension. En machine learning, il y a la série et plein d'autres informations. On construit une matrice avec des séries décalées.",
"_____no_output_____"
]
],
[
[
"from statsmodels.tsa.tsatools import lagmat\nlag = 8\nX = lagmat(df_nosunday[\"value\"], lag)\nlagged = df_nosunday.copy()\nfor c in range(1,lag+1):\n lagged[\"lag%d\" % c] = X[:, c-1]\nlagged.tail()",
"_____no_output_____"
]
],
[
[
"On ajoute ou on réécrit le jour de la semaine qu'on utilise comme variable supplémentaire.",
"_____no_output_____"
]
],
[
[
"lagged[\"weekday\"] = lagged.date.dt.weekday",
"_____no_output_____"
],
[
"X = lagged.drop([\"date\", \"value\", \"notrend\", \"trend\"], axis=1)\nY = lagged[\"value\"]\nX.shape, Y.shape",
"_____no_output_____"
],
[
"from numpy import corrcoef\ncorrcoef(X)",
"_____no_output_____"
]
],
[
[
"Etrange autant de grandes valeurs, cela veut dire que la tendance est trop forte pour calculer des corrélations, il vaudrait mieux tout recommencer avec la série $\\Delta Y_t = Y_t - Y_{t-1}$. Bref, passons...",
"_____no_output_____"
]
],
[
[
"X.columns",
"_____no_output_____"
]
],
[
[
"Une régression linéaire car les modèles linéaires sont toujours de bonnes baseline et pour connaître le modèle simulé, on ne fera pas beaucoup mieux.",
"_____no_output_____"
]
],
[
[
"from sklearn.linear_model import LinearRegression\nclr = LinearRegression()\nclr.fit(X, Y)",
"_____no_output_____"
],
[
"from sklearn.metrics import r2_score\nr2_score(Y, clr.predict(X))",
"_____no_output_____"
],
[
"clr.coef_",
"_____no_output_____"
]
],
[
[
"On retrouve la saisonnalité, $Y_t$ et $Y_{t-6}$ sont de mèches.",
"_____no_output_____"
]
],
[
[
"for i in range(1, X.shape[1]):\n print(\"X(t-%d)\" % (i), r2_score(Y, X.iloc[:, i]))",
"X(t-1) -0.5799344874123231\nX(t-2) -1.0271995693021703\nX(t-3) -1.2451181610331497\nX(t-4) -1.0497781280554928\nX(t-5) -0.6300696727754616\nX(t-6) 0.8212380818165589\nX(t-7) -0.643903114304551\nX(t-8) -1.09689904382877\n"
]
],
[
[
"Auparavant (l'année dernière en fait), je construisais deux bases, apprentissage et tests, comme ceci :",
"_____no_output_____"
]
],
[
[
"n = X.shape[0]\nX_train = X.iloc[:n * 2//3]\nX_test = X.iloc[n * 2//3:]\nY_train = Y[:n * 2//3]\nY_test = Y[n * 2//3:]",
"_____no_output_____"
]
],
[
[
"Et puis *scikit-learn* est arrivée avec [TimeSeriesSplit](https://scikit-learn.org/stable/modules/generated/sklearn.model_selection.TimeSeriesSplit.html).",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import TimeSeriesSplit\ntscv = TimeSeriesSplit(n_splits=5)\nfor train_index, test_index in tscv.split(lagged):\n data_train, data_test = lagged.iloc[train_index, :], lagged.iloc[test_index, :]\n print(\"TRAIN:\", data_train.shape, \"TEST:\", data_test.shape)",
"TRAIN: (107, 13) TEST: (104, 13)\nTRAIN: (211, 13) TEST: (104, 13)\nTRAIN: (315, 13) TEST: (104, 13)\nTRAIN: (419, 13) TEST: (104, 13)\nTRAIN: (523, 13) TEST: (104, 13)\n"
]
],
[
[
"Et on calé une forêt aléatoire...",
"_____no_output_____"
]
],
[
[
"import warnings\nfrom sklearn.ensemble import RandomForestRegressor\nclr = RandomForestRegressor()\n\ndef train_test(clr, train_index, test_index):\n data_train = lagged.iloc[train_index, :]\n data_test = lagged.iloc[test_index, :]\n clr.fit(data_train.drop([\"value\", \"date\", \"notrend\", \"trend\"], \n axis=1), \n data_train.value)\n r2 = r2_score(data_test.value,\n clr.predict(data_test.drop([\"value\", \"date\", \"notrend\",\n \"trend\"], axis=1).as_matrix()))\n return r2\n\nwarnings.simplefilter(\"ignore\")\nlast_test_index = None\nfor train_index, test_index in tscv.split(lagged):\n r2 = train_test(clr, train_index, test_index) \n if last_test_index is not None:\n r2_prime = train_test(clr, last_test_index, test_index) \n print(r2, r2_prime)\n else:\n print(r2)\n last_test_index = test_index",
"0.6795844303954097\n0.8643514472109561 0.8438674497139955\n0.889424015517347 0.8566080912412136\n0.8108804128996021 0.652299214153693\n0.9082580468326908 0.9146950904017541\n"
]
],
[
[
"2 ans coupé en 5, soit tous les 5 mois, ça veut dire que ce découpage inclut parfois Noël, parfois l'été et que les performances y seront très sensibles.",
"_____no_output_____"
]
],
[
[
"from sklearn.metrics import r2_score\nr2 = r2_score(data_test.value,\n clr.predict(data_test.drop([\"value\", \"date\", \"notrend\",\n \"trend\"], axis=1).as_matrix()))\nr2",
"_____no_output_____"
]
],
[
[
"On compare avec le $r_2$ avec le même $r_2$ obtenu en utilisant $Y_{t-1}$, $Y_{t-2}$, ... $Y_{t-d}$ comme prédiction.",
"_____no_output_____"
]
],
[
[
"for i in range(1, 9):\n print(i, \":\", r2_score(data_test.value, data_test[\"lag%d\" % i]))",
"1 : -0.9357733133623056\n2 : -1.4886358005577112\n3 : -1.8674091365311156\n4 : -1.5617646397661757\n5 : -0.9531085434874935\n6 : 0.8567402931376816\n7 : -0.9271996269480662\n8 : -1.5219232924913277\n"
],
[
"lagged[:5]",
"_____no_output_____"
]
],
[
[
"En fait le jour de la semaine est une variable catégorielle, on crée une colonne par jour.",
"_____no_output_____"
]
],
[
[
"from sklearn.compose import ColumnTransformer\nfrom sklearn.preprocessing import OneHotEncoder",
"_____no_output_____"
],
[
"cols = ['lag1', 'lag2', 'lag3',\n 'lag4', 'lag5', 'lag6', 'lag7', 'lag8']\nct = ColumnTransformer(\n [('pass', \"passthrough\", cols),\n (\"dummies\", OneHotEncoder(), [\"weekday\"])])\npred = ct.fit(lagged).transform(lagged[:5])\npred",
"_____no_output_____"
]
],
[
[
"On met tout dans un pipeline parce que c'est plus joli, plus pratique aussi.",
"_____no_output_____"
]
],
[
[
"from sklearn.pipeline import make_pipeline\nfrom sklearn.decomposition import PCA, TruncatedSVD \ncols = ['lag1', 'lag2', 'lag3',\n 'lag4', 'lag5', 'lag6', 'lag7', 'lag8']\nmodel = make_pipeline(\n make_pipeline(\n ColumnTransformer(\n [('pass', \"passthrough\", cols),\n (\"dummies\", make_pipeline(OneHotEncoder(), \n TruncatedSVD(n_components=2)), [\"weekday\"])]),\n LinearRegression()))\nmodel.fit(lagged, lagged[\"value\"])",
"_____no_output_____"
]
],
[
[
"C'est plus facile à voir visuellement.",
"_____no_output_____"
]
],
[
[
"from mlinsights.plotting import pipeline2dot\ndot = pipeline2dot(model, lagged)\nfrom jyquickhelper import RenderJsDot\nRenderJsDot(dot)",
"_____no_output_____"
],
[
"r2_score(lagged['value'], model.predict(lagged))",
"_____no_output_____"
]
],
[
[
"## Templating\n\nComplètement hors sujet mais utile.",
"_____no_output_____"
]
],
[
[
"from jinja2 import Template\ntemplate = Template('Hello {{ name }}!')\ntemplate.render(name='John Doe')",
"_____no_output_____"
],
[
"template = Template(\"\"\"\n{{ name }}\n{{ \"-\" * len(name) }}\nPossède :\n{% for i in range(len(meubles)) %}\n- {{meubles[i]}}{% endfor %}\n\"\"\")\nmeubles = ['table', \"tabouret\"]\nprint(template.render(name='John Doe Doe', len=len,\n meubles=meubles))",
"\nJohn Doe Doe\n------------\nPossède :\n\n- table\n- tabouret\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
]
] |
d0c981cbfa44f37d720b79047fd13d0e9c0726dc | 576 | ipynb | Jupyter Notebook | Hypothesis Testing/Hypothesis Testing.ipynb | yatharthrajput/Intro-to-ML | e6d5569069fade9030c9d7f023994edc139f8247 | [
"Apache-2.0"
] | 4 | 2021-12-14T09:07:37.000Z | 2022-01-07T11:18:59.000Z | Hypothesis Testing/Hypothesis Testing.ipynb | yatharthrajput/Intro-to-ML | e6d5569069fade9030c9d7f023994edc139f8247 | [
"Apache-2.0"
] | null | null | null | Hypothesis Testing/Hypothesis Testing.ipynb | yatharthrajput/Intro-to-ML | e6d5569069fade9030c9d7f023994edc139f8247 | [
"Apache-2.0"
] | null | null | null | 16.941176 | 34 | 0.524306 | [] | [] | [] |
d0c990d0e854ec603e85ace274f0bcab49d3fc2b | 68,591 | ipynb | Jupyter Notebook | Project_data modeling with postgres/.ipynb_checkpoints/etl-checkpoint.ipynb | yumengdong/Data-Engineer-Nanodegree-Udacity | 9fff4ccc088263049d5842f89174f335142bcb60 | [
"MIT"
] | null | null | null | Project_data modeling with postgres/.ipynb_checkpoints/etl-checkpoint.ipynb | yumengdong/Data-Engineer-Nanodegree-Udacity | 9fff4ccc088263049d5842f89174f335142bcb60 | [
"MIT"
] | null | null | null | Project_data modeling with postgres/.ipynb_checkpoints/etl-checkpoint.ipynb | yumengdong/Data-Engineer-Nanodegree-Udacity | 9fff4ccc088263049d5842f89174f335142bcb60 | [
"MIT"
] | null | null | null | 31.334399 | 402 | 0.422606 | [
[
[
"# ETL Processes\nUse this notebook to develop the ETL process for each of your tables before completing the `etl.py` file to load the whole datasets.",
"_____no_output_____"
]
],
[
[
"import os\nimport glob\nimport psycopg2\nimport pandas as pd\nfrom sql_queries import *",
"_____no_output_____"
],
[
"conn = psycopg2.connect(\"host=127.0.0.1 dbname=studentdb user=student password=student\")\ncur = conn.cursor()",
"_____no_output_____"
],
[
"conn = psycopg2.connect(\"host=127.0.0.1 dbname=sparkifydb user=student password=student\")\ncur = conn.cursor()",
"_____no_output_____"
],
[
"#YD: set auto commit. pring connection \n\nconn.set_session(autocommit=True)\nprint(conn)",
"<connection object at 0x11d86a048; dsn: 'user=student password=xxx dbname=sparkifydb host=127.0.0.1', closed: 0>\n"
],
[
"#YD: get all files. Use os.walk()\n\ndef get_files(filepath):\n all_files = []\n for root, dirs, files in os.walk(filepath):\n files = glob.glob(os.path.join(root,'*.json'))\n for f in files :\n all_files.append(os.path.abspath(f))\n \n return all_files",
"_____no_output_____"
],
[
"#YD: read json file\n\ndf1 = pd.read_json('data/log_data/2018/11/2018-11-01-events.json', lines=True)",
"_____no_output_____"
],
[
"df1.head()",
"_____no_output_____"
],
[
"df2 = pd.read_json('data/song_data/A/A/A/TRAAAAW128F429D538.json', lines=True)",
"_____no_output_____"
],
[
"df2.head()",
"_____no_output_____"
]
],
[
[
"# Process `song_data`\nIn this first part, you'll perform ETL on the first dataset, `song_data`, to create the `songs` and `artists` dimensional tables.\n\nLet's perform ETL on a single song file and load a single record into each table to start.\n- Use the `get_files` function provided above to get a list of all song JSON files in `data/song_data`\n- Select the first song in this list\n- Read the song file and view the data",
"_____no_output_____"
]
],
[
[
"song_files = get_files('data/song_data')",
"_____no_output_____"
],
[
"print(song_files[0])",
"/Users/yumengdong/E_Drive/13Fall/Rochester_AD_415/For SSN/0_Data Science/Data Engineer/Data Modeling/Project_data modeling with postgres/data/song_data/A/A/A/TRAAAEF128F4273421.json\n"
],
[
"len(song_files)",
"_____no_output_____"
],
[
"filepath = song_files[0]",
"_____no_output_____"
],
[
"df = pd.read_json(filepath, lines=True)\ndf.head()",
"_____no_output_____"
]
],
[
[
"## #1: `songs` Table\n#### Extract Data for Songs Table\n- Select columns for song ID, title, artist ID, year, and duration\n- Use `df.values` to select just the values from the dataframe\n- Index to select the first (only) record in the dataframe\n- Convert the array to a list and set it to `song_data`",
"_____no_output_____"
]
],
[
[
"# song_id, title, artist_id, year, duration\n#YD: Pandas tolist() is used to convert a series to list.\n\nsong_data = df[['song_id','title','artist_id','year','duration']].values.tolist()[0]\nsong_data",
"_____no_output_____"
],
[
"song_data = df[['song_id','title','artist_id','year','duration']].values[0]\nsong_data",
"_____no_output_____"
]
],
[
[
"#### Insert Record into Song Table\nImplement the `song_table_insert` query in `sql_queries.py` and run the cell below to insert a record for this song into the `songs` table. Remember to run `create_tables.py` before running the cell below to ensure you've created/resetted the `songs` table in the sparkify database.",
"_____no_output_____"
]
],
[
[
"cur.execute(song_table_insert, song_data)\nconn.commit()",
"_____no_output_____"
]
],
[
[
"Run `test.ipynb` to see if you've successfully added a record to this table.",
"_____no_output_____"
]
],
[
[
"# cur.close()\n# conn.close()",
"_____no_output_____"
]
],
[
[
"## #2: `artists` Table\n#### Extract Data for Artists Table\n- Select columns for artist ID, name, location, latitude, and longitude\n- Use `df.values` to select just the values from the dataframe\n- Index to select the first (only) record in the dataframe\n- Convert the array to a list and set it to `artist_data`",
"_____no_output_____"
]
],
[
[
"artist_data = df[['artist_id','artist_name','artist_location','artist_latitude','artist_longitude']].values.tolist()[0]\nartist_data",
"_____no_output_____"
],
[
"type(artist_data)",
"_____no_output_____"
],
[
"artist_data = df[['artist_id','artist_name','artist_location','artist_latitude','artist_longitude']].values[0]\nartist_data",
"_____no_output_____"
],
[
"type(artist_data)",
"_____no_output_____"
]
],
[
[
"#### Insert Record into Artist Table\nImplement the `artist_table_insert` query in `sql_queries.py` and run the cell below to insert a record for this song's artist into the `artists` table. Remember to run `create_tables.py` before running the cell below to ensure you've created/resetted the `artists` table in the sparkify database.",
"_____no_output_____"
]
],
[
[
"cur.execute(artist_table_insert, artist_data)\nconn.commit()",
"_____no_output_____"
]
],
[
[
"Run `test.ipynb` to see if you've successfully added a record to this table.",
"_____no_output_____"
],
[
"# Process `log_data`\nIn this part, you'll perform ETL on the second dataset, `log_data`, to create the `time` and `users` dimensional tables, as well as the `songplays` fact table.\n\nLet's perform ETL on a single log file and load a single record into each table.\n- Use the `get_files` function provided above to get a list of all log JSON files in `data/log_data`\n- Select the first log file in this list\n- Read the log file and view the data",
"_____no_output_____"
]
],
[
[
"log_files = get_files('data/log_data')",
"_____no_output_____"
],
[
"filepath = log_files[0]",
"_____no_output_____"
],
[
"df = pd.read_json(filepath, lines=True)\ndf.head()",
"_____no_output_____"
]
],
[
[
"## #3: `time` Table\n#### Extract Data for Time Table\n- Filter records by `NextSong` action\n- Convert the `ts` timestamp column to datetime\n - Hint: the current timestamp is in milliseconds\n- Extract the timestamp, hour, day, week of year, month, year, and weekday from the `ts` column and set `time_data` to a list containing these values in order\n - Hint: use pandas' [`dt` attribute](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.dt.html) to access easily datetimelike properties.\n- Specify labels for these columns and set to `column_labels`\n- Create a dataframe, `time_df,` containing the time data for this file by combining `column_labels` and `time_data` into a dictionary and converting this into a dataframe",
"_____no_output_____"
]
],
[
[
"df = df[df['page'] == 'NextSong']\ndf.head()",
"_____no_output_____"
],
[
"#YD: note that to_datetime default is 'ns'\nt = pd.to_datetime(df['ts'], unit='ms')\nt.head()",
"_____no_output_____"
],
[
"t = df.copy()\nt['ts'] = pd.to_datetime(df['ts'], unit='ms')\nt.head()",
"_____no_output_____"
],
[
"time_data = t['ts'].tolist()",
"_____no_output_____"
],
[
"len(time_data)",
"_____no_output_____"
],
[
"time_data[72].year",
"_____no_output_____"
],
[
"time_data[72].day_name()",
"_____no_output_____"
],
[
"time_data[72].weekday()",
"_____no_output_____"
],
[
"#YD: use day_name() to return weekday name\n\ntime_data_list = (t['ts'], t['ts'].dt.hour, t['ts'].dt.day, t['ts'].dt.week, t['ts'].dt.month, t['ts'].dt.year, t['ts'].dt.day_name())",
"_____no_output_____"
],
[
"column_labels = ['start_time','hour','day','week','month', 'year','weekday']",
"_____no_output_____"
],
[
"# time_df = pd.DataFrame(time_data_list,column_labels)\n# time_df.head(10)",
"_____no_output_____"
],
[
"time_df = pd.DataFrame(dict(zip(column_labels, time_data_list)))\ntime_df.head(10)",
"_____no_output_____"
],
[
"df['ts'] = time_df['start_time']",
"_____no_output_____"
],
[
"# start_time = []\n# time_hour = []\n# time_day = []\n# time_week = []\n# time_month = []\n# time_year = []\n# time_weekday = []\n\n# for i in time_data:\n# start_time = i\n# time_hour.append(i.hour)\n# time_day.append(i.day)\n# time_week.append(i.week)\n# time_month.append(i.month)\n# time_year.append(i.year)\n# time_weekday.append(i.weekday())",
"_____no_output_____"
],
[
"# column_labels = pd.DataFrame({\n# 'start_time': start_time,\n# 'hour': time_hour\n# 'day': time_day\n# 'week': time_week\n# 'month': time_month\n# 'year': time_year\n# 'weekday': time_weekday \n# })\n# column_",
"_____no_output_____"
],
[
"# time_df = pd.DataFrame({\n# 'start_time': start_time,\n# 'hour': time_hour,\n# 'day': time_day,\n# 'week': time_week,\n# 'month': time_month,\n# 'year': time_year,\n# 'weekday': time_weekday \n# })\n# time_df.head()",
"_____no_output_____"
]
],
[
[
"#### Insert Records into Time Table\nImplement the `time_table_insert` query in `sql_queries.py` and run the cell below to insert records for the timestamps in this log file into the `time` table. Remember to run `create_tables.py` before running the cell below to ensure you've created/resetted the `time` table in the sparkify database.",
"_____no_output_____"
]
],
[
[
"#YD: how to insert rows one by one\n\nfor i, row in time_df.iterrows():\n cur.execute(time_table_insert, list(row))\n conn.commit()",
"_____no_output_____"
],
[
"# cur.close()\n# conn.close()",
"_____no_output_____"
]
],
[
[
"Run `test.ipynb` to see if you've successfully added records to this table.",
"_____no_output_____"
],
[
"## #4: `users` Table\n#### Extract Data for Users Table\n- Select columns for user ID, first name, last name, gender and level and set to `user_df`",
"_____no_output_____"
]
],
[
[
"user_df = df[['userId','firstName','lastName','gender','level']]\nuser_df.head()",
"_____no_output_____"
]
],
[
[
"#### Insert Records into Users Table\nImplement the `user_table_insert` query in `sql_queries.py` and run the cell below to insert records for the users in this log file into the `users` table. Remember to run `create_tables.py` before running the cell below to ensure you've created/resetted the `users` table in the sparkify database.",
"_____no_output_____"
]
],
[
[
"for i, row in user_df.iterrows():\n cur.execute(user_table_insert, row)\n conn.commit()",
"_____no_output_____"
]
],
[
[
"Run `test.ipynb` to see if you've successfully added records to this table.",
"_____no_output_____"
],
[
"## #5: `songplays` Table\n#### Extract Data and Songplays Table\nThis one is a little more complicated since information from the songs table, artists table, and original log file are all needed for the `songplays` table. Since the log file does not specify an ID for either the song or the artist, you'll need to get the song ID and artist ID by querying the songs and artists tables to find matches based on song title, artist name, and song duration time.\n- Implement the `song_select` query in `sql_queries.py` to find the song ID and artist ID based on the title, artist name, and duration of a song.\n- Select the timestamp, user ID, level, song ID, artist ID, session ID, location, and user agent and set to `songplay_data`\n\n#### Insert Records into Songplays Table\n- Implement the `songplay_table_insert` query and run the cell below to insert records for the songplay actions in this log file into the `songplays` table. Remember to run `create_tables.py` before running the cell below to ensure you've created/resetted the `songplays` table in the sparkify database.",
"_____no_output_____"
]
],
[
[
"df.head(1)",
"_____no_output_____"
],
[
"df['ts'] = df['ts']",
"_____no_output_____"
],
[
"songplay_table_insert",
"_____no_output_____"
],
[
"song_select",
"_____no_output_____"
],
[
"import pdb",
"_____no_output_____"
],
[
"for index, row in df.iterrows():\n cur.execute(song_select, (row.song,row.artist,row.length))\n results = cur.fetchone()\n \n if results:\n songid, artistid = results\n else:\n songid, artistid = None, None\n# pdb.set_trace()\n\n songplay_data = (str(row['ts']), row['userId'], row['level']\n ,songid, artistid, row['sessionId'], row['location'],\n row['userAgent'])\n \n cur.execute(songplay_table_insert, songplay_data)\n conn.commit()",
"_____no_output_____"
]
],
[
[
"Run `test.ipynb` to see if you've successfully added records to this table.",
"_____no_output_____"
],
[
"# Close Connection to Sparkify Database",
"_____no_output_____"
]
],
[
[
"conn.close()",
"_____no_output_____"
]
],
[
[
"# Implement `etl.py`\nUse what you've completed in this notebook to implement `etl.py`.",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
]
] |
d0c99afaee2b86236a0c2bbb91cb1e1b64e159bc | 5,595 | ipynb | Jupyter Notebook | test.ipynb | popkdodge/lambdata | 78927f40e05979970e6398cc1ff1fa7bacd46c6f | [
"MIT"
] | null | null | null | test.ipynb | popkdodge/lambdata | 78927f40e05979970e6398cc1ff1fa7bacd46c6f | [
"MIT"
] | null | null | null | test.ipynb | popkdodge/lambdata | 78927f40e05979970e6398cc1ff1fa7bacd46c6f | [
"MIT"
] | 1 | 2020-07-07T20:42:41.000Z | 2020-07-07T20:42:41.000Z | 23.119835 | 252 | 0.477212 | [
[
[
"class Customer:\n def __init__(self, name, zip_code):\n self.name = name\n self.zip_code = zip_code",
"_____no_output_____"
],
[
"customer1 = Customer(\"Jane\", '90210')\ncustomer2 = Customer(\"Joe\", '29402')\ncustomer3 = Customer('Harold','39233')",
"_____no_output_____"
],
[
"class Complex:\n def __init__(self, real, imaginary):\n self.r = real\n self.i = imaginary\n def add(self, other_complex):\n self.r += other_complex.r\n self.i += other_complex.i\n\n",
"_____no_output_____"
],
[
"x = Complex(3.0, 21)\ny = Complex(0.3, 93)",
"_____no_output_____"
],
[
"x.add(y)",
"_____no_output_____"
],
[
"class Boat:\n def __init__(self, boat_name, boat_price, boat_type):\n self.name = boat_name\n self.price = boat_price\n self.type = boat_type\n\n",
"_____no_output_____"
],
[
"boat1 = Boat('Giligans', 2000, 'Sailboat')",
"_____no_output_____"
],
[
"boat1.type",
"_____no_output_____"
],
[
"class Carclub:\n def __init__(self, membername):\n self.name = NameError\n self.car_count = 1\n \n def add_car(self):\n self.car_count += 1\n\n def sold_car(self):\n self.car_count -= 1\nclass Cars:\n def __init__(self, brand, year, model):\n self.brand = str(brand)\n self.year = int(year)\n self.model = model\n def sound(self):\n return \"Vroom!\"\n\nclass Porsche(Cars):\n def __init__(self, year, model):\n super().__init__(year,model, model)\n self.brand = 'Porsche'\n self.year = int(year)\n self.model = model\n def sound():\n return \"Buzz\"",
"_____no_output_____"
],
[
"car1 = Porsche(2020, '911')",
"_____no_output_____"
],
[
"import Cars",
"_____no_output_____"
],
[
"class Rectangle:\n def __init__(self, length, width):\n self.length = length\n self.width = width\n\n def area(self):\n return self.length * self.width\n\n def perimeter(self):\n return 2 * self.length + 2 * self.width\n\nclass Square:\n def __init__(self, length):\n self.length = length\n\n def area(self):\n return self.length * self.length\n\n def perimeter(self):\n return 4 * self.length",
"_____no_output_____"
],
[
"shape1 = Square(4)\nshape1.area()",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0c99c324d9cc8b957415c086430e54ff1e1535c | 17,164 | ipynb | Jupyter Notebook | a6_w3_ex2.ipynb | indervirbanipal/scalable-machine-learning-on-big-data-using-apache-spark | cf2f6f1524d2e8cc5bc8f8c8c4ad49454d4c6e38 | [
"MIT"
] | null | null | null | a6_w3_ex2.ipynb | indervirbanipal/scalable-machine-learning-on-big-data-using-apache-spark | cf2f6f1524d2e8cc5bc8f8c8c4ad49454d4c6e38 | [
"MIT"
] | null | null | null | a6_w3_ex2.ipynb | indervirbanipal/scalable-machine-learning-on-big-data-using-apache-spark | cf2f6f1524d2e8cc5bc8f8c8c4ad49454d4c6e38 | [
"MIT"
] | null | null | null | 40.672986 | 423 | 0.586577 | [
[
[
"<a href=\"https://cognitiveclass.ai\"><img src = \"https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/Logos/organization_logo/organization_logo.png\" width = 400> </a>\n",
"_____no_output_____"
],
[
"This notebook is designed to run in a IBM Watson Studio default runtime (NOT the Watson Studio Apache Spark Runtime as the default runtime with 1 vCPU is free of charge). Therefore, we install Apache Spark in local mode for test purposes only. Please don't use it in production.\n\nIn case you are facing issues, please read the following two documents first:\n\n<https://github.com/IBM/skillsnetwork/wiki/Environment-Setup>\n\n<https://github.com/IBM/skillsnetwork/wiki/FAQ>\n\nThen, please feel free to ask:\n\n[https://coursera.org/learn/machine-learning-big-data-apache-spark/discussions/all](https://coursera.org/learn/machine-learning-big-data-apache-spark/discussions/all?cm_mmc=Email_Newsletter-_-Developer_Ed%2BTech-_-WW_WW-_-SkillsNetwork-Courses-IBMDeveloperSkillsNetwork-ML0201EN-SkillsNetwork-20647446&cm_mmca1=000026UJ&cm_mmca2=10006555&cm_mmca3=M12345678&cvosrc=email.Newsletter.M12345678&cvo_campaign=000026UJ)\n\nPlease make sure to follow the guidelines before asking a question:\n\n<https://github.com/IBM/skillsnetwork/wiki/FAQ#im-feeling-lost-and-confused-please-help-me>\n\nIf running outside Watson Studio, this should work as well. In case you are running in an Apache Spark context outside Watson Studio, please remove the Apache Spark setup in the first notebook cells.\n",
"_____no_output_____"
]
],
[
[
"from IPython.display import Markdown, display\ndef printmd(string):\n display(Markdown('# <span style=\"color:red\">'+string+'</span>'))\n\n\nif ('sc' in locals() or 'sc' in globals()):\n printmd('<<<<<!!!!! It seems that you are running in a IBM Watson Studio Apache Spark Notebook. Please run it in an IBM Watson Studio Default Runtime (without Apache Spark) !!!!!>>>>>')\n",
"_____no_output_____"
],
[
"!pip install pyspark==2.4.5",
"Looking in indexes: https://pypi.org/simple, https://indervir.singh.banipal%40ibm.com:****@na.artifactory.swg-devops.com/artifactory/api/pypi/wcp-nlp-pypi-virtual/simple, https://indervir.singh.banipal%40ibm.com:****@na.artifactory.swg-devops.com/artifactory/api/pypi/wcp-nlp-snapshot-pypi-local/simple\r\nRequirement already satisfied: pyspark==2.4.5 in /usr/local/lib/python3.7/site-packages (2.4.5)\r\nRequirement already satisfied: py4j==0.10.7 in /usr/local/lib/python3.7/site-packages (from pyspark==2.4.5) (0.10.7)\r\n"
],
[
"try:\n from pyspark import SparkContext, SparkConf\n from pyspark.sql import SparkSession\nexcept ImportError as e:\n printmd('<<<<<!!!!! Please restart your kernel after installing Apache Spark !!!!!>>>>>')",
"_____no_output_____"
],
[
"sc = SparkContext.getOrCreate(SparkConf().setMaster(\"local[*]\"))\n\nspark = SparkSession \\\n .builder \\\n .getOrCreate()",
"_____no_output_____"
]
],
[
[
"Welcome to exercise two of week three of “Apache Spark for Scalable Machine Learning on BigData”. In this exercise we’ll work on clustering.\n\nLet’s create our DataFrame again:\n",
"_____no_output_____"
]
],
[
[
"# delete files from previous runs\n!rm -f hmp.parquet*\n\n# download the file containing the data in PARQUET format\n!wget https://github.com/IBM/coursera/raw/master/hmp.parquet\n \n# create a dataframe out of it\ndf = spark.read.parquet('hmp.parquet')\n\n# register a corresponding query table\ndf.createOrReplaceTempView('df')",
"--2020-12-09 04:39:14-- https://github.com/IBM/coursera/raw/master/hmp.parquet\nResolving github.com (github.com)... 140.82.114.4\nConnecting to github.com (github.com)|140.82.114.4|:443... connected.\nHTTP request sent, awaiting response... 301 Moved Permanently\nLocation: https://github.com/IBM/skillsnetwork/raw/master/hmp.parquet [following]\n--2020-12-09 04:39:14-- https://github.com/IBM/skillsnetwork/raw/master/hmp.parquet\nReusing existing connection to github.com:443.\nHTTP request sent, awaiting response... 302 Found\nLocation: https://raw.githubusercontent.com/IBM/skillsnetwork/master/hmp.parquet [following]\n--2020-12-09 04:39:15-- https://raw.githubusercontent.com/IBM/skillsnetwork/master/hmp.parquet\nResolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.64.133, 151.101.128.133, 151.101.192.133, ...\nConnecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.64.133|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 932997 (911K) [application/octet-stream]\nSaving to: ‘hmp.parquet’\n\nhmp.parquet 100%[===================>] 911.13K 4.21MB/s in 0.2s \n\n2020-12-09 04:39:15 (4.21 MB/s) - ‘hmp.parquet’ saved [932997/932997]\n\n"
]
],
[
[
"Let’s reuse our feature engineering pipeline.\n",
"_____no_output_____"
]
],
[
[
"from pyspark.ml.feature import OneHotEncoder, StringIndexer, VectorAssembler, Normalizer\nfrom pyspark.ml.linalg import Vectors\nfrom pyspark.ml import Pipeline\n\nindexer = StringIndexer(inputCol=\"class\", outputCol=\"classIndex\")\nencoder = OneHotEncoder(inputCol=\"classIndex\", outputCol=\"categoryVec\")\nvectorAssembler = VectorAssembler(inputCols=[\"x\",\"y\",\"z\"],\n outputCol=\"features\")\nnormalizer = Normalizer(inputCol=\"features\", outputCol=\"features_norm\", p=1.0)\n\npipeline = Pipeline(stages=[indexer, encoder, vectorAssembler, normalizer])\nmodel = pipeline.fit(df)\nprediction = model.transform(df)\nprediction.show()",
"+---+---+---+--------------------+-----------+----------+--------------+----------------+--------------------+\n| x| y| z| source| class|classIndex| categoryVec| features| features_norm|\n+---+---+---+--------------------+-----------+----------+--------------+----------------+--------------------+\n| 22| 49| 35|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[22.0,49.0,35.0]|[0.20754716981132...|\n| 22| 49| 35|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[22.0,49.0,35.0]|[0.20754716981132...|\n| 22| 52| 35|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[22.0,52.0,35.0]|[0.20183486238532...|\n| 22| 52| 35|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[22.0,52.0,35.0]|[0.20183486238532...|\n| 21| 52| 34|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[21.0,52.0,34.0]|[0.19626168224299...|\n| 22| 51| 34|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[22.0,51.0,34.0]|[0.20560747663551...|\n| 20| 50| 35|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[20.0,50.0,35.0]|[0.19047619047619...|\n| 22| 52| 34|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[22.0,52.0,34.0]|[0.20370370370370...|\n| 22| 50| 34|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[22.0,50.0,34.0]|[0.20754716981132...|\n| 22| 51| 35|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[22.0,51.0,35.0]|[0.20370370370370...|\n| 21| 51| 33|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[21.0,51.0,33.0]|[0.2,0.4857142857...|\n| 20| 50| 34|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[20.0,50.0,34.0]|[0.19230769230769...|\n| 21| 49| 33|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[21.0,49.0,33.0]|[0.20388349514563...|\n| 21| 49| 33|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[21.0,49.0,33.0]|[0.20388349514563...|\n| 20| 51| 35|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[20.0,51.0,35.0]|[0.18867924528301...|\n| 18| 49| 34|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[18.0,49.0,34.0]|[0.17821782178217...|\n| 19| 48| 34|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[19.0,48.0,34.0]|[0.18811881188118...|\n| 16| 53| 34|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[16.0,53.0,34.0]|[0.15533980582524...|\n| 18| 52| 35|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[18.0,52.0,35.0]|[0.17142857142857...|\n| 18| 51| 32|Accelerometer-201...|Brush_teeth| 6.0|(13,[6],[1.0])|[18.0,51.0,32.0]|[0.17821782178217...|\n+---+---+---+--------------------+-----------+----------+--------------+----------------+--------------------+\nonly showing top 20 rows\n\n"
]
],
[
[
"Now let’s create a new pipeline for kmeans.\n",
"_____no_output_____"
]
],
[
[
"from pyspark.ml.clustering import KMeans\nfrom pyspark.ml.evaluation import ClusteringEvaluator\n\nkmeans = KMeans(featuresCol=\"features\").setK(14).setSeed(1)\npipeline = Pipeline(stages=[vectorAssembler, kmeans])\nmodel = pipeline.fit(df)\npredictions = model.transform(df)\n\nevaluator = ClusteringEvaluator()\n\nsilhouette = evaluator.evaluate(predictions)\nprint(\"Silhouette with squared euclidean distance = \" + str(silhouette))",
"Silhouette with squared euclidean distance = 0.4020618068072166\n"
]
],
[
[
"We have 14 different movement patterns in the dataset, so setting K of KMeans to 14 is a good idea. But please experiment with different values for K, do you find a sweet spot? The closer Silhouette gets to 1, the better.\n\n[https://en.wikipedia.org/wiki/Silhouette\\_(clustering)](https://en.wikipedia.org/wiki/Silhouette_(clustering)?cm_mmc=Email_Newsletter-_-Developer_Ed%2BTech-_-WW_WW-_-SkillsNetwork-Courses-IBMDeveloperSkillsNetwork-ML0201EN-SkillsNetwork-20647446&cm_mmca1=000026UJ&cm_mmca2=10006555&cm_mmca3=M12345678&cvosrc=email.Newsletter.M12345678&cvo_campaign=000026UJ)\n",
"_____no_output_____"
]
],
[
[
"# please change the pipeline the check performance for different K, feel free to use a loop",
"_____no_output_____"
]
],
[
[
"Now please extend the pipeline to work on the normalized features. You need to tell KMeans to use the normalized feature column and change the pipeline in order to contain the normalizer stage as well.\n",
"_____no_output_____"
]
],
[
[
"kmeans = KMeans($$).setK(14).setSeed(1)\npipeline = $$\nmodel = pipeline.fit(df)\n\npredictions = model.transform(df)\n\nevaluator = ClusteringEvaluator()\n\nsilhouette = evaluator.evaluate(predictions)\nprint(\"Silhouette with squared euclidean distance = \" + str(silhouette))\n",
"_____no_output_____"
]
],
[
[
"Sometimes, inflating the dataset helps, here we multiply x by 10, let’s see if the performance inceases.\n",
"_____no_output_____"
]
],
[
[
"from pyspark.sql.functions import col\ndf_denormalized = df.select([col('*'),(col('x')*10)]).drop('x').withColumnRenamed('(x * 10)','x')",
"_____no_output_____"
],
[
"kmeans = KMeans(featuresCol=\"features\").setK(14).setSeed(1)\npipeline = Pipeline(stages=[vectorAssembler, kmeans])\nmodel = pipeline.fit(df_denormalized)\npredictions = model.transform(df_denormalized)\n\nevaluator = ClusteringEvaluator()\n\nsilhouette = evaluator.evaluate(predictions)\nprint(\"Silhouette with squared euclidean distance = \" + str(silhouette))",
"_____no_output_____"
]
],
[
[
"Apache SparkML can be used to try many different algorithms and parametrizations using the same pipeline. Please change the code below to use GaussianMixture over KMeans. Please use the following link for your reference.\n\n[https://spark.apache.org/docs/latest/ml-clustering.html#gaussian-mixture-model-gmm](https://spark.apache.org/docs/latest/ml-clustering.html#gaussian-mixture-model-gmm?cm_mmc=Email_Newsletter-_-Developer_Ed%2BTech-_-WW_WW-_-SkillsNetwork-Courses-IBMDeveloperSkillsNetwork-ML0201EN-SkillsNetwork-20647446&cm_mmca1=000026UJ&cm_mmca2=10006555&cm_mmca3=M12345678&cvosrc=email.Newsletter.M12345678&cvo_campaign=000026UJ)\n",
"_____no_output_____"
]
],
[
[
"from pyspark.ml.clustering import GaussianMixture\n\ngmm = $$\npipeline = $$\n\nmodel = pipeline.fit(df)\n\npredictions = model.transform(df)\n\nevaluator = ClusteringEvaluator()\n\nsilhouette = evaluator.evaluate(predictions)\nprint(\"Silhouette with squared euclidean distance = \" + str(silhouette))",
"_____no_output_____"
]
],
[
[
"### Thank you for completing this lab!\n\nThis notebook was created by <a href=\"https://linkedin.com/in/romeo-kienzler-089b4557\"> Romeo Kienzler </a> I hope you found this lab interesting and educational. Feel free to contact me if you have any questions!\n",
"_____no_output_____"
],
[
"## Change Log\n\n| Date (YYYY-MM-DD) | Version | Changed By | Change Description |\n| ----------------- | ------- | ---------- | ----------------------------------------------------------- |\n| 2020-09-29 | 2.0 | Srishti | Migrated Lab to Markdown and added to course repo in GitLab |\n\n<hr>\n\n## <h3 align=\"center\"> © IBM Corporation 2020. All rights reserved. <h3/>\n",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
]
] |
d0c99d7f489ddd8a987756ce4cf2528b2f6b1352 | 6,937 | ipynb | Jupyter Notebook | data-analysis/numpy/3_operations.ipynb | pbgnz/ds-ml | 45cb4756e20aa5f4e4077437faee18633ca9a0e5 | [
"MIT"
] | null | null | null | data-analysis/numpy/3_operations.ipynb | pbgnz/ds-ml | 45cb4756e20aa5f4e4077437faee18633ca9a0e5 | [
"MIT"
] | null | null | null | data-analysis/numpy/3_operations.ipynb | pbgnz/ds-ml | 45cb4756e20aa5f4e4077437faee18633ca9a0e5 | [
"MIT"
] | null | null | null | 21.021212 | 246 | 0.476287 | [
[
[
"# NumPy Operations",
"_____no_output_____"
],
[
"## Arithmetic\n\nYou can easily perform array with array arithmetic, or scalar with array arithmetic. Let's see some examples:",
"_____no_output_____"
]
],
[
[
"import numpy as np\narr = np.arange(0,10)",
"_____no_output_____"
],
[
"arr + arr",
"_____no_output_____"
],
[
"arr * arr",
"_____no_output_____"
],
[
"arr - arr",
"_____no_output_____"
],
[
"# Warning on division by zero, but not an error!\n# Just replaced with nan\narr/arr",
"/Users/marci/anaconda/lib/python3.5/site-packages/ipykernel/__main__.py:1: RuntimeWarning: invalid value encountered in true_divide\n if __name__ == '__main__':\n"
],
[
"# Also warning, but not an error instead infinity\n1/arr",
"/Users/marci/anaconda/lib/python3.5/site-packages/ipykernel/__main__.py:1: RuntimeWarning: divide by zero encountered in true_divide\n if __name__ == '__main__':\n"
],
[
"arr**3",
"_____no_output_____"
]
],
[
[
"## Universal Array Functions\n\nNumpy comes with many [universal array functions](http://docs.scipy.org/doc/numpy/reference/ufuncs.html), which are essentially just mathematical operations you can use to perform the operation across the array. Let's show some common ones:",
"_____no_output_____"
]
],
[
[
"#Taking Square Roots\nnp.sqrt(arr)",
"_____no_output_____"
],
[
"#Calcualting exponential (e^)\nnp.exp(arr)",
"_____no_output_____"
],
[
"np.max(arr) #same as arr.max()",
"_____no_output_____"
],
[
"np.sin(arr)",
"_____no_output_____"
],
[
"np.log(arr)",
"/Users/marci/anaconda/lib/python3.5/site-packages/ipykernel/__main__.py:1: RuntimeWarning: divide by zero encountered in log\n if __name__ == '__main__':\n"
]
],
[
[
"# Great Job!\n\nThat's all we need to know for now!",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
]
] |
d0c99df925e86d53838009086d355dafd8e5bf46 | 9,556 | ipynb | Jupyter Notebook | assignment_2/Task_2.ipynb | utkarsh530/ee604_assignments | 225619702f45ae47aa058ac99418545b08c52a3e | [
"MIT"
] | null | null | null | assignment_2/Task_2.ipynb | utkarsh530/ee604_assignments | 225619702f45ae47aa058ac99418545b08c52a3e | [
"MIT"
] | null | null | null | assignment_2/Task_2.ipynb | utkarsh530/ee604_assignments | 225619702f45ae47aa058ac99418545b08c52a3e | [
"MIT"
] | null | null | null | 30.240506 | 161 | 0.486605 | [
[
[
"# Copyright 2020 IITK EE604A Image Processing. All Rights Reserved.\n# \n# Licensed under the MIT License. Use and/or modification of this code outside of EE604 must reference:\n#\n# © IITK EE604A Image Processing \n# https://github.com/ee604/ee604_assignments\n#\n# Author: Shashi Kant Gupta, Chiranjeev Prachand and Prof K. S. Venkatesh, Department of Electrical Engineering, IIT Kanpur",
"_____no_output_____"
]
],
[
[
"# Task 2: Image Enhancement II: Spatial Smoothing\n\nIn this task, we will implement average, gaussian, and median spatial filter.",
"_____no_output_____"
]
],
[
[
"%%bash\npip install git+https://github.com/ee604/ee604_plugins",
"_____no_output_____"
],
[
"# Importing required libraries\n\nimport cv2\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom ee604_plugins import download_dataset, cv2_imshow\ndownload_dataset(assignment_no=2, task_no=2) # download data for this assignment",
"_____no_output_____"
],
[
"def avgFilter(img, kernel_size=7):\n '''\n Write a program to implement average filter. You have to assume square kernels.\n \n Inputs:\n + img - grayscaled image of size N x N\n - values between [0, 255] - 'uint8'\n + kernel_size - size of the kernel window which should be used for averaging.\n \n Ouputs:\n + out_img - smoothed grayscaled image of size N x N\n - values between [0, 255] - 'uint8'\n \n Allowed modules:\n + Basic numpy operations\n + cv2.filter2D() to perform 2D convolution\n \n Hint:\n + Not needed.\n \n '''\n \n #############################\n # Start your code from here #\n #############################\n \n # Replace with your code...\n \n #############################\n # End your code here ########\n ############################# \n \n return out_img",
"_____no_output_____"
],
[
"def gaussianFilter(img, kernel_size=7, sigma=3):\n '''\n Write a program to implement gaussian filter. You have to assume square kernels.\n \n Inputs:\n + img - grayscaled image of size N x N\n - values between [0, 255] - 'uint8'\n + kernel_size - size of the kernel window which should be used for smoothing. \n + sigma - sigma parameter for gaussian kernel\n \n Ouputs:\n + out_img - smoothed grayscaled image of size N x N\n - values between [0, 255] - 'uint8'\n \n Allowed modules:\n + Basic numpy operations\n + cv2.filter2D() to perform 2D convolution\n + cv2.getGaussianKernel(). Note that this will give you 1D gaussian.\n \n Hint:\n + Not needed.\n \n '''\n \n #############################\n # Start your code from here #\n #############################\n \n # Replace with your code...\n \n #############################\n # End your code here ########\n ############################# \n \n return out_img",
"_____no_output_____"
],
[
"def medianFilter(img, kernel_size=7):\n '''\n Write a program to implement median filter. You have to assume square kernels.\n \n Inputs:\n + img - grayscaled image of size N x N\n - values between [0, 255] - 'uint8'\n + kernel_size - size of the kernel window which should be used for smoothing.\n \n Ouputs:\n + out_img - smoothed grayscaled image of size N x N\n - values between [0, 255] - 'uint8'\n \n Allowed modules:\n + Basic numpy operations\n + np.median()\n \n Hint:\n + Not needed.\n \n '''\n \n #############################\n # Start your code from here #\n #############################\n \n # Replace with your code...\n \n #############################\n # End your code here ########\n #############################\n \n return out_img",
"_____no_output_____"
]
],
[
[
"### Test\n\n---\nYour observation should compare the different methods for different images. Must include a sentence on which method + kernel size worked best in each case.",
"_____no_output_____"
]
],
[
[
"# Do not change codes inside this cell\n# Add your observations in next to next cell\n# Your observation should compare the different methods for different images\n\nlena_orig = cv2.imread('data/lena_gray.jpg', 0)\nlena_noisy_1 = cv2.imread('data/lena_noisy_1.jpg', 0)\nlena_noisy_2 = cv2.imread('data/lena_noisy_2.jpg', 0)\nlena_noisy_3 = cv2.imread('data/lena_noisy_3.jpg', 0)\n\ndef plot_frame(gridx, gridy, subplot_id, img, name):\n plt.subplot(gridx, gridy, 1 + int(subplot_id))\n plt.imshow(np.uint8(img), cmap=\"gray\", vmin=0, vmax=255)\n plt.axis(\"off\")\n plt.title(name)",
"_____no_output_____"
],
[
"# Do not change codes inside this cell\n# Add your observations in next cell\n\nimg_arr = [lena_noisy_1, lena_noisy_2, lena_noisy_3]\nimg_caption = [\"Noisy 1\", \"Noisy 2\", \"Noisy 3\"]\n\nfor i in range(3):\n for kernel_size in [5, 7, 9]:\n print(\"\\n-------------------------------------\")\n print(\"# Lena\", img_caption[i], \"| kernel:\", kernel_size, \"x\", kernel_size)\n print(\"-------------------------------------\")\n\n plt.figure(figsize=(20, 13))\n plot_frame(1, 5, 0, lena_orig, \"Original\")\n plot_frame(1, 5, 1, img_arr[i], \"Noisy\")\n\n tmp_img = avgFilter(np.copy(img_arr[i]), kernel_size=kernel_size)\n plot_frame(1, 5, 2, tmp_img, \"Avg.\")\n\n tmp_img = gaussianFilter(np.copy(img_arr[i]), kernel_size=kernel_size, sigma=int(kernel_size/5))\n plot_frame(1, 5, 3, tmp_img, \"Gaussian.\")\n\n tmp_img = medianFilter(np.copy(img_arr[i]), kernel_size=kernel_size)\n plot_frame(1, 5, 4, tmp_img, \"Median.\")\n\n plt.show()",
"_____no_output_____"
],
[
"your_observation = \"\"\"\nReplace this with your observations.\n\"\"\"\n\nprint(your_observation)",
"_____no_output_____"
],
[
"# Submission >>>>>>>>>>>>>>>>>>>>>\n# Do not change codes inside this cell.\n\ngen_imgs = []\nimg_arr = [lena_noisy_1, lena_noisy_2, lena_noisy_3]\n\nfor i in range(3):\n for kernel_size in [5, 7, 9]:\n tmp_img = avgFilter(np.copy(img_arr[i]), kernel_size=kernel_size)\n gen_imgs.append(tmp_img)\n \n tmp_img = gaussianFilter(np.copy(img_arr[i]), kernel_size=kernel_size, sigma=int(kernel_size/5))\n gen_imgs.append(tmp_img)\n \n tmp_img = medianFilter(np.copy(img_arr[i]), kernel_size=kernel_size)\n gen_imgs.append(tmp_img)\n\ntask2_submission = np.array(gen_imgs)",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
]
] |
d0c9a5725cbddc7f0dce5b986a55387956a2862c | 54,071 | ipynb | Jupyter Notebook | miricoord/BasicTransforms.ipynb | STScI-MIRI/miricoord | d378c24f4b8d649fb15d557c6350ab5070afba66 | [
"BSD-3-Clause"
] | null | null | null | miricoord/BasicTransforms.ipynb | STScI-MIRI/miricoord | d378c24f4b8d649fb15d557c6350ab5070afba66 | [
"BSD-3-Clause"
] | 2 | 2019-06-05T18:04:22.000Z | 2021-12-02T21:00:55.000Z | miricoord/BasicTransforms.ipynb | STScI-MIRI/miricoord | d378c24f4b8d649fb15d557c6350ab5070afba66 | [
"BSD-3-Clause"
] | 2 | 2019-09-20T14:01:30.000Z | 2021-11-04T11:52:54.000Z | 56.441545 | 13,856 | 0.811248 | [
[
[
"# A simple notebook to do MIRI coordinate transforms. #",
"_____no_output_____"
],
[
"Some functionality depends on having the JWST pipeline and/or pysiaf module installed",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport pdb as pdb\nfrom astropy.modeling import models\nfrom asdf import AsdfFile\nfrom jwst import datamodels\nfrom jwst.assign_wcs import miri\nimport pysiaf",
"_____no_output_____"
]
],
[
[
"### Imager transforms using standalone code plus pysiaf ###",
"_____no_output_____"
],
[
"Import the miricoord standalone code:",
"_____no_output_____"
]
],
[
[
"import miricoord.imager.mirim_tools as mt",
"_____no_output_____"
]
],
[
[
"Read the MIRI apertures from the SIAF",
"_____no_output_____"
]
],
[
[
"siaf = pysiaf.Siaf('MIRI')#,basepath='/Users/dlaw/jwcode/pysiaf/pysiaf/pre_delivery_data/MIRI')",
"_____no_output_____"
]
],
[
[
"Get the MIRIM_FULL x,y reference location from the SIAF",
"_____no_output_____"
]
],
[
[
"xref,yref=siaf['MIRIM_FULL'].XDetRef,siaf['MIRIM_FULL'].YDetRef",
"_____no_output_____"
]
],
[
[
"Note that these are in the SIAF 1-indexed reference frame; in order to use them we'll first have to transform them to the 0-indexed frame used by all MIRI coordinates code (and the JWST pipeline):",
"_____no_output_____"
]
],
[
[
"xref,yref=xref-1,yref-1",
"_____no_output_____"
],
[
"xref,yref",
"_____no_output_____"
]
],
[
[
"Transform them to v2,v3 for filter 'F770W'",
"_____no_output_____"
]
],
[
[
"v2ref,v3ref=mt.xytov2v3(xref,yref,'F770W')",
"_____no_output_____"
],
[
"v2ref,v3ref",
"_____no_output_____"
]
],
[
[
"This should be showing that the v2,v3 reference point of MIRIM_FULL (for which F770W is the reference filter) is -453.559, -373.814 (note that this changed in CDP-7)",
"_____no_output_____"
],
[
"We can also convert a given location to RA,DEC if we assume a few JWST attitude keywords. First import the miricoord telescope tools module:",
"_____no_output_____"
]
],
[
[
"import miricoord.tel.tel_tools as teltools",
"_____no_output_____"
]
],
[
[
"Let's pretend that the telescope pointing had the reference point looking at RA=312.5, DEC=-76.0, and had spacecraft roll 73 degrees",
"_____no_output_____"
]
],
[
[
"raref,decref,rollref=312.5,-76.0,73.0",
"_____no_output_____"
]
],
[
[
"Given that, we want to know where the location v2,v3=(-400,-420) is (this is somewhere in the coronagraphs):",
"_____no_output_____"
]
],
[
[
"v2,v3=[-400.],[-420.]",
"_____no_output_____"
],
[
"ra,dec,newroll=teltools.jwst_v2v3toradec(v2,v3,v2ref=v2ref,v3ref=v3ref,raref=raref,decref=decref,rollref=rollref)",
"_____no_output_____"
]
],
[
[
"The RA,dec of this point is:",
"_____no_output_____"
]
],
[
[
"ra,dec",
"_____no_output_____"
]
],
[
[
"And the local roll at this new location is:",
"_____no_output_____"
]
],
[
[
"newroll",
"_____no_output_____"
]
],
[
[
"Note that if we instead had a FITS header with the appropriate keywords, we could have passed that to jwst_v2v3toradec instead of individual values.",
"_____no_output_____"
],
[
"### Now let's do an imager transform using the JWST pipeline code ###",
"_____no_output_____"
],
[
"Import the miricoord pipeline access code:",
"_____no_output_____"
]
],
[
[
"import miricoord.imager.mirim_pipetools as mpt",
"_____no_output_____"
],
[
"v2ref,v3ref=mpt.xytov2v3(xref,yref,'F770W')",
"_____no_output_____"
],
[
"v2ref,v3ref",
"_____no_output_____"
]
],
[
[
"This should be the same answer as before, but under the hood it used the JWST pipeline!",
"_____no_output_____"
],
[
"We can also access the pipeline distortion model directly:",
"_____no_output_____"
]
],
[
[
"model=mpt.xytov2v3model('F770W')",
"_____no_output_____"
]
],
[
[
"And use that to do forward transforms:",
"_____no_output_____"
]
],
[
[
"model(xref,yref)",
"_____no_output_____"
]
],
[
[
"And backward transforms:",
"_____no_output_____"
]
],
[
[
"model.inverse(v2ref,v3ref)",
"_____no_output_____"
]
],
[
[
"### Now do a conversion to Ideal coordinates using the SIAF apertures: ###",
"_____no_output_____"
],
[
"Let's work out where v2,v3=-415.069, -400.576 is for the LRS slit",
"_____no_output_____"
]
],
[
[
"v2,v3=-415.069, -400.576",
"_____no_output_____"
],
[
"xideal,yideal=mt.v2v3toIdeal(v2,v3,'MIRIM_SLIT')",
"SIAF version: PRDOPSSOC-031\n"
],
[
"xideal,yideal",
"_____no_output_____"
]
],
[
[
"It's 0,0, which makes sense since this was the MIRIM_SLIT reference point.",
"_____no_output_____"
],
[
"Now see what the lower-left corner of the LRS slit corresponds to in the SIAF:",
"_____no_output_____"
]
],
[
[
"xideal,yideal=siaf['MIRIM_SLIT'].XIdlVert1,siaf['MIRIM_SLIT'].YIdlVert1",
"_____no_output_____"
],
[
"v2,v3=mt.Idealtov2v3(xideal,yideal,'MIRIM_SLIT')",
"SIAF version: PRDOPSSOC-031\n"
],
[
"xideal,yideal,v2,v3",
"_____no_output_____"
],
[
"siaf['MIRIM_SLIT'].plot()",
"_____no_output_____"
]
],
[
[
"As another example, APT requires Ideal coordinate offsets from the reference point",
"_____no_output_____"
],
[
"If we wanted to see where an offset of XIdeal,YIdeal=10,0 in filter F2300C would land a star on the imager detector compared to the nominal Lyot coronagraph reference point in F770W:",
"_____no_output_____"
]
],
[
[
"xideal,yideal=10,0",
"_____no_output_____"
],
[
"v2,v3=mt.Idealtov2v3(xideal,yideal,'MIRIM_CORONLYOT')",
"SIAF version: PRDOPSSOC-031\n"
],
[
"x,y=mt.v2v3toxy(v2,v3,'F2300C')",
"_____no_output_____"
],
[
"print(x,y)",
"[231.28115409] [885.2137205]\n"
],
[
"siaf['MIRIM_CORONLYOT'].plot()",
"_____no_output_____"
]
],
[
[
"### Now we'll do an MRS transform using standalone code plus pysiaf ###",
"_____no_output_____"
]
],
[
[
"import miricoord.mrs.mrs_tools as mrst",
"_____no_output_____"
]
],
[
[
"Get the MRS v2,v3 reference point from the SIAF",
"_____no_output_____"
]
],
[
[
"v2ref,v3ref=siaf['MIRIFU_CHANNEL1A'].V2Ref,siaf['MIRIFU_CHANNEL1A'].V3Ref",
"_____no_output_____"
],
[
"v2ref,v3ref",
"_____no_output_____"
],
[
"siaf['MIRIFU_CHANNEL1A'].plot()",
"_____no_output_____"
]
],
[
[
"Figure out what alpha,beta this is in Channel 1A",
"_____no_output_____"
]
],
[
[
"alpha,beta=mrst.v2v3toab(v2ref,v3ref,'1A')",
"_____no_output_____"
],
[
"alpha,beta",
"_____no_output_____"
]
],
[
[
"By design, it's zero,zero since this was the reference point",
"_____no_output_____"
],
[
"Now find out where pixels 50,60 55,60 and 60,60 on the SHORT detector would be for Ch1A",
"_____no_output_____"
]
],
[
[
"x,y=[50,55,60],[60,60,60]",
"_____no_output_____"
],
[
"temp=mrst.xytoabl(x,y,'1A',trim=1)",
"_____no_output_____"
],
[
"temp",
"_____no_output_____"
]
],
[
[
"Note that here the return is actually a dictionary of information, and that it is only 2 elements long. This is because we specified trim=1, which will remove any values that do not correspond to a light-sensitive slice.",
"_____no_output_____"
]
],
[
[
"v2,v3=mrst.abtov2v3(temp['alpha'],temp['beta'],'1A')",
"_____no_output_____"
],
[
"v2,v3",
"_____no_output_____"
]
],
[
[
"### Now we'll do an MRS transform using the pipeline code ###",
"_____no_output_____"
]
],
[
[
"import miricoord.mrs.mrs_pipetools as mrspt",
"_____no_output_____"
],
[
"x,y=30.31,511.0",
"_____no_output_____"
],
[
"a,b,l=mrspt.xytoabl(x,y,'1A')",
"_____no_output_____"
],
[
"print(a,b,l)",
"0.4612954052724527 0.0 5.343680519509376\n"
]
],
[
[
"Be warned: using the pipeline code in this way can give strange results if you try to transform a pixel that doesn't land on a slice in your channel specified!! (The pipeline itself has code elsewhere to deal with this, but here we're hooking directly into the transform modules).",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
]
] |
d0c9ab983f88b3d6571efb9583ee8f8e32037f30 | 670,889 | ipynb | Jupyter Notebook | code_neurips/main_infocnf_disentangle_cifar_bs900_sratio_1_4th_drop_0_5_rl_stdscale_6_2cond_linear_multiscale_beta_10_run1.ipynb | minhtannguyen/ffjord | f3418249eaa4647f4339aea8d814cf2ce33be141 | [
"MIT"
] | null | null | null | code_neurips/main_infocnf_disentangle_cifar_bs900_sratio_1_4th_drop_0_5_rl_stdscale_6_2cond_linear_multiscale_beta_10_run1.ipynb | minhtannguyen/ffjord | f3418249eaa4647f4339aea8d814cf2ce33be141 | [
"MIT"
] | null | null | null | code_neurips/main_infocnf_disentangle_cifar_bs900_sratio_1_4th_drop_0_5_rl_stdscale_6_2cond_linear_multiscale_beta_10_run1.ipynb | minhtannguyen/ffjord | f3418249eaa4647f4339aea8d814cf2ce33be141 | [
"MIT"
] | null | null | null | 99.508899 | 4,331 | 0.535707 | [
[
[
"import os\nos.environ['CUDA_VISIBLE_DEVICES']='4,5,6,7'",
"_____no_output_____"
],
[
"%run -p ../train_cnf_disentangle_rl_2cond_multiscale_beta.py --data colormnist --dims 64,64,64 --strides 1,1,1,1 --num_blocks 2 --layer_type concat --multiscale True --rademacher True --batch_size 900 --test_batch_size 500 --save ../experiments_published/infocnf_conditional_disentangle_colormnist_bs900_sratio_1_4th_drop_0_5_rl_stdscale_6_2cond_linear_multiscale_beta_10_run1 --seed 1 --lr 0.001 --conditional True --controlled_tol False --train_mode semisup --log_freq 10 --weight_y 0.5 --condition_ratio 0.25 --dropout_rate 0.5 --scale_fac 1.0 --scale_std 6.0 --cond_nn linear --y_color 10 --y_class 10 --beta 10.0\n#",
"/tancode/repos/tan-ffjord/train_cnf_disentangle_rl_2cond_multiscale_beta.py\nfrom __future__ import print_function\n\nimport argparse\nimport os\nimport time\nimport numpy as np\n\nimport torch\nimport torch.optim as optim\nimport torchvision.datasets as dset\nimport torchvision.transforms as tforms\nfrom torchvision.utils import save_image\n\nimport torch.utils.data as data\nfrom torch.utils.data import Dataset\n\nfrom PIL import Image\nimport os.path\nimport errno\nimport codecs\n\nimport lib.layers as layers\nimport lib.utils as utils\nimport lib.multiscale_parallel as multiscale_parallel\nimport lib.modules as modules\nimport lib.thops as thops\n\nfrom train_misc import standard_normal_logprob\nfrom train_misc import set_cnf_options, count_nfe, count_parameters, count_total_time, count_nfe_gate\nfrom train_misc import add_spectral_norm, spectral_norm_power_iteration\nfrom train_misc import create_regularization_fns, get_regularization, append_regularization_to_log\n\nfrom tensorboardX import SummaryWriter\n\n# go fast boi!!\ntorch.backends.cudnn.benchmark = True\nSOLVERS = [\"dopri5\", \"bdf\", \"rk4\", \"midpoint\", 'adams', 'explicit_adams']\nGATES = [\"cnn1\", \"cnn2\", \"rnn\"]\n\nparser = argparse.ArgumentParser(\"Continuous Normalizing Flow\")\nparser.add_argument(\"--data\", choices=[\"colormnist\", \"mnist\", \"svhn\", \"cifar10\", 'lsun_church'], type=str, default=\"mnist\")\nparser.add_argument(\"--dims\", type=str, default=\"8,32,32,8\")\nparser.add_argument(\"--strides\", type=str, default=\"2,2,1,-2,-2\")\nparser.add_argument(\"--num_blocks\", type=int, default=1, help='Number of stacked CNFs.')\n\nparser.add_argument(\"--conv\", type=eval, default=True, choices=[True, False])\nparser.add_argument(\n \"--layer_type\", type=str, default=\"ignore\",\n choices=[\"ignore\", \"concat\", \"concat_v2\", \"squash\", \"concatsquash\", \"concatcoord\", \"hyper\", \"blend\"]\n)\nparser.add_argument(\"--divergence_fn\", type=str, default=\"approximate\", choices=[\"brute_force\", \"approximate\"])\nparser.add_argument(\n \"--nonlinearity\", type=str, default=\"softplus\", choices=[\"tanh\", \"relu\", \"softplus\", \"elu\", \"swish\"]\n)\n\nparser.add_argument(\"--seed\", type=int, default=0)\n\nparser.add_argument('--solver', type=str, default='dopri5', choices=SOLVERS)\nparser.add_argument('--atol', type=float, default=1e-5)\nparser.add_argument('--rtol', type=float, default=1e-5)\nparser.add_argument(\"--step_size\", type=float, default=None, help=\"Optional fixed step size.\")\n\nparser.add_argument('--gate', type=str, default='cnn1', choices=GATES)\nparser.add_argument('--scale', type=float, default=1.0)\nparser.add_argument('--scale_fac', type=float, default=1.0)\nparser.add_argument('--scale_std', type=float, default=1.0)\nparser.add_argument('--eta', default=0.1, type=float,\n help='tuning parameter that allows us to trade-off the competing goals of' \n 'minimizing the prediction loss and maximizing the gate rewards ')\nparser.add_argument('--rl-weight', default=0.01, type=float,\n help='rl weight')\n\nparser.add_argument('--gamma', default=0.99, type=float,\n help='discount factor, default: (0.99)')\n\nparser.add_argument('--test_solver', type=str, default=None, choices=SOLVERS + [None])\nparser.add_argument('--test_atol', type=float, default=None)\nparser.add_argument('--test_rtol', type=float, default=None)\n\nparser.add_argument(\"--imagesize\", type=int, default=None)\nparser.add_argument(\"--alpha\", type=float, default=1e-6)\nparser.add_argument('--time_length', type=float, default=1.0)\nparser.add_argument('--train_T', type=eval, default=True)\n\nparser.add_argument(\"--num_epochs\", type=int, default=500)\nparser.add_argument(\"--batch_size\", type=int, default=200)\nparser.add_argument(\n \"--batch_size_schedule\", type=str, default=\"\", help=\"Increases the batchsize at every given epoch, dash separated.\"\n)\nparser.add_argument(\"--test_batch_size\", type=int, default=200)\nparser.add_argument(\"--lr\", type=float, default=1e-3)\nparser.add_argument(\"--warmup_iters\", type=float, default=1000)\nparser.add_argument(\"--weight_decay\", type=float, default=0.0)\nparser.add_argument(\"--spectral_norm_niter\", type=int, default=10)\nparser.add_argument(\"--weight_y\", type=float, default=0.5)\nparser.add_argument(\"--annealing_std\", type=eval, default=False, choices=[True, False])\nparser.add_argument(\"--y_class\", type=int, default=10)\nparser.add_argument(\"--y_color\", type=int, default=10)\n\nparser.add_argument(\"--add_noise\", type=eval, default=True, choices=[True, False])\nparser.add_argument(\"--batch_norm\", type=eval, default=False, choices=[True, False])\nparser.add_argument('--residual', type=eval, default=False, choices=[True, False])\nparser.add_argument('--autoencode', type=eval, default=False, choices=[True, False])\nparser.add_argument('--rademacher', type=eval, default=True, choices=[True, False])\nparser.add_argument('--spectral_norm', type=eval, default=False, choices=[True, False])\nparser.add_argument('--multiscale', type=eval, default=False, choices=[True, False])\nparser.add_argument('--parallel', type=eval, default=False, choices=[True, False])\nparser.add_argument('--conditional', type=eval, default=False, choices=[True, False])\nparser.add_argument('--controlled_tol', type=eval, default=False, choices=[True, False])\nparser.add_argument(\"--train_mode\", choices=[\"semisup\", \"sup\", \"unsup\"], type=str, default=\"semisup\")\nparser.add_argument(\"--condition_ratio\", type=float, default=0.5)\nparser.add_argument(\"--dropout_rate\", type=float, default=0.0)\nparser.add_argument(\"--cond_nn\", choices=[\"linear\", \"mlp\"], type=str, default=\"linear\")\n\n\n# Regularizations\nparser.add_argument('--l1int', type=float, default=None, help=\"int_t ||f||_1\")\nparser.add_argument('--l2int', type=float, default=None, help=\"int_t ||f||_2\")\nparser.add_argument('--dl2int', type=float, default=None, help=\"int_t ||f^T df/dt||_2\")\nparser.add_argument('--JFrobint', type=float, default=None, help=\"int_t ||df/dx||_F\")\nparser.add_argument('--JdiagFrobint', type=float, default=None, help=\"int_t ||df_i/dx_i||_F\")\nparser.add_argument('--JoffdiagFrobint', type=float, default=None, help=\"int_t ||df/dx - df_i/dx_i||_F\")\n\nparser.add_argument(\"--time_penalty\", type=float, default=0, help=\"Regularization on the end_time.\")\nparser.add_argument(\n \"--max_grad_norm\", type=float, default=1e10,\n help=\"Max norm of graidents (default is just stupidly high to avoid any clipping)\"\n)\n\nparser.add_argument(\"--begin_epoch\", type=int, default=1)\nparser.add_argument(\"--resume\", type=str, default=None)\nparser.add_argument(\"--save\", type=str, default=\"experiments/cnf\")\nparser.add_argument(\"--val_freq\", type=int, default=1)\nparser.add_argument(\"--log_freq\", type=int, default=1)\n\n# for disentanglement\nparser.add_argument('--beta', default=0.01, type=float, help='disentanglement weight')\n\nargs = parser.parse_args()\n\nimport lib.odenvp_conditional_rl_2cond_multiscale as odenvp\n \n# set seed\ntorch.manual_seed(args.seed)\nnp.random.seed(args.seed)\n\n# logger\nutils.makedirs(args.save)\nlogger = utils.get_logger(logpath=os.path.join(args.save, 'logs'), filepath=os.path.abspath(__file__)) # write to log file\nwriter = SummaryWriter(os.path.join(args.save, 'tensorboard')) # write to tensorboard\n\nif args.layer_type == \"blend\":\n logger.info(\"!! Setting time_length from None to 1.0 due to use of Blend layers.\")\n args.time_length = 1.0\n\nlogger.info(args)\n\nclass ColorMNIST(data.Dataset):\n \"\"\"\n ColorMNIST\n \"\"\"\n urls = [\n 'http://yann.lecun.com/exdb/mnist/train-images-idx3-ubyte.gz',\n 'http://yann.lecun.com/exdb/mnist/train-labels-idx1-ubyte.gz',\n 'http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz',\n 'http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz',\n ]\n raw_folder = 'raw'\n processed_folder = 'processed'\n training_file = 'training.pt'\n test_file = 'test.pt'\n\n def __init__(self, root, train=True, transform=None, target_transform=None, download=False):\n self.root = os.path.expanduser(root)\n self.transform = transform\n self.target_transform = target_transform\n self.train = train # training set or test set\n\n if download:\n self.download()\n\n if not self._check_exists():\n raise RuntimeError('Dataset not found.' +\n ' You can use download=True to download it')\n\n if self.train:\n self.train_data, self.train_labels = torch.load(\n os.path.join(self.root, self.processed_folder, self.training_file))\n \n self.train_data = np.tile(self.train_data[:, :, :, np.newaxis], 3)\n else:\n self.test_data, self.test_labels = torch.load(\n os.path.join(self.root, self.processed_folder, self.test_file))\n \n self.test_data = np.tile(self.test_data[:, :, :, np.newaxis], 3)\n \n self.pallette = [[31, 119, 180],\n [255, 127, 14],\n [44, 160, 44],\n [214, 39, 40],\n [148, 103, 189],\n [140, 86, 75],\n [227, 119, 194],\n [127, 127, 127],\n [188, 189, 34],\n [23, 190, 207]]\n\n def __getitem__(self, index):\n \"\"\"\n Args:\n index (int): Index\n\n Returns:\n tuple: (image, target) where target is index of the target class.\n \"\"\"\n if self.train:\n img, target = self.train_data[index].copy(), self.train_labels[index]\n else:\n img, target = self.test_data[index].copy(), self.test_labels[index]\n \n # doing this so that it is consistent with all other datasets\n # to return a PIL Image\n y_color_digit = np.random.randint(0, args.y_color)\n c_digit = self.pallette[y_color_digit]\n \n img[:, :, 0] = img[:, :, 0] / 255 * c_digit[0]\n img[:, :, 1] = img[:, :, 1] / 255 * c_digit[1]\n img[:, :, 2] = img[:, :, 2] / 255 * c_digit[2]\n \n img = Image.fromarray(img)\n\n if self.transform is not None:\n img = self.transform(img)\n\n if self.target_transform is not None:\n target = self.target_transform(target)\n\n return img, [target,torch.from_numpy(np.array(y_color_digit))]\n\n def __len__(self):\n if self.train:\n return len(self.train_data)\n else:\n return len(self.test_data)\n\n def _check_exists(self):\n return os.path.exists(os.path.join(self.root, self.processed_folder, self.training_file)) and \\\n os.path.exists(os.path.join(self.root, self.processed_folder, self.test_file))\n\n def download(self):\n \"\"\"Download the MNIST data if it doesn't exist in processed_folder already.\"\"\"\n from six.moves import urllib\n import gzip\n\n if self._check_exists():\n return\n\n # download files\n try:\n os.makedirs(os.path.join(self.root, self.raw_folder))\n os.makedirs(os.path.join(self.root, self.processed_folder))\n except OSError as e:\n if e.errno == errno.EEXIST:\n pass\n else:\n raise\n\n for url in self.urls:\n print('Downloading ' + url)\n data = urllib.request.urlopen(url)\n filename = url.rpartition('/')[2]\n file_path = os.path.join(self.root, self.raw_folder, filename)\n with open(file_path, 'wb') as f:\n f.write(data.read())\n with open(file_path.replace('.gz', ''), 'wb') as out_f, \\\n gzip.GzipFile(file_path) as zip_f:\n out_f.write(zip_f.read())\n os.unlink(file_path)\n\n # process and save as torch files\n print('Processing...')\n\n training_set = (\n read_image_file(os.path.join(self.root, self.raw_folder, 'train-images-idx3-ubyte')),\n read_label_file(os.path.join(self.root, self.raw_folder, 'train-labels-idx1-ubyte'))\n )\n test_set = (\n read_image_file(os.path.join(self.root, self.raw_folder, 't10k-images-idx3-ubyte')),\n read_label_file(os.path.join(self.root, self.raw_folder, 't10k-labels-idx1-ubyte'))\n )\n with open(os.path.join(self.root, self.processed_folder, self.training_file), 'wb') as f:\n torch.save(training_set, f)\n with open(os.path.join(self.root, self.processed_folder, self.test_file), 'wb') as f:\n torch.save(test_set, f)\n\n print('Done!')\n\n def __repr__(self):\n fmt_str = 'Dataset ' + self.__class__.__name__ + '\\n'\n fmt_str += ' Number of datapoints: {}\\n'.format(self.__len__())\n tmp = 'train' if self.train is True else 'test'\n fmt_str += ' Split: {}\\n'.format(tmp)\n fmt_str += ' Root Location: {}\\n'.format(self.root)\n tmp = ' Transforms (if any): '\n fmt_str += '{0}{1}\\n'.format(tmp, self.transform.__repr__().replace('\\n', '\\n' + ' ' * len(tmp)))\n tmp = ' Target Transforms (if any): '\n fmt_str += '{0}{1}'.format(tmp, self.target_transform.__repr__().replace('\\n', '\\n' + ' ' * len(tmp)))\n return fmt_str\n\n\ndef add_noise(x):\n \"\"\"\n [0, 1] -> [0, 255] -> add noise -> [0, 1]\n \"\"\"\n if args.add_noise:\n noise = x.new().resize_as_(x).uniform_()\n x = x * 255 + noise\n x = x / 256\n return x\n\n\ndef update_lr(optimizer, itr):\n iter_frac = min(float(itr + 1) / max(args.warmup_iters, 1), 1.0)\n lr = args.lr * iter_frac\n for param_group in optimizer.param_groups:\n param_group[\"lr\"] = lr\n\n \ndef update_scale_std(model, epoch):\n epoch_frac = 1.0 - float(epoch - 1) / max(args.num_epochs + 1, 1)\n scale_std = args.scale_std * epoch_frac\n model.set_scale_std(scale_std)\n\n\ndef get_train_loader(train_set, epoch):\n if args.batch_size_schedule != \"\":\n epochs = [0] + list(map(int, args.batch_size_schedule.split(\"-\")))\n n_passed = sum(np.array(epochs) <= epoch)\n current_batch_size = int(args.batch_size * n_passed)\n else:\n current_batch_size = args.batch_size\n train_loader = torch.utils.data.DataLoader(\n dataset=train_set, batch_size=current_batch_size, shuffle=True, drop_last=True, pin_memory=True\n )\n logger.info(\"===> Using batch size {}. Total {} iterations/epoch.\".format(current_batch_size, len(train_loader)))\n return train_loader\n\n\ndef get_dataset(args):\n trans = lambda im_size: tforms.Compose([tforms.Resize(im_size), tforms.ToTensor(), add_noise])\n\n if args.data == \"mnist\":\n im_dim = 1\n im_size = 28 if args.imagesize is None else args.imagesize\n train_set = dset.MNIST(root=\"../data\", train=True, transform=trans(im_size), download=True)\n test_set = dset.MNIST(root=\"../data\", train=False, transform=trans(im_size), download=True)\n if args.data == \"colormnist\":\n im_dim = 3\n im_size = 28 if args.imagesize is None else args.imagesize\n train_set = ColorMNIST(root=\"../data\", train=True, transform=trans(im_size), download=True)\n test_set = ColorMNIST(root=\"../data\", train=False, transform=trans(im_size), download=True)\n elif args.data == \"svhn\":\n im_dim = 3\n im_size = 32 if args.imagesize is None else args.imagesize\n train_set = dset.SVHN(root=\"../data\", split=\"train\", transform=trans(im_size), download=True)\n test_set = dset.SVHN(root=\"../data\", split=\"test\", transform=trans(im_size), download=True)\n elif args.data == \"cifar10\":\n im_dim = 3\n im_size = 32 if args.imagesize is None else args.imagesize\n train_set = dset.CIFAR10(\n root=\"../data\", train=True, transform=tforms.Compose([\n tforms.Resize(im_size),\n tforms.RandomHorizontalFlip(),\n tforms.ToTensor(),\n add_noise,\n ]), download=True\n )\n test_set = dset.CIFAR10(root=\"../data\", train=False, transform=trans(im_size), download=True)\n elif args.data == 'celeba':\n im_dim = 3\n im_size = 64 if args.imagesize is None else args.imagesize\n train_set = dset.CelebA(\n train=True, transform=tforms.Compose([\n tforms.ToPILImage(),\n tforms.Resize(im_size),\n tforms.RandomHorizontalFlip(),\n tforms.ToTensor(),\n add_noise,\n ])\n )\n test_set = dset.CelebA(\n train=False, transform=tforms.Compose([\n tforms.ToPILImage(),\n tforms.Resize(im_size),\n tforms.ToTensor(),\n add_noise,\n ])\n )\n elif args.data == 'lsun_church':\n im_dim = 3\n im_size = 64 if args.imagesize is None else args.imagesize\n train_set = dset.LSUN(\n '../data', ['church_outdoor_train'], transform=tforms.Compose([\n tforms.Resize(96),\n tforms.RandomCrop(64),\n tforms.Resize(im_size),\n tforms.ToTensor(),\n add_noise,\n ])\n )\n test_set = dset.LSUN(\n '../data', ['church_outdoor_val'], transform=tforms.Compose([\n tforms.Resize(96),\n tforms.RandomCrop(64),\n tforms.Resize(im_size),\n tforms.ToTensor(),\n add_noise,\n ])\n ) \n elif args.data == 'imagenet_64':\n im_dim = 3\n im_size = 64 if args.imagesize is None else args.imagesize\n train_set = dset.ImageFolder(\n train=True, transform=tforms.Compose([\n tforms.ToPILImage(),\n tforms.Resize(im_size),\n tforms.RandomHorizontalFlip(),\n tforms.ToTensor(),\n add_noise,\n ])\n )\n test_set = dset.ImageFolder(\n train=False, transform=tforms.Compose([\n tforms.ToPILImage(),\n tforms.Resize(im_size),\n tforms.ToTensor(),\n add_noise,\n ])\n )\n \n data_shape = (im_dim, im_size, im_size)\n if not args.conv:\n data_shape = (im_dim * im_size * im_size,)\n\n test_loader = torch.utils.data.DataLoader(\n dataset=test_set, batch_size=args.test_batch_size, shuffle=False, drop_last=True\n )\n return train_set, test_loader, data_shape\n\n\ndef compute_bits_per_dim(x, model):\n zero = torch.zeros(x.shape[0], 1).to(x)\n\n # Don't use data parallelize if batch size is small.\n # if x.shape[0] < 200:\n # model = model.module\n \n z, delta_logp, atol, rtol, logp_actions, nfe = model(x, zero) # run model forward\n\n logpz = standard_normal_logprob(z).view(z.shape[0], -1).sum(1, keepdim=True) # logp(z)\n logpx = logpz - delta_logp\n\n logpx_per_dim = torch.sum(logpx) / x.nelement() # averaged over batches\n bits_per_dim = -(logpx_per_dim - np.log(256)) / np.log(2)\n\n return bits_per_dim, atol, rtol, logp_actions, nfe\n\ndef compute_bits_per_dim_conditional(x, y, y_color, model):\n zero = torch.zeros(x.shape[0], 1).to(x)\n y_onehot = thops.onehot(y, num_classes=model.module.y_class).to(x)\n y_onehot_color = thops.onehot(y_color, num_classes=model.module.y_color).to(x)\n\n # Don't use data parallelize if batch size is small.\n # if x.shape[0] < 200:\n # model = model.module\n \n z, z_unsup, delta_logp, atol, rtol, logp_actions, nfe = model(x, zero) # run model forward\n \n z_unsup = torch.cat(z_unsup, 1)\n \n z_sup_class = [o[:,:int(np.prod(o.size()[1:])*0.5)] for o in z]\n z_sup_class = torch.cat(z_sup_class,1)\n \n z_sup_color = [o[:,int(np.prod(o.size()[1:])*0.5):] for o in z]\n z_sup_color = torch.cat(z_sup_color,1)\n \n # prior\n mean, logs = model.module._prior(y_onehot)\n mean_color, logs_color = model.module._prior_color(y_onehot_color)\n\n logpz_sup = modules.GaussianDiag.logp(mean, logs, z_sup_class).view(-1,1) # logp(z)_sup\n beta_logpz_sup = logpz_sup * (1.0 - args.beta * torch.exp(logpz_sup) / torch.tensor(model.module.y_class).to(logpz_sup))\n \n logpz_color_sup = modules.GaussianDiag.logp(mean_color, logs_color, z_sup_color).view(-1,1) # logp(z)_color_sup\n beta_logpz_color_sup = logpz_color_sup * (1.0 - args.beta * torch.exp(logpz_color_sup) / torch.tensor(model.module.y_color).to(logpz_color_sup))\n \n logpz_unsup = standard_normal_logprob(z_unsup).view(z_unsup.shape[0], -1).sum(1, keepdim=True)\n logpz = beta_logpz_sup + beta_logpz_color_sup + logpz_unsup\n logpx = logpz - delta_logp\n\n logpx_per_dim = torch.sum(logpx) / x.nelement() # averaged over batches\n bits_per_dim = -(logpx_per_dim - np.log(256)) / np.log(2)\n \n # dropout\n if args.dropout_rate > 0:\n z_sup_class = model.module.dropout(z_sup_class)\n z_sup_color = model.module.dropout_color(z_sup_color)\n \n # compute xentropy loss\n y_logits = model.module.project_class(z_sup_class)\n loss_xent = model.module.loss_class(y_logits, y.to(x.get_device()))\n y_predicted = np.argmax(y_logits.cpu().detach().numpy(), axis=1)\n \n y_logits_color = model.module.project_color(z_sup_color)\n loss_xent_color = model.module.loss_class(y_logits_color, y_color.to(x.get_device()))\n y_color_predicted = np.argmax(y_logits_color.cpu().detach().numpy(), axis=1)\n\n return bits_per_dim, loss_xent, loss_xent_color, y_predicted, y_color_predicted, atol, rtol, logp_actions, nfe\n\ndef create_model(args, data_shape, regularization_fns):\n hidden_dims = tuple(map(int, args.dims.split(\",\")))\n strides = tuple(map(int, args.strides.split(\",\")))\n\n if args.multiscale:\n model = odenvp.ODENVP(\n (args.batch_size, *data_shape),\n n_blocks=args.num_blocks,\n intermediate_dims=hidden_dims,\n nonlinearity=args.nonlinearity,\n alpha=args.alpha,\n cnf_kwargs={\"T\": args.time_length, \"train_T\": args.train_T, \"regularization_fns\": regularization_fns, \"solver\": args.solver, \"atol\": args.atol, \"rtol\": args.rtol, \"scale\": args.scale, \"scale_fac\": args.scale_fac, \"scale_std\": args.scale_std, \"gate\": args.gate},\n condition_ratio=args.condition_ratio * 2.,\n dropout_rate=args.dropout_rate,\n cond_nn=args.cond_nn,\n y_class = args.y_class,\n y_color = args.y_color)\n elif args.parallel:\n model = multiscale_parallel.MultiscaleParallelCNF(\n (args.batch_size, *data_shape),\n n_blocks=args.num_blocks,\n intermediate_dims=hidden_dims,\n alpha=args.alpha,\n time_length=args.time_length,\n )\n else:\n if args.autoencode:\n\n def build_cnf():\n autoencoder_diffeq = layers.AutoencoderDiffEqNet(\n hidden_dims=hidden_dims,\n input_shape=data_shape,\n strides=strides,\n conv=args.conv,\n layer_type=args.layer_type,\n nonlinearity=args.nonlinearity,\n )\n odefunc = layers.AutoencoderODEfunc(\n autoencoder_diffeq=autoencoder_diffeq,\n divergence_fn=args.divergence_fn,\n residual=args.residual,\n rademacher=args.rademacher,\n )\n cnf = layers.CNF(\n odefunc=odefunc,\n T=args.time_length,\n regularization_fns=regularization_fns,\n solver=args.solver,\n )\n return cnf\n else:\n\n def build_cnf():\n diffeq = layers.ODEnet(\n hidden_dims=hidden_dims,\n input_shape=data_shape,\n strides=strides,\n conv=args.conv,\n layer_type=args.layer_type,\n nonlinearity=args.nonlinearity,\n )\n odefunc = layers.ODEfunc(\n diffeq=diffeq,\n divergence_fn=args.divergence_fn,\n residual=args.residual,\n rademacher=args.rademacher,\n )\n cnf = layers.CNF(\n odefunc=odefunc,\n T=args.time_length,\n train_T=args.train_T,\n regularization_fns=regularization_fns,\n solver=args.solver,\n )\n return cnf\n\n chain = [layers.LogitTransform(alpha=args.alpha)] if args.alpha > 0 else [layers.ZeroMeanTransform()]\n chain = chain + [build_cnf() for _ in range(args.num_blocks)]\n if args.batch_norm:\n chain.append(layers.MovingBatchNorm2d(data_shape[0]))\n model = layers.SequentialFlow(chain)\n return model\n\n\nif __name__ == \"__main__\":\n\n # get deivce\n device = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n cvt = lambda x: x.type(torch.float32).to(device, non_blocking=True)\n\n # load dataset\n train_set, test_loader, data_shape = get_dataset(args)\n\n # build model\n regularization_fns, regularization_coeffs = create_regularization_fns(args)\n model = create_model(args, data_shape, regularization_fns)\n\n if args.spectral_norm: add_spectral_norm(model, logger)\n set_cnf_options(args, model)\n\n logger.info(model)\n logger.info(\"Number of trainable parameters: {}\".format(count_parameters(model)))\n \n writer.add_text('info', \"Number of trainable parameters: {}\".format(count_parameters(model)))\n\n # optimizer\n optimizer = optim.Adam(model.parameters(), lr=args.lr, weight_decay=args.weight_decay)\n \n # set initial iter\n itr = 1\n \n # set the meters\n time_epoch_meter = utils.RunningAverageMeter(0.97)\n time_meter = utils.RunningAverageMeter(0.97)\n loss_meter = utils.RunningAverageMeter(0.97) # track total loss\n nll_meter = utils.RunningAverageMeter(0.97) # track negative log-likelihood\n xent_meter = utils.RunningAverageMeter(0.97) # track xentropy score\n xent_color_meter = utils.RunningAverageMeter(0.97) # track xentropy score\n error_meter = utils.RunningAverageMeter(0.97) # track error score\n error_color_meter = utils.RunningAverageMeter(0.97)\n steps_meter = utils.RunningAverageMeter(0.97)\n grad_meter = utils.RunningAverageMeter(0.97)\n tt_meter = utils.RunningAverageMeter(0.97)\n\n # restore parameters\n if args.resume is not None:\n checkpt = torch.load(args.resume, map_location=lambda storage, loc: storage)\n model.load_state_dict(checkpt[\"state_dict\"])\n if \"optim_state_dict\" in checkpt.keys():\n optimizer.load_state_dict(checkpt[\"optim_state_dict\"])\n # Manually move optimizer state to device.\n for state in optimizer.state.values():\n for k, v in state.items():\n if torch.is_tensor(v):\n state[k] = cvt(v)\n args.begin_epoch = checkpt['epoch'] + 1\n itr = checkpt['iter'] + 1\n time_epoch_meter.set(checkpt['epoch_time_avg'])\n time_meter.set(checkpt['time_train'])\n loss_meter.set(checkpt['loss_train'])\n nll_meter.set(checkpt['bits_per_dim_train'])\n xent_meter.set(checkpt['xent_train'])\n xent_color_meter.set(checkpt['xent_train_color'])\n error_meter.set(checkpt['error_train'])\n error_color_meter.set(checkpt['error_train_color'])\n steps_meter.set(checkpt['nfe_train'])\n grad_meter.set(checkpt['grad_train'])\n tt_meter.set(checkpt['total_time_train'])\n\n if torch.cuda.is_available():\n model = torch.nn.DataParallel(model).cuda()\n\n # For visualization.\n if args.conditional:\n fixed_y = torch.from_numpy(np.arange(model.module.y_class)).repeat(model.module.y_class).type(torch.long).to(device, non_blocking=True)\n fixed_y_onehot = thops.onehot(fixed_y, num_classes=model.module.y_class)\n \n fixed_y_color = torch.from_numpy(np.arange(model.module.y_color)).repeat(model.module.y_color).type(torch.long).to(device, non_blocking=True)\n fixed_y_onehot_color = thops.onehot(fixed_y_color, num_classes=model.module.y_color)\n with torch.no_grad():\n mean, logs = model.module._prior(fixed_y_onehot)\n mean_color, logs_color = model.module._prior_color(fixed_y_onehot_color)\n fixed_z_sup = modules.GaussianDiag.sample(mean, logs)\n fixed_z_color_sup = modules.GaussianDiag.sample(mean_color, logs_color)\n dim_unsup = np.prod(data_shape) - np.prod(fixed_z_sup.shape[1:]) - np.prod(fixed_z_color_sup.shape[1:])\n fixed_z_unsup = cvt(torch.randn(model.module.y_class**2, dim_unsup))\n \n a_sup = fixed_z_sup.shape[1] // (2**(model.module.n_scale - 1))\n a_color_sup = fixed_z_color_sup.shape[1] // (2**(model.module.n_scale - 1))\n a_unsup = fixed_z_unsup.shape[1] // (2**(model.module.n_scale - 1))\n \n fixed_z = []\n start_sup = 0; start_color_sup = 0; start_unsup = 0\n for ns in range(model.module.n_scale, 1, -1):\n end_sup = start_sup + (2**(ns-2))*a_sup\n end_color_sup = start_color_sup + (2**(ns-2))*a_color_sup\n end_unsup = start_unsup + (2**(ns-2))*a_unsup\n \n fixed_z.append(fixed_z_sup[:,start_sup:end_sup])\n fixed_z.append(fixed_z_color_sup[:,start_color_sup:end_color_sup])\n fixed_z.append(fixed_z_unsup[:,start_unsup:end_unsup])\n \n start_sup = end_sup; start_color_sup = end_color_sup; start_unsup = end_unsup\n \n end_sup = start_sup + a_sup\n end_color_sup = start_color_sup + a_color_sup\n end_unsup = start_unsup + a_unsup\n \n fixed_z.append(fixed_z_sup[:,start_sup:end_sup])\n fixed_z.append(fixed_z_color_sup[:,start_color_sup:end_color_sup])\n fixed_z.append(fixed_z_unsup[:,start_unsup:end_unsup])\n \n # for i_z in range(len(fixed_z)): print(fixed_z[i_z].shape)\n \n fixed_z = torch.cat(fixed_z,1)\n else:\n fixed_z = cvt(torch.randn(100, *data_shape))\n \n\n if args.spectral_norm and not args.resume: spectral_norm_power_iteration(model, 500)\n\n best_loss_nll = float(\"inf\")\n best_error_score = float(\"inf\")\n best_error_score_color = float(\"inf\")\n \n for epoch in range(args.begin_epoch, args.num_epochs + 1):\n start_epoch = time.time()\n model.train()\n if args.annealing_std:\n update_scale_std(model.module, epoch)\n \n train_loader = get_train_loader(train_set, epoch)\n for _, (x, y_all) in enumerate(train_loader):\n start = time.time()\n \n y = y_all[0]\n y_color = y_all[1]\n \n update_lr(optimizer, itr)\n optimizer.zero_grad()\n\n if not args.conv:\n x = x.view(x.shape[0], -1)\n\n # cast data and move to device\n x = cvt(x)\n \n # compute loss\n if args.conditional:\n loss_nll, loss_xent, loss_xent_color, y_predicted, y_color_predicted, atol, rtol, logp_actions, nfe = compute_bits_per_dim_conditional(x, y, y_color, model)\n if args.train_mode == \"semisup\":\n loss = loss_nll + args.weight_y * 0.5 * (loss_xent + loss_xent_color)\n elif args.train_mode == \"sup\":\n loss = 0.5 * (loss_xent + loss_xent_color)\n elif args.train_mode == \"unsup\":\n loss = loss_nll\n else:\n raise ValueError('Choose supported train_mode: semisup, sup, unsup')\n error_score = 1. - np.mean(y_predicted.astype(int) == y.numpy()) \n error_score_color = 1. - np.mean(y_color_predicted.astype(int) == y_color.numpy())\n \n else:\n loss, atol, rtol, logp_actions, nfe = compute_bits_per_dim(x, model)\n loss_nll, loss_xent, loss_xent_color, error_score, error_score_color = loss, 0., 0., 0., 0.\n \n if regularization_coeffs:\n reg_states = get_regularization(model, regularization_coeffs)\n reg_loss = sum(\n reg_state * coeff for reg_state, coeff in zip(reg_states, regularization_coeffs) if coeff != 0\n )\n loss = loss + reg_loss\n total_time = count_total_time(model)\n loss = loss + total_time * args.time_penalty\n\n # re-weight the gate rewards\n normalized_eta = args.eta / len(logp_actions)\n \n # collect cumulative future rewards\n R = - loss\n cum_rewards = []\n for r in nfe[::-1]:\n R = -normalized_eta * r.view(-1,1) + args.gamma * R\n cum_rewards.insert(0,R)\n \n # apply REINFORCE\n rl_loss = 0\n for lpa, r in zip(logp_actions, cum_rewards):\n rl_loss = rl_loss - lpa.view(-1,1) * args.rl_weight * r\n \n loss = loss + rl_loss.mean()\n \n loss.backward()\n \n grad_norm = torch.nn.utils.clip_grad_norm_(model.parameters(), args.max_grad_norm)\n\n optimizer.step()\n\n if args.spectral_norm: spectral_norm_power_iteration(model, args.spectral_norm_niter)\n \n time_meter.update(time.time() - start)\n loss_meter.update(loss.item())\n nll_meter.update(loss_nll.item())\n if args.conditional:\n xent_meter.update(loss_xent.item())\n xent_color_meter.update(loss_xent_color.item())\n else:\n xent_meter.update(loss_xent)\n xent_color_meter.update(loss_xent_color)\n error_meter.update(error_score)\n error_color_meter.update(error_score_color)\n steps_meter.update(count_nfe_gate(model))\n grad_meter.update(grad_norm)\n tt_meter.update(total_time)\n \n for idx in range(len(model.module.transforms)):\n for layer in model.module.transforms[idx].chain:\n if hasattr(layer, 'atol'):\n layer.odefunc.after_odeint()\n \n # write to tensorboard\n writer.add_scalars('time', {'train_iter': time_meter.val}, itr)\n writer.add_scalars('loss', {'train_iter': loss_meter.val}, itr)\n writer.add_scalars('bits_per_dim', {'train_iter': nll_meter.val}, itr)\n writer.add_scalars('xent', {'train_iter': xent_meter.val}, itr)\n writer.add_scalars('xent_color', {'train_iter': xent_color_meter.val}, itr)\n writer.add_scalars('error', {'train_iter': error_meter.val}, itr)\n writer.add_scalars('error_color', {'train_iter': error_color_meter.val}, itr)\n writer.add_scalars('nfe', {'train_iter': steps_meter.val}, itr)\n writer.add_scalars('grad', {'train_iter': grad_meter.val}, itr)\n writer.add_scalars('total_time', {'train_iter': tt_meter.val}, itr)\n\n if itr % args.log_freq == 0:\n for tol_indx in range(len(atol)):\n writer.add_scalars('atol_%i'%tol_indx, {'train': atol[tol_indx].mean()}, itr)\n writer.add_scalars('rtol_%i'%tol_indx, {'train': rtol[tol_indx].mean()}, itr)\n \n log_message = (\n \"Iter {:04d} | Time {:.4f}({:.4f}) | Bit/dim {:.4f}({:.4f}) | Xent {:.4f}({:.4f}) | Xent Color {:.4f}({:.4f}) | Loss {:.4f}({:.4f}) | Error {:.4f}({:.4f}) | Error Color {:.4f}({:.4f}) |\"\n \"Steps {:.0f}({:.2f}) | Grad Norm {:.4f}({:.4f}) | Total Time {:.2f}({:.2f})\".format(\n itr, time_meter.val, time_meter.avg, nll_meter.val, nll_meter.avg, xent_meter.val, xent_meter.avg, xent_color_meter.val, xent_color_meter.avg, loss_meter.val, loss_meter.avg, error_meter.val, error_meter.avg, error_color_meter.val, error_color_meter.avg, steps_meter.val, steps_meter.avg, grad_meter.val, grad_meter.avg, tt_meter.val, tt_meter.avg\n )\n )\n if regularization_coeffs:\n log_message = append_regularization_to_log(log_message, regularization_fns, reg_states)\n logger.info(log_message)\n writer.add_text('info', log_message, itr)\n\n itr += 1\n \n # compute test loss\n model.eval()\n if epoch % args.val_freq == 0:\n with torch.no_grad():\n # write to tensorboard\n writer.add_scalars('time', {'train_epoch': time_meter.avg}, epoch)\n writer.add_scalars('loss', {'train_epoch': loss_meter.avg}, epoch)\n writer.add_scalars('bits_per_dim', {'train_epoch': nll_meter.avg}, epoch)\n writer.add_scalars('xent', {'train_epoch': xent_meter.avg}, epoch)\n writer.add_scalars('xent_color', {'train_epoch': xent_color_meter.avg}, epoch)\n writer.add_scalars('error', {'train_epoch': error_meter.avg}, epoch)\n writer.add_scalars('error_color', {'train_epoch': error_color_meter.avg}, epoch)\n writer.add_scalars('nfe', {'train_epoch': steps_meter.avg}, epoch)\n writer.add_scalars('grad', {'train_epoch': grad_meter.avg}, epoch)\n writer.add_scalars('total_time', {'train_epoch': tt_meter.avg}, epoch)\n \n start = time.time()\n logger.info(\"validating...\")\n writer.add_text('info', \"validating...\", epoch)\n losses_nll = []; losses_xent = []; losses_xent_color = []; losses = []\n total_correct = 0\n total_correct_color = 0\n \n for (x, y_all) in test_loader:\n y = y_all[0]\n y_color = y_all[1]\n if not args.conv:\n x = x.view(x.shape[0], -1)\n x = cvt(x)\n if args.conditional:\n loss_nll, loss_xent, loss_xent_color, y_predicted, y_color_predicted, atol, rtol, logp_actions, nfe = compute_bits_per_dim_conditional(x, y, y_color, model)\n if args.train_mode == \"semisup\":\n loss = loss_nll + args.weight_y * 0.5 * (loss_xent + loss_xent_color)\n elif args.train_mode == \"sup\":\n loss = 0.5 * (loss_xent + loss_xent_color)\n elif args.train_mode == \"unsup\":\n loss = loss_nll\n else:\n raise ValueError('Choose supported train_mode: semisup, sup, unsup')\n total_correct += np.sum(y_predicted.astype(int) == y.numpy())\n total_correct_color += np.sum(y_color_predicted.astype(int) == y_color.numpy())\n else:\n loss, atol, rtol, logp_actions, nfe = compute_bits_per_dim(x, model)\n loss_nll, loss_xent, loss_xent_color = loss, 0., 0.\n losses_nll.append(loss_nll.cpu().numpy()); losses.append(loss.cpu().numpy())\n if args.conditional: \n losses_xent.append(loss_xent.cpu().numpy())\n losses_xent_color.append(loss_xent_color.cpu().numpy())\n else:\n losses_xent.append(loss_xent)\n losses_xent_color.append(loss_xent_color)\n \n loss_nll = np.mean(losses_nll); loss_xent = np.mean(losses_xent); loss_xent_color = np.mean(losses_xent_color); loss = np.mean(losses)\n error_score = 1. - total_correct / len(test_loader.dataset)\n error_score_color = 1. - total_correct_color / len(test_loader.dataset)\n time_epoch_meter.update(time.time() - start_epoch)\n \n # write to tensorboard\n test_time_spent = time.time() - start\n writer.add_scalars('time', {'validation': test_time_spent}, epoch)\n writer.add_scalars('epoch_time', {'validation': time_epoch_meter.val}, epoch)\n writer.add_scalars('bits_per_dim', {'validation': loss_nll}, epoch)\n writer.add_scalars('xent', {'validation': loss_xent}, epoch)\n writer.add_scalars('xent_color', {'validation': loss_xent_color}, epoch)\n writer.add_scalars('loss', {'validation': loss}, epoch)\n writer.add_scalars('error', {'validation': error_score}, epoch)\n writer.add_scalars('error_color', {'validation': error_score_color}, epoch)\n \n for tol_indx in range(len(atol)):\n writer.add_scalars('atol_%i'%tol_indx, {'validation': atol[tol_indx].mean()}, epoch)\n writer.add_scalars('rtol_%i'%tol_indx, {'validation': rtol[tol_indx].mean()}, epoch)\n \n log_message = \"Epoch {:04d} | Time {:.4f}, Epoch Time {:.4f}({:.4f}), Bit/dim {:.4f}(best: {:.4f}), Xent {:.4f}, Xent Color {:.4f}. Loss {:.4f}, Error {:.4f}(best: {:.4f}), Error Color {:.4f}(best: {:.4f})\".format(epoch, time.time() - start, time_epoch_meter.val, time_epoch_meter.avg, loss_nll, best_loss_nll, loss_xent, loss_xent_color, loss, error_score, best_error_score, error_score_color, best_error_score_color)\n logger.info(log_message)\n writer.add_text('info', log_message, epoch)\n \n for name, param in model.named_parameters():\n writer.add_histogram(name, param.clone().cpu().data.numpy(), epoch)\n \n \n utils.makedirs(args.save)\n torch.save({\n \"args\": args,\n \"state_dict\": model.module.state_dict() if torch.cuda.is_available() else model.state_dict(),\n \"optim_state_dict\": optimizer.state_dict(),\n \"epoch\": epoch,\n \"iter\": itr-1,\n \"error\": error_score,\n \"error_color\": error_score_color,\n \"loss\": loss,\n \"xent\": loss_xent,\n \"xent_color\": loss_xent_color,\n \"bits_per_dim\": loss_nll,\n \"best_bits_per_dim\": best_loss_nll,\n \"best_error_score\": best_error_score,\n \"best_error_score_color\": best_error_score_color,\n \"epoch_time\": time_epoch_meter.val,\n \"epoch_time_avg\": time_epoch_meter.avg,\n \"time\": test_time_spent,\n \"error_train\": error_meter.avg,\n \"error_train_color\": error_color_meter.avg,\n \"loss_train\": loss_meter.avg,\n \"xent_train\": xent_meter.avg,\n \"xent_train_color\": xent_color_meter.avg,\n \"bits_per_dim_train\": nll_meter.avg,\n \"total_time_train\": tt_meter.avg,\n \"time_train\": time_meter.avg,\n \"nfe_train\": steps_meter.avg,\n \"grad_train\": grad_meter.avg,\n }, os.path.join(args.save, \"epoch_%i_checkpt.pth\"%epoch))\n \n torch.save({\n \"args\": args,\n \"state_dict\": model.module.state_dict() if torch.cuda.is_available() else model.state_dict(),\n \"optim_state_dict\": optimizer.state_dict(),\n \"epoch\": epoch,\n \"iter\": itr-1,\n \"error\": error_score,\n \"error_color\": error_score_color,\n \"loss\": loss,\n \"xent\": loss_xent,\n \"xent_color\": loss_xent_color,\n \"bits_per_dim\": loss_nll,\n \"best_bits_per_dim\": best_loss_nll,\n \"best_error_score\": best_error_score,\n \"best_error_score_color\": best_error_score_color,\n \"epoch_time\": time_epoch_meter.val,\n \"epoch_time_avg\": time_epoch_meter.avg,\n \"time\": test_time_spent,\n \"error_train\": error_meter.avg,\n \"error_train_color\": error_color_meter.avg,\n \"loss_train\": loss_meter.avg,\n \"xent_train\": xent_meter.avg,\n \"xent_train_color\": xent_color_meter.avg,\n \"bits_per_dim_train\": nll_meter.avg,\n \"total_time_train\": tt_meter.avg,\n \"time_train\": time_meter.avg,\n \"nfe_train\": steps_meter.avg,\n \"grad_train\": grad_meter.avg,\n }, os.path.join(args.save, \"current_checkpt.pth\"))\n \n if loss_nll < best_loss_nll:\n best_loss_nll = loss_nll\n utils.makedirs(args.save)\n torch.save({\n \"args\": args,\n \"state_dict\": model.module.state_dict() if torch.cuda.is_available() else model.state_dict(),\n \"optim_state_dict\": optimizer.state_dict(),\n \"epoch\": epoch,\n \"iter\": itr-1,\n \"error\": error_score,\n \"error_color\": error_score_color,\n \"loss\": loss,\n \"xent\": loss_xent,\n \"xent_color\": loss_xent_color,\n \"bits_per_dim\": loss_nll,\n \"best_bits_per_dim\": best_loss_nll,\n \"best_error_score\": best_error_score,\n \"best_error_score_color\": best_error_score_color,\n \"epoch_time\": time_epoch_meter.val,\n \"epoch_time_avg\": time_epoch_meter.avg,\n \"time\": test_time_spent,\n \"error_train\": error_meter.avg,\n \"error_train_color\": error_color_meter.avg,\n \"loss_train\": loss_meter.avg,\n \"xent_train\": xent_meter.avg,\n \"xent_train_color\": xent_color_meter.avg,\n \"bits_per_dim_train\": nll_meter.avg,\n \"total_time_train\": tt_meter.avg,\n \"time_train\": time_meter.avg,\n \"nfe_train\": steps_meter.avg,\n \"grad_train\": grad_meter.avg,\n }, os.path.join(args.save, \"best_nll_checkpt.pth\"))\n \n if args.conditional:\n if error_score < best_error_score:\n best_error_score = error_score\n utils.makedirs(args.save)\n torch.save({\n \"args\": args,\n \"state_dict\": model.module.state_dict() if torch.cuda.is_available() else model.state_dict(),\n \"optim_state_dict\": optimizer.state_dict(),\n \"epoch\": epoch,\n \"iter\": itr-1,\n \"error\": error_score,\n \"error_color\": error_score_color,\n \"loss\": loss,\n \"xent\": loss_xent,\n \"xent_color\": loss_xent_color,\n \"bits_per_dim\": loss_nll,\n \"best_bits_per_dim\": best_loss_nll,\n \"best_error_score\": best_error_score,\n \"best_error_score_color\": best_error_score_color,\n \"epoch_time\": time_epoch_meter.val,\n \"epoch_time_avg\": time_epoch_meter.avg,\n \"time\": test_time_spent,\n \"error_train\": error_meter.avg,\n \"error_train_color\": error_color_meter.avg,\n \"loss_train\": loss_meter.avg,\n \"xent_train\": xent_meter.avg,\n \"xent_train_color\": xent_color_meter.avg,\n \"bits_per_dim_train\": nll_meter.avg,\n \"total_time_train\": tt_meter.avg,\n \"time_train\": time_meter.avg,\n \"nfe_train\": steps_meter.avg,\n \"grad_train\": grad_meter.avg,\n }, os.path.join(args.save, \"best_error_checkpt.pth\"))\n \n if error_score_color < best_error_score_color:\n best_error_score_color = error_score_color\n utils.makedirs(args.save)\n torch.save({\n \"args\": args,\n \"state_dict\": model.module.state_dict() if torch.cuda.is_available() else model.state_dict(),\n \"optim_state_dict\": optimizer.state_dict(),\n \"epoch\": epoch,\n \"iter\": itr-1,\n \"error\": error_score,\n \"error_color\": error_score_color,\n \"loss\": loss,\n \"xent\": loss_xent,\n \"xent_color\": loss_xent_color,\n \"bits_per_dim\": loss_nll,\n \"best_bits_per_dim\": best_loss_nll,\n \"best_error_score\": best_error_score,\n \"best_error_score_color\": best_error_score_color,\n \"epoch_time\": time_epoch_meter.val,\n \"epoch_time_avg\": time_epoch_meter.avg,\n \"time\": test_time_spent,\n \"error_train\": error_meter.avg,\n \"error_train_color\": error_color_meter.avg,\n \"loss_train\": loss_meter.avg,\n \"xent_train\": xent_meter.avg,\n \"xent_train_color\": xent_color_meter.avg,\n \"bits_per_dim_train\": nll_meter.avg,\n \"total_time_train\": tt_meter.avg,\n \"time_train\": time_meter.avg,\n \"nfe_train\": steps_meter.avg,\n \"grad_train\": grad_meter.avg,\n }, os.path.join(args.save, \"best_error_color_checkpt.pth\"))\n \n\n # visualize samples and density\n with torch.no_grad():\n fig_filename = os.path.join(args.save, \"figs\", \"{:04d}.jpg\".format(epoch))\n utils.makedirs(os.path.dirname(fig_filename))\n generated_samples, atol, rtol, logp_actions, nfe = model(fixed_z, reverse=True)\n generated_samples = generated_samples.view(-1, *data_shape)\n for tol_indx in range(len(atol)):\n writer.add_scalars('atol_gen_%i'%tol_indx, {'validation': atol[tol_indx].mean()}, epoch)\n writer.add_scalars('rtol_gen_%i'%tol_indx, {'validation': rtol[tol_indx].mean()}, epoch)\n save_image(generated_samples, fig_filename, nrow=10)\n if args.data == \"mnist\":\n writer.add_images('generated_images', generated_samples.repeat(1,3,1,1), epoch)\n else:\n writer.add_images('generated_images', generated_samples.repeat(1,1,1,1), epoch)\nNamespace(JFrobint=None, JdiagFrobint=None, JoffdiagFrobint=None, add_noise=True, alpha=1e-06, annealing_std=False, atol=1e-05, autoencode=False, batch_norm=False, batch_size=900, batch_size_schedule='', begin_epoch=1, beta=10.0, cond_nn='linear', condition_ratio=0.25, conditional=True, controlled_tol=False, conv=True, data='colormnist', dims='64,64,64', divergence_fn='approximate', dl2int=None, dropout_rate=0.5, eta=0.1, gamma=0.99, gate='cnn1', imagesize=None, l1int=None, l2int=None, layer_type='concat', log_freq=10, lr=0.001, max_grad_norm=10000000000.0, multiscale=True, nonlinearity='softplus', num_blocks=2, num_epochs=500, parallel=False, rademacher=True, residual=False, resume=None, rl_weight=0.01, rtol=1e-05, save='../experiments_published/infocnf_conditional_disentangle_colormnist_bs900_sratio_1_4th_drop_0_5_rl_stdscale_6_2cond_linear_multiscale_beta_10_run1', scale=1.0, scale_fac=1.0, scale_std=6.0, seed=1, solver='dopri5', spectral_norm=False, spectral_norm_niter=10, step_size=None, strides='1,1,1,1', test_atol=None, test_batch_size=500, test_rtol=None, test_solver=None, time_length=1.0, time_penalty=0, train_T=True, train_mode='semisup', val_freq=1, warmup_iters=1000, weight_decay=0.0, weight_y=0.5, y_class=10, y_color=10)\nODENVP(\n (transforms): ModuleList(\n (0): StackedCNFLayers(\n (chain): ModuleList(\n (0): LogitTransform()\n (1): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(3, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(4, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 3, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n (2): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(3, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(4, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 3, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n (3): SqueezeLayer()\n (4): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(12, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(13, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 12, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n (5): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(12, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(13, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 12, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n )\n )\n (1): StackedCNFLayers(\n (chain): ModuleList(\n (0): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(6, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(7, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 6, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n (1): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(6, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(7, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 6, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n (2): SqueezeLayer()\n (3): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(24, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(25, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 24, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n (4): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(24, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(25, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 24, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n )\n )\n (2): StackedCNFLayers(\n (chain): ModuleList(\n (0): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(12, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(13, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 12, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n (1): CNF_Gate(\n (gate_net): FeedforwardGateI(\n (maxpool): MaxPool2d(kernel_size=2, stride=2, padding=0, dilation=1, ceil_mode=False)\n (conv1): Conv2d(12, 10, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1), bias=False)\n (bn1): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu1): ReLU(inplace)\n (conv2): Conv2d(10, 10, kernel_size=(3, 3), stride=(2, 2), padding=(1, 1), bias=False)\n (bn2): BatchNorm2d(10, eps=1e-05, momentum=0.1, affine=True, track_running_stats=True)\n (relu2): ReLU(inplace)\n (avg_layer): AdaptiveAvgPool2d(output_size=(1, 1))\n (linear_layer): Conv2d(10, 1, kernel_size=(1, 1), stride=(1, 1))\n (sigmoid): Sigmoid()\n )\n (odefunc): RegularizedODEfunc(\n (odefunc): ODEfunc_rl(\n (diffeq): ODEnet(\n (layers): ModuleList(\n (0): ConcatConv2d(\n (_layer): Conv2d(13, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (1): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (2): ConcatConv2d(\n (_layer): Conv2d(65, 64, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n (3): ConcatConv2d(\n (_layer): Conv2d(65, 12, kernel_size=(3, 3), stride=(1, 1), padding=(1, 1))\n )\n )\n (activation_fns): ModuleList(\n (0): Softplus(beta=1, threshold=20)\n (1): Softplus(beta=1, threshold=20)\n (2): Softplus(beta=1, threshold=20)\n )\n )\n )\n )\n )\n )\n )\n )\n (project_ycond): LinearZeros(in_features=10, out_features=1176, bias=True)\n (project_ycond_color): LinearZeros(in_features=10, out_features=1176, bias=True)\n (project_class): LinearZeros(in_features=588, out_features=10, bias=True)\n (project_color): LinearZeros(in_features=588, out_features=10, bias=True)\n (dropout): Dropout(p=0.5)\n (dropout_color): Dropout(p=0.5)\n)\nNumber of trainable parameters: 951104\n===> Using batch size 900. Total 66 iterations/epoch.\n/tancode/repos/tan-ffjord/lib/layers/odefunc_rl.py:291: UserWarning: To copy construct from a tensor, it is recommended to use sourceTensor.clone().detach() or sourceTensor.clone().detach().requires_grad_(True), rather than torch.tensor(sourceTensor).\n t = torch.tensor(t).type_as(y)\n/opt/conda/lib/python3.6/site-packages/torch/nn/parallel/_functions.py:61: UserWarning: Was asked to gather along dimension 0, but all input tensors were scalars; will instead unsqueeze and return a vector.\n warnings.warn('Was asked to gather along dimension 0, but all '\nIter 0010 | Time 6.7172(28.9773) | Bit/dim 25.4505(27.3297) | Xent 2.2869(2.3009) | Xent Color 2.3007(2.3023) | Loss 48.6142(51.7970) | Error 0.8744(0.8882) | Error Color 0.9067(0.8898) |Steps 296(293.37) | Grad Norm 260.8726(275.0037) | Total Time 0.00(0.00)\nIter 0020 | Time 7.2747(23.2512) | Bit/dim 20.0909(26.0735) | Xent 2.2513(2.2928) | Xent Color 2.2917(2.3003) | Loss 39.1978(49.5869) | Error 0.8644(0.8869) | Error Color 0.8811(0.8910) |Steps 290(296.46) | Grad Norm 216.4315(264.8294) | Total Time 0.00(0.00)\nIter 0030 | Time 7.2844(19.0315) | Bit/dim 13.8656(23.5615) | Xent 2.1974(2.2735) | Xent Color 2.2745(2.2954) | Loss 27.6801(45.0974) | Error 0.5411(0.8307) | Error Color 0.7822(0.8687) |Steps 302(298.98) | Grad Norm 159.2173(243.6388) | Total Time 0.00(0.00)\nIter 0040 | Time 8.5218(16.1508) | Bit/dim 8.9832(20.2265) | Xent 2.1211(2.2412) | Xent Color 2.2517(2.2866) | Loss 18.9711(39.0977) | Error 0.3322(0.7163) | Error Color 0.7511(0.8413) |Steps 362(309.32) | Grad Norm 95.5069(211.8952) | Total Time 0.00(0.00)\nIter 0050 | Time 8.9191(14.2288) | Bit/dim 6.6884(16.8755) | Xent 2.0425(2.1962) | Xent Color 2.2351(2.2744) | Loss 14.8061(33.0821) | Error 0.3333(0.6080) | Error Color 0.7467(0.8130) |Steps 392(327.39) | Grad Norm 33.8638(171.6100) | Total Time 0.00(0.00)\nIter 0060 | Time 9.3227(12.9358) | Bit/dim 6.0965(14.1054) | Xent 1.9660(2.1429) | Xent Color 2.1978(2.2582) | Loss 13.8245(28.1125) | Error 0.3422(0.5346) | Error Color 0.7800(0.8032) |Steps 368(346.20) | Grad Norm 25.0495(132.5938) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0001 | Time 70.6257, Epoch Time 660.3164(660.3164), Bit/dim 5.7409(best: inf), Xent 1.8894, Xent Color 2.1737. Loss 6.7567, Error 0.2505(best: inf), Error Color 0.7276(best: inf)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0070 | Time 9.1856(11.9171) | Bit/dim 5.5568(11.9159) | Xent 1.8885(2.0823) | Xent Color 2.1676(2.2383) | Loss 12.6809(24.6215) | Error 0.3100(0.4738) | Error Color 0.6700(0.7873) |Steps 368(355.91) | Grad Norm 18.3093(103.8220) | Total Time 0.00(0.00)\nIter 0080 | Time 8.5462(11.0740) | Bit/dim 4.9704(10.1646) | Xent 1.8138(2.0166) | Xent Color 2.1314(2.2142) | Loss 11.5146(21.3208) | Error 0.3022(0.4245) | Error Color 0.6000(0.7364) |Steps 386(361.58) | Grad Norm 14.4526(80.3129) | Total Time 0.00(0.00)\nIter 0090 | Time 8.7664(10.4519) | Bit/dim 4.5811(8.7587) | Xent 1.7558(1.9542) | Xent Color 2.1022(2.1889) | Loss 10.9431(18.6679) | Error 0.2756(0.3892) | Error Color 0.6278(0.7121) |Steps 398(365.35) | Grad Norm 13.4106(63.1016) | Total Time 0.00(0.00)\nIter 0100 | Time 8.5721(10.0347) | Bit/dim 4.1664(7.6068) | Xent 1.7182(1.8965) | Xent Color 2.0705(2.1608) | Loss 9.9141(16.4906) | Error 0.2700(0.3599) | Error Color 0.5889(0.6806) |Steps 350(367.33) | Grad Norm 9.0484(49.1766) | Total Time 0.00(0.00)\nIter 0110 | Time 8.8333(9.7371) | Bit/dim 3.7622(6.6452) | Xent 1.7104(1.8495) | Xent Color 2.0338(2.1304) | Loss 9.2627(14.6923) | Error 0.2900(0.3392) | Error Color 0.5344(0.6460) |Steps 344(368.86) | Grad Norm 8.0415(38.5385) | Total Time 0.00(0.00)\nIter 0120 | Time 8.8842(9.5004) | Bit/dim 3.3653(5.8283) | Xent 1.7375(1.8180) | Xent Color 2.0034(2.1006) | Loss 8.6042(13.1561) | Error 0.3022(0.3279) | Error Color 0.5533(0.6173) |Steps 398(369.11) | Grad Norm 8.2501(30.6077) | Total Time 0.00(0.00)\nIter 0130 | Time 8.7716(9.3606) | Bit/dim 3.0526(5.1349) | Xent 1.7686(1.8017) | Xent Color 1.9625(2.0678) | Loss 7.8607(11.8673) | Error 0.3089(0.3252) | Error Color 0.5411(0.5919) |Steps 362(371.64) | Grad Norm 6.3208(24.4518) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0002 | Time 56.7973, Epoch Time 664.9273(660.4547), Bit/dim 2.9671(best: 5.7409), Xent 1.7650, Xent Color 1.9373. Loss 3.8927, Error 0.2727(best: 0.2505), Error Color 0.4008(best: 0.7276)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0140 | Time 9.3806(9.3302) | Bit/dim 2.7925(4.5470) | Xent 1.8212(1.8013) | Xent Color 1.9172(2.0341) | Loss 7.5780(11.2172) | Error 0.3511(0.3309) | Error Color 0.4789(0.5642) |Steps 398(378.14) | Grad Norm 5.6835(19.5810) | Total Time 0.00(0.00)\nIter 0150 | Time 9.7713(9.3318) | Bit/dim 2.6174(4.0578) | Xent 1.8334(1.8090) | Xent Color 1.8795(1.9970) | Loss 7.2931(10.2060) | Error 0.3667(0.3395) | Error Color 0.4844(0.5414) |Steps 392(382.29) | Grad Norm 4.3354(15.6803) | Total Time 0.00(0.00)\nIter 0160 | Time 9.5154(9.3397) | Bit/dim 2.4789(3.6578) | Xent 1.8511(1.8204) | Xent Color 1.8173(1.9568) | Loss 7.0443(9.3975) | Error 0.3756(0.3494) | Error Color 0.4633(0.5223) |Steps 416(387.01) | Grad Norm 3.2786(12.5222) | Total Time 0.00(0.00)\nIter 0170 | Time 9.5460(9.3467) | Bit/dim 2.4090(3.3358) | Xent 1.8710(1.8333) | Xent Color 1.7650(1.9131) | Loss 6.8228(8.7430) | Error 0.4067(0.3620) | Error Color 0.4389(0.5023) |Steps 410(390.85) | Grad Norm 2.7683(10.0176) | Total Time 0.00(0.00)\nIter 0180 | Time 9.0851(9.3864) | Bit/dim 2.3311(3.0782) | Xent 1.8909(1.8464) | Xent Color 1.7012(1.8651) | Loss 6.7733(8.2210) | Error 0.4244(0.3752) | Error Color 0.3933(0.4826) |Steps 398(392.75) | Grad Norm 2.4628(8.0934) | Total Time 0.00(0.00)\nIter 0190 | Time 9.8556(9.4278) | Bit/dim 2.2726(2.8714) | Xent 1.8944(1.8565) | Xent Color 1.6574(1.8142) | Loss 6.5912(7.7909) | Error 0.4322(0.3885) | Error Color 0.4000(0.4623) |Steps 392(394.52) | Grad Norm 1.9854(6.5953) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0003 | Time 59.4674, Epoch Time 703.2980(661.7400), Bit/dim 2.2406(best: 2.9671), Xent 1.8488, Xent Color 1.5590. Loss 3.0926, Error 0.3303(best: 0.2505), Error Color 0.3205(best: 0.4008)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0200 | Time 9.4039(9.4423) | Bit/dim 2.2369(2.7060) | Xent 1.8804(1.8628) | Xent Color 1.5552(1.7596) | Loss 6.4890(7.9800) | Error 0.4267(0.3986) | Error Color 0.3600(0.4415) |Steps 422(397.15) | Grad Norm 2.9059(5.6168) | Total Time 0.00(0.00)\nIter 0210 | Time 8.9537(9.3514) | Bit/dim 2.1969(2.5768) | Xent 1.8212(1.8583) | Xent Color 1.4897(1.7008) | Loss 6.2960(7.5526) | Error 0.4022(0.4033) | Error Color 0.3600(0.4234) |Steps 392(397.56) | Grad Norm 1.7889(4.7524) | Total Time 0.00(0.00)\nIter 0220 | Time 9.1212(9.3087) | Bit/dim 2.1935(2.4774) | Xent 1.7891(1.8448) | Xent Color 1.4049(1.6344) | Loss 6.1313(7.2172) | Error 0.3756(0.4026) | Error Color 0.3744(0.4061) |Steps 380(397.62) | Grad Norm 1.9538(4.2179) | Total Time 0.00(0.00)\nIter 0230 | Time 9.4057(9.3153) | Bit/dim 2.1735(2.4017) | Xent 1.7253(1.8199) | Xent Color 1.3348(1.5587) | Loss 6.2112(6.9530) | Error 0.3633(0.3967) | Error Color 0.3722(0.3903) |Steps 404(399.36) | Grad Norm 15.3468(4.9750) | Total Time 0.00(0.00)\nIter 0240 | Time 9.2129(9.3003) | Bit/dim 2.1952(2.3445) | Xent 1.6687(1.7879) | Xent Color 1.2999(1.4933) | Loss 6.2078(6.7462) | Error 0.3622(0.3885) | Error Color 0.3678(0.3874) |Steps 374(398.80) | Grad Norm 38.6927(10.2800) | Total Time 0.00(0.00)\nIter 0250 | Time 9.3261(9.2917) | Bit/dim 2.1615(2.2988) | Xent 1.6233(1.7444) | Xent Color 1.1964(1.4226) | Loss 6.0412(6.5681) | Error 0.3689(0.3747) | Error Color 0.3122(0.3710) |Steps 392(398.79) | Grad Norm 17.9464(13.0578) | Total Time 0.00(0.00)\nIter 0260 | Time 9.2764(9.2878) | Bit/dim 2.1560(2.2610) | Xent 1.5278(1.6948) | Xent Color 1.1005(1.3497) | Loss 5.8918(6.4088) | Error 0.3200(0.3614) | Error Color 0.2467(0.3444) |Steps 404(399.47) | Grad Norm 5.7904(13.4234) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0004 | Time 59.1054, Epoch Time 692.9184(662.6754), Bit/dim 2.2640(best: 2.2406), Xent 1.4234, Xent Color 1.9069. Loss 3.0966, Error 0.2461(best: 0.2505), Error Color 0.7540(best: 0.3205)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0270 | Time 9.0536(9.2732) | Bit/dim 2.1902(2.2433) | Xent 1.4021(1.6347) | Xent Color 1.1097(1.3395) | Loss 5.8966(6.7792) | Error 0.2878(0.3472) | Error Color 0.3044(0.3785) |Steps 404(400.46) | Grad Norm 29.4089(27.0024) | Total Time 0.00(0.00)\nIter 0280 | Time 9.1345(9.2491) | Bit/dim 2.1653(2.2253) | Xent 1.3247(1.5696) | Xent Color 1.0664(1.2790) | Loss 5.9299(6.5529) | Error 0.2567(0.3333) | Error Color 0.2189(0.3610) |Steps 410(399.54) | Grad Norm 21.5437(28.0124) | Total Time 0.00(0.00)\nIter 0290 | Time 9.1795(9.1947) | Bit/dim 2.1553(2.2092) | Xent 1.2923(1.5015) | Xent Color 0.9834(1.2108) | Loss 5.7691(6.3521) | Error 0.2689(0.3191) | Error Color 0.1867(0.3251) |Steps 398(399.75) | Grad Norm 12.1269(25.2689) | Total Time 0.00(0.00)\nIter 0300 | Time 9.1232(9.1806) | Bit/dim 2.1806(2.1968) | Xent 1.1452(1.4301) | Xent Color 0.8935(1.1420) | Loss 5.7087(6.1823) | Error 0.2422(0.3059) | Error Color 0.1556(0.2911) |Steps 398(397.63) | Grad Norm 6.1207(21.4241) | Total Time 0.00(0.00)\nIter 0310 | Time 9.2053(9.1935) | Bit/dim 2.1731(2.1918) | Xent 1.1081(1.3515) | Xent Color 0.8773(1.0706) | Loss 5.6488(6.0548) | Error 0.2400(0.2904) | Error Color 0.2133(0.2650) |Steps 410(398.16) | Grad Norm 17.8320(18.8727) | Total Time 0.00(0.00)\nIter 0320 | Time 9.1081(9.1686) | Bit/dim 2.3436(2.2107) | Xent 1.0477(1.2709) | Xent Color 3.3597(1.2907) | Loss 7.0553(6.1134) | Error 0.2422(0.2780) | Error Color 0.8400(0.3280) |Steps 392(398.99) | Grad Norm 217.2945(46.1337) | Total Time 0.00(0.00)\nIter 0330 | Time 8.5102(9.1415) | Bit/dim 2.2318(2.2186) | Xent 1.0155(1.2024) | Xent Color 1.2981(1.3370) | Loss 5.8035(6.0780) | Error 0.2356(0.2679) | Error Color 0.5267(0.3948) |Steps 374(396.60) | Grad Norm 41.3241(51.2425) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0005 | Time 57.1491, Epoch Time 681.8088(663.2494), Bit/dim 2.1932(best: 2.2406), Xent 0.9300, Xent Color 1.1729. Loss 2.7189, Error 0.1822(best: 0.2461), Error Color 0.4311(best: 0.3205)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0340 | Time 9.3889(9.1476) | Bit/dim 2.1497(2.2083) | Xent 1.0450(1.1533) | Xent Color 1.1686(1.2932) | Loss 5.8075(6.4107) | Error 0.2489(0.2618) | Error Color 0.3900(0.3965) |Steps 404(395.94) | Grad Norm 26.2196(45.2528) | Total Time 0.00(0.00)\nIter 0350 | Time 9.3942(9.0989) | Bit/dim 2.1385(2.1904) | Xent 0.9926(1.1168) | Xent Color 1.0802(1.2370) | Loss 5.6914(6.2140) | Error 0.2256(0.2577) | Error Color 0.3122(0.3728) |Steps 410(394.40) | Grad Norm 11.9567(37.0845) | Total Time 0.00(0.00)\nIter 0360 | Time 8.8042(9.0569) | Bit/dim 2.1227(2.1759) | Xent 0.9006(1.0708) | Xent Color 0.9718(1.1790) | Loss 5.4301(6.0503) | Error 0.2300(0.2523) | Error Color 0.2300(0.3397) |Steps 368(394.10) | Grad Norm 9.2982(29.8413) | Total Time 0.00(0.00)\nIter 0370 | Time 8.7372(9.0536) | Bit/dim 2.1365(2.1642) | Xent 0.8315(1.0143) | Xent Color 0.9206(1.1199) | Loss 5.5160(5.9123) | Error 0.2356(0.2434) | Error Color 0.2100(0.3076) |Steps 386(394.04) | Grad Norm 4.8088(23.3643) | Total Time 0.00(0.00)\nIter 0380 | Time 8.9203(9.0468) | Bit/dim 2.1290(2.1573) | Xent 0.8045(0.9584) | Xent Color 0.8965(1.0625) | Loss 5.3339(5.7925) | Error 0.2089(0.2356) | Error Color 0.1800(0.2782) |Steps 380(394.12) | Grad Norm 5.0422(18.5704) | Total Time 0.00(0.00)\nIter 0390 | Time 9.6733(9.0798) | Bit/dim 2.1331(2.1505) | Xent 0.8247(0.9170) | Xent Color 0.8518(1.0075) | Loss 5.4388(5.7002) | Error 0.2433(0.2295) | Error Color 0.1978(0.2537) |Steps 392(394.66) | Grad Norm 7.0343(15.7348) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0006 | Time 58.0401, Epoch Time 679.6995(663.7429), Bit/dim 2.1330(best: 2.1932), Xent 0.6577, Xent Color 0.7270. Loss 2.4792, Error 0.1498(best: 0.1822), Error Color 0.0746(best: 0.3205)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0400 | Time 9.5213(9.1470) | Bit/dim 2.1461(2.1435) | Xent 0.7502(0.8785) | Xent Color 0.7788(0.9524) | Loss 5.4233(6.1132) | Error 0.1978(0.2235) | Error Color 0.1689(0.2321) |Steps 398(394.49) | Grad Norm 9.6663(13.7149) | Total Time 0.00(0.00)\nIter 0410 | Time 9.4314(9.1417) | Bit/dim 2.1297(2.1368) | Xent 0.7200(0.8438) | Xent Color 0.7489(0.9007) | Loss 5.4094(5.9191) | Error 0.2056(0.2188) | Error Color 0.1456(0.2131) |Steps 410(394.66) | Grad Norm 12.3953(13.3133) | Total Time 0.00(0.00)\nIter 0420 | Time 9.0920(9.1527) | Bit/dim 2.1761(2.1342) | Xent 0.6716(0.8066) | Xent Color 1.4224(0.8880) | Loss 5.6537(5.7845) | Error 0.1989(0.2123) | Error Color 0.6189(0.2252) |Steps 386(395.06) | Grad Norm 142.6906(22.1804) | Total Time 0.00(0.00)\nIter 0430 | Time 9.4062(9.1654) | Bit/dim 2.0998(2.1298) | Xent 0.6981(0.7777) | Xent Color 0.6841(0.8974) | Loss 5.3709(5.6903) | Error 0.1889(0.2067) | Error Color 0.1678(0.2502) |Steps 410(396.21) | Grad Norm 4.9823(31.4163) | Total Time 0.00(0.00)\nIter 0440 | Time 9.1139(9.1420) | Bit/dim 2.0973(2.1218) | Xent 0.7159(0.7677) | Xent Color 0.6583(0.8468) | Loss 5.2336(5.5906) | Error 0.2167(0.2065) | Error Color 0.1422(0.2334) |Steps 386(396.01) | Grad Norm 2.4519(28.0055) | Total Time 0.00(0.00)\nIter 0450 | Time 9.1725(9.1428) | Bit/dim 2.1241(2.1149) | Xent 0.6861(0.7504) | Xent Color 0.6117(0.7930) | Loss 5.2659(5.5104) | Error 0.2067(0.2051) | Error Color 0.1222(0.2073) |Steps 404(396.49) | Grad Norm 8.9610(24.1920) | Total Time 0.00(0.00)\nIter 0460 | Time 9.2673(9.1450) | Bit/dim 2.0895(2.1095) | Xent 0.7110(0.7286) | Xent Color 0.5501(0.7383) | Loss 5.2467(5.4377) | Error 0.2044(0.2018) | Error Color 0.0989(0.1823) |Steps 404(398.34) | Grad Norm 5.9507(21.1386) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0007 | Time 59.2969, Epoch Time 686.7517(664.4332), Bit/dim 2.0983(best: 2.1330), Xent 0.5478, Xent Color 0.5069. Loss 2.3620, Error 0.1357(best: 0.1498), Error Color 0.0459(best: 0.0746)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0470 | Time 9.4887(9.1887) | Bit/dim 2.0731(2.1032) | Xent 0.6185(0.7068) | Xent Color 0.5381(0.6898) | Loss 5.1876(5.8212) | Error 0.1789(0.1979) | Error Color 0.0922(0.1615) |Steps 398(399.24) | Grad Norm 4.4478(18.8473) | Total Time 0.00(0.00)\nIter 0480 | Time 8.9057(9.2101) | Bit/dim 2.0673(2.0977) | Xent 0.6631(0.6911) | Xent Color 0.4830(0.6432) | Loss 5.1382(5.6402) | Error 0.1967(0.1962) | Error Color 0.0867(0.1440) |Steps 410(400.13) | Grad Norm 11.1923(15.9550) | Total Time 0.00(0.00)\nIter 0490 | Time 9.3357(9.2346) | Bit/dim 2.0761(2.0928) | Xent 0.6305(0.6788) | Xent Color 0.5262(0.6059) | Loss 5.0455(5.5159) | Error 0.1744(0.1946) | Error Color 0.1367(0.1333) |Steps 404(401.53) | Grad Norm 27.7882(16.3739) | Total Time 0.00(0.00)\nIter 0500 | Time 9.3203(9.2283) | Bit/dim 2.0709(2.0864) | Xent 0.6408(0.6658) | Xent Color 1.0010(0.6060) | Loss 5.3432(5.4281) | Error 0.2000(0.1923) | Error Color 0.4322(0.1506) |Steps 404(402.79) | Grad Norm 128.9114(26.3958) | Total Time 0.00(0.00)\nIter 0510 | Time 9.0984(9.2196) | Bit/dim 2.0598(2.0856) | Xent 0.6175(0.6543) | Xent Color 0.5491(0.6588) | Loss 5.1286(5.3819) | Error 0.1833(0.1891) | Error Color 0.1556(0.1832) |Steps 398(401.93) | Grad Norm 19.0915(37.1310) | Total Time 0.00(0.00)\nIter 0520 | Time 8.9585(9.1894) | Bit/dim 2.0503(2.0760) | Xent 0.6164(0.6534) | Xent Color 0.5226(0.6338) | Loss 4.9709(5.3120) | Error 0.1800(0.1888) | Error Color 0.1033(0.1737) |Steps 380(400.84) | Grad Norm 18.5146(33.6722) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0008 | Time 59.0021, Epoch Time 690.7191(665.2217), Bit/dim 2.0525(best: 2.0983), Xent 0.4770, Xent Color 0.4204. Loss 2.2769, Error 0.1287(best: 0.1357), Error Color 0.0557(best: 0.0459)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0530 | Time 9.4225(9.2271) | Bit/dim 2.0289(2.0667) | Xent 0.5710(0.6465) | Xent Color 0.5675(0.6031) | Loss 4.9024(5.7885) | Error 0.1756(0.1879) | Error Color 0.1822(0.1627) |Steps 404(401.99) | Grad Norm 42.6756(30.9025) | Total Time 0.00(0.00)\nIter 0540 | Time 9.1718(9.2343) | Bit/dim 2.0199(2.0599) | Xent 0.5650(0.6336) | Xent Color 0.4578(0.5697) | Loss 5.0246(5.5880) | Error 0.1733(0.1857) | Error Color 0.1000(0.1511) |Steps 398(401.78) | Grad Norm 19.2245(28.7212) | Total Time 0.00(0.00)\nIter 0550 | Time 9.3834(9.2499) | Bit/dim 2.0297(2.0522) | Xent 0.6291(0.6221) | Xent Color 0.3987(0.5301) | Loss 4.9850(5.4283) | Error 0.1744(0.1822) | Error Color 0.0633(0.1355) |Steps 404(402.88) | Grad Norm 8.7679(25.3062) | Total Time 0.00(0.00)\nIter 0560 | Time 9.4572(9.2707) | Bit/dim 2.1703(2.0513) | Xent 0.5655(0.6127) | Xent Color 4.3467(0.6392) | Loss 7.0091(5.3909) | Error 0.1767(0.1821) | Error Color 0.8111(0.1596) |Steps 380(403.58) | Grad Norm 248.6860(34.1775) | Total Time 0.00(0.00)\nIter 0570 | Time 9.1423(9.2506) | Bit/dim 2.0738(2.0761) | Xent 0.7124(0.6236) | Xent Color 0.7875(0.8889) | Loss 5.3442(5.4804) | Error 0.2222(0.1881) | Error Color 0.2867(0.2423) |Steps 398(402.40) | Grad Norm 41.5933(46.4471) | Total Time 0.00(0.00)\nIter 0580 | Time 8.5995(9.1970) | Bit/dim 2.0546(2.0708) | Xent 0.6698(0.6517) | Xent Color 0.6495(0.8420) | Loss 5.0626(5.4015) | Error 0.2044(0.1974) | Error Color 0.1978(0.2429) |Steps 380(398.69) | Grad Norm 17.5373(39.7830) | Total Time 0.00(0.00)\nIter 0590 | Time 9.2272(9.1438) | Bit/dim 2.0165(2.0621) | Xent 0.6385(0.6487) | Xent Color 0.5056(0.7693) | Loss 5.0389(5.3103) | Error 0.1911(0.1970) | Error Color 0.1356(0.2216) |Steps 398(395.55) | Grad Norm 8.5801(31.7753) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0009 | Time 58.0060, Epoch Time 686.8772(665.8714), Bit/dim 2.0364(best: 2.0525), Xent 0.4601, Xent Color 0.3912. Loss 2.2493, Error 0.1255(best: 0.1287), Error Color 0.0549(best: 0.0459)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0600 | Time 9.1449(9.1441) | Bit/dim 2.0257(2.0514) | Xent 0.6099(0.6353) | Xent Color 0.4471(0.6925) | Loss 4.9638(5.6913) | Error 0.2089(0.1943) | Error Color 0.1100(0.1940) |Steps 404(395.72) | Grad Norm 9.6668(25.6121) | Total Time 0.00(0.00)\nIter 0610 | Time 9.6455(9.1792) | Bit/dim 2.0256(2.0436) | Xent 0.5043(0.6160) | Xent Color 0.3961(0.6144) | Loss 4.8792(5.4914) | Error 0.1511(0.1884) | Error Color 0.0900(0.1657) |Steps 386(396.20) | Grad Norm 3.8504(20.2711) | Total Time 0.00(0.00)\nIter 0620 | Time 8.8903(9.2134) | Bit/dim 1.9888(2.0326) | Xent 0.5913(0.6060) | Xent Color 0.3353(0.5466) | Loss 4.8844(5.3381) | Error 0.1700(0.1856) | Error Color 0.0600(0.1423) |Steps 404(398.27) | Grad Norm 8.6997(16.8191) | Total Time 0.00(0.00)\nIter 0630 | Time 9.2710(9.2189) | Bit/dim 2.0170(2.0247) | Xent 0.5323(0.5984) | Xent Color 0.3095(0.4888) | Loss 4.9071(5.2141) | Error 0.1700(0.1842) | Error Color 0.0622(0.1217) |Steps 398(396.72) | Grad Norm 7.3644(14.3718) | Total Time 0.00(0.00)\nIter 0640 | Time 9.2847(9.2266) | Bit/dim 1.9812(2.0166) | Xent 0.5717(0.5927) | Xent Color 0.2686(0.4385) | Loss 4.8180(5.1147) | Error 0.1633(0.1821) | Error Color 0.0489(0.1059) |Steps 374(394.98) | Grad Norm 7.3085(12.7881) | Total Time 0.00(0.00)\nIter 0650 | Time 9.1105(9.2200) | Bit/dim 2.0091(2.0090) | Xent 0.5506(0.5830) | Xent Color 0.2471(0.3933) | Loss 4.8428(5.0406) | Error 0.1622(0.1789) | Error Color 0.0489(0.0910) |Steps 368(395.67) | Grad Norm 1.3976(10.4449) | Total Time 0.00(0.00)\nIter 0660 | Time 9.5099(9.2618) | Bit/dim 1.9760(2.0011) | Xent 0.5797(0.5731) | Xent Color 0.2764(0.3546) | Loss 4.8831(4.9795) | Error 0.1878(0.1761) | Error Color 0.0556(0.0788) |Steps 404(398.82) | Grad Norm 26.5622(9.3783) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0010 | Time 61.5212, Epoch Time 695.7308(666.7672), Bit/dim 1.9873(best: 2.0364), Xent 0.4134, Xent Color 0.2015. Loss 2.1410, Error 0.1191(best: 0.1255), Error Color 0.0214(best: 0.0459)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0670 | Time 9.4487(9.2806) | Bit/dim 1.9724(1.9930) | Xent 0.5625(0.5711) | Xent Color 0.2049(0.3238) | Loss 4.7675(5.3341) | Error 0.1844(0.1765) | Error Color 0.0333(0.0703) |Steps 398(400.04) | Grad Norm 10.6748(10.0485) | Total Time 0.00(0.00)\nIter 0680 | Time 9.1763(9.2918) | Bit/dim 1.9614(1.9849) | Xent 0.4529(0.5608) | Xent Color 0.2836(0.2985) | Loss 4.7054(5.1797) | Error 0.1356(0.1729) | Error Color 0.0667(0.0634) |Steps 392(400.26) | Grad Norm 45.3951(12.0547) | Total Time 0.00(0.00)\nIter 0690 | Time 9.6863(9.2823) | Bit/dim 2.4790(2.1575) | Xent 0.8430(0.5829) | Xent Color 1.5044(1.4873) | Loss 6.4157(5.9438) | Error 0.2789(0.1799) | Error Color 0.5856(0.2093) |Steps 398(400.74) | Grad Norm 19.2891(48.4319) | Total Time 0.00(0.00)\nIter 0700 | Time 8.8773(9.2739) | Bit/dim 2.1898(2.1726) | Xent 0.7311(0.6872) | Xent Color 0.9471(1.4220) | Loss 5.5616(5.9115) | Error 0.2322(0.2159) | Error Color 0.3900(0.2775) |Steps 356(396.67) | Grad Norm 15.6015(40.7727) | Total Time 0.00(0.00)\nIter 0710 | Time 9.0732(9.1932) | Bit/dim 2.0809(2.1576) | Xent 0.6330(0.6813) | Xent Color 0.9156(1.3055) | Loss 5.2688(5.7770) | Error 0.1900(0.2144) | Error Color 0.3356(0.3062) |Steps 386(393.00) | Grad Norm 8.5618(33.5252) | Total Time 0.00(0.00)\nIter 0720 | Time 9.1195(9.1243) | Bit/dim 2.0419(2.1299) | Xent 0.6402(0.6746) | Xent Color 0.8017(1.1845) | Loss 5.0754(5.6253) | Error 0.1956(0.2116) | Error Color 0.3033(0.3090) |Steps 350(390.36) | Grad Norm 6.2612(27.3116) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0011 | Time 58.3225, Epoch Time 686.1206(667.3478), Bit/dim 2.0283(best: 1.9873), Xent 0.4357, Xent Color 0.5437. Loss 2.2731, Error 0.1243(best: 0.1191), Error Color 0.1362(best: 0.0214)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0730 | Time 8.7026(9.0884) | Bit/dim 2.0347(2.1004) | Xent 0.5862(0.6566) | Xent Color 0.6284(1.0539) | Loss 5.0554(5.9545) | Error 0.1733(0.2050) | Error Color 0.2078(0.2907) |Steps 380(388.79) | Grad Norm 8.5212(22.0441) | Total Time 0.00(0.00)\nIter 0740 | Time 8.8387(9.0506) | Bit/dim 2.0098(2.0769) | Xent 0.5509(0.6400) | Xent Color 0.5142(0.9263) | Loss 4.9784(5.6903) | Error 0.1700(0.1997) | Error Color 0.1489(0.2638) |Steps 392(386.59) | Grad Norm 3.8025(17.4328) | Total Time 0.00(0.00)\nIter 0750 | Time 9.3532(9.0600) | Bit/dim 2.0143(2.0566) | Xent 0.5931(0.6181) | Xent Color 0.4427(0.8097) | Loss 4.9312(5.4847) | Error 0.1778(0.1928) | Error Color 0.1356(0.2350) |Steps 350(386.22) | Grad Norm 2.8505(13.6355) | Total Time 0.00(0.00)\nIter 0760 | Time 9.0506(9.0744) | Bit/dim 1.9839(2.0391) | Xent 0.5358(0.6008) | Xent Color 0.3637(0.7037) | Loss 4.8744(5.3164) | Error 0.1644(0.1872) | Error Color 0.0989(0.2038) |Steps 398(386.38) | Grad Norm 4.2409(10.9902) | Total Time 0.00(0.00)\nIter 0770 | Time 9.3725(9.1241) | Bit/dim 1.9972(2.0253) | Xent 0.4860(0.5874) | Xent Color 0.2982(0.6077) | Loss 4.8649(5.1938) | Error 0.1644(0.1823) | Error Color 0.0744(0.1745) |Steps 410(389.36) | Grad Norm 2.4446(9.1092) | Total Time 0.00(0.00)\nIter 0780 | Time 9.3258(9.1627) | Bit/dim 1.9846(2.0133) | Xent 0.6120(0.5788) | Xent Color 0.2460(0.5215) | Loss 4.8556(5.0897) | Error 0.2011(0.1795) | Error Color 0.0589(0.1469) |Steps 404(391.47) | Grad Norm 1.8936(7.9804) | Total Time 0.00(0.00)\nIter 0790 | Time 9.4605(9.1706) | Bit/dim 1.9565(2.0020) | Xent 0.4803(0.5631) | Xent Color 0.2402(0.4471) | Loss 4.7149(4.9970) | Error 0.1522(0.1746) | Error Color 0.0678(0.1242) |Steps 422(395.10) | Grad Norm 1.4454(6.8745) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0012 | Time 61.1946, Epoch Time 686.8557(667.9330), Bit/dim 1.9769(best: 1.9873), Xent 0.3842, Xent Color 0.1415. Loss 2.1084, Error 0.1056(best: 0.1191), Error Color 0.0123(best: 0.0214)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0800 | Time 9.0690(9.1844) | Bit/dim 1.9928(1.9931) | Xent 0.5582(0.5535) | Xent Color 0.4535(0.3976) | Loss 4.8590(5.3691) | Error 0.1778(0.1709) | Error Color 0.1844(0.1113) |Steps 380(396.99) | Grad Norm 55.9886(9.9093) | Total Time 0.00(0.00)\nIter 0810 | Time 9.1171(9.1723) | Bit/dim 1.9829(2.0024) | Xent 0.4543(0.5580) | Xent Color 0.4551(0.5369) | Loss 4.8335(5.3183) | Error 0.1400(0.1733) | Error Color 0.1556(0.1621) |Steps 398(396.03) | Grad Norm 18.2568(20.6431) | Total Time 0.00(0.00)\nIter 0820 | Time 8.7196(9.1322) | Bit/dim 2.0183(1.9996) | Xent 0.4991(0.5617) | Xent Color 0.3924(0.5085) | Loss 4.8489(5.2000) | Error 0.1533(0.1749) | Error Color 0.1356(0.1592) |Steps 404(395.06) | Grad Norm 13.9879(19.2338) | Total Time 0.00(0.00)\nIter 0830 | Time 8.7758(9.0919) | Bit/dim 1.9692(1.9902) | Xent 0.5009(0.5557) | Xent Color 0.2398(0.4511) | Loss 4.6502(5.0816) | Error 0.1678(0.1734) | Error Color 0.0667(0.1375) |Steps 410(393.94) | Grad Norm 6.1257(16.0344) | Total Time 0.00(0.00)\nIter 0840 | Time 8.6898(9.1062) | Bit/dim 1.9555(1.9822) | Xent 0.5122(0.5444) | Xent Color 0.1836(0.3856) | Loss 4.6352(4.9828) | Error 0.1456(0.1695) | Error Color 0.0433(0.1127) |Steps 386(393.98) | Grad Norm 2.9694(13.0906) | Total Time 0.00(0.00)\nIter 0850 | Time 9.0588(9.1164) | Bit/dim 1.9506(1.9724) | Xent 0.5105(0.5342) | Xent Color 0.1626(0.3293) | Loss 4.6384(4.8949) | Error 0.1611(0.1666) | Error Color 0.0400(0.0934) |Steps 416(394.51) | Grad Norm 3.0437(10.5216) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0013 | Time 60.4818, Epoch Time 685.7198(668.4666), Bit/dim 1.9471(best: 1.9769), Xent 0.3693, Xent Color 0.0975. Loss 2.0638, Error 0.1070(best: 0.1056), Error Color 0.0095(best: 0.0123)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0860 | Time 9.3641(9.1482) | Bit/dim 1.9290(1.9638) | Xent 0.4822(0.5289) | Xent Color 0.1484(0.2826) | Loss 4.5541(5.3621) | Error 0.1356(0.1655) | Error Color 0.0300(0.0767) |Steps 380(394.81) | Grad Norm 3.0546(8.4811) | Total Time 0.00(0.00)\nIter 0870 | Time 9.1043(9.1583) | Bit/dim 1.9578(1.9546) | Xent 0.4984(0.5228) | Xent Color 0.1165(0.2438) | Loss 4.6591(5.1646) | Error 0.1544(0.1630) | Error Color 0.0222(0.0632) |Steps 380(397.37) | Grad Norm 1.2352(6.7387) | Total Time 0.00(0.00)\nIter 0880 | Time 9.1356(9.1862) | Bit/dim 1.9213(1.9477) | Xent 0.5333(0.5161) | Xent Color 0.1196(0.2129) | Loss 4.6060(5.0257) | Error 0.1867(0.1614) | Error Color 0.0256(0.0532) |Steps 404(397.81) | Grad Norm 1.1387(5.4732) | Total Time 0.00(0.00)\nIter 0890 | Time 9.0929(9.2180) | Bit/dim 1.9106(1.9421) | Xent 0.5084(0.5124) | Xent Color 0.1044(0.1858) | Loss 4.5874(4.9172) | Error 0.1578(0.1604) | Error Color 0.0156(0.0440) |Steps 410(398.64) | Grad Norm 4.2379(4.5422) | Total Time 0.00(0.00)\nIter 0900 | Time 9.4961(9.2743) | Bit/dim 1.9293(1.9363) | Xent 0.4574(0.5083) | Xent Color 0.1061(0.1643) | Loss 4.6209(4.8241) | Error 0.1533(0.1587) | Error Color 0.0244(0.0379) |Steps 404(397.89) | Grad Norm 1.4704(4.1748) | Total Time 0.00(0.00)\nIter 0910 | Time 9.2397(9.3108) | Bit/dim 1.9109(1.9298) | Xent 0.5186(0.5024) | Xent Color 0.0875(0.1469) | Loss 4.5440(4.7581) | Error 0.1678(0.1570) | Error Color 0.0189(0.0329) |Steps 404(399.04) | Grad Norm 3.6815(3.9061) | Total Time 0.00(0.00)\nIter 0920 | Time 9.1589(9.2879) | Bit/dim 1.9186(1.9231) | Xent 0.4982(0.5008) | Xent Color 0.0842(0.1317) | Loss 4.5277(4.7066) | Error 0.1478(0.1542) | Error Color 0.0122(0.0283) |Steps 404(398.89) | Grad Norm 4.0143(3.4989) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0014 | Time 60.4269, Epoch Time 697.6148(669.3411), Bit/dim 1.9074(best: 1.9471), Xent 0.3536, Xent Color 0.0475. Loss 2.0076, Error 0.1032(best: 0.1056), Error Color 0.0032(best: 0.0095)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 0930 | Time 9.6231(9.3157) | Bit/dim 1.8977(1.9168) | Xent 0.4540(0.4983) | Xent Color 0.0755(0.1198) | Loss 4.5132(5.1282) | Error 0.1489(0.1543) | Error Color 0.0144(0.0253) |Steps 404(400.66) | Grad Norm 4.6427(3.9062) | Total Time 0.00(0.00)\nIter 0940 | Time 9.6831(9.2965) | Bit/dim 1.8851(1.9110) | Xent 0.4422(0.4884) | Xent Color 0.0802(0.1095) | Loss 4.4898(4.9689) | Error 0.1456(0.1513) | Error Color 0.0122(0.0225) |Steps 416(404.43) | Grad Norm 5.3138(4.3038) | Total Time 0.00(0.00)\nIter 0950 | Time 9.4883(9.2934) | Bit/dim 1.8723(1.9052) | Xent 0.4868(0.4916) | Xent Color 0.0826(0.1031) | Loss 4.5530(4.8612) | Error 0.1489(0.1522) | Error Color 0.0144(0.0215) |Steps 416(404.87) | Grad Norm 14.4166(5.7711) | Total Time 0.00(0.00)\nIter 0960 | Time 9.1306(9.2467) | Bit/dim 1.8979(1.8985) | Xent 0.5749(0.4880) | Xent Color 0.0645(0.0959) | Loss 4.5138(4.7637) | Error 0.1822(0.1513) | Error Color 0.0078(0.0197) |Steps 404(403.77) | Grad Norm 8.5314(6.1008) | Total Time 0.00(0.00)\nIter 0970 | Time 9.1473(9.2605) | Bit/dim 1.8876(1.8938) | Xent 0.5040(0.4897) | Xent Color 0.0739(0.0890) | Loss 4.4940(4.6939) | Error 0.1689(0.1524) | Error Color 0.0156(0.0180) |Steps 392(403.65) | Grad Norm 13.0868(6.2384) | Total Time 0.00(0.00)\nIter 0980 | Time 9.2549(9.2795) | Bit/dim 1.8844(1.8883) | Xent 0.4150(0.4862) | Xent Color 0.0951(0.0882) | Loss 4.5102(4.6486) | Error 0.1344(0.1508) | Error Color 0.0233(0.0188) |Steps 404(406.12) | Grad Norm 21.7056(9.0341) | Total Time 0.00(0.00)\nIter 0990 | Time 9.0893(9.2506) | Bit/dim 1.8608(1.8813) | Xent 0.4447(0.4872) | Xent Color 0.0669(0.0833) | Loss 4.4198(4.6010) | Error 0.1422(0.1516) | Error Color 0.0156(0.0177) |Steps 410(405.68) | Grad Norm 9.7601(9.0233) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0015 | Time 61.4996, Epoch Time 695.4272(670.1237), Bit/dim 1.8708(best: 1.9074), Xent 0.3374, Xent Color 0.0398. Loss 1.9651, Error 0.0986(best: 0.1032), Error Color 0.0047(best: 0.0032)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1000 | Time 9.0699(9.3324) | Bit/dim 2.3956(1.9209) | Xent 0.5016(0.4876) | Xent Color 2.7520(0.6848) | Loss 6.6072(5.3392) | Error 0.1589(0.1514) | Error Color 0.5533(0.0678) |Steps 374(406.49) | Grad Norm 110.2073(32.6068) | Total Time 0.00(0.00)\nIter 1010 | Time 10.8736(9.5948) | Bit/dim 2.2263(2.0558) | Xent 0.9779(0.5655) | Xent Color 2.2289(1.2679) | Loss 6.5132(5.7851) | Error 0.3222(0.1780) | Error Color 0.6200(0.2152) |Steps 512(422.95) | Grad Norm 48.4332(38.4317) | Total Time 0.00(0.00)\nIter 1020 | Time 11.2847(10.0230) | Bit/dim 2.1151(2.0802) | Xent 0.5581(0.5990) | Xent Color 1.0769(1.2977) | Loss 5.7828(5.8314) | Error 0.1844(0.1899) | Error Color 0.4233(0.2914) |Steps 524(445.79) | Grad Norm 18.8597(34.8306) | Total Time 0.00(0.00)\nIter 1030 | Time 11.1110(10.3452) | Bit/dim 2.0076(2.0673) | Xent 0.5589(0.6089) | Xent Color 0.8675(1.2136) | Loss 5.3677(5.7608) | Error 0.1756(0.1937) | Error Color 0.3322(0.3134) |Steps 458(455.42) | Grad Norm 9.8981(29.3010) | Total Time 0.00(0.00)\nIter 1040 | Time 10.9590(10.4383) | Bit/dim 1.9554(2.0451) | Xent 0.6056(0.5988) | Xent Color 0.6453(1.0885) | Loss 5.1025(5.6166) | Error 0.1922(0.1909) | Error Color 0.2378(0.3031) |Steps 452(460.43) | Grad Norm 5.7269(23.8483) | Total Time 0.00(0.00)\nIter 1050 | Time 10.0779(10.4113) | Bit/dim 1.9754(2.0231) | Xent 0.5564(0.5900) | Xent Color 0.4602(0.9367) | Loss 4.9695(5.4534) | Error 0.1789(0.1881) | Error Color 0.1589(0.2682) |Steps 434(459.21) | Grad Norm 3.6072(18.5817) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0016 | Time 66.4438, Epoch Time 784.8283(673.5648), Bit/dim 1.9604(best: 1.8708), Xent 0.3865, Xent Color 0.2256. Loss 2.1135, Error 0.1115(best: 0.0986), Error Color 0.0281(best: 0.0032)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1060 | Time 10.1463(10.3948) | Bit/dim 1.9573(2.0048) | Xent 0.5829(0.5853) | Xent Color 0.3091(0.7883) | Loss 4.8385(5.8491) | Error 0.1789(0.1846) | Error Color 0.0844(0.2266) |Steps 470(458.57) | Grad Norm 4.2805(14.6382) | Total Time 0.00(0.00)\nIter 1070 | Time 10.4849(10.3174) | Bit/dim 1.9164(1.9854) | Xent 0.5039(0.5729) | Xent Color 0.2587(0.6548) | Loss 4.7758(5.5692) | Error 0.1689(0.1802) | Error Color 0.0589(0.1871) |Steps 434(455.54) | Grad Norm 4.3223(11.7948) | Total Time 0.00(0.00)\nIter 1080 | Time 10.1013(10.2491) | Bit/dim 1.9398(1.9710) | Xent 0.5117(0.5652) | Xent Color 0.1877(0.5389) | Loss 4.7566(5.3512) | Error 0.1678(0.1780) | Error Color 0.0344(0.1515) |Steps 440(450.92) | Grad Norm 1.5271(9.3968) | Total Time 0.00(0.00)\nIter 1090 | Time 10.0345(10.1756) | Bit/dim 1.8993(1.9567) | Xent 0.5515(0.5547) | Xent Color 0.1800(0.4451) | Loss 4.6080(5.1747) | Error 0.1800(0.1746) | Error Color 0.0400(0.1217) |Steps 446(449.98) | Grad Norm 5.1568(7.8671) | Total Time 0.00(0.00)\nIter 1100 | Time 9.8408(10.0937) | Bit/dim 1.8862(1.9446) | Xent 0.4684(0.5368) | Xent Color 0.1607(0.3722) | Loss 4.6977(5.0361) | Error 0.1522(0.1696) | Error Color 0.0367(0.0995) |Steps 470(448.02) | Grad Norm 1.9512(6.6309) | Total Time 0.00(0.00)\nIter 1110 | Time 10.0474(10.0635) | Bit/dim 1.8848(1.9338) | Xent 0.5305(0.5306) | Xent Color 0.1321(0.3138) | Loss 4.6870(4.9353) | Error 0.1689(0.1678) | Error Color 0.0300(0.0822) |Steps 464(446.28) | Grad Norm 2.0182(6.1817) | Total Time 0.00(0.00)\nIter 1120 | Time 10.4883(10.0633) | Bit/dim 1.8636(1.9204) | Xent 0.4987(0.5226) | Xent Color 0.1371(0.2686) | Loss 4.5417(4.8475) | Error 0.1433(0.1649) | Error Color 0.0344(0.0685) |Steps 464(445.79) | Grad Norm 4.9133(5.9002) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0017 | Time 65.4989, Epoch Time 749.9574(675.8566), Bit/dim 1.8936(best: 1.8708), Xent 0.3526, Xent Color 0.0725. Loss 1.9999, Error 0.1054(best: 0.0986), Error Color 0.0055(best: 0.0032)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1130 | Time 10.1681(10.0673) | Bit/dim 1.8864(1.9103) | Xent 0.5354(0.5150) | Xent Color 0.1192(0.2322) | Loss 4.6361(5.2581) | Error 0.1567(0.1621) | Error Color 0.0256(0.0579) |Steps 458(442.59) | Grad Norm 6.3032(5.7457) | Total Time 0.00(0.00)\nIter 1140 | Time 10.0575(10.0400) | Bit/dim 1.8893(1.9014) | Xent 0.5804(0.5121) | Xent Color 0.0897(0.2016) | Loss 4.6937(5.0932) | Error 0.1767(0.1600) | Error Color 0.0122(0.0493) |Steps 440(443.17) | Grad Norm 1.1176(5.2114) | Total Time 0.00(0.00)\nIter 1150 | Time 9.6653(10.0419) | Bit/dim 1.8532(1.8916) | Xent 0.4365(0.5000) | Xent Color 0.1106(0.1765) | Loss 4.5525(4.9604) | Error 0.1233(0.1567) | Error Color 0.0267(0.0418) |Steps 458(444.52) | Grad Norm 3.6062(4.6835) | Total Time 0.00(0.00)\nIter 1160 | Time 9.8308(9.9833) | Bit/dim 1.8513(1.8846) | Xent 0.4282(0.4911) | Xent Color 0.0979(0.1553) | Loss 4.5076(4.8616) | Error 0.1300(0.1523) | Error Color 0.0222(0.0357) |Steps 422(441.02) | Grad Norm 3.0018(4.0295) | Total Time 0.00(0.00)\nIter 1170 | Time 9.6432(9.9606) | Bit/dim 1.8621(1.8756) | Xent 0.4850(0.4915) | Xent Color 0.0931(0.1393) | Loss 4.6277(4.7815) | Error 0.1644(0.1524) | Error Color 0.0144(0.0314) |Steps 428(437.52) | Grad Norm 3.9596(3.9596) | Total Time 0.00(0.00)\nIter 1180 | Time 9.2510(9.9429) | Bit/dim 1.8427(1.8676) | Xent 0.4270(0.4822) | Xent Color 0.0869(0.1264) | Loss 4.5443(4.7215) | Error 0.1322(0.1502) | Error Color 0.0222(0.0287) |Steps 434(437.79) | Grad Norm 7.5967(4.5563) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0018 | Time 67.5054, Epoch Time 746.8974(677.9878), Bit/dim 1.8453(best: 1.8708), Xent 0.3305, Xent Color 0.0427. Loss 1.9387, Error 0.0973(best: 0.0986), Error Color 0.0044(best: 0.0032)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1190 | Time 10.1824(9.9412) | Bit/dim 1.8388(1.8610) | Xent 0.4431(0.4768) | Xent Color 0.0920(0.1171) | Loss 4.5423(5.2448) | Error 0.1333(0.1486) | Error Color 0.0200(0.0262) |Steps 440(435.70) | Grad Norm 5.6429(5.1003) | Total Time 0.00(0.00)\nIter 1200 | Time 10.3162(9.9635) | Bit/dim 1.8459(1.8539) | Xent 0.4069(0.4691) | Xent Color 0.0817(0.1074) | Loss 4.5155(5.0583) | Error 0.1333(0.1455) | Error Color 0.0167(0.0234) |Steps 452(438.44) | Grad Norm 9.4718(5.2399) | Total Time 0.00(0.00)\nIter 1210 | Time 9.4049(9.9426) | Bit/dim 1.8181(1.8473) | Xent 0.3744(0.4636) | Xent Color 0.0826(0.1021) | Loss 4.3795(4.9052) | Error 0.1222(0.1442) | Error Color 0.0211(0.0223) |Steps 428(438.11) | Grad Norm 8.0320(6.3285) | Total Time 0.00(0.00)\nIter 1220 | Time 9.6611(9.8660) | Bit/dim 1.8051(1.8389) | Xent 0.4537(0.4639) | Xent Color 0.0836(0.0946) | Loss 4.5339(4.7916) | Error 0.1522(0.1447) | Error Color 0.0167(0.0204) |Steps 440(438.35) | Grad Norm 9.5114(6.0232) | Total Time 0.00(0.00)\nIter 1230 | Time 10.2137(9.8156) | Bit/dim 1.8186(1.8329) | Xent 0.4690(0.4604) | Xent Color 0.0797(0.0897) | Loss 4.5100(4.7006) | Error 0.1489(0.1436) | Error Color 0.0167(0.0195) |Steps 434(437.53) | Grad Norm 8.3272(6.3474) | Total Time 0.00(0.00)\nIter 1240 | Time 9.8491(9.8270) | Bit/dim 1.8196(1.8253) | Xent 0.4630(0.4579) | Xent Color 0.0835(0.0859) | Loss 4.4431(4.6304) | Error 0.1500(0.1442) | Error Color 0.0200(0.0187) |Steps 434(436.98) | Grad Norm 11.6574(6.9939) | Total Time 0.00(0.00)\nIter 1250 | Time 10.2548(9.8693) | Bit/dim 1.8081(1.8166) | Xent 0.4386(0.4532) | Xent Color 0.0590(0.0801) | Loss 4.4754(4.5750) | Error 0.1300(0.1431) | Error Color 0.0100(0.0172) |Steps 434(435.15) | Grad Norm 4.8559(6.7727) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0019 | Time 65.4746, Epoch Time 738.5180(679.8037), Bit/dim 1.7912(best: 1.8453), Xent 0.3014, Xent Color 0.0278. Loss 1.8735, Error 0.0888(best: 0.0973), Error Color 0.0015(best: 0.0032)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1260 | Time 10.0549(9.8854) | Bit/dim 1.7608(1.8070) | Xent 0.4680(0.4506) | Xent Color 0.0685(0.0753) | Loss 4.3793(5.0409) | Error 0.1500(0.1425) | Error Color 0.0189(0.0161) |Steps 446(433.84) | Grad Norm 6.3717(6.2720) | Total Time 0.00(0.00)\nIter 1270 | Time 9.7888(9.8830) | Bit/dim 1.7779(1.8004) | Xent 0.4289(0.4457) | Xent Color 0.0578(0.0717) | Loss 4.3557(4.8629) | Error 0.1400(0.1404) | Error Color 0.0122(0.0155) |Steps 434(432.70) | Grad Norm 5.0653(6.3611) | Total Time 0.00(0.00)\nIter 1280 | Time 9.5061(9.8549) | Bit/dim 1.7995(1.7930) | Xent 0.3734(0.4442) | Xent Color 0.9662(0.0987) | Loss 4.7890(4.7492) | Error 0.1244(0.1399) | Error Color 0.3156(0.0251) |Steps 404(432.00) | Grad Norm 130.9594(11.0568) | Total Time 0.00(0.00)\nIter 1290 | Time 11.0816(10.0268) | Bit/dim 2.0478(1.8870) | Xent 0.8469(0.5529) | Xent Color 1.5619(1.0244) | Loss 5.8629(5.3159) | Error 0.2833(0.1781) | Error Color 0.5467(0.1731) |Steps 494(441.78) | Grad Norm 19.8707(28.9034) | Total Time 0.00(0.00)\nIter 1300 | Time 12.2225(10.6073) | Bit/dim 1.9553(1.9086) | Xent 0.5780(0.5967) | Xent Color 0.7770(1.0044) | Loss 5.4686(5.3834) | Error 0.1833(0.1930) | Error Color 0.2989(0.2229) |Steps 560(470.64) | Grad Norm 53.1587(26.8076) | Total Time 0.00(0.00)\nIter 1310 | Time 12.0484(11.0618) | Bit/dim 1.8772(1.9088) | Xent 0.5537(0.5983) | Xent Color 0.5335(0.9004) | Loss 5.1145(5.3524) | Error 0.1822(0.1913) | Error Color 0.1889(0.2231) |Steps 536(495.55) | Grad Norm 7.8364(37.4357) | Total Time 0.00(0.00)\nIter 1320 | Time 11.3798(11.3357) | Bit/dim 1.8520(1.8943) | Xent 0.5194(0.5889) | Xent Color 0.3734(0.7793) | Loss 4.9295(5.2653) | Error 0.1833(0.1887) | Error Color 0.1189(0.2043) |Steps 518(504.86) | Grad Norm 3.2076(31.2316) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0020 | Time 69.4055, Epoch Time 819.7647(684.0025), Bit/dim 1.8551(best: 1.7912), Xent 0.3654, Xent Color 0.2492. Loss 2.0087, Error 0.1116(best: 0.0888), Error Color 0.0431(best: 0.0015)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1330 | Time 10.6615(11.1700) | Bit/dim 1.8045(1.8773) | Xent 0.4502(0.5709) | Xent Color 0.2625(0.6639) | Loss 4.7234(5.7595) | Error 0.1422(0.1824) | Error Color 0.0578(0.1789) |Steps 488(500.31) | Grad Norm 2.8765(24.2814) | Total Time 0.00(0.00)\nIter 1340 | Time 10.5896(10.9899) | Bit/dim 1.8041(1.8571) | Xent 0.5435(0.5552) | Xent Color 0.2278(0.5572) | Loss 4.5962(5.4667) | Error 0.1744(0.1773) | Error Color 0.0522(0.1503) |Steps 482(493.56) | Grad Norm 3.5998(18.8485) | Total Time 0.00(0.00)\nIter 1350 | Time 10.5911(10.8870) | Bit/dim 1.7709(1.8403) | Xent 0.4719(0.5388) | Xent Color 0.1830(0.4608) | Loss 4.4392(5.2259) | Error 0.1556(0.1727) | Error Color 0.0367(0.1224) |Steps 470(487.62) | Grad Norm 2.3257(14.4280) | Total Time 0.00(0.00)\nIter 1360 | Time 10.4566(10.7605) | Bit/dim 1.7677(1.8226) | Xent 0.4449(0.5235) | Xent Color 0.1667(0.3856) | Loss 4.4318(5.0222) | Error 0.1444(0.1674) | Error Color 0.0422(0.1020) |Steps 464(481.56) | Grad Norm 8.8613(12.3380) | Total Time 0.00(0.00)\nIter 1370 | Time 10.0449(10.6168) | Bit/dim 1.7133(1.8041) | Xent 0.4770(0.5099) | Xent Color 0.1748(0.3257) | Loss 4.3153(4.8523) | Error 0.1411(0.1627) | Error Color 0.0511(0.0857) |Steps 458(474.30) | Grad Norm 11.2445(11.0540) | Total Time 0.00(0.00)\nIter 1380 | Time 10.8412(10.6133) | Bit/dim 1.7427(1.7873) | Xent 0.4293(0.4906) | Xent Color 0.1217(0.2772) | Loss 4.3659(4.7122) | Error 0.1333(0.1567) | Error Color 0.0233(0.0722) |Steps 476(468.75) | Grad Norm 5.8912(10.1031) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0021 | Time 61.4770, Epoch Time 779.7184(686.8740), Bit/dim 1.7337(best: 1.7912), Xent 0.3153, Xent Color 0.0677. Loss 1.8294, Error 0.0944(best: 0.0888), Error Color 0.0085(best: 0.0015)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1390 | Time 10.8641(10.6235) | Bit/dim 1.7295(1.7722) | Xent 0.5226(0.4853) | Xent Color 0.1130(0.2364) | Loss 4.3443(5.1321) | Error 0.1589(0.1546) | Error Color 0.0300(0.0609) |Steps 440(464.38) | Grad Norm 5.1180(8.8831) | Total Time 0.00(0.00)\nIter 1400 | Time 9.9560(10.5498) | Bit/dim 1.7113(1.7564) | Xent 0.4259(0.4797) | Xent Color 0.1044(0.2036) | Loss 4.1957(4.9019) | Error 0.1411(0.1519) | Error Color 0.0278(0.0515) |Steps 446(460.26) | Grad Norm 1.7798(7.8331) | Total Time 0.00(0.00)\nIter 1410 | Time 10.7834(10.5279) | Bit/dim 1.7041(1.7434) | Xent 0.4087(0.4672) | Xent Color 0.0964(0.1748) | Loss 4.2710(4.7269) | Error 0.1400(0.1484) | Error Color 0.0200(0.0438) |Steps 470(456.10) | Grad Norm 3.7130(6.7916) | Total Time 0.00(0.00)\nIter 1420 | Time 10.0972(10.4721) | Bit/dim 1.6948(1.7304) | Xent 0.4419(0.4604) | Xent Color 0.0894(0.1537) | Loss 4.2427(4.5957) | Error 0.1522(0.1467) | Error Color 0.0267(0.0383) |Steps 446(452.59) | Grad Norm 8.7802(6.8365) | Total Time 0.00(0.00)\nIter 1430 | Time 10.4856(10.4040) | Bit/dim 1.6552(1.7162) | Xent 0.4129(0.4586) | Xent Color 0.0707(0.1351) | Loss 4.2130(4.4936) | Error 0.1400(0.1462) | Error Color 0.0156(0.0331) |Steps 458(451.09) | Grad Norm 4.0481(6.1251) | Total Time 0.00(0.00)\nIter 1440 | Time 9.9936(10.3703) | Bit/dim 1.6634(1.7023) | Xent 0.4256(0.4498) | Xent Color 0.0811(0.1217) | Loss 4.1582(4.4027) | Error 0.1389(0.1432) | Error Color 0.0200(0.0295) |Steps 392(445.91) | Grad Norm 3.0063(6.4069) | Total Time 0.00(0.00)\nIter 1450 | Time 10.3397(10.3513) | Bit/dim 1.6315(1.6873) | Xent 0.4142(0.4410) | Xent Color 0.1114(0.1096) | Loss 4.0053(4.3222) | Error 0.1411(0.1407) | Error Color 0.0278(0.0261) |Steps 458(443.64) | Grad Norm 14.5687(6.7656) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0022 | Time 62.9821, Epoch Time 767.9363(689.3059), Bit/dim 1.6432(best: 1.7337), Xent 0.2891, Xent Color 0.0274. Loss 1.7223, Error 0.0881(best: 0.0888), Error Color 0.0020(best: 0.0015)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1460 | Time 10.0633(10.3080) | Bit/dim 1.6214(1.6738) | Xent 0.3947(0.4296) | Xent Color 0.0704(0.0998) | Loss 4.0569(4.7327) | Error 0.1189(0.1373) | Error Color 0.0167(0.0236) |Steps 404(439.19) | Grad Norm 10.4894(7.3675) | Total Time 0.00(0.00)\nIter 1470 | Time 10.2523(10.2567) | Bit/dim 1.6127(1.6594) | Xent 0.4291(0.4252) | Xent Color 0.0591(0.0912) | Loss 4.0157(4.5524) | Error 0.1378(0.1358) | Error Color 0.0133(0.0214) |Steps 422(436.19) | Grad Norm 7.1890(7.5960) | Total Time 0.00(0.00)\nIter 1480 | Time 10.3116(10.2423) | Bit/dim 1.8385(1.6586) | Xent 0.4860(0.4296) | Xent Color 3.2933(0.3747) | Loss 5.9462(4.5680) | Error 0.1433(0.1366) | Error Color 0.6222(0.0653) |Steps 464(433.35) | Grad Norm 91.6240(20.7798) | Total Time 0.00(0.00)\nIter 1490 | Time 11.8057(10.6166) | Bit/dim 1.8785(1.7307) | Xent 0.5243(0.4681) | Xent Color 0.9022(0.5822) | Loss 5.2026(4.7681) | Error 0.1578(0.1488) | Error Color 0.3767(0.1562) |Steps 554(456.20) | Grad Norm 22.0677(23.9255) | Total Time 0.00(0.00)\nIter 1500 | Time 11.3599(10.7758) | Bit/dim 1.7272(1.7389) | Xent 0.5089(0.4800) | Xent Color 0.5630(0.5955) | Loss 4.5945(4.7638) | Error 0.1767(0.1527) | Error Color 0.2100(0.1806) |Steps 488(467.88) | Grad Norm 10.8173(20.7590) | Total Time 0.00(0.00)\nIter 1510 | Time 10.8252(10.8340) | Bit/dim 1.6442(1.7203) | Xent 0.4569(0.4777) | Xent Color 0.3407(0.5549) | Loss 4.3068(4.6805) | Error 0.1422(0.1519) | Error Color 0.1244(0.1777) |Steps 440(468.06) | Grad Norm 3.6537(17.0549) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0023 | Time 67.3688, Epoch Time 799.2027(692.6028), Bit/dim 1.6290(best: 1.6432), Xent 0.2977, Xent Color 0.1813. Loss 1.7487, Error 0.0886(best: 0.0881), Error Color 0.0381(best: 0.0015)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1520 | Time 11.3099(10.8290) | Bit/dim 1.6265(1.6966) | Xent 0.4106(0.4750) | Xent Color 0.2763(0.4919) | Loss 4.2799(5.2049) | Error 0.1411(0.1503) | Error Color 0.0967(0.1608) |Steps 488(468.47) | Grad Norm 4.7597(13.8233) | Total Time 0.00(0.00)\nIter 1530 | Time 10.8410(10.8382) | Bit/dim 1.6060(1.6725) | Xent 0.4574(0.4631) | Xent Color 0.2480(0.4292) | Loss 4.2548(4.9491) | Error 0.1422(0.1466) | Error Color 0.0844(0.1409) |Steps 476(470.99) | Grad Norm 7.3784(11.4601) | Total Time 0.00(0.00)\nIter 1540 | Time 11.2530(10.8414) | Bit/dim 1.5601(1.6494) | Xent 0.5047(0.4562) | Xent Color 0.1769(0.3684) | Loss 4.1286(4.7385) | Error 0.1578(0.1437) | Error Color 0.0500(0.1205) |Steps 482(472.19) | Grad Norm 5.0254(9.5706) | Total Time 0.00(0.00)\nIter 1550 | Time 11.0349(10.8389) | Bit/dim 1.5544(1.6267) | Xent 0.4614(0.4505) | Xent Color 0.1278(0.3138) | Loss 4.0877(4.5768) | Error 0.1544(0.1422) | Error Color 0.0278(0.1012) |Steps 482(474.68) | Grad Norm 1.3833(7.7774) | Total Time 0.00(0.00)\nIter 1560 | Time 10.9531(10.8457) | Bit/dim 1.5228(1.6052) | Xent 0.4508(0.4443) | Xent Color 0.1380(0.2674) | Loss 4.0479(4.4392) | Error 0.1356(0.1405) | Error Color 0.0411(0.0847) |Steps 476(474.92) | Grad Norm 3.3626(6.3929) | Total Time 0.00(0.00)\nIter 1570 | Time 11.2369(10.8472) | Bit/dim 1.5309(1.5862) | Xent 0.4138(0.4362) | Xent Color 0.1078(0.2287) | Loss 4.0365(4.3280) | Error 0.1189(0.1374) | Error Color 0.0233(0.0702) |Steps 482(472.45) | Grad Norm 5.7928(5.9460) | Total Time 0.00(0.00)\nIter 1580 | Time 11.0123(10.8581) | Bit/dim 1.5204(1.5683) | Xent 0.4126(0.4241) | Xent Color 0.0845(0.1963) | Loss 4.0103(4.2320) | Error 0.1267(0.1339) | Error Color 0.0211(0.0588) |Steps 476(470.47) | Grad Norm 4.0500(5.8972) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0024 | Time 63.7600, Epoch Time 802.1201(695.8883), Bit/dim 1.5125(best: 1.6290), Xent 0.2608, Xent Color 0.0421. Loss 1.5882, Error 0.0776(best: 0.0881), Error Color 0.0030(best: 0.0015)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1590 | Time 10.6728(10.8014) | Bit/dim 1.5085(1.5527) | Xent 0.3607(0.4155) | Xent Color 0.0803(0.1678) | Loss 3.9470(4.6703) | Error 0.1200(0.1323) | Error Color 0.0144(0.0480) |Steps 482(469.44) | Grad Norm 5.9171(5.6315) | Total Time 0.00(0.00)\nIter 1600 | Time 10.4735(10.7862) | Bit/dim 1.4794(1.5390) | Xent 0.3817(0.4025) | Xent Color 0.0723(0.1432) | Loss 3.8686(4.4731) | Error 0.1233(0.1278) | Error Color 0.0156(0.0400) |Steps 446(467.56) | Grad Norm 1.8761(4.9943) | Total Time 0.00(0.00)\nIter 1610 | Time 10.1747(10.7077) | Bit/dim 1.4652(1.5236) | Xent 0.3509(0.3999) | Xent Color 0.0823(0.1249) | Loss 3.7517(4.3085) | Error 0.1233(0.1269) | Error Color 0.0267(0.0341) |Steps 458(467.18) | Grad Norm 8.0624(4.7682) | Total Time 0.00(0.00)\nIter 1620 | Time 10.9256(10.6540) | Bit/dim 1.4709(1.5091) | Xent 0.3612(0.3918) | Xent Color 0.0674(0.1088) | Loss 3.8012(4.1789) | Error 0.1244(0.1251) | Error Color 0.0111(0.0286) |Steps 482(466.70) | Grad Norm 5.8153(4.5728) | Total Time 0.00(0.00)\nIter 1630 | Time 10.7002(10.6515) | Bit/dim 1.4628(1.4958) | Xent 0.3770(0.3854) | Xent Color 0.0584(0.0955) | Loss 3.7908(4.0771) | Error 0.1178(0.1226) | Error Color 0.0111(0.0244) |Steps 470(464.78) | Grad Norm 6.7987(4.8117) | Total Time 0.00(0.00)\nIter 1640 | Time 10.6101(10.6416) | Bit/dim 1.4471(1.4829) | Xent 0.3592(0.3813) | Xent Color 0.0488(0.0845) | Loss 3.7891(3.9944) | Error 0.1100(0.1214) | Error Color 0.0067(0.0208) |Steps 458(462.82) | Grad Norm 4.5723(5.0824) | Total Time 0.00(0.00)\nIter 1650 | Time 10.2190(10.6700) | Bit/dim 1.4268(1.4712) | Xent 0.3277(0.3747) | Xent Color 0.0628(0.0770) | Loss 3.6863(3.9394) | Error 0.1078(0.1196) | Error Color 0.0156(0.0181) |Steps 446(461.89) | Grad Norm 12.0591(5.7447) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0025 | Time 63.7553, Epoch Time 787.8342(698.6467), Bit/dim 1.4406(best: 1.5125), Xent 0.2303, Xent Color 0.0277. Loss 1.5051, Error 0.0681(best: 0.0776), Error Color 0.0030(best: 0.0015)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1660 | Time 10.5589(10.6289) | Bit/dim 1.4272(1.4605) | Xent 0.3613(0.3744) | Xent Color 0.0648(0.0715) | Loss 3.6763(4.3508) | Error 0.1244(0.1184) | Error Color 0.0167(0.0165) |Steps 428(459.72) | Grad Norm 11.9885(6.5228) | Total Time 0.00(0.00)\nIter 1670 | Time 10.1024(10.5641) | Bit/dim 1.4198(1.4512) | Xent 0.3248(0.3658) | Xent Color 0.0599(0.0652) | Loss 3.6408(4.1827) | Error 0.1033(0.1156) | Error Color 0.0167(0.0146) |Steps 446(459.62) | Grad Norm 15.9009(7.3713) | Total Time 0.00(0.00)\nIter 1680 | Time 10.7272(10.5560) | Bit/dim 1.8146(1.5225) | Xent 0.7990(0.3806) | Xent Color 1.0064(0.6126) | Loss 5.1858(4.4722) | Error 0.2667(0.1212) | Error Color 0.4122(0.1198) |Steps 488(461.33) | Grad Norm 36.3684(32.1239) | Total Time 0.00(0.00)\nIter 1690 | Time 11.3191(10.7113) | Bit/dim 1.7268(1.5876) | Xent 0.3950(0.3836) | Xent Color 0.4712(0.6232) | Loss 4.5729(4.5445) | Error 0.1311(0.1229) | Error Color 0.1811(0.1553) |Steps 482(468.62) | Grad Norm 8.6082(27.3734) | Total Time 0.00(0.00)\nIter 1700 | Time 11.3540(10.8664) | Bit/dim 1.5930(1.6046) | Xent 0.4256(0.3929) | Xent Color 0.3205(0.5645) | Loss 4.2546(4.5090) | Error 0.1411(0.1271) | Error Color 0.1078(0.1522) |Steps 494(474.41) | Grad Norm 3.3526(21.6519) | Total Time 0.00(0.00)\nIter 1710 | Time 10.6015(10.8816) | Bit/dim 1.5068(1.5875) | Xent 0.3495(0.3851) | Xent Color 0.2025(0.4872) | Loss 3.9034(4.4031) | Error 0.1167(0.1242) | Error Color 0.0622(0.1347) |Steps 470(474.75) | Grad Norm 2.3386(17.1110) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0026 | Time 67.4678, Epoch Time 801.4857(701.7319), Bit/dim 1.4864(best: 1.4406), Xent 0.2286, Xent Color 0.0956. Loss 1.5675, Error 0.0692(best: 0.0681), Error Color 0.0107(best: 0.0015)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1720 | Time 11.0920(10.8559) | Bit/dim 1.4809(1.5625) | Xent 0.3310(0.3795) | Xent Color 0.1505(0.4076) | Loss 3.9369(4.9067) | Error 0.1067(0.1214) | Error Color 0.0422(0.1136) |Steps 464(475.10) | Grad Norm 1.8869(13.4196) | Total Time 0.00(0.00)\nIter 1730 | Time 10.3236(10.8365) | Bit/dim 1.4444(1.5360) | Xent 0.3329(0.3725) | Xent Color 0.1251(0.3359) | Loss 3.7861(4.6297) | Error 0.1122(0.1198) | Error Color 0.0333(0.0928) |Steps 458(471.87) | Grad Norm 1.6695(10.5350) | Total Time 0.00(0.00)\nIter 1740 | Time 10.4816(10.7692) | Bit/dim 1.4468(1.5119) | Xent 0.3627(0.3621) | Xent Color 0.0943(0.2774) | Loss 3.8147(4.4211) | Error 0.1100(0.1166) | Error Color 0.0222(0.0759) |Steps 476(470.79) | Grad Norm 3.2942(8.4806) | Total Time 0.00(0.00)\nIter 1750 | Time 10.6355(10.6659) | Bit/dim 1.4132(1.4893) | Xent 0.3393(0.3515) | Xent Color 0.0956(0.2308) | Loss 3.7851(4.2445) | Error 0.1056(0.1123) | Error Color 0.0200(0.0620) |Steps 458(465.40) | Grad Norm 2.6602(6.8658) | Total Time 0.00(0.00)\nIter 1760 | Time 10.1077(10.5862) | Bit/dim 1.4208(1.4690) | Xent 0.3121(0.3407) | Xent Color 0.0718(0.1922) | Loss 3.6106(4.0970) | Error 0.1089(0.1086) | Error Color 0.0144(0.0504) |Steps 410(459.29) | Grad Norm 1.4382(5.6283) | Total Time 0.00(0.00)\nIter 1770 | Time 9.7391(10.4586) | Bit/dim 1.4020(1.4530) | Xent 0.3177(0.3335) | Xent Color 0.0767(0.1624) | Loss 3.6610(3.9738) | Error 0.1033(0.1058) | Error Color 0.0233(0.0419) |Steps 440(453.36) | Grad Norm 1.9866(5.1364) | Total Time 0.00(0.00)\nIter 1780 | Time 10.1746(10.3801) | Bit/dim 1.3849(1.4371) | Xent 0.2866(0.3286) | Xent Color 0.0721(0.1373) | Loss 3.5932(3.8799) | Error 0.1022(0.1041) | Error Color 0.0122(0.0348) |Steps 446(446.86) | Grad Norm 1.1129(4.6004) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0027 | Time 63.6583, Epoch Time 774.0552(703.9016), Bit/dim 1.3922(best: 1.4406), Xent 0.1944, Xent Color 0.0257. Loss 1.4473, Error 0.0609(best: 0.0681), Error Color 0.0012(best: 0.0015)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1790 | Time 10.0713(10.2612) | Bit/dim 1.3834(1.4258) | Xent 0.3025(0.3269) | Xent Color 0.0648(0.1186) | Loss 3.5570(4.2913) | Error 0.1011(0.1051) | Error Color 0.0133(0.0295) |Steps 404(441.42) | Grad Norm 3.3275(4.2114) | Total Time 0.00(0.00)\nIter 1800 | Time 9.6213(10.1681) | Bit/dim 1.3835(1.4136) | Xent 0.3010(0.3214) | Xent Color 0.0581(0.1038) | Loss 3.5690(4.1040) | Error 0.1022(0.1031) | Error Color 0.0111(0.0252) |Steps 422(438.90) | Grad Norm 6.0030(4.7781) | Total Time 0.00(0.00)\nIter 1810 | Time 10.1876(10.1509) | Bit/dim 1.3674(1.4015) | Xent 0.2601(0.3114) | Xent Color 0.0443(0.0911) | Loss 3.5528(3.9599) | Error 0.0956(0.1008) | Error Color 0.0078(0.0217) |Steps 458(439.51) | Grad Norm 2.6926(4.4417) | Total Time 0.00(0.00)\nIter 1820 | Time 10.1891(10.1695) | Bit/dim 1.3553(1.3913) | Xent 0.2625(0.3068) | Xent Color 0.0495(0.0805) | Loss 3.5431(3.8535) | Error 0.0811(0.0985) | Error Color 0.0089(0.0183) |Steps 434(437.52) | Grad Norm 2.6302(3.9918) | Total Time 0.00(0.00)\nIter 1830 | Time 10.4139(10.1755) | Bit/dim 1.3534(1.3829) | Xent 0.2804(0.3035) | Xent Color 0.0524(0.0720) | Loss 3.5033(3.7728) | Error 0.0900(0.0981) | Error Color 0.0100(0.0160) |Steps 452(437.09) | Grad Norm 1.7018(3.4445) | Total Time 0.00(0.00)\nIter 1840 | Time 10.2529(10.1567) | Bit/dim 1.3574(1.3741) | Xent 0.2895(0.2980) | Xent Color 0.0383(0.0645) | Loss 3.5120(3.7048) | Error 0.0956(0.0966) | Error Color 0.0067(0.0139) |Steps 428(436.18) | Grad Norm 1.6553(3.2773) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0028 | Time 62.7857, Epoch Time 752.2048(705.3507), Bit/dim 1.3478(best: 1.3922), Xent 0.1787, Xent Color 0.0163. Loss 1.3966, Error 0.0562(best: 0.0609), Error Color 0.0009(best: 0.0012)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1850 | Time 10.2656(10.1637) | Bit/dim 1.3447(1.3675) | Xent 0.3255(0.2988) | Xent Color 0.0450(0.0593) | Loss 3.4642(4.2204) | Error 0.0933(0.0960) | Error Color 0.0111(0.0125) |Steps 446(435.38) | Grad Norm 3.5596(3.4322) | Total Time 0.00(0.00)\nIter 1860 | Time 9.8071(10.1092) | Bit/dim 1.3372(1.3599) | Xent 0.2692(0.2958) | Xent Color 0.0347(0.0544) | Loss 3.5086(4.0254) | Error 0.0944(0.0955) | Error Color 0.0033(0.0110) |Steps 428(433.73) | Grad Norm 2.9107(3.4930) | Total Time 0.00(0.00)\nIter 1870 | Time 10.1905(10.1021) | Bit/dim 1.3362(1.3519) | Xent 0.2703(0.2939) | Xent Color 0.0516(0.0508) | Loss 3.5183(3.8801) | Error 0.0933(0.0949) | Error Color 0.0133(0.0104) |Steps 440(434.21) | Grad Norm 3.6545(3.4229) | Total Time 0.00(0.00)\nIter 1880 | Time 9.9582(10.0967) | Bit/dim 1.3271(1.3451) | Xent 0.2890(0.2901) | Xent Color 0.0263(0.0476) | Loss 3.3198(3.7657) | Error 0.0867(0.0936) | Error Color 0.0022(0.0092) |Steps 410(431.71) | Grad Norm 2.5046(3.2449) | Total Time 0.00(0.00)\nIter 1890 | Time 9.9263(10.1187) | Bit/dim 1.3073(1.3375) | Xent 0.2611(0.2825) | Xent Color 0.0337(0.0453) | Loss 3.3953(3.6773) | Error 0.0833(0.0915) | Error Color 0.0044(0.0087) |Steps 422(429.37) | Grad Norm 4.1807(3.3581) | Total Time 0.00(0.00)\nIter 1900 | Time 10.2864(10.1006) | Bit/dim 1.3201(1.3322) | Xent 0.2803(0.2799) | Xent Color 0.0276(0.0425) | Loss 3.3719(3.6100) | Error 0.0878(0.0901) | Error Color 0.0022(0.0081) |Steps 428(429.71) | Grad Norm 7.6358(3.8557) | Total Time 0.00(0.00)\nIter 1910 | Time 10.9099(10.0990) | Bit/dim 1.3051(1.3258) | Xent 0.2642(0.2778) | Xent Color 0.0273(0.0415) | Loss 3.5011(3.5605) | Error 0.0844(0.0892) | Error Color 0.0033(0.0080) |Steps 434(429.39) | Grad Norm 2.2276(4.9871) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0029 | Time 63.8571, Epoch Time 751.2987(706.7291), Bit/dim 1.3038(best: 1.3478), Xent 0.1675, Xent Color 0.0152. Loss 1.3495, Error 0.0515(best: 0.0562), Error Color 0.0008(best: 0.0009)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1920 | Time 9.7226(10.0579) | Bit/dim 1.3090(1.3196) | Xent 0.2643(0.2737) | Xent Color 0.0361(0.0397) | Loss 3.3950(3.9939) | Error 0.0878(0.0887) | Error Color 0.0056(0.0074) |Steps 434(428.69) | Grad Norm 3.0889(5.2995) | Total Time 0.00(0.00)\nIter 1930 | Time 9.8496(9.9875) | Bit/dim 1.3059(1.3135) | Xent 0.2405(0.2704) | Xent Color 0.0378(0.0385) | Loss 3.4114(3.8296) | Error 0.0678(0.0866) | Error Color 0.0056(0.0071) |Steps 416(428.78) | Grad Norm 3.8538(5.4746) | Total Time 0.00(0.00)\nIter 1940 | Time 9.8119(9.9506) | Bit/dim 1.2835(1.3055) | Xent 0.2457(0.2670) | Xent Color 0.0376(0.0364) | Loss 3.3472(3.7024) | Error 0.0833(0.0850) | Error Color 0.0078(0.0064) |Steps 428(425.51) | Grad Norm 4.9931(4.9850) | Total Time 0.00(0.00)\nIter 1950 | Time 9.9121(9.9499) | Bit/dim 1.2805(1.2985) | Xent 0.2258(0.2617) | Xent Color 0.0401(0.0351) | Loss 3.2639(3.6088) | Error 0.0756(0.0844) | Error Color 0.0100(0.0062) |Steps 386(423.97) | Grad Norm 5.3077(5.0814) | Total Time 0.00(0.00)\nIter 1960 | Time 9.4864(9.9164) | Bit/dim 1.2645(1.2917) | Xent 0.2581(0.2644) | Xent Color 0.0322(0.0335) | Loss 3.2996(3.5392) | Error 0.0889(0.0862) | Error Color 0.0044(0.0059) |Steps 386(422.43) | Grad Norm 5.8611(4.7377) | Total Time 0.00(0.00)\nIter 1970 | Time 9.8230(9.9165) | Bit/dim 1.2660(1.2843) | Xent 0.2619(0.2617) | Xent Color 0.0316(0.0329) | Loss 3.3205(3.4792) | Error 0.0800(0.0844) | Error Color 0.0056(0.0056) |Steps 434(421.80) | Grad Norm 6.7399(5.5887) | Total Time 0.00(0.00)\nIter 1980 | Time 9.7297(9.9146) | Bit/dim 1.2857(1.2797) | Xent 0.2365(0.2611) | Xent Color 0.0361(0.0330) | Loss 3.3130(3.4364) | Error 0.0744(0.0841) | Error Color 0.0078(0.0058) |Steps 410(423.34) | Grad Norm 13.7749(7.3325) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0030 | Time 62.4518, Epoch Time 736.2992(707.6162), Bit/dim 1.2690(best: 1.3038), Xent 0.1576, Xent Color 0.0132. Loss 1.3117, Error 0.0517(best: 0.0515), Error Color 0.0010(best: 0.0008)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 1990 | Time 10.0191(9.8896) | Bit/dim 1.2652(1.2739) | Xent 0.2751(0.2586) | Xent Color 0.0437(0.0327) | Loss 3.3332(3.8301) | Error 0.0889(0.0832) | Error Color 0.0122(0.0060) |Steps 428(423.14) | Grad Norm 15.5137(7.9520) | Total Time 0.00(0.00)\nIter 2000 | Time 10.3006(9.8920) | Bit/dim 1.2300(1.2666) | Xent 0.2296(0.2543) | Xent Color 0.0315(0.0312) | Loss 3.2665(3.6866) | Error 0.0678(0.0809) | Error Color 0.0056(0.0058) |Steps 422(421.63) | Grad Norm 4.5016(7.5746) | Total Time 0.00(0.00)\nIter 2010 | Time 9.8735(9.8718) | Bit/dim 1.2190(1.2569) | Xent 0.2115(0.2468) | Xent Color 0.0258(0.0298) | Loss 3.1929(3.5644) | Error 0.0678(0.0791) | Error Color 0.0056(0.0052) |Steps 416(421.14) | Grad Norm 5.6267(7.1701) | Total Time 0.00(0.00)\nIter 2020 | Time 10.2935(9.8959) | Bit/dim 1.2076(1.2477) | Xent 0.2436(0.2473) | Xent Color 0.0225(0.0284) | Loss 3.1533(3.4762) | Error 0.0756(0.0792) | Error Color 0.0044(0.0050) |Steps 452(421.52) | Grad Norm 1.7587(6.4590) | Total Time 0.00(0.00)\nIter 2030 | Time 9.8719(9.8883) | Bit/dim 1.2075(1.2363) | Xent 0.2401(0.2423) | Xent Color 0.0228(0.0275) | Loss 3.1591(3.3974) | Error 0.0811(0.0779) | Error Color 0.0033(0.0048) |Steps 410(420.00) | Grad Norm 4.2834(5.7865) | Total Time 0.00(0.00)\nIter 2040 | Time 9.7017(9.8615) | Bit/dim 1.2631(1.2320) | Xent 0.2464(0.2439) | Xent Color 0.0790(0.0296) | Loss 3.3610(3.3549) | Error 0.0867(0.0788) | Error Color 0.0278(0.0057) |Steps 416(419.46) | Grad Norm 33.9761(7.6979) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0031 | Time 64.5348, Epoch Time 737.3258(708.5075), Bit/dim 2.1069(best: 1.2690), Xent 2.4425, Xent Color 3.5489. Loss 3.6047, Error 0.6689(best: 0.0515), Error Color 0.7436(best: 0.0008)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2050 | Time 11.4719(9.9931) | Bit/dim 1.9940(1.3855) | Xent 1.0502(0.4537) | Xent Color 1.6618(0.7301) | Loss 5.8807(4.5456) | Error 0.3300(0.1322) | Error Color 0.5100(0.1272) |Steps 500(425.61) | Grad Norm 33.3734(30.4530) | Total Time 0.00(0.00)\nIter 2060 | Time 10.2090(10.1409) | Bit/dim 1.8117(1.5093) | Xent 0.5017(0.5160) | Xent Color 0.4190(0.7052) | Loss 4.6304(4.6476) | Error 0.1633(0.1546) | Error Color 0.1567(0.1599) |Steps 446(433.14) | Grad Norm 7.4566(25.2362) | Total Time 0.00(0.00)\nIter 2070 | Time 10.3240(10.1685) | Bit/dim 1.5631(1.5445) | Xent 0.4775(0.5068) | Xent Color 0.2740(0.6075) | Loss 4.0571(4.5508) | Error 0.1533(0.1550) | Error Color 0.0978(0.1497) |Steps 410(431.71) | Grad Norm 3.4849(19.9980) | Total Time 0.00(0.00)\nIter 2080 | Time 9.9788(10.1222) | Bit/dim 1.4324(1.5320) | Xent 0.3659(0.4740) | Xent Color 0.1649(0.5016) | Loss 3.7485(4.3854) | Error 0.1233(0.1466) | Error Color 0.0500(0.1274) |Steps 416(429.50) | Grad Norm 3.0758(15.7535) | Total Time 0.00(0.00)\nIter 2090 | Time 9.5606(10.0531) | Bit/dim 1.3566(1.4958) | Xent 0.3238(0.4381) | Xent Color 0.1235(0.4081) | Loss 3.6169(4.2009) | Error 0.1044(0.1364) | Error Color 0.0367(0.1048) |Steps 428(426.15) | Grad Norm 1.9801(12.3836) | Total Time 0.00(0.00)\nIter 2100 | Time 9.4048(10.0201) | Bit/dim 1.3151(1.4536) | Xent 0.3779(0.4089) | Xent Color 0.1071(0.3313) | Loss 3.5368(4.0317) | Error 0.1156(0.1272) | Error Color 0.0322(0.0853) |Steps 422(426.71) | Grad Norm 2.6107(9.9385) | Total Time 0.00(0.00)\nIter 2110 | Time 10.1181(10.0133) | Bit/dim 1.2643(1.4107) | Xent 0.2563(0.3807) | Xent Color 0.0892(0.2692) | Loss 3.4213(3.8790) | Error 0.0878(0.1192) | Error Color 0.0211(0.0689) |Steps 446(426.75) | Grad Norm 4.1994(8.0581) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0032 | Time 61.7884, Epoch Time 755.0395(709.9034), Bit/dim 1.2772(best: 1.2690), Xent 0.1802, Xent Color 0.0368. Loss 1.3315, Error 0.0571(best: 0.0515), Error Color 0.0025(best: 0.0008)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2120 | Time 9.7413(9.9806) | Bit/dim 1.2557(1.3734) | Xent 0.2998(0.3551) | Xent Color 0.0703(0.2199) | Loss 3.3859(4.2346) | Error 0.1067(0.1121) | Error Color 0.0089(0.0552) |Steps 434(427.18) | Grad Norm 1.9258(6.6215) | Total Time 0.00(0.00)\nIter 2130 | Time 9.8337(9.9295) | Bit/dim 1.2421(1.3418) | Xent 0.2442(0.3325) | Xent Color 0.0568(0.1780) | Loss 3.3162(3.9967) | Error 0.0778(0.1040) | Error Color 0.0078(0.0437) |Steps 404(423.78) | Grad Norm 1.5098(5.3820) | Total Time 0.00(0.00)\nIter 2140 | Time 9.8488(9.9175) | Bit/dim 1.2251(1.3125) | Xent 0.2706(0.3137) | Xent Color 0.0598(0.1470) | Loss 3.2969(3.8133) | Error 0.0978(0.0985) | Error Color 0.0078(0.0351) |Steps 440(423.02) | Grad Norm 2.0878(4.4894) | Total Time 0.00(0.00)\nIter 2150 | Time 10.1331(9.9692) | Bit/dim 1.2060(1.2871) | Xent 0.3043(0.3039) | Xent Color 0.0489(0.1219) | Loss 3.2867(3.6719) | Error 0.1067(0.0967) | Error Color 0.0078(0.0281) |Steps 440(424.48) | Grad Norm 2.3548(3.8127) | Total Time 0.00(0.00)\nIter 2160 | Time 9.8118(9.9331) | Bit/dim 1.1912(1.2646) | Xent 0.2563(0.2912) | Xent Color 0.0397(0.1032) | Loss 3.1634(3.5499) | Error 0.0722(0.0928) | Error Color 0.0044(0.0232) |Steps 386(420.95) | Grad Norm 2.6257(3.5553) | Total Time 0.00(0.00)\nIter 2170 | Time 10.1594(9.8912) | Bit/dim 1.1858(1.2456) | Xent 0.2944(0.2870) | Xent Color 0.0429(0.0882) | Loss 3.1830(3.4572) | Error 0.0978(0.0916) | Error Color 0.0067(0.0193) |Steps 416(419.79) | Grad Norm 4.1198(3.6987) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0033 | Time 62.2389, Epoch Time 735.6644(710.6763), Bit/dim 1.1836(best: 1.2690), Xent 0.1539, Xent Color 0.0148. Loss 1.2258, Error 0.0475(best: 0.0515), Error Color 0.0005(best: 0.0008)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2180 | Time 9.6602(9.8639) | Bit/dim 1.1927(1.2310) | Xent 0.2147(0.2774) | Xent Color 0.0465(0.0759) | Loss 3.1710(3.9397) | Error 0.0733(0.0895) | Error Color 0.0133(0.0161) |Steps 416(419.56) | Grad Norm 3.9995(3.4793) | Total Time 0.00(0.00)\nIter 2190 | Time 9.6172(9.8038) | Bit/dim 1.1707(1.2173) | Xent 0.3076(0.2704) | Xent Color 0.0371(0.0668) | Loss 3.1910(3.7318) | Error 0.0844(0.0866) | Error Color 0.0067(0.0137) |Steps 416(418.65) | Grad Norm 3.1594(3.6499) | Total Time 0.00(0.00)\nIter 2200 | Time 9.2424(9.7881) | Bit/dim 1.1614(1.2038) | Xent 0.2110(0.2622) | Xent Color 0.0347(0.0596) | Loss 3.1255(3.5777) | Error 0.0700(0.0843) | Error Color 0.0067(0.0121) |Steps 422(418.48) | Grad Norm 4.1251(3.8501) | Total Time 0.00(0.00)\nIter 2210 | Time 9.6080(9.7318) | Bit/dim 1.1753(1.1931) | Xent 0.2813(0.2587) | Xent Color 0.0400(0.0536) | Loss 3.1512(3.4610) | Error 0.0811(0.0832) | Error Color 0.0067(0.0105) |Steps 428(418.06) | Grad Norm 7.1129(3.8984) | Total Time 0.00(0.00)\nIter 2220 | Time 9.8741(9.7708) | Bit/dim 1.1551(1.1824) | Xent 0.2290(0.2540) | Xent Color 0.0344(0.0488) | Loss 3.1393(3.3708) | Error 0.0656(0.0809) | Error Color 0.0056(0.0095) |Steps 434(418.54) | Grad Norm 2.0300(3.8230) | Total Time 0.00(0.00)\nIter 2230 | Time 9.3988(9.7393) | Bit/dim 1.1466(1.1727) | Xent 0.1765(0.2438) | Xent Color 0.0313(0.0448) | Loss 3.1235(3.2942) | Error 0.0533(0.0773) | Error Color 0.0022(0.0086) |Steps 422(416.93) | Grad Norm 4.3794(3.9318) | Total Time 0.00(0.00)\nIter 2240 | Time 9.7513(9.7288) | Bit/dim 1.1286(1.1645) | Xent 0.2263(0.2360) | Xent Color 0.0262(0.0407) | Loss 3.0467(3.2322) | Error 0.0678(0.0745) | Error Color 0.0011(0.0074) |Steps 416(415.82) | Grad Norm 4.6442(3.6141) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0034 | Time 61.8092, Epoch Time 723.9513(711.0745), Bit/dim 1.1346(best: 1.1836), Xent 0.1396, Xent Color 0.0106. Loss 1.1722, Error 0.0450(best: 0.0475), Error Color 0.0003(best: 0.0005)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2250 | Time 9.9605(9.7246) | Bit/dim 1.1364(1.1557) | Xent 0.2008(0.2344) | Xent Color 0.0316(0.0391) | Loss 3.0265(3.6982) | Error 0.0667(0.0746) | Error Color 0.0044(0.0075) |Steps 398(416.67) | Grad Norm 4.0524(3.7066) | Total Time 0.00(0.00)\nIter 2260 | Time 9.6750(9.7137) | Bit/dim 1.1302(1.1492) | Xent 0.2307(0.2295) | Xent Color 0.0348(0.0373) | Loss 3.1043(3.5280) | Error 0.0811(0.0736) | Error Color 0.0111(0.0071) |Steps 422(415.88) | Grad Norm 7.5547(3.9539) | Total Time 0.00(0.00)\nIter 2270 | Time 9.4189(9.7306) | Bit/dim 1.1122(1.1423) | Xent 0.2488(0.2300) | Xent Color 0.0310(0.0356) | Loss 3.0152(3.4018) | Error 0.0767(0.0733) | Error Color 0.0078(0.0066) |Steps 428(416.51) | Grad Norm 4.8857(4.2189) | Total Time 0.00(0.00)\nIter 2280 | Time 9.9815(9.7714) | Bit/dim 1.1134(1.1368) | Xent 0.2462(0.2274) | Xent Color 0.0393(0.0344) | Loss 3.0603(3.3115) | Error 0.0611(0.0714) | Error Color 0.0089(0.0061) |Steps 416(416.31) | Grad Norm 8.6953(4.6368) | Total Time 0.00(0.00)\nIter 2290 | Time 9.6117(9.8010) | Bit/dim 1.0977(1.1291) | Xent 0.2516(0.2247) | Xent Color 0.0319(0.0328) | Loss 2.9586(3.2290) | Error 0.0689(0.0705) | Error Color 0.0056(0.0057) |Steps 392(414.90) | Grad Norm 5.7328(4.9206) | Total Time 0.00(0.00)\nIter 2300 | Time 9.2555(9.7443) | Bit/dim 1.1092(1.1225) | Xent 0.2274(0.2219) | Xent Color 0.0265(0.0308) | Loss 2.9835(3.1649) | Error 0.0711(0.0698) | Error Color 0.0056(0.0051) |Steps 416(415.99) | Grad Norm 2.5049(4.3441) | Total Time 0.00(0.00)\nIter 2310 | Time 9.7926(9.7119) | Bit/dim 1.0949(1.1164) | Xent 0.2084(0.2182) | Xent Color 0.0283(0.0297) | Loss 2.9188(3.1132) | Error 0.0667(0.0688) | Error Color 0.0033(0.0049) |Steps 410(413.98) | Grad Norm 6.2273(4.2906) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0035 | Time 61.2910, Epoch Time 727.2759(711.5606), Bit/dim 1.0973(best: 1.1346), Xent 0.1300, Xent Color 0.0080. Loss 1.1318, Error 0.0440(best: 0.0450), Error Color 0.0002(best: 0.0003)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2320 | Time 9.7029(9.6985) | Bit/dim 1.1043(1.1114) | Xent 0.1727(0.2165) | Xent Color 0.0235(0.0287) | Loss 3.0047(3.5032) | Error 0.0522(0.0684) | Error Color 0.0067(0.0049) |Steps 422(414.30) | Grad Norm 3.8727(4.1444) | Total Time 0.00(0.00)\nIter 2330 | Time 9.7642(9.6916) | Bit/dim 1.0843(1.1055) | Xent 0.1947(0.2134) | Xent Color 0.0253(0.0281) | Loss 2.9849(3.3619) | Error 0.0667(0.0675) | Error Color 0.0022(0.0050) |Steps 410(413.99) | Grad Norm 7.4909(4.5104) | Total Time 0.00(0.00)\nIter 2340 | Time 9.6672(9.7357) | Bit/dim 1.0827(1.1002) | Xent 0.1915(0.2106) | Xent Color 0.0189(0.0277) | Loss 2.9263(3.2569) | Error 0.0611(0.0664) | Error Color 0.0022(0.0050) |Steps 440(416.48) | Grad Norm 2.7897(4.9824) | Total Time 0.00(0.00)\nIter 2350 | Time 10.2639(9.7361) | Bit/dim 1.0793(1.0947) | Xent 0.1893(0.2079) | Xent Color 0.0280(0.0271) | Loss 2.9536(3.1687) | Error 0.0678(0.0663) | Error Color 0.0067(0.0049) |Steps 422(416.25) | Grad Norm 4.8626(4.8281) | Total Time 0.00(0.00)\nIter 2360 | Time 9.8634(9.7864) | Bit/dim 1.0734(1.0896) | Xent 0.1882(0.2029) | Xent Color 0.0358(0.0263) | Loss 2.8794(3.0991) | Error 0.0567(0.0642) | Error Color 0.0089(0.0048) |Steps 404(416.22) | Grad Norm 4.6684(4.4615) | Total Time 0.00(0.00)\nIter 2370 | Time 9.7149(9.7711) | Bit/dim 1.0682(1.0846) | Xent 0.2175(0.2025) | Xent Color 0.0222(0.0254) | Loss 2.9243(3.0560) | Error 0.0744(0.0644) | Error Color 0.0033(0.0044) |Steps 416(414.89) | Grad Norm 5.3931(4.2988) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0036 | Time 69.9213, Epoch Time 737.2601(712.3316), Bit/dim 2.9427(best: 1.0973), Xent 0.5492, Xent Color 14.6926. Loss 6.7531, Error 0.1682(best: 0.0440), Error Color 0.7722(best: 0.0002)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2380 | Time 9.5014(9.8285) | Bit/dim 1.9872(1.2046) | Xent 0.7397(0.2502) | Xent Color 1.3971(0.7714) | Loss 5.4572(4.1613) | Error 0.2389(0.0789) | Error Color 0.3889(0.0862) |Steps 410(417.78) | Grad Norm 61.7220(26.8109) | Total Time 0.00(0.00)\nIter 2390 | Time 10.4311(9.8520) | Bit/dim 1.9182(1.4052) | Xent 0.3951(0.3123) | Xent Color 0.5192(0.7595) | Loss 4.9314(4.4002) | Error 0.1089(0.0995) | Error Color 0.1978(0.1356) |Steps 452(421.42) | Grad Norm 10.1583(26.6980) | Total Time 0.00(0.00)\nIter 2400 | Time 10.3912(9.8856) | Bit/dim 1.7745(1.5139) | Xent 0.2988(0.3238) | Xent Color 0.3245(0.6611) | Loss 4.3863(4.4445) | Error 0.0922(0.1037) | Error Color 0.1167(0.1375) |Steps 422(423.75) | Grad Norm 4.1629(21.3450) | Total Time 0.00(0.00)\nIter 2410 | Time 10.0214(9.9454) | Bit/dim 1.6951(1.5686) | Xent 0.2300(0.3099) | Xent Color 0.1556(0.5414) | Loss 4.1379(4.3911) | Error 0.0767(0.0992) | Error Color 0.0433(0.1167) |Steps 446(428.29) | Grad Norm 2.1595(16.5409) | Total Time 0.00(0.00)\nIter 2420 | Time 10.5438(10.0628) | Bit/dim 1.6092(1.5851) | Xent 0.2432(0.2995) | Xent Color 0.0984(0.4309) | Loss 3.9837(4.2988) | Error 0.0722(0.0959) | Error Color 0.0256(0.0939) |Steps 458(432.77) | Grad Norm 2.5642(12.8995) | Total Time 0.00(0.00)\nIter 2430 | Time 10.4977(10.1604) | Bit/dim 1.4924(1.5714) | Xent 0.2036(0.2842) | Xent Color 0.0980(0.3435) | Loss 3.7266(4.1798) | Error 0.0633(0.0911) | Error Color 0.0278(0.0759) |Steps 452(437.30) | Grad Norm 1.6580(10.0502) | Total Time 0.00(0.00)\nIter 2440 | Time 10.6080(10.2186) | Bit/dim 1.3888(1.5341) | Xent 0.2313(0.2671) | Xent Color 0.1049(0.2785) | Loss 3.6111(4.0484) | Error 0.0711(0.0856) | Error Color 0.0244(0.0623) |Steps 470(439.60) | Grad Norm 2.5435(8.0721) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0037 | Time 62.6210, Epoch Time 758.2331(713.7086), Bit/dim 1.3559(best: 1.0973), Xent 0.1340, Xent Color 0.0395. Loss 1.3993, Error 0.0422(best: 0.0440), Error Color 0.0038(best: 0.0002)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2450 | Time 9.7957(10.1705) | Bit/dim 1.2751(1.4784) | Xent 0.2217(0.2552) | Xent Color 0.0890(0.2290) | Loss 3.2939(4.3592) | Error 0.0656(0.0817) | Error Color 0.0256(0.0519) |Steps 440(440.54) | Grad Norm 3.8020(6.6138) | Total Time 0.00(0.00)\nIter 2460 | Time 9.9927(10.1526) | Bit/dim 1.1973(1.4172) | Xent 0.1985(0.2436) | Xent Color 0.0646(0.1880) | Loss 3.2729(4.0868) | Error 0.0767(0.0793) | Error Color 0.0178(0.0429) |Steps 440(441.01) | Grad Norm 1.8684(5.5110) | Total Time 0.00(0.00)\nIter 2470 | Time 10.4066(10.1404) | Bit/dim 1.1649(1.3578) | Xent 0.2289(0.2402) | Xent Color 0.0789(0.1563) | Loss 3.1673(3.8584) | Error 0.0733(0.0775) | Error Color 0.0200(0.0360) |Steps 434(441.26) | Grad Norm 4.0790(4.7856) | Total Time 0.00(0.00)\nIter 2480 | Time 9.9581(10.1688) | Bit/dim 1.1552(1.3071) | Xent 0.1931(0.2307) | Xent Color 0.0440(0.1286) | Loss 3.0893(3.6761) | Error 0.0589(0.0741) | Error Color 0.0100(0.0293) |Steps 428(438.83) | Grad Norm 2.6073(4.2315) | Total Time 0.00(0.00)\nIter 2490 | Time 10.4849(10.2052) | Bit/dim 1.1345(1.2639) | Xent 0.2375(0.2250) | Xent Color 0.0496(0.1075) | Loss 3.1602(3.5246) | Error 0.0789(0.0723) | Error Color 0.0100(0.0242) |Steps 458(437.58) | Grad Norm 4.4413(4.0263) | Total Time 0.00(0.00)\nIter 2500 | Time 9.8055(10.1243) | Bit/dim 1.1100(1.2278) | Xent 0.1843(0.2180) | Xent Color 0.0449(0.0905) | Loss 3.0341(3.4047) | Error 0.0689(0.0703) | Error Color 0.0100(0.0201) |Steps 422(434.34) | Grad Norm 4.2116(3.6959) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0038 | Time 62.0665, Epoch Time 752.1846(714.8629), Bit/dim 1.1058(best: 1.0973), Xent 0.1180, Xent Color 0.0124. Loss 1.1384, Error 0.0391(best: 0.0422), Error Color 0.0003(best: 0.0002)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2510 | Time 9.8949(10.1124) | Bit/dim 1.1024(1.1962) | Xent 0.2335(0.2159) | Xent Color 0.0443(0.0771) | Loss 2.9929(3.8502) | Error 0.0667(0.0697) | Error Color 0.0089(0.0168) |Steps 410(431.30) | Grad Norm 1.5775(3.3313) | Total Time 0.00(0.00)\nIter 2520 | Time 10.1499(10.1120) | Bit/dim 1.0886(1.1702) | Xent 0.1822(0.2077) | Xent Color 0.0291(0.0663) | Loss 2.9475(3.6217) | Error 0.0522(0.0664) | Error Color 0.0033(0.0142) |Steps 428(431.33) | Grad Norm 3.2525(3.0791) | Total Time 0.00(0.00)\nIter 2530 | Time 9.6173(10.0753) | Bit/dim 1.0745(1.1484) | Xent 0.2095(0.2061) | Xent Color 0.0396(0.0582) | Loss 2.9691(3.4555) | Error 0.0656(0.0656) | Error Color 0.0078(0.0122) |Steps 410(429.27) | Grad Norm 4.0222(3.0317) | Total Time 0.00(0.00)\nIter 2540 | Time 9.7201(10.0340) | Bit/dim 1.0793(1.1311) | Xent 0.1788(0.2014) | Xent Color 0.0305(0.0509) | Loss 2.9900(3.3225) | Error 0.0611(0.0644) | Error Color 0.0033(0.0102) |Steps 410(428.77) | Grad Norm 1.7389(3.0723) | Total Time 0.00(0.00)\nIter 2550 | Time 9.6763(10.0286) | Bit/dim 1.0810(1.1162) | Xent 0.1697(0.1976) | Xent Color 0.0365(0.0459) | Loss 2.9829(3.2210) | Error 0.0489(0.0628) | Error Color 0.0078(0.0090) |Steps 422(427.30) | Grad Norm 1.6228(2.8957) | Total Time 0.00(0.00)\nIter 2560 | Time 10.2310(9.9878) | Bit/dim 1.0752(1.1036) | Xent 0.1658(0.1958) | Xent Color 0.0342(0.0414) | Loss 2.9080(3.1402) | Error 0.0567(0.0625) | Error Color 0.0067(0.0082) |Steps 410(425.43) | Grad Norm 4.4101(2.9189) | Total Time 0.00(0.00)\nIter 2570 | Time 9.7499(9.9659) | Bit/dim 1.0425(1.0927) | Xent 0.2005(0.1953) | Xent Color 0.0256(0.0379) | Loss 2.9020(3.0793) | Error 0.0600(0.0622) | Error Color 0.0033(0.0073) |Steps 422(426.17) | Grad Norm 3.2509(2.7828) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0039 | Time 61.5005, Epoch Time 741.1859(715.6526), Bit/dim 1.0577(best: 1.0973), Xent 0.1078, Xent Color 0.0070. Loss 1.0864, Error 0.0353(best: 0.0391), Error Color 0.0004(best: 0.0002)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2580 | Time 9.6987(9.9560) | Bit/dim 1.0543(1.0832) | Xent 0.1674(0.1957) | Xent Color 0.0278(0.0347) | Loss 2.8852(3.5169) | Error 0.0578(0.0620) | Error Color 0.0089(0.0067) |Steps 416(425.69) | Grad Norm 3.8620(2.7988) | Total Time 0.00(0.00)\nIter 2590 | Time 9.2163(9.9217) | Bit/dim 1.0489(1.0753) | Xent 0.1860(0.1962) | Xent Color 0.0214(0.0320) | Loss 2.8220(3.3469) | Error 0.0578(0.0626) | Error Color 0.0011(0.0060) |Steps 410(422.23) | Grad Norm 1.3866(2.6407) | Total Time 0.00(0.00)\nIter 2600 | Time 10.1422(9.8507) | Bit/dim 1.0577(1.0692) | Xent 0.1967(0.1912) | Xent Color 0.0219(0.0299) | Loss 2.9217(3.2207) | Error 0.0589(0.0607) | Error Color 0.0044(0.0055) |Steps 416(420.17) | Grad Norm 3.2073(2.6961) | Total Time 0.00(0.00)\nIter 2610 | Time 9.6628(9.7972) | Bit/dim 1.0491(1.0622) | Xent 0.1626(0.1870) | Xent Color 0.0323(0.0289) | Loss 2.8208(3.1223) | Error 0.0556(0.0595) | Error Color 0.0100(0.0054) |Steps 422(418.32) | Grad Norm 5.2766(2.7426) | Total Time 0.00(0.00)\nIter 2620 | Time 9.7170(9.7699) | Bit/dim 1.0177(1.0563) | Xent 0.1689(0.1831) | Xent Color 0.0229(0.0269) | Loss 2.8137(3.0446) | Error 0.0556(0.0588) | Error Color 0.0067(0.0048) |Steps 410(413.78) | Grad Norm 3.9437(3.3058) | Total Time 0.00(0.00)\nIter 2630 | Time 9.6302(9.7749) | Bit/dim 1.0236(1.0506) | Xent 0.1675(0.1807) | Xent Color 0.0168(0.0255) | Loss 2.8068(2.9892) | Error 0.0600(0.0582) | Error Color 0.0000(0.0044) |Steps 416(414.88) | Grad Norm 2.0069(3.5191) | Total Time 0.00(0.00)\nIter 2640 | Time 9.8312(9.7970) | Bit/dim 1.0150(1.0454) | Xent 0.1873(0.1838) | Xent Color 0.0267(0.0245) | Loss 2.7958(2.9495) | Error 0.0533(0.0587) | Error Color 0.0089(0.0044) |Steps 428(416.45) | Grad Norm 3.5151(3.3749) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0040 | Time 62.1752, Epoch Time 729.4202(716.0656), Bit/dim 1.0298(best: 1.0577), Xent 0.0995, Xent Color 0.0060. Loss 1.0561, Error 0.0324(best: 0.0353), Error Color 0.0002(best: 0.0002)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2650 | Time 9.6004(9.8310) | Bit/dim 1.0346(1.0408) | Xent 0.1604(0.1840) | Xent Color 0.0176(0.0237) | Loss 2.8614(3.3495) | Error 0.0500(0.0577) | Error Color 0.0011(0.0040) |Steps 422(417.77) | Grad Norm 1.9295(3.5032) | Total Time 0.00(0.00)\nIter 2660 | Time 10.1061(9.8660) | Bit/dim 1.0299(1.0373) | Xent 0.1555(0.1779) | Xent Color 0.0230(0.0228) | Loss 2.8260(3.2151) | Error 0.0500(0.0561) | Error Color 0.0044(0.0039) |Steps 434(417.91) | Grad Norm 8.2870(3.9972) | Total Time 0.00(0.00)\nIter 2670 | Time 10.0151(9.8910) | Bit/dim 1.0122(1.0328) | Xent 0.2055(0.1768) | Xent Color 0.0228(0.0224) | Loss 2.7496(3.1075) | Error 0.0622(0.0560) | Error Color 0.0056(0.0038) |Steps 398(418.03) | Grad Norm 4.3161(4.5639) | Total Time 0.00(0.00)\nIter 2680 | Time 10.0023(9.8830) | Bit/dim 1.0155(1.0290) | Xent 0.1779(0.1776) | Xent Color 0.0195(0.0218) | Loss 2.7620(3.0275) | Error 0.0644(0.0562) | Error Color 0.0044(0.0038) |Steps 398(417.47) | Grad Norm 5.4581(4.6408) | Total Time 0.00(0.00)\nIter 2690 | Time 9.8704(9.8873) | Bit/dim 1.0211(1.0252) | Xent 0.1955(0.1774) | Xent Color 0.0173(0.0210) | Loss 2.8317(2.9660) | Error 0.0600(0.0565) | Error Color 0.0011(0.0035) |Steps 428(417.11) | Grad Norm 4.1449(4.4552) | Total Time 0.00(0.00)\nIter 2700 | Time 10.0196(9.9116) | Bit/dim 1.0062(1.0213) | Xent 0.1789(0.1759) | Xent Color 0.0148(0.0204) | Loss 2.7911(2.9187) | Error 0.0556(0.0559) | Error Color 0.0011(0.0033) |Steps 428(419.69) | Grad Norm 6.1872(4.3752) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0041 | Time 61.8295, Epoch Time 740.2248(716.7904), Bit/dim 1.0078(best: 1.0298), Xent 0.1001, Xent Color 0.0037. Loss 1.0338, Error 0.0324(best: 0.0324), Error Color 0.0000(best: 0.0002)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2710 | Time 10.0076(9.8967) | Bit/dim 1.0142(1.0180) | Xent 0.1568(0.1705) | Xent Color 0.0218(0.0195) | Loss 2.7943(3.4049) | Error 0.0567(0.0544) | Error Color 0.0022(0.0030) |Steps 410(420.86) | Grad Norm 9.0402(4.3940) | Total Time 0.00(0.00)\nIter 2720 | Time 10.3534(9.8738) | Bit/dim 1.0316(1.0172) | Xent 0.1767(0.1709) | Xent Color 0.0509(0.0214) | Loss 2.8781(3.2470) | Error 0.0533(0.0543) | Error Color 0.0156(0.0039) |Steps 446(420.52) | Grad Norm 24.8705(6.5514) | Total Time 0.00(0.00)\nIter 2740 | Time 9.9983(9.9270) | Bit/dim 0.9905(1.0120) | Xent 0.1842(0.1662) | Xent Color 0.0174(0.0218) | Loss 2.6859(3.0307) | Error 0.0633(0.0531) | Error Color 0.0033(0.0041) |Steps 410(421.41) | Grad Norm 6.9738(8.3075) | Total Time 0.00(0.00)\nIter 2750 | Time 10.2656(10.0061) | Bit/dim 0.9974(1.0084) | Xent 0.1319(0.1649) | Xent Color 0.0149(0.0203) | Loss 2.7447(2.9639) | Error 0.0344(0.0521) | Error Color 0.0011(0.0036) |Steps 434(421.19) | Grad Norm 2.0268(7.3544) | Total Time 0.00(0.00)\nIter 2760 | Time 10.4816(10.0375) | Bit/dim 1.0067(1.0060) | Xent 0.1769(0.1651) | Xent Color 0.0147(0.0187) | Loss 2.7996(2.9085) | Error 0.0589(0.0525) | Error Color 0.0011(0.0031) |Steps 428(419.25) | Grad Norm 4.3037(6.6123) | Total Time 0.00(0.00)\nIter 2770 | Time 9.6160(10.0401) | Bit/dim 0.9884(1.0019) | Xent 0.1781(0.1649) | Xent Color 0.0157(0.0175) | Loss 2.7477(2.8628) | Error 0.0544(0.0524) | Error Color 0.0022(0.0027) |Steps 416(419.78) | Grad Norm 2.9880(5.9501) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0042 | Time 63.0289, Epoch Time 747.4804(717.7111), Bit/dim 0.9899(best: 1.0078), Xent 0.0963, Xent Color 0.0036. Loss 1.0149, Error 0.0321(best: 0.0324), Error Color 0.0000(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2780 | Time 9.8247(10.0020) | Bit/dim 0.9794(0.9987) | Xent 0.1687(0.1607) | Xent Color 0.0177(0.0171) | Loss 2.7128(3.2742) | Error 0.0567(0.0511) | Error Color 0.0044(0.0025) |Steps 398(418.19) | Grad Norm 7.6125(6.1036) | Total Time 0.00(0.00)\nIter 2790 | Time 10.0746(9.9989) | Bit/dim 0.9767(0.9947) | Xent 0.1553(0.1594) | Xent Color 0.0156(0.0164) | Loss 2.7047(3.1330) | Error 0.0444(0.0510) | Error Color 0.0022(0.0024) |Steps 416(419.05) | Grad Norm 6.2967(5.7498) | Total Time 0.00(0.00)\nIter 2800 | Time 9.7509(9.9832) | Bit/dim 0.9943(0.9920) | Xent 0.1184(0.1610) | Xent Color 0.0197(0.0159) | Loss 2.7269(3.0298) | Error 0.0389(0.0507) | Error Color 0.0056(0.0023) |Steps 422(421.20) | Grad Norm 15.8447(5.9318) | Total Time 0.00(0.00)\nIter 2810 | Time 10.0694(9.9408) | Bit/dim 0.9894(0.9921) | Xent 0.1497(0.1598) | Xent Color 0.0223(0.0193) | Loss 2.7834(2.9585) | Error 0.0511(0.0502) | Error Color 0.0044(0.0037) |Steps 428(422.66) | Grad Norm 10.8856(8.3513) | Total Time 0.00(0.00)\nIter 2820 | Time 10.2160(9.9268) | Bit/dim 0.9751(0.9895) | Xent 0.1477(0.1545) | Xent Color 0.0254(0.0191) | Loss 2.7304(2.8964) | Error 0.0533(0.0490) | Error Color 0.0067(0.0038) |Steps 428(421.65) | Grad Norm 12.0320(8.8072) | Total Time 0.00(0.00)\nIter 2830 | Time 10.0070(9.9186) | Bit/dim 0.9722(0.9859) | Xent 0.1635(0.1538) | Xent Color 0.0173(0.0181) | Loss 2.7359(2.8500) | Error 0.0456(0.0490) | Error Color 0.0033(0.0034) |Steps 428(421.00) | Grad Norm 9.0599(8.4845) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0043 | Time 62.3765, Epoch Time 737.9840(718.3193), Bit/dim 0.9723(best: 0.9899), Xent 0.0987, Xent Color 0.0028. Loss 0.9977, Error 0.0320(best: 0.0321), Error Color 0.0000(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2840 | Time 10.1240(9.8998) | Bit/dim 0.9734(0.9825) | Xent 0.1738(0.1537) | Xent Color 0.0143(0.0171) | Loss 2.7582(3.3402) | Error 0.0489(0.0487) | Error Color 0.0022(0.0031) |Steps 416(419.35) | Grad Norm 9.2707(8.3527) | Total Time 0.00(0.00)\nIter 2850 | Time 10.1689(9.8942) | Bit/dim 0.9680(0.9787) | Xent 0.1208(0.1535) | Xent Color 0.0109(0.0161) | Loss 2.6434(3.1719) | Error 0.0467(0.0486) | Error Color 0.0000(0.0028) |Steps 416(418.73) | Grad Norm 5.2610(7.9240) | Total Time 0.00(0.00)\nIter 2860 | Time 9.8554(9.9284) | Bit/dim 0.9758(0.9767) | Xent 0.1516(0.1541) | Xent Color 0.0149(0.0153) | Loss 2.7611(3.0563) | Error 0.0544(0.0487) | Error Color 0.0011(0.0025) |Steps 434(419.22) | Grad Norm 7.0780(7.3810) | Total Time 0.00(0.00)\nIter 2870 | Time 9.7171(9.8992) | Bit/dim 0.9650(0.9730) | Xent 0.1336(0.1535) | Xent Color 0.0130(0.0146) | Loss 2.6984(2.9593) | Error 0.0500(0.0485) | Error Color 0.0011(0.0023) |Steps 416(419.01) | Grad Norm 9.8421(7.0148) | Total Time 0.00(0.00)\nIter 2880 | Time 10.0441(9.8821) | Bit/dim 0.9712(0.9699) | Xent 0.1691(0.1550) | Xent Color 0.0150(0.0145) | Loss 2.6560(2.8842) | Error 0.0611(0.0492) | Error Color 0.0000(0.0021) |Steps 422(417.88) | Grad Norm 17.8040(7.4188) | Total Time 0.00(0.00)\nIter 2890 | Time 10.5155(9.8903) | Bit/dim 0.9647(0.9692) | Xent 0.1632(0.1520) | Xent Color 0.0160(0.0156) | Loss 2.6506(2.8306) | Error 0.0567(0.0478) | Error Color 0.0022(0.0024) |Steps 386(415.33) | Grad Norm 12.6932(8.9222) | Total Time 0.00(0.00)\nIter 2900 | Time 10.3922(9.9516) | Bit/dim 0.9666(0.9668) | Xent 0.1377(0.1488) | Xent Color 0.0149(0.0158) | Loss 2.6366(2.7941) | Error 0.0500(0.0472) | Error Color 0.0022(0.0025) |Steps 428(418.67) | Grad Norm 8.0344(9.1717) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0044 | Time 62.1809, Epoch Time 740.9018(718.9967), Bit/dim 0.9572(best: 0.9723), Xent 0.0847, Xent Color 0.0024. Loss 0.9790, Error 0.0288(best: 0.0320), Error Color 0.0000(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2910 | Time 10.0556(10.0122) | Bit/dim 0.9436(0.9640) | Xent 0.1640(0.1492) | Xent Color 0.0126(0.0146) | Loss 2.6887(3.2480) | Error 0.0533(0.0474) | Error Color 0.0000(0.0021) |Steps 428(420.98) | Grad Norm 8.1203(8.5676) | Total Time 0.00(0.00)\nIter 2920 | Time 10.1032(10.0211) | Bit/dim 0.9432(0.9609) | Xent 0.1366(0.1475) | Xent Color 0.0110(0.0138) | Loss 2.6250(3.0995) | Error 0.0433(0.0471) | Error Color 0.0000(0.0018) |Steps 434(422.85) | Grad Norm 6.6158(7.9120) | Total Time 0.00(0.00)\nIter 2930 | Time 9.5882(9.9721) | Bit/dim 0.9506(0.9602) | Xent 0.1265(0.1447) | Xent Color 0.0132(0.0143) | Loss 2.6713(2.9881) | Error 0.0411(0.0465) | Error Color 0.0011(0.0020) |Steps 398(421.34) | Grad Norm 13.3389(9.3025) | Total Time 0.00(0.00)\nIter 2940 | Time 10.1049(9.9406) | Bit/dim 0.9525(0.9588) | Xent 0.1075(0.1427) | Xent Color 0.0126(0.0138) | Loss 2.6758(2.9049) | Error 0.0311(0.0453) | Error Color 0.0011(0.0018) |Steps 422(419.66) | Grad Norm 8.2451(9.1872) | Total Time 0.00(0.00)\nIter 2950 | Time 10.4178(10.0161) | Bit/dim 0.9410(0.9553) | Xent 0.1703(0.1417) | Xent Color 0.0099(0.0138) | Loss 2.6682(2.8434) | Error 0.0511(0.0437) | Error Color 0.0022(0.0018) |Steps 398(420.56) | Grad Norm 7.2887(9.1235) | Total Time 0.00(0.00)\nIter 2960 | Time 9.5779(9.9620) | Bit/dim 0.9437(0.9538) | Xent 0.1530(0.1439) | Xent Color 0.0121(0.0144) | Loss 2.5809(2.7961) | Error 0.0444(0.0443) | Error Color 0.0022(0.0022) |Steps 416(420.39) | Grad Norm 8.7960(10.3386) | Total Time 0.00(0.00)\nIter 2970 | Time 10.0892(9.9201) | Bit/dim 0.9342(0.9500) | Xent 0.1379(0.1413) | Xent Color 0.0079(0.0139) | Loss 2.6642(2.7588) | Error 0.0467(0.0438) | Error Color 0.0000(0.0020) |Steps 440(419.93) | Grad Norm 7.0007(9.7874) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0045 | Time 62.3398, Epoch Time 741.1944(719.6627), Bit/dim 0.9397(best: 0.9572), Xent 0.0841, Xent Color 0.0018. Loss 0.9612, Error 0.0275(best: 0.0288), Error Color 0.0000(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 2980 | Time 10.6627(9.9408) | Bit/dim 0.9257(0.9467) | Xent 0.1462(0.1413) | Xent Color 0.0163(0.0133) | Loss 2.6874(3.1609) | Error 0.0433(0.0443) | Error Color 0.0044(0.0019) |Steps 434(420.47) | Grad Norm 7.7170(9.2322) | Total Time 0.00(0.00)\nIter 2990 | Time 13.6349(10.3682) | Bit/dim 2.6458(1.2452) | Xent 1.4467(0.4841) | Xent Color 7.6559(2.0915) | Loss 10.2100(4.7002) | Error 0.4678(0.1213) | Error Color 0.8144(0.1468) |Steps 596(443.35) | Grad Norm 108.6735(41.6873) | Total Time 0.00(0.00)\nIter 3000 | Time 15.3921(11.8508) | Bit/dim 2.3301(1.5363) | Xent 0.7281(0.7438) | Xent Color 1.4747(2.2121) | Loss 6.6568(5.4237) | Error 0.2489(0.2022) | Error Color 0.5122(0.2721) |Steps 680(504.78) | Grad Norm 1332.5699(473693509.9970) | Total Time 0.00(0.00)\nIter 3010 | Time 13.1624(12.1216) | Bit/dim 2.0117(1.6864) | Xent 0.7244(0.7225) | Xent Color 0.7986(1.9130) | Loss 5.5643(5.5392) | Error 0.2278(0.2054) | Error Color 0.3233(0.3081) |Steps 602(523.91) | Grad Norm 5.6010(349313025.0914) | Total Time 0.00(0.00)\nIter 3020 | Time 12.6405(12.1993) | Bit/dim 1.9104(1.7591) | Xent 0.4362(0.6531) | Xent Color 0.5649(1.5908) | Loss 5.0309(5.4522) | Error 0.1444(0.1905) | Error Color 0.2156(0.2983) |Steps 542(533.46) | Grad Norm 3.8594(257591853.5596) | Total Time 0.00(0.00)\nIter 3030 | Time 11.6638(12.2292) | Bit/dim 1.8741(1.7935) | Xent 0.3787(0.5784) | Xent Color 0.3747(1.2939) | Loss 4.8549(5.3025) | Error 0.1233(0.1712) | Error Color 0.1344(0.2651) |Steps 524(535.72) | Grad Norm 3.8450(189954448.6436) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0046 | Time 72.9126, Epoch Time 918.6792(725.6332), Bit/dim 1.8286(best: 0.9397), Xent 0.2107, Xent Color 0.1766. Loss 1.9255, Error 0.0651(best: 0.0275), Error Color 0.0458(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3040 | Time 11.9673(12.1137) | Bit/dim 1.8132(1.8003) | Xent 0.3446(0.5117) | Xent Color 0.2435(1.0332) | Loss 4.6631(5.8348) | Error 0.1167(0.1541) | Error Color 0.0733(0.2235) |Steps 518(533.89) | Grad Norm 3.9150(140076994.6635) | Total Time 0.00(0.00)\nIter 3050 | Time 11.2961(11.9906) | Bit/dim 1.7668(1.7935) | Xent 0.2700(0.4576) | Xent Color 0.2044(0.8183) | Loss 4.5129(5.4945) | Error 0.0811(0.1397) | Error Color 0.0544(0.1821) |Steps 530(529.13) | Grad Norm 5.4982(103296156.4381) | Total Time 0.00(0.00)\nIter 3060 | Time 11.4660(11.8552) | Bit/dim 1.6871(1.7731) | Xent 0.2888(0.4148) | Xent Color 0.1819(0.6505) | Loss 4.3406(5.2099) | Error 0.0978(0.1284) | Error Color 0.0556(0.1480) |Steps 518(523.45) | Grad Norm 7.6199(76173079.8367) | Total Time 0.00(0.00)\nIter 3070 | Time 10.9618(11.6676) | Bit/dim 1.6454(1.7441) | Xent 0.2484(0.3768) | Xent Color 0.1711(0.5216) | Loss 4.1335(4.9563) | Error 0.0778(0.1177) | Error Color 0.0556(0.1206) |Steps 482(512.81) | Grad Norm 10.3675(56171868.7777) | Total Time 0.00(0.00)\nIter 3080 | Time 11.1656(11.5233) | Bit/dim 1.5764(1.7075) | Xent 0.2984(0.3476) | Xent Color 0.1128(0.4196) | Loss 4.0736(4.7451) | Error 0.0878(0.1083) | Error Color 0.0222(0.0987) |Steps 488(506.70) | Grad Norm 7.7450(41422493.1034) | Total Time 0.00(0.00)\nIter 3090 | Time 11.5132(11.4432) | Bit/dim 1.5065(1.6683) | Xent 0.2464(0.3196) | Xent Color 0.1138(0.3384) | Loss 3.9514(4.5600) | Error 0.0722(0.1000) | Error Color 0.0278(0.0801) |Steps 512(501.91) | Grad Norm 7.2884(30545947.4533) | Total Time 0.00(0.00)\nIter 3100 | Time 11.0463(11.3805) | Bit/dim 1.4971(1.6299) | Xent 0.2477(0.3006) | Xent Color 0.0909(0.2830) | Loss 3.8950(4.4069) | Error 0.0756(0.0942) | Error Color 0.0200(0.0685) |Steps 458(497.28) | Grad Norm 5.4977(22525321.8390) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0047 | Time 71.2535, Epoch Time 840.7912(729.0879), Bit/dim 1.4997(best: 0.9397), Xent 0.1462, Xent Color 0.0581. Loss 1.5507, Error 0.0476(best: 0.0275), Error Color 0.0070(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3110 | Time 10.7467(11.3465) | Bit/dim 1.4814(1.5911) | Xent 0.2038(0.2818) | Xent Color 0.0793(0.2399) | Loss 3.8077(4.8396) | Error 0.0656(0.0891) | Error Color 0.0200(0.0595) |Steps 470(492.64) | Grad Norm 10.0661(16610719.7827) | Total Time 0.00(0.00)\nIter 3120 | Time 10.6995(11.3132) | Bit/dim 1.3975(1.5509) | Xent 0.2106(0.2662) | Xent Color 0.0862(0.2012) | Loss 3.6614(4.5636) | Error 0.0589(0.0837) | Error Color 0.0200(0.0497) |Steps 470(490.31) | Grad Norm 11.4004(12249147.9793) | Total Time 0.00(0.00)\nIter 3130 | Time 10.8139(11.2680) | Bit/dim 1.3651(1.5057) | Xent 0.1998(0.2580) | Xent Color 0.0779(0.1756) | Loss 3.6488(4.3394) | Error 0.0644(0.0813) | Error Color 0.0156(0.0449) |Steps 476(489.58) | Grad Norm 10.1359(9032820.8870) | Total Time 0.00(0.00)\nIter 3140 | Time 10.6613(11.1826) | Bit/dim 1.3018(1.4593) | Xent 0.2162(0.2523) | Xent Color 0.0707(0.1505) | Loss 3.4667(4.1379) | Error 0.0711(0.0795) | Error Color 0.0189(0.0385) |Steps 476(486.07) | Grad Norm 9.0679(6661022.7753) | Total Time 0.00(0.00)\nIter 3150 | Time 10.5930(11.1500) | Bit/dim 1.2830(1.4135) | Xent 0.2508(0.2456) | Xent Color 0.0666(0.1284) | Loss 3.4772(3.9681) | Error 0.0767(0.0771) | Error Color 0.0167(0.0323) |Steps 464(485.85) | Grad Norm 5.9934(4912000.2061) | Total Time 0.00(0.00)\nIter 3160 | Time 10.6010(11.1028) | Bit/dim 1.2521(1.3727) | Xent 0.2272(0.2399) | Xent Color 0.0512(0.1109) | Loss 3.4070(3.8265) | Error 0.0711(0.0764) | Error Color 0.0089(0.0271) |Steps 476(482.15) | Grad Norm 8.4584(3622229.0753) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0048 | Time 68.9469, Epoch Time 823.8692(731.9313), Bit/dim 1.2366(best: 0.9397), Xent 0.1272, Xent Color 0.0884. Loss 1.2905, Error 0.0422(best: 0.0275), Error Color 0.0242(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3170 | Time 10.9526(11.0714) | Bit/dim 1.2271(1.3363) | Xent 0.1963(0.2281) | Xent Color 0.1566(0.1063) | Loss 3.3993(4.3844) | Error 0.0689(0.0733) | Error Color 0.0556(0.0276) |Steps 464(479.51) | Grad Norm 30.7495(2671123.6576) | Total Time 0.00(0.00)\nIter 3180 | Time 11.1038(11.0235) | Bit/dim 1.1958(1.3036) | Xent 0.1809(0.2223) | Xent Color 0.0679(0.0995) | Loss 3.2913(4.1089) | Error 0.0611(0.0709) | Error Color 0.0144(0.0260) |Steps 458(476.29) | Grad Norm 11.7938(1969754.5276) | Total Time 0.00(0.00)\nIter 3190 | Time 10.8111(11.0027) | Bit/dim 1.1809(1.2726) | Xent 0.1651(0.2169) | Xent Color 0.0626(0.0882) | Loss 3.2869(3.8900) | Error 0.0478(0.0689) | Error Color 0.0156(0.0227) |Steps 452(472.73) | Grad Norm 8.7296(1452546.8269) | Total Time 0.00(0.00)\nIter 3200 | Time 11.2599(11.0300) | Bit/dim 1.1519(1.2449) | Xent 0.2000(0.2138) | Xent Color 0.0474(0.0773) | Loss 3.2195(3.7177) | Error 0.0711(0.0679) | Error Color 0.0111(0.0195) |Steps 458(473.24) | Grad Norm 3.6667(1071145.2079) | Total Time 0.00(0.00)\nIter 3210 | Time 11.0787(11.0173) | Bit/dim 1.1374(1.2196) | Xent 0.1647(0.2075) | Xent Color 0.0418(0.0718) | Loss 3.1410(3.5819) | Error 0.0522(0.0664) | Error Color 0.0122(0.0183) |Steps 446(472.26) | Grad Norm 6.5489(789891.4762) | Total Time 0.00(0.00)\nIter 3220 | Time 10.9514(11.0320) | Bit/dim 1.1234(1.1962) | Xent 0.2085(0.2038) | Xent Color 0.0481(0.0642) | Loss 3.2026(3.4723) | Error 0.0822(0.0658) | Error Color 0.0089(0.0155) |Steps 470(470.98) | Grad Norm 8.4709(582487.2583) | Total Time 0.00(0.00)\nIter 3230 | Time 10.7576(11.0309) | Bit/dim 1.1016(1.1738) | Xent 0.1842(0.2011) | Xent Color 0.0485(0.0588) | Loss 3.1488(3.3855) | Error 0.0589(0.0646) | Error Color 0.0144(0.0140) |Steps 464(470.13) | Grad Norm 6.3236(429541.9672) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0049 | Time 70.4602, Epoch Time 818.0482(734.5149), Bit/dim 1.1034(best: 0.9397), Xent 0.1106, Xent Color 0.0112. Loss 1.1338, Error 0.0375(best: 0.0275), Error Color 0.0007(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3240 | Time 11.1508(11.0093) | Bit/dim 1.0910(1.1549) | Xent 0.1872(0.1970) | Xent Color 0.0706(0.0550) | Loss 3.1752(3.8772) | Error 0.0600(0.0631) | Error Color 0.0222(0.0131) |Steps 440(468.82) | Grad Norm 19.0395(316756.9045) | Total Time 0.00(0.00)\nIter 3250 | Time 10.5911(11.0078) | Bit/dim 1.0956(1.1426) | Xent 0.2183(0.1970) | Xent Color 0.0371(0.0595) | Loss 3.1354(3.6862) | Error 0.0622(0.0626) | Error Color 0.0067(0.0152) |Steps 464(468.86) | Grad Norm 9.3085(233589.3635) | Total Time 0.00(0.00)\nIter 3260 | Time 10.5825(10.9236) | Bit/dim 1.0739(1.1268) | Xent 0.1849(0.1966) | Xent Color 0.0309(0.0554) | Loss 3.0051(3.5176) | Error 0.0611(0.0634) | Error Color 0.0067(0.0138) |Steps 428(465.58) | Grad Norm 4.0804(172256.7120) | Total Time 0.00(0.00)\nIter 3270 | Time 11.5750(10.8557) | Bit/dim 1.0725(1.1117) | Xent 0.1773(0.1908) | Xent Color 0.0227(0.0502) | Loss 3.1032(3.3860) | Error 0.0533(0.0614) | Error Color 0.0022(0.0119) |Steps 482(460.36) | Grad Norm 4.4026(127027.6096) | Total Time 0.00(0.00)\nIter 3280 | Time 10.3573(10.8024) | Bit/dim 1.0709(1.0999) | Xent 0.1539(0.1887) | Xent Color 0.0381(0.0457) | Loss 3.0279(3.2900) | Error 0.0589(0.0610) | Error Color 0.0089(0.0106) |Steps 476(458.61) | Grad Norm 4.3127(93674.5484) | Total Time 0.00(0.00)\nIter 3290 | Time 10.2460(10.7629) | Bit/dim 1.0500(1.0868) | Xent 0.1407(0.1837) | Xent Color 0.0402(0.0423) | Loss 2.9063(3.2100) | Error 0.0411(0.0591) | Error Color 0.0111(0.0093) |Steps 440(455.41) | Grad Norm 5.6571(69079.1887) | Total Time 0.00(0.00)\nIter 3300 | Time 11.3130(10.7662) | Bit/dim 1.0385(1.0769) | Xent 0.1320(0.1793) | Xent Color 0.0357(0.0391) | Loss 2.9339(3.1459) | Error 0.0444(0.0577) | Error Color 0.0078(0.0081) |Steps 434(452.54) | Grad Norm 4.0464(50941.9567) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0050 | Time 68.6077, Epoch Time 801.8720(736.5356), Bit/dim 1.0443(best: 0.9397), Xent 0.1002, Xent Color 0.0088. Loss 1.0716, Error 0.0337(best: 0.0275), Error Color 0.0002(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3310 | Time 10.4147(10.7321) | Bit/dim 1.0363(1.0666) | Xent 0.2178(0.1778) | Xent Color 0.0442(0.0376) | Loss 2.9881(3.5888) | Error 0.0711(0.0566) | Error Color 0.0111(0.0075) |Steps 458(453.27) | Grad Norm 8.8812(37567.4434) | Total Time 0.00(0.00)\nIter 3320 | Time 10.6438(10.7419) | Bit/dim 1.0360(1.0583) | Xent 0.1510(0.1738) | Xent Color 0.0232(0.0350) | Loss 3.0738(3.4338) | Error 0.0478(0.0555) | Error Color 0.0033(0.0067) |Steps 470(454.51) | Grad Norm 10.5411(27704.8179) | Total Time 0.00(0.00)\nIter 3330 | Time 13.3089(10.9967) | Bit/dim 1.9930(1.2169) | Xent 0.5803(0.2475) | Xent Color 1.1236(0.6551) | Loss 5.5741(3.9394) | Error 0.2156(0.0782) | Error Color 0.4011(0.1007) |Steps 602(467.39) | Grad Norm 18.5798(20451.1492) | Total Time 0.00(0.00)\nIter 3340 | Time 12.5056(11.4567) | Bit/dim 1.9284(1.4116) | Xent 0.3478(0.2760) | Xent Color 0.7798(0.7549) | Loss 5.0710(4.2902) | Error 0.1078(0.0882) | Error Color 0.3233(0.1772) |Steps 524(489.54) | Grad Norm 4.3123(15083.7312) | Total Time 0.00(0.00)\nIter 3350 | Time 12.1846(11.7639) | Bit/dim 1.7462(1.5179) | Xent 0.2827(0.2788) | Xent Color 0.4569(0.7078) | Loss 4.6792(4.4234) | Error 0.0922(0.0891) | Error Color 0.1811(0.1904) |Steps 560(505.02) | Grad Norm 9.7637(11124.7679) | Total Time 0.00(0.00)\nIter 3360 | Time 11.9998(11.8867) | Bit/dim 1.6883(1.5688) | Xent 0.1925(0.2694) | Xent Color 0.2582(0.6126) | Loss 4.4252(4.4478) | Error 0.0567(0.0856) | Error Color 0.0778(0.1729) |Steps 548(514.01) | Grad Norm 4.2425(8204.8276) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0051 | Time 74.2080, Epoch Time 877.7962(740.7734), Bit/dim 1.6196(best: 0.9397), Xent 0.1455, Xent Color 0.1065. Loss 1.6826, Error 0.0443(best: 0.0275), Error Color 0.0135(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3370 | Time 12.0566(11.9904) | Bit/dim 1.5680(1.5817) | Xent 0.1847(0.2591) | Xent Color 0.1802(0.5098) | Loss 4.0838(5.0818) | Error 0.0622(0.0818) | Error Color 0.0522(0.1458) |Steps 560(522.91) | Grad Norm 2.2570(6051.2279) | Total Time 0.00(0.00)\nIter 3380 | Time 12.0005(11.9557) | Bit/dim 1.5211(1.5737) | Xent 0.1609(0.2457) | Xent Color 0.1256(0.4136) | Loss 3.9361(4.8207) | Error 0.0511(0.0783) | Error Color 0.0389(0.1179) |Steps 518(523.36) | Grad Norm 3.5226(4463.1148) | Total Time 0.00(0.00)\nIter 3390 | Time 12.0140(11.9219) | Bit/dim 1.4834(1.5530) | Xent 0.1907(0.2349) | Xent Color 0.1266(0.3390) | Loss 3.9115(4.5851) | Error 0.0700(0.0753) | Error Color 0.0322(0.0957) |Steps 530(523.09) | Grad Norm 4.0904(3292.2754) | Total Time 0.00(0.00)\nIter 3400 | Time 11.1763(11.8225) | Bit/dim 1.4375(1.5272) | Xent 0.1635(0.2257) | Xent Color 0.0860(0.2764) | Loss 3.7811(4.3819) | Error 0.0533(0.0729) | Error Color 0.0189(0.0767) |Steps 512(518.19) | Grad Norm 2.9146(2428.8246) | Total Time 0.00(0.00)\nIter 3410 | Time 10.5266(11.7425) | Bit/dim 1.3935(1.4961) | Xent 0.1404(0.2159) | Xent Color 0.1007(0.2269) | Loss 3.6348(4.2073) | Error 0.0478(0.0696) | Error Color 0.0267(0.0616) |Steps 488(514.96) | Grad Norm 5.3650(1791.9281) | Total Time 0.00(0.00)\nIter 3420 | Time 10.9844(11.6318) | Bit/dim 1.3736(1.4660) | Xent 0.2045(0.2108) | Xent Color 0.0733(0.1872) | Loss 3.6510(4.0635) | Error 0.0622(0.0672) | Error Color 0.0167(0.0499) |Steps 470(507.14) | Grad Norm 3.1664(1322.1187) | Total Time 0.00(0.00)\nIter 3430 | Time 11.9435(11.4294) | Bit/dim 1.3526(1.4360) | Xent 0.2144(0.2045) | Xent Color 0.0737(0.1596) | Loss 3.6653(3.9264) | Error 0.0644(0.0650) | Error Color 0.0189(0.0424) |Steps 518(499.09) | Grad Norm 7.8452(976.8924) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0052 | Time 69.2212, Epoch Time 852.0209(744.1108), Bit/dim 1.3288(best: 0.9397), Xent 0.1133, Xent Color 0.0280. Loss 1.3642, Error 0.0359(best: 0.0275), Error Color 0.0014(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3440 | Time 10.5240(11.2677) | Bit/dim 1.2885(1.4053) | Xent 0.1701(0.1979) | Xent Color 0.0726(0.1374) | Loss 3.4280(4.3340) | Error 0.0622(0.0632) | Error Color 0.0156(0.0359) |Steps 446(490.41) | Grad Norm 5.6523(721.9607) | Total Time 0.00(0.00)\nIter 3450 | Time 10.8449(11.1886) | Bit/dim 1.2833(1.3771) | Xent 0.1887(0.1936) | Xent Color 0.0558(0.1176) | Loss 3.3688(4.0985) | Error 0.0611(0.0616) | Error Color 0.0122(0.0301) |Steps 452(487.30) | Grad Norm 1.3953(533.7736) | Total Time 0.00(0.00)\nIter 3460 | Time 11.3564(11.1277) | Bit/dim 1.2720(1.3486) | Xent 0.1472(0.1904) | Xent Color 0.0699(0.1037) | Loss 3.4203(3.9106) | Error 0.0478(0.0603) | Error Color 0.0233(0.0265) |Steps 458(479.29) | Grad Norm 6.5839(395.2360) | Total Time 0.00(0.00)\nIter 3470 | Time 10.4613(11.0747) | Bit/dim 1.2447(1.3227) | Xent 0.1643(0.1874) | Xent Color 0.0712(0.0928) | Loss 3.2866(3.7511) | Error 0.0511(0.0595) | Error Color 0.0167(0.0234) |Steps 446(473.72) | Grad Norm 9.1661(293.2859) | Total Time 0.00(0.00)\nIter 3480 | Time 12.1524(10.9769) | Bit/dim 1.3034(1.3044) | Xent 0.3870(0.1941) | Xent Color 1.7725(0.1757) | Loss 4.3401(3.6792) | Error 0.1189(0.0617) | Error Color 0.4433(0.0491) |Steps 440(465.07) | Grad Norm 62.3594(225.1998) | Total Time 0.00(0.00)\nIter 3490 | Time 12.0924(11.0205) | Bit/dim 1.3149(1.3149) | Xent 0.2314(0.1959) | Xent Color 0.1760(0.2124) | Loss 3.6659(3.6810) | Error 0.0756(0.0620) | Error Color 0.0544(0.0665) |Steps 536(470.61) | Grad Norm 14.3821(171.4624) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0053 | Time 70.6044, Epoch Time 818.9796(746.3569), Bit/dim 1.2388(best: 0.9397), Xent 0.1170, Xent Color 0.0364. Loss 1.2772, Error 0.0362(best: 0.0275), Error Color 0.0023(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3500 | Time 11.6858(11.1584) | Bit/dim 1.2324(1.3020) | Xent 0.1790(0.1949) | Xent Color 0.0977(0.1889) | Loss 3.3947(4.2743) | Error 0.0611(0.0621) | Error Color 0.0256(0.0581) |Steps 464(477.81) | Grad Norm 5.9221(128.4060) | Total Time 0.00(0.00)\nIter 3510 | Time 11.1504(11.0814) | Bit/dim 1.1996(1.2798) | Xent 0.1823(0.1875) | Xent Color 0.0747(0.1598) | Loss 3.2904(4.0174) | Error 0.0589(0.0598) | Error Color 0.0211(0.0483) |Steps 494(475.08) | Grad Norm 3.8924(95.9343) | Total Time 0.00(0.00)\nIter 3520 | Time 10.3129(10.9419) | Bit/dim 1.1592(1.2541) | Xent 0.1757(0.1809) | Xent Color 0.0599(0.1342) | Loss 3.1495(3.7978) | Error 0.0600(0.0575) | Error Color 0.0089(0.0392) |Steps 452(469.01) | Grad Norm 2.6320(71.5475) | Total Time 0.00(0.00)\nIter 3530 | Time 10.7515(10.8691) | Bit/dim 1.1507(1.2273) | Xent 0.1369(0.1739) | Xent Color 0.0565(0.1143) | Loss 3.0604(3.6128) | Error 0.0433(0.0553) | Error Color 0.0156(0.0322) |Steps 434(461.34) | Grad Norm 1.6801(53.2821) | Total Time 0.00(0.00)\nIter 3540 | Time 10.5627(10.7441) | Bit/dim 1.1228(1.2017) | Xent 0.1582(0.1709) | Xent Color 0.0445(0.0974) | Loss 3.0362(3.4666) | Error 0.0500(0.0546) | Error Color 0.0067(0.0262) |Steps 446(457.12) | Grad Norm 1.7110(39.6987) | Total Time 0.00(0.00)\nIter 3550 | Time 10.6538(10.7325) | Bit/dim 1.1028(1.1788) | Xent 0.1637(0.1675) | Xent Color 0.0476(0.0846) | Loss 3.0433(3.3526) | Error 0.0544(0.0541) | Error Color 0.0089(0.0221) |Steps 464(453.58) | Grad Norm 1.4121(29.8419) | Total Time 0.00(0.00)\nIter 3560 | Time 10.3399(10.5977) | Bit/dim 1.0941(1.1571) | Xent 0.1539(0.1667) | Xent Color 0.0346(0.0731) | Loss 3.0282(3.2488) | Error 0.0489(0.0533) | Error Color 0.0067(0.0184) |Steps 446(449.29) | Grad Norm 3.1637(22.7407) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0054 | Time 64.1016, Epoch Time 784.2161(747.4927), Bit/dim 1.0794(best: 0.9397), Xent 0.0978, Xent Color 0.0130. Loss 1.1071, Error 0.0318(best: 0.0275), Error Color 0.0005(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3570 | Time 10.4994(10.4946) | Bit/dim 1.0719(1.1359) | Xent 0.1468(0.1640) | Xent Color 0.0426(0.0644) | Loss 2.8893(3.6622) | Error 0.0467(0.0525) | Error Color 0.0078(0.0158) |Steps 416(443.54) | Grad Norm 2.0843(17.4037) | Total Time 0.00(0.00)\nIter 3580 | Time 10.4748(10.4725) | Bit/dim 1.0534(1.1161) | Xent 0.2077(0.1630) | Xent Color 0.0304(0.0578) | Loss 2.9428(3.4614) | Error 0.0611(0.0517) | Error Color 0.0000(0.0135) |Steps 428(440.25) | Grad Norm 1.9345(13.4894) | Total Time 0.00(0.00)\nIter 3590 | Time 10.9252(10.4590) | Bit/dim 1.0500(1.0987) | Xent 0.1416(0.1607) | Xent Color 0.0433(0.0521) | Loss 2.9063(3.3107) | Error 0.0422(0.0503) | Error Color 0.0122(0.0119) |Steps 440(440.86) | Grad Norm 4.3560(10.5524) | Total Time 0.00(0.00)\nIter 3600 | Time 10.3601(10.4601) | Bit/dim 1.0361(1.0831) | Xent 0.1585(0.1601) | Xent Color 0.0400(0.0480) | Loss 2.8735(3.1913) | Error 0.0489(0.0497) | Error Color 0.0089(0.0107) |Steps 452(440.37) | Grad Norm 3.8851(8.6537) | Total Time 0.00(0.00)\nIter 3610 | Time 9.7622(10.4226) | Bit/dim 1.0274(1.0702) | Xent 0.1797(0.1611) | Xent Color 0.0304(0.0437) | Loss 2.8111(3.0945) | Error 0.0622(0.0502) | Error Color 0.0044(0.0095) |Steps 434(440.60) | Grad Norm 2.2262(7.3895) | Total Time 0.00(0.00)\nIter 3620 | Time 11.0030(10.4191) | Bit/dim 1.0338(1.0593) | Xent 0.1379(0.1574) | Xent Color 0.0300(0.0401) | Loss 2.8115(3.0243) | Error 0.0478(0.0489) | Error Color 0.0044(0.0082) |Steps 416(439.55) | Grad Norm 7.9139(6.6959) | Total Time 0.00(0.00)\nIter 3630 | Time 10.4749(10.3750) | Bit/dim 1.0101(1.0495) | Xent 0.1808(0.1566) | Xent Color 0.0269(0.0371) | Loss 2.8219(2.9656) | Error 0.0556(0.0491) | Error Color 0.0044(0.0075) |Steps 428(437.45) | Grad Norm 5.4955(5.9650) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0055 | Time 61.9616, Epoch Time 769.1950(748.1437), Bit/dim 1.0175(best: 0.9397), Xent 0.0885, Xent Color 0.0089. Loss 1.0419, Error 0.0287(best: 0.0275), Error Color 0.0004(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3640 | Time 10.4229(10.3508) | Bit/dim 0.9976(1.0385) | Xent 0.1401(0.1574) | Xent Color 0.0339(0.0348) | Loss 2.7262(3.3221) | Error 0.0433(0.0495) | Error Color 0.0078(0.0067) |Steps 416(435.75) | Grad Norm 1.6376(5.1961) | Total Time 0.00(0.00)\nIter 3650 | Time 10.0588(10.4122) | Bit/dim 1.0126(1.0311) | Xent 0.1894(0.1565) | Xent Color 0.0239(0.0328) | Loss 2.7918(3.1821) | Error 0.0544(0.0497) | Error Color 0.0022(0.0061) |Steps 434(433.92) | Grad Norm 2.9208(4.7835) | Total Time 0.00(0.00)\nIter 3660 | Time 10.4882(10.4413) | Bit/dim 0.9907(1.0230) | Xent 0.1142(0.1555) | Xent Color 0.0260(0.0319) | Loss 2.7837(3.0728) | Error 0.0400(0.0488) | Error Color 0.0056(0.0059) |Steps 446(433.41) | Grad Norm 1.8756(4.5870) | Total Time 0.00(0.00)\nIter 3670 | Time 10.4793(10.4818) | Bit/dim 0.9929(1.0169) | Xent 0.1397(0.1544) | Xent Color 0.0209(0.0306) | Loss 2.7527(2.9919) | Error 0.0478(0.0488) | Error Color 0.0022(0.0056) |Steps 380(431.13) | Grad Norm 3.0617(4.1896) | Total Time 0.00(0.00)\nIter 3680 | Time 9.8231(10.4785) | Bit/dim 0.9895(1.0093) | Xent 0.1360(0.1468) | Xent Color 0.0253(0.0296) | Loss 2.7055(2.9242) | Error 0.0433(0.0467) | Error Color 0.0089(0.0057) |Steps 440(430.44) | Grad Norm 4.0735(4.2251) | Total Time 0.00(0.00)\nIter 3690 | Time 10.3128(10.4342) | Bit/dim 0.9917(1.0036) | Xent 0.1819(0.1475) | Xent Color 0.0245(0.0283) | Loss 2.7499(2.8722) | Error 0.0556(0.0468) | Error Color 0.0022(0.0053) |Steps 416(430.22) | Grad Norm 3.3080(4.0151) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0056 | Time 63.3388, Epoch Time 775.8958(748.9763), Bit/dim 0.9811(best: 0.9397), Xent 0.0859, Xent Color 0.0066. Loss 1.0042, Error 0.0269(best: 0.0275), Error Color 0.0003(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3700 | Time 9.6396(10.4209) | Bit/dim 0.9774(0.9981) | Xent 0.1392(0.1460) | Xent Color 0.0226(0.0277) | Loss 2.6368(3.3352) | Error 0.0467(0.0475) | Error Color 0.0044(0.0052) |Steps 410(432.33) | Grad Norm 2.6000(4.1919) | Total Time 0.00(0.00)\nIter 3710 | Time 10.6041(10.4310) | Bit/dim 0.9858(0.9932) | Xent 0.1397(0.1444) | Xent Color 0.0203(0.0259) | Loss 2.7163(3.1743) | Error 0.0433(0.0465) | Error Color 0.0033(0.0046) |Steps 428(430.19) | Grad Norm 4.1839(4.1432) | Total Time 0.00(0.00)\nIter 3720 | Time 10.5802(10.3950) | Bit/dim 0.9736(0.9889) | Xent 0.1349(0.1466) | Xent Color 0.0254(0.0250) | Loss 2.7908(3.0533) | Error 0.0411(0.0464) | Error Color 0.0033(0.0044) |Steps 446(431.07) | Grad Norm 11.0706(4.8902) | Total Time 0.00(0.00)\nIter 3730 | Time 10.2228(10.3915) | Bit/dim 0.9624(0.9844) | Xent 0.1321(0.1428) | Xent Color 0.0235(0.0246) | Loss 2.6426(2.9541) | Error 0.0456(0.0454) | Error Color 0.0033(0.0042) |Steps 422(431.19) | Grad Norm 6.8351(5.4439) | Total Time 0.00(0.00)\nIter 3740 | Time 10.1589(10.3739) | Bit/dim 0.9672(0.9802) | Xent 0.1575(0.1419) | Xent Color 0.0198(0.0239) | Loss 2.6994(2.8840) | Error 0.0489(0.0454) | Error Color 0.0033(0.0041) |Steps 428(431.29) | Grad Norm 5.1485(5.7045) | Total Time 0.00(0.00)\nIter 3750 | Time 10.2240(10.3356) | Bit/dim 0.9671(0.9764) | Xent 0.1278(0.1375) | Xent Color 0.0199(0.0231) | Loss 2.7124(2.8325) | Error 0.0367(0.0442) | Error Color 0.0033(0.0039) |Steps 440(430.54) | Grad Norm 5.3458(5.7747) | Total Time 0.00(0.00)\nIter 3760 | Time 11.1958(10.3106) | Bit/dim 0.9551(0.9719) | Xent 0.1256(0.1354) | Xent Color 0.0190(0.0227) | Loss 2.6821(2.7882) | Error 0.0456(0.0438) | Error Color 0.0022(0.0039) |Steps 446(429.23) | Grad Norm 3.0156(5.6574) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0057 | Time 62.3839, Epoch Time 765.7905(749.4807), Bit/dim 0.9558(best: 0.9397), Xent 0.0808, Xent Color 0.0050. Loss 0.9773, Error 0.0258(best: 0.0269), Error Color 0.0002(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3770 | Time 9.8027(10.2923) | Bit/dim 0.9670(0.9679) | Xent 0.1116(0.1327) | Xent Color 0.0160(0.0215) | Loss 2.6583(3.2119) | Error 0.0367(0.0427) | Error Color 0.0044(0.0035) |Steps 422(430.16) | Grad Norm 3.7357(5.3542) | Total Time 0.00(0.00)\nIter 3780 | Time 10.5420(10.2561) | Bit/dim 0.9429(0.9630) | Xent 0.1284(0.1326) | Xent Color 0.0275(0.0209) | Loss 2.5919(3.0661) | Error 0.0378(0.0425) | Error Color 0.0044(0.0033) |Steps 434(430.22) | Grad Norm 8.8183(5.2837) | Total Time 0.00(0.00)\nIter 3790 | Time 10.1808(10.2586) | Bit/dim 0.9587(0.9613) | Xent 0.1132(0.1349) | Xent Color 0.0288(0.0210) | Loss 2.6165(2.9622) | Error 0.0356(0.0430) | Error Color 0.0056(0.0034) |Steps 422(430.23) | Grad Norm 11.0751(6.3930) | Total Time 0.00(0.00)\nIter 3800 | Time 9.7919(10.2413) | Bit/dim 0.9526(0.9580) | Xent 0.1377(0.1339) | Xent Color 0.0152(0.0202) | Loss 2.6161(2.8737) | Error 0.0389(0.0422) | Error Color 0.0011(0.0032) |Steps 416(425.94) | Grad Norm 7.7603(6.7672) | Total Time 0.00(0.00)\nIter 3810 | Time 10.1970(10.2660) | Bit/dim 0.9440(0.9547) | Xent 0.1307(0.1331) | Xent Color 0.0188(0.0198) | Loss 2.6716(2.8154) | Error 0.0333(0.0420) | Error Color 0.0022(0.0031) |Steps 428(426.63) | Grad Norm 6.2282(6.9896) | Total Time 0.00(0.00)\nIter 3820 | Time 10.1225(10.2331) | Bit/dim 0.9353(0.9519) | Xent 0.1015(0.1307) | Xent Color 0.0221(0.0198) | Loss 2.5539(2.7673) | Error 0.0356(0.0409) | Error Color 0.0044(0.0032) |Steps 416(424.99) | Grad Norm 9.1407(7.3750) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0058 | Time 64.1946, Epoch Time 760.5858(749.8139), Bit/dim 0.9598(best: 0.9397), Xent 0.0807, Xent Color 0.0153. Loss 0.9838, Error 0.0249(best: 0.0258), Error Color 0.0013(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3830 | Time 10.2165(10.2232) | Bit/dim 0.9619(0.9514) | Xent 0.1387(0.1326) | Xent Color 0.0166(0.0221) | Loss 2.7204(3.3024) | Error 0.0422(0.0416) | Error Color 0.0011(0.0040) |Steps 446(425.56) | Grad Norm 11.2609(8.5621) | Total Time 0.00(0.00)\nIter 3840 | Time 9.7978(10.1949) | Bit/dim 0.9343(0.9496) | Xent 0.0809(0.1309) | Xent Color 0.0211(0.0244) | Loss 2.6276(3.1347) | Error 0.0267(0.0408) | Error Color 0.0033(0.0050) |Steps 428(425.02) | Grad Norm 7.6154(9.3932) | Total Time 0.00(0.00)\nIter 3850 | Time 10.7020(10.2353) | Bit/dim 0.9447(0.9476) | Xent 0.1191(0.1303) | Xent Color 0.0154(0.0228) | Loss 2.6495(3.0104) | Error 0.0322(0.0399) | Error Color 0.0033(0.0045) |Steps 428(427.10) | Grad Norm 8.0136(9.4152) | Total Time 0.00(0.00)\nIter 3860 | Time 10.3541(10.2567) | Bit/dim 0.9273(0.9445) | Xent 0.1397(0.1318) | Xent Color 0.0152(0.0214) | Loss 2.6673(2.9103) | Error 0.0389(0.0397) | Error Color 0.0022(0.0040) |Steps 446(427.49) | Grad Norm 3.2285(8.8115) | Total Time 0.00(0.00)\nIter 3870 | Time 9.5984(10.2344) | Bit/dim 0.9304(0.9408) | Xent 0.0923(0.1286) | Xent Color 0.0114(0.0198) | Loss 2.5477(2.8325) | Error 0.0333(0.0393) | Error Color 0.0000(0.0035) |Steps 428(427.43) | Grad Norm 4.2072(8.2373) | Total Time 0.00(0.00)\nIter 3880 | Time 9.6286(10.2097) | Bit/dim 0.9156(0.9352) | Xent 0.1374(0.1306) | Xent Color 0.0170(0.0184) | Loss 2.5627(2.7681) | Error 0.0489(0.0404) | Error Color 0.0033(0.0031) |Steps 416(426.58) | Grad Norm 7.0760(7.3780) | Total Time 0.00(0.00)\nIter 3890 | Time 10.1302(10.2126) | Bit/dim 0.9224(0.9317) | Xent 0.1086(0.1291) | Xent Color 0.0112(0.0172) | Loss 2.5150(2.7213) | Error 0.0378(0.0402) | Error Color 0.0011(0.0027) |Steps 398(423.63) | Grad Norm 2.8011(7.2104) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0059 | Time 63.6394, Epoch Time 763.1483(750.2139), Bit/dim 0.9167(best: 0.9397), Xent 0.0743, Xent Color 0.0029. Loss 0.9359, Error 0.0236(best: 0.0249), Error Color 0.0000(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3900 | Time 10.0011(10.2395) | Bit/dim 0.9180(0.9282) | Xent 0.1420(0.1278) | Xent Color 0.0165(0.0166) | Loss 2.5812(3.1606) | Error 0.0411(0.0401) | Error Color 0.0011(0.0025) |Steps 422(427.40) | Grad Norm 12.5241(7.0922) | Total Time 0.00(0.00)\nIter 3910 | Time 10.2950(10.2179) | Bit/dim 0.9203(0.9263) | Xent 0.1280(0.1267) | Xent Color 0.0116(0.0163) | Loss 2.6571(3.0180) | Error 0.0367(0.0394) | Error Color 0.0011(0.0024) |Steps 410(426.70) | Grad Norm 3.7905(7.7577) | Total Time 0.00(0.00)\nIter 3920 | Time 10.7919(10.2038) | Bit/dim 0.9340(0.9248) | Xent 0.1392(0.1257) | Xent Color 0.0216(0.0167) | Loss 2.6318(2.9092) | Error 0.0533(0.0399) | Error Color 0.0022(0.0026) |Steps 434(427.84) | Grad Norm 13.2191(8.0687) | Total Time 0.00(0.00)\nIter 3930 | Time 10.2034(10.2249) | Bit/dim 0.9201(0.9228) | Xent 0.1284(0.1253) | Xent Color 0.0277(0.0168) | Loss 2.6109(2.8273) | Error 0.0489(0.0401) | Error Color 0.0067(0.0025) |Steps 422(427.32) | Grad Norm 10.5302(8.6332) | Total Time 0.00(0.00)\nIter 3940 | Time 10.3458(10.2727) | Bit/dim 0.9181(0.9214) | Xent 0.1284(0.1262) | Xent Color 0.0184(0.0177) | Loss 2.6110(2.7653) | Error 0.0356(0.0403) | Error Color 0.0022(0.0027) |Steps 410(426.25) | Grad Norm 10.5888(9.2557) | Total Time 0.00(0.00)\nIter 3950 | Time 9.9312(10.2592) | Bit/dim 0.9251(0.9190) | Xent 0.1107(0.1229) | Xent Color 0.0173(0.0170) | Loss 2.5769(2.7184) | Error 0.0400(0.0389) | Error Color 0.0022(0.0027) |Steps 404(424.61) | Grad Norm 10.2038(8.9391) | Total Time 0.00(0.00)\nIter 3960 | Time 10.4438(10.2878) | Bit/dim 0.9042(0.9161) | Xent 0.0928(0.1190) | Xent Color 0.0142(0.0168) | Loss 2.5650(2.6776) | Error 0.0300(0.0383) | Error Color 0.0011(0.0029) |Steps 434(426.04) | Grad Norm 7.3624(8.8840) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0060 | Time 64.3287, Epoch Time 763.5196(750.6131), Bit/dim 0.9080(best: 0.9167), Xent 0.0713, Xent Color 0.0025. Loss 0.9265, Error 0.0231(best: 0.0236), Error Color 0.0000(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 3970 | Time 9.9098(10.2967) | Bit/dim 0.9034(0.9136) | Xent 0.1106(0.1177) | Xent Color 0.0253(0.0165) | Loss 2.5951(3.0807) | Error 0.0411(0.0378) | Error Color 0.0067(0.0028) |Steps 428(426.24) | Grad Norm 12.2552(9.1293) | Total Time 0.00(0.00)\nIter 3980 | Time 10.0607(10.2862) | Bit/dim 0.8952(0.9114) | Xent 0.1203(0.1177) | Xent Color 0.0174(0.0159) | Loss 2.6122(2.9543) | Error 0.0389(0.0376) | Error Color 0.0033(0.0026) |Steps 434(428.30) | Grad Norm 8.7222(9.0709) | Total Time 0.00(0.00)\nIter 3990 | Time 9.9780(10.2427) | Bit/dim 0.9163(0.9107) | Xent 0.0942(0.1178) | Xent Color 0.0620(0.0184) | Loss 2.6509(2.8613) | Error 0.0322(0.0374) | Error Color 0.0200(0.0036) |Steps 434(428.80) | Grad Norm 19.7269(10.1676) | Total Time 0.00(0.00)\nIter 4000 | Time 10.2167(10.2858) | Bit/dim 0.9126(0.9103) | Xent 0.1132(0.1175) | Xent Color 0.0169(0.0179) | Loss 2.6041(2.7887) | Error 0.0333(0.0376) | Error Color 0.0033(0.0033) |Steps 452(429.76) | Grad Norm 11.2636(10.5177) | Total Time 0.00(0.00)\nIter 4010 | Time 9.9297(10.3093) | Bit/dim 0.9067(0.9074) | Xent 0.1283(0.1164) | Xent Color 0.0120(0.0172) | Loss 2.6023(2.7320) | Error 0.0422(0.0374) | Error Color 0.0033(0.0031) |Steps 434(430.90) | Grad Norm 7.6740(9.7399) | Total Time 0.00(0.00)\nIter 4020 | Time 10.0679(10.3174) | Bit/dim 0.9270(0.9051) | Xent 0.1069(0.1152) | Xent Color 0.1103(0.0200) | Loss 2.6593(2.6936) | Error 0.0344(0.0367) | Error Color 0.0433(0.0042) |Steps 404(431.28) | Grad Norm 39.6421(10.5757) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0061 | Time 75.3388, Epoch Time 783.4211(751.5973), Bit/dim 2.2663(best: 0.9080), Xent 1.6442, Xent Color 1.6166. Loss 3.0815, Error 0.4792(best: 0.0231), Error Color 0.5290(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4030 | Time 13.0602(10.7522) | Bit/dim 2.3469(1.2478) | Xent 0.7853(0.3852) | Xent Color 1.8542(1.5808) | Loss 6.5451(4.7666) | Error 0.2433(0.1148) | Error Color 0.5256(0.1626) |Steps 614(456.64) | Grad Norm 43.5064(36.6952) | Total Time 0.00(0.00)\nIter 4040 | Time 11.5646(11.1290) | Bit/dim 1.9834(1.4683) | Xent 0.5406(0.4450) | Xent Color 0.7042(1.3950) | Loss 5.2255(4.9630) | Error 0.1678(0.1368) | Error Color 0.2833(0.2035) |Steps 536(479.20) | Grad Norm 14.4918(32.6762) | Total Time 0.00(0.00)\nIter 4050 | Time 12.4259(11.4671) | Bit/dim 1.8232(1.5778) | Xent 0.3378(0.4176) | Xent Color 0.3621(1.1489) | Loss 4.7698(4.9413) | Error 0.1111(0.1290) | Error Color 0.1511(0.1967) |Steps 584(502.52) | Grad Norm 7.2378(26.5839) | Total Time 0.00(0.00)\nIter 4060 | Time 12.1982(11.7527) | Bit/dim 1.7114(1.6222) | Xent 0.2446(0.3783) | Xent Color 0.1806(0.9220) | Loss 4.3769(4.8305) | Error 0.0756(0.1171) | Error Color 0.0522(0.1710) |Steps 572(520.78) | Grad Norm 2.2878(21.7750) | Total Time 0.00(0.00)\nIter 4070 | Time 13.0160(12.0282) | Bit/dim 1.6638(1.6359) | Xent 0.2178(0.3422) | Xent Color 0.1465(0.7250) | Loss 4.3259(4.6976) | Error 0.0744(0.1066) | Error Color 0.0433(0.1399) |Steps 566(534.83) | Grad Norm 9.8532(17.7885) | Total Time 0.00(0.00)\nIter 4080 | Time 12.3015(12.1368) | Bit/dim 1.5621(1.6232) | Xent 0.1601(0.3075) | Xent Color 0.1323(0.5718) | Loss 4.0931(4.5583) | Error 0.0533(0.0962) | Error Color 0.0456(0.1133) |Steps 578(541.77) | Grad Norm 8.9148(15.0780) | Total Time 0.00(0.00)\nIter 4090 | Time 11.9137(12.1849) | Bit/dim 1.4915(1.5939) | Xent 0.2104(0.2834) | Xent Color 0.1086(0.4507) | Loss 3.9406(4.4086) | Error 0.0644(0.0892) | Error Color 0.0322(0.0910) |Steps 530(543.64) | Grad Norm 9.3690(12.6961) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0062 | Time 72.2232, Epoch Time 919.5928(756.6372), Bit/dim 1.4712(best: 0.9080), Xent 0.1228, Xent Color 0.0413. Loss 1.5123, Error 0.0415(best: 0.0231), Error Color 0.0019(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4100 | Time 12.5289(12.1758) | Bit/dim 1.4071(1.5554) | Xent 0.2143(0.2585) | Xent Color 0.0842(0.3597) | Loss 3.8367(4.8438) | Error 0.0644(0.0816) | Error Color 0.0111(0.0739) |Steps 536(541.31) | Grad Norm 4.6716(11.0612) | Total Time 0.00(0.00)\nIter 4110 | Time 11.8140(12.1509) | Bit/dim 1.3700(1.5103) | Xent 0.1753(0.2406) | Xent Color 0.1015(0.2907) | Loss 3.6905(4.5462) | Error 0.0622(0.0758) | Error Color 0.0267(0.0604) |Steps 512(536.23) | Grad Norm 9.2377(10.2293) | Total Time 0.00(0.00)\nIter 4120 | Time 11.2751(12.0387) | Bit/dim 1.3142(1.4669) | Xent 0.2255(0.2295) | Xent Color 0.1534(0.2389) | Loss 3.4760(4.2987) | Error 0.0711(0.0724) | Error Color 0.0533(0.0512) |Steps 488(526.09) | Grad Norm 30.2588(10.8551) | Total Time 0.00(0.00)\nIter 4130 | Time 14.1509(12.2205) | Bit/dim 1.4741(1.4674) | Xent 0.2382(0.2364) | Xent Color 0.4785(0.4842) | Loss 4.1201(4.3168) | Error 0.0733(0.0747) | Error Color 0.1767(0.1173) |Steps 578(533.07) | Grad Norm 11.8423(23.5550) | Total Time 0.00(0.00)\nIter 4140 | Time 11.8213(12.1367) | Bit/dim 1.4200(1.4653) | Xent 0.1946(0.2340) | Xent Color 0.2988(0.4681) | Loss 3.7912(4.2154) | Error 0.0600(0.0740) | Error Color 0.1056(0.1283) |Steps 470(524.22) | Grad Norm 6.2545(20.8490) | Total Time 0.00(0.00)\nIter 4150 | Time 11.7854(12.0718) | Bit/dim 1.3279(1.4359) | Xent 0.2018(0.2225) | Xent Color 0.1776(0.4085) | Loss 3.6127(4.0582) | Error 0.0778(0.0708) | Error Color 0.0544(0.1152) |Steps 506(519.62) | Grad Norm 6.8059(17.0435) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0063 | Time 69.7222, Epoch Time 887.7507(760.5706), Bit/dim 1.2819(best: 0.9080), Xent 0.1132, Xent Color 0.0652. Loss 1.3265, Error 0.0356(best: 0.0231), Error Color 0.0038(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4160 | Time 11.3275(12.0126) | Bit/dim 1.2792(1.3974) | Xent 0.2013(0.2149) | Xent Color 0.1195(0.3415) | Loss 3.3865(4.5049) | Error 0.0611(0.0686) | Error Color 0.0222(0.0959) |Steps 470(512.72) | Grad Norm 4.0013(14.1803) | Total Time 0.00(0.00)\nIter 4170 | Time 11.7934(11.9280) | Bit/dim 1.2146(1.3559) | Xent 0.1532(0.2074) | Xent Color 0.1127(0.2807) | Loss 3.2744(4.2019) | Error 0.0511(0.0662) | Error Color 0.0311(0.0779) |Steps 506(507.09) | Grad Norm 5.8378(11.9232) | Total Time 0.00(0.00)\nIter 4180 | Time 11.3756(11.8246) | Bit/dim 1.1735(1.3101) | Xent 0.1858(0.1985) | Xent Color 0.0649(0.2287) | Loss 3.2312(3.9448) | Error 0.0567(0.0633) | Error Color 0.0144(0.0623) |Steps 494(503.03) | Grad Norm 3.8928(9.8322) | Total Time 0.00(0.00)\nIter 4190 | Time 10.6993(11.6938) | Bit/dim 1.1316(1.2698) | Xent 0.1606(0.1882) | Xent Color 0.0712(0.1872) | Loss 3.1166(3.7414) | Error 0.0456(0.0599) | Error Color 0.0167(0.0496) |Steps 476(495.35) | Grad Norm 3.3916(8.2851) | Total Time 0.00(0.00)\nIter 4200 | Time 11.3703(11.5818) | Bit/dim 1.1095(1.2309) | Xent 0.1790(0.1831) | Xent Color 0.0545(0.1546) | Loss 3.1607(3.5747) | Error 0.0533(0.0585) | Error Color 0.0133(0.0402) |Steps 512(488.69) | Grad Norm 1.8221(7.1392) | Total Time 0.00(0.00)\nIter 4210 | Time 10.8935(11.4798) | Bit/dim 1.1051(1.1986) | Xent 0.1753(0.1795) | Xent Color 0.0498(0.1282) | Loss 3.1089(3.4489) | Error 0.0644(0.0579) | Error Color 0.0078(0.0324) |Steps 470(483.60) | Grad Norm 3.3441(6.1593) | Total Time 0.00(0.00)\nIter 4220 | Time 10.7786(11.4418) | Bit/dim 1.0710(1.1695) | Xent 0.1370(0.1737) | Xent Color 0.0532(0.1077) | Loss 2.9756(3.3364) | Error 0.0467(0.0556) | Error Color 0.0122(0.0264) |Steps 458(480.45) | Grad Norm 1.3586(4.9300) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0064 | Time 67.0232, Epoch Time 842.5922(763.0312), Bit/dim 1.0785(best: 0.9080), Xent 0.0966, Xent Color 0.0147. Loss 1.1063, Error 0.0310(best: 0.0231), Error Color 0.0005(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4230 | Time 11.3158(11.4209) | Bit/dim 1.0765(1.1444) | Xent 0.1905(0.1696) | Xent Color 0.0339(0.0917) | Loss 3.0567(3.7985) | Error 0.0511(0.0540) | Error Color 0.0056(0.0221) |Steps 488(476.68) | Grad Norm 4.0325(4.3387) | Total Time 0.00(0.00)\nIter 4240 | Time 11.7808(11.3837) | Bit/dim 1.0677(1.1240) | Xent 0.1168(0.1635) | Xent Color 0.0429(0.0783) | Loss 2.9649(3.5892) | Error 0.0433(0.0525) | Error Color 0.0056(0.0180) |Steps 500(477.72) | Grad Norm 1.7431(3.9788) | Total Time 0.00(0.00)\nIter 4250 | Time 10.8380(11.3375) | Bit/dim 1.0288(1.1048) | Xent 0.1346(0.1600) | Xent Color 0.0381(0.0685) | Loss 2.8681(3.4248) | Error 0.0433(0.0508) | Error Color 0.0067(0.0149) |Steps 440(475.95) | Grad Norm 3.8695(4.2578) | Total Time 0.00(0.00)\nIter 4260 | Time 11.0697(11.3801) | Bit/dim 1.0348(1.0873) | Xent 0.1274(0.1566) | Xent Color 0.0372(0.0608) | Loss 2.9160(3.2940) | Error 0.0444(0.0500) | Error Color 0.0067(0.0131) |Steps 458(474.68) | Grad Norm 3.2015(4.3710) | Total Time 0.00(0.00)\nIter 4270 | Time 11.2525(11.2997) | Bit/dim 1.0396(1.0736) | Xent 0.1684(0.1537) | Xent Color 0.0321(0.0535) | Loss 2.9128(3.1937) | Error 0.0544(0.0489) | Error Color 0.0067(0.0110) |Steps 452(472.12) | Grad Norm 2.5450(4.0373) | Total Time 0.00(0.00)\nIter 4280 | Time 10.9683(11.2572) | Bit/dim 1.0270(1.0614) | Xent 0.1650(0.1517) | Xent Color 0.0365(0.0487) | Loss 2.8877(3.1089) | Error 0.0433(0.0476) | Error Color 0.0067(0.0097) |Steps 446(469.46) | Grad Norm 2.8584(4.0711) | Total Time 0.00(0.00)\nIter 4290 | Time 10.6345(11.1760) | Bit/dim 1.0131(1.0508) | Xent 0.1444(0.1497) | Xent Color 0.0359(0.0446) | Loss 2.8433(3.0472) | Error 0.0422(0.0470) | Error Color 0.0078(0.0088) |Steps 482(469.75) | Grad Norm 5.8081(4.5880) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0065 | Time 68.1525, Epoch Time 829.6735(765.0305), Bit/dim 1.0153(best: 0.9080), Xent 0.0909, Xent Color 0.0099. Loss 1.0404, Error 0.0298(best: 0.0231), Error Color 0.0006(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4300 | Time 10.9345(11.1023) | Bit/dim 1.0179(1.0414) | Xent 0.1418(0.1501) | Xent Color 0.0342(0.0416) | Loss 2.8522(3.4516) | Error 0.0433(0.0467) | Error Color 0.0056(0.0082) |Steps 440(467.27) | Grad Norm 4.0146(5.0037) | Total Time 0.00(0.00)\nIter 4310 | Time 11.7497(11.1469) | Bit/dim 1.0122(1.0321) | Xent 0.1012(0.1469) | Xent Color 0.0254(0.0384) | Loss 2.8456(3.2917) | Error 0.0367(0.0462) | Error Color 0.0044(0.0073) |Steps 428(465.12) | Grad Norm 6.1178(5.0157) | Total Time 0.00(0.00)\nIter 4320 | Time 10.6128(11.1330) | Bit/dim 1.0071(1.0235) | Xent 0.1090(0.1442) | Xent Color 0.0264(0.0357) | Loss 2.7645(3.1673) | Error 0.0333(0.0448) | Error Color 0.0044(0.0066) |Steps 452(460.28) | Grad Norm 1.9250(4.6220) | Total Time 0.00(0.00)\nIter 4330 | Time 11.4873(11.1470) | Bit/dim 1.0044(1.0157) | Xent 0.1359(0.1409) | Xent Color 0.0278(0.0336) | Loss 2.8876(3.0756) | Error 0.0411(0.0438) | Error Color 0.0056(0.0062) |Steps 500(459.74) | Grad Norm 1.6360(4.4772) | Total Time 0.00(0.00)\nIter 4340 | Time 10.7984(11.0964) | Bit/dim 0.9900(1.0089) | Xent 0.1268(0.1405) | Xent Color 0.0217(0.0313) | Loss 2.7811(2.9994) | Error 0.0422(0.0441) | Error Color 0.0022(0.0057) |Steps 458(459.50) | Grad Norm 8.9695(4.6757) | Total Time 0.00(0.00)\nIter 4350 | Time 10.6590(11.0006) | Bit/dim 0.9624(1.0019) | Xent 0.1074(0.1383) | Xent Color 0.0322(0.0307) | Loss 2.7542(2.9377) | Error 0.0389(0.0432) | Error Color 0.0067(0.0055) |Steps 470(457.03) | Grad Norm 4.9809(4.7116) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0066 | Time 66.3550, Epoch Time 815.2879(766.5382), Bit/dim 0.9777(best: 0.9080), Xent 0.0839, Xent Color 0.0059. Loss 1.0001, Error 0.0272(best: 0.0231), Error Color 0.0000(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4360 | Time 10.7468(10.9712) | Bit/dim 0.9740(0.9953) | Xent 0.1326(0.1377) | Xent Color 0.0208(0.0287) | Loss 2.7810(3.4360) | Error 0.0411(0.0435) | Error Color 0.0044(0.0048) |Steps 446(454.94) | Grad Norm 3.8491(4.5719) | Total Time 0.00(0.00)\nIter 4370 | Time 10.0285(10.9054) | Bit/dim 0.9837(0.9898) | Xent 0.1414(0.1382) | Xent Color 0.0189(0.0273) | Loss 2.7233(3.2561) | Error 0.0422(0.0434) | Error Color 0.0011(0.0043) |Steps 452(454.90) | Grad Norm 5.4240(4.6667) | Total Time 0.00(0.00)\nIter 4380 | Time 11.3466(10.8847) | Bit/dim 0.9603(0.9842) | Xent 0.1314(0.1377) | Xent Color 0.0216(0.0266) | Loss 2.7727(3.1189) | Error 0.0356(0.0435) | Error Color 0.0022(0.0041) |Steps 470(452.48) | Grad Norm 4.0971(5.0131) | Total Time 0.00(0.00)\nIter 4400 | Time 10.1810(10.8125) | Bit/dim 0.9602(0.9746) | Xent 0.1433(0.1306) | Xent Color 0.0185(0.0238) | Loss 2.7112(2.9381) | Error 0.0456(0.0415) | Error Color 0.0011(0.0036) |Steps 446(449.13) | Grad Norm 6.5543(5.1072) | Total Time 0.00(0.00)\nIter 4410 | Time 11.4532(10.8133) | Bit/dim 0.9675(0.9717) | Xent 0.1501(0.1300) | Xent Color 0.0487(0.0245) | Loss 2.7909(2.8790) | Error 0.0478(0.0415) | Error Color 0.0122(0.0041) |Steps 482(450.22) | Grad Norm 23.6484(6.4219) | Total Time 0.00(0.00)\nIter 4420 | Time 12.0348(10.9460) | Bit/dim 1.5519(1.1056) | Xent 0.5189(0.1905) | Xent Color 0.2821(0.5186) | Loss 4.1580(3.3475) | Error 0.1678(0.0602) | Error Color 0.0900(0.0973) |Steps 506(456.70) | Grad Norm 17.1980(23.3241) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0067 | Time 72.4244, Epoch Time 814.9995(767.9921), Bit/dim 1.5478(best: 0.9080), Xent 0.1209, Xent Color 0.2538. Loss 1.6415, Error 0.0373(best: 0.0231), Error Color 0.0903(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4430 | Time 12.7597(11.3411) | Bit/dim 1.3768(1.2053) | Xent 0.2270(0.1923) | Xent Color 0.1895(0.4626) | Loss 3.8726(4.0582) | Error 0.0689(0.0610) | Error Color 0.0556(0.1008) |Steps 554(479.10) | Grad Norm 5.2862(19.2754) | Total Time 0.00(0.00)\nIter 4440 | Time 13.2707(11.7320) | Bit/dim 1.2048(1.2234) | Xent 0.1441(0.1963) | Xent Color 0.0809(0.3724) | Loss 3.4277(3.9371) | Error 0.0467(0.0629) | Error Color 0.0256(0.0835) |Steps 554(496.97) | Grad Norm 6.8881(15.7553) | Total Time 0.00(0.00)\nIter 4450 | Time 12.0369(11.8443) | Bit/dim 1.1016(1.2009) | Xent 0.1823(0.1866) | Xent Color 0.0689(0.2935) | Loss 3.1903(3.7545) | Error 0.0556(0.0596) | Error Color 0.0122(0.0659) |Steps 530(503.45) | Grad Norm 2.8424(12.7723) | Total Time 0.00(0.00)\nIter 4460 | Time 11.3261(11.8170) | Bit/dim 1.0613(1.1674) | Xent 0.1372(0.1742) | Xent Color 0.0561(0.2332) | Loss 2.9392(3.5670) | Error 0.0433(0.0558) | Error Color 0.0122(0.0520) |Steps 482(502.58) | Grad Norm 2.5452(10.2159) | Total Time 0.00(0.00)\nIter 4470 | Time 10.8695(11.7132) | Bit/dim 1.0307(1.1330) | Xent 0.1012(0.1635) | Xent Color 0.0487(0.1846) | Loss 2.9171(3.4106) | Error 0.0311(0.0520) | Error Color 0.0089(0.0404) |Steps 470(498.72) | Grad Norm 1.7279(8.1746) | Total Time 0.00(0.00)\nIter 4480 | Time 11.7239(11.6208) | Bit/dim 1.0024(1.1014) | Xent 0.1354(0.1585) | Xent Color 0.0409(0.1483) | Loss 2.8267(3.2722) | Error 0.0422(0.0502) | Error Color 0.0056(0.0321) |Steps 452(491.93) | Grad Norm 3.8098(6.8368) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0068 | Time 69.0079, Epoch Time 876.2288(771.2392), Bit/dim 0.9962(best: 0.9080), Xent 0.0792, Xent Color 0.0128. Loss 1.0192, Error 0.0250(best: 0.0231), Error Color 0.0005(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4490 | Time 10.5980(11.5114) | Bit/dim 1.0008(1.0753) | Xent 0.1433(0.1532) | Xent Color 0.0514(0.1208) | Loss 2.8222(3.7552) | Error 0.0444(0.0486) | Error Color 0.0089(0.0255) |Steps 476(487.91) | Grad Norm 2.9832(5.8148) | Total Time 0.00(0.00)\nIter 4500 | Time 10.9340(11.5133) | Bit/dim 1.0019(1.0532) | Xent 0.1183(0.1444) | Xent Color 0.0363(0.0992) | Loss 2.7675(3.5065) | Error 0.0444(0.0454) | Error Color 0.0044(0.0205) |Steps 482(486.58) | Grad Norm 3.0086(4.9348) | Total Time 0.00(0.00)\nIter 4510 | Time 11.2328(11.4946) | Bit/dim 0.9838(1.0344) | Xent 0.1326(0.1405) | Xent Color 0.0334(0.0824) | Loss 2.7720(3.3218) | Error 0.0444(0.0444) | Error Color 0.0067(0.0169) |Steps 452(482.14) | Grad Norm 1.8229(4.1758) | Total Time 0.00(0.00)\nIter 4520 | Time 11.5063(11.4605) | Bit/dim 0.9741(1.0184) | Xent 0.1390(0.1372) | Xent Color 0.0317(0.0693) | Loss 2.7473(3.1753) | Error 0.0333(0.0429) | Error Color 0.0044(0.0140) |Steps 470(478.96) | Grad Norm 2.1549(3.5949) | Total Time 0.00(0.00)\nIter 4530 | Time 11.8084(11.4513) | Bit/dim 0.9622(1.0043) | Xent 0.1078(0.1328) | Xent Color 0.0324(0.0593) | Loss 2.7280(3.0594) | Error 0.0322(0.0416) | Error Color 0.0089(0.0119) |Steps 476(476.75) | Grad Norm 2.2620(3.2129) | Total Time 0.00(0.00)\nIter 4540 | Time 11.4347(11.3788) | Bit/dim 0.9701(0.9934) | Xent 0.1134(0.1317) | Xent Color 0.0227(0.0515) | Loss 2.7050(2.9750) | Error 0.0322(0.0411) | Error Color 0.0011(0.0099) |Steps 488(475.74) | Grad Norm 4.0254(3.2858) | Total Time 0.00(0.00)\nIter 4550 | Time 11.3928(11.3700) | Bit/dim 0.9564(0.9844) | Xent 0.1421(0.1316) | Xent Color 0.0309(0.0462) | Loss 2.7125(2.9108) | Error 0.0411(0.0410) | Error Color 0.0056(0.0089) |Steps 440(472.17) | Grad Norm 2.3956(3.3462) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0069 | Time 65.7329, Epoch Time 837.9097(773.2393), Bit/dim 0.9547(best: 0.9080), Xent 0.0795, Xent Color 0.0082. Loss 0.9766, Error 0.0258(best: 0.0231), Error Color 0.0004(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4560 | Time 11.3289(11.3029) | Bit/dim 0.9504(0.9767) | Xent 0.1053(0.1287) | Xent Color 0.0282(0.0408) | Loss 2.6514(3.3575) | Error 0.0333(0.0401) | Error Color 0.0044(0.0077) |Steps 440(469.83) | Grad Norm 2.6407(3.1781) | Total Time 0.00(0.00)\nIter 4570 | Time 10.5585(11.3317) | Bit/dim 0.9406(0.9698) | Xent 0.1413(0.1285) | Xent Color 0.0277(0.0369) | Loss 2.6857(3.1870) | Error 0.0422(0.0399) | Error Color 0.0044(0.0068) |Steps 458(470.18) | Grad Norm 3.3248(3.1493) | Total Time 0.00(0.00)\nIter 4580 | Time 11.0509(11.3217) | Bit/dim 0.9479(0.9643) | Xent 0.1004(0.1257) | Xent Color 0.0224(0.0336) | Loss 2.5985(3.0546) | Error 0.0333(0.0391) | Error Color 0.0044(0.0061) |Steps 482(470.05) | Grad Norm 2.4012(3.0381) | Total Time 0.00(0.00)\nIter 4590 | Time 11.7037(11.3058) | Bit/dim 0.9350(0.9588) | Xent 0.1339(0.1267) | Xent Color 0.0308(0.0313) | Loss 2.7106(2.9566) | Error 0.0400(0.0400) | Error Color 0.0067(0.0057) |Steps 446(470.05) | Grad Norm 7.3741(3.1742) | Total Time 0.00(0.00)\nIter 4600 | Time 11.6375(11.2933) | Bit/dim 0.9404(0.9540) | Xent 0.1090(0.1237) | Xent Color 0.0395(0.0298) | Loss 2.6727(2.8851) | Error 0.0344(0.0390) | Error Color 0.0167(0.0056) |Steps 482(471.93) | Grad Norm 11.1740(3.9338) | Total Time 0.00(0.00)\nIter 4610 | Time 11.1336(11.2705) | Bit/dim 0.9279(0.9508) | Xent 0.1052(0.1219) | Xent Color 0.0251(0.0277) | Loss 2.6848(2.8373) | Error 0.0333(0.0384) | Error Color 0.0056(0.0051) |Steps 452(471.97) | Grad Norm 5.2054(4.3754) | Total Time 0.00(0.00)\nIter 4620 | Time 11.7781(11.3257) | Bit/dim 0.9336(0.9461) | Xent 0.1209(0.1219) | Xent Color 0.0193(0.0262) | Loss 2.6545(2.7924) | Error 0.0422(0.0385) | Error Color 0.0033(0.0048) |Steps 458(470.85) | Grad Norm 4.2293(4.0046) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0070 | Time 66.2768, Epoch Time 834.8327(775.0871), Bit/dim 0.9327(best: 0.9080), Xent 0.0741, Xent Color 0.0062. Loss 0.9528, Error 0.0234(best: 0.0231), Error Color 0.0004(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4630 | Time 11.5168(11.3046) | Bit/dim 0.9219(0.9420) | Xent 0.1014(0.1193) | Xent Color 0.0175(0.0252) | Loss 2.6590(3.2070) | Error 0.0267(0.0371) | Error Color 0.0022(0.0047) |Steps 452(468.73) | Grad Norm 2.9576(3.7813) | Total Time 0.00(0.00)\nIter 4640 | Time 11.7715(11.3167) | Bit/dim 0.9236(0.9382) | Xent 0.0893(0.1171) | Xent Color 0.0247(0.0244) | Loss 2.6487(3.0582) | Error 0.0311(0.0369) | Error Color 0.0022(0.0043) |Steps 500(465.38) | Grad Norm 5.5701(3.8985) | Total Time 0.00(0.00)\nIter 4650 | Time 11.2355(11.2397) | Bit/dim 0.9362(0.9359) | Xent 0.1217(0.1171) | Xent Color 0.0266(0.0234) | Loss 2.6962(2.9461) | Error 0.0378(0.0366) | Error Color 0.0078(0.0041) |Steps 458(464.33) | Grad Norm 9.9564(4.9054) | Total Time 0.00(0.00)\nIter 4660 | Time 11.7525(11.2300) | Bit/dim 0.9241(0.9329) | Xent 0.1513(0.1174) | Xent Color 0.0223(0.0224) | Loss 2.7113(2.8642) | Error 0.0467(0.0363) | Error Color 0.0067(0.0041) |Steps 476(462.91) | Grad Norm 4.1602(4.9107) | Total Time 0.00(0.00)\nIter 4670 | Time 11.2572(11.2325) | Bit/dim 0.9074(0.9294) | Xent 0.1162(0.1156) | Xent Color 0.0221(0.0213) | Loss 2.6181(2.7965) | Error 0.0367(0.0357) | Error Color 0.0056(0.0038) |Steps 464(462.04) | Grad Norm 6.0508(4.7545) | Total Time 0.00(0.00)\nIter 4680 | Time 10.6520(11.2070) | Bit/dim 0.9182(0.9264) | Xent 0.1252(0.1177) | Xent Color 0.0157(0.0207) | Loss 2.6537(2.7545) | Error 0.0389(0.0364) | Error Color 0.0033(0.0037) |Steps 446(463.07) | Grad Norm 1.9537(5.1452) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0071 | Time 66.7659, Epoch Time 826.6961(776.6353), Bit/dim 0.9151(best: 0.9080), Xent 0.0696, Xent Color 0.0040. Loss 0.9335, Error 0.0221(best: 0.0231), Error Color 0.0000(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4690 | Time 10.8511(11.1863) | Bit/dim 0.9190(0.9243) | Xent 0.1296(0.1195) | Xent Color 0.0213(0.0203) | Loss 2.5723(3.2509) | Error 0.0433(0.0370) | Error Color 0.0033(0.0037) |Steps 458(462.66) | Grad Norm 8.9644(5.5918) | Total Time 0.00(0.00)\nIter 4700 | Time 11.2497(11.1719) | Bit/dim 0.9079(0.9219) | Xent 0.1144(0.1166) | Xent Color 0.0277(0.0200) | Loss 2.6076(3.0841) | Error 0.0378(0.0365) | Error Color 0.0067(0.0035) |Steps 440(461.39) | Grad Norm 9.5699(6.0804) | Total Time 0.00(0.00)\nIter 4710 | Time 11.0571(11.1118) | Bit/dim 0.9212(0.9206) | Xent 0.0986(0.1162) | Xent Color 0.0186(0.0206) | Loss 2.6227(2.9574) | Error 0.0344(0.0365) | Error Color 0.0022(0.0036) |Steps 440(456.17) | Grad Norm 14.2705(7.7395) | Total Time 0.00(0.00)\nIter 4720 | Time 11.1768(11.0820) | Bit/dim 0.9167(0.9197) | Xent 0.1404(0.1149) | Xent Color 0.0262(0.0205) | Loss 2.6139(2.8659) | Error 0.0456(0.0367) | Error Color 0.0033(0.0034) |Steps 440(456.94) | Grad Norm 12.5807(8.5553) | Total Time 0.00(0.00)\nIter 4730 | Time 11.9478(11.0933) | Bit/dim 0.9285(0.9218) | Xent 0.1158(0.1153) | Xent Color 0.0378(0.0255) | Loss 2.6953(2.8062) | Error 0.0378(0.0367) | Error Color 0.0100(0.0053) |Steps 512(454.80) | Grad Norm 19.7461(11.4250) | Total Time 0.00(0.00)\nIter 4740 | Time 10.8897(11.0597) | Bit/dim 0.9415(0.9242) | Xent 0.1105(0.1148) | Xent Color 0.0450(0.0314) | Loss 2.6511(2.7704) | Error 0.0333(0.0367) | Error Color 0.0144(0.0077) |Steps 470(454.33) | Grad Norm 28.7228(14.7613) | Total Time 0.00(0.00)\nIter 4750 | Time 10.8620(11.0153) | Bit/dim 0.9124(0.9231) | Xent 0.1101(0.1119) | Xent Color 0.0235(0.0291) | Loss 2.6050(2.7284) | Error 0.0367(0.0353) | Error Color 0.0044(0.0069) |Steps 434(454.80) | Grad Norm 10.7070(14.2929) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0072 | Time 66.3359, Epoch Time 817.1167(777.8498), Bit/dim 0.9106(best: 0.9080), Xent 0.0723, Xent Color 0.0038. Loss 0.9296, Error 0.0237(best: 0.0221), Error Color 0.0001(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4760 | Time 11.6926(11.0365) | Bit/dim 0.9135(0.9196) | Xent 0.0959(0.1122) | Xent Color 0.0143(0.0252) | Loss 2.6178(3.1622) | Error 0.0356(0.0358) | Error Color 0.0022(0.0055) |Steps 476(452.76) | Grad Norm 6.6925(12.4702) | Total Time 0.00(0.00)\nIter 4770 | Time 10.5181(11.0248) | Bit/dim 0.9102(0.9156) | Xent 0.1130(0.1083) | Xent Color 0.0202(0.0230) | Loss 2.5731(3.0152) | Error 0.0300(0.0346) | Error Color 0.0044(0.0048) |Steps 452(454.85) | Grad Norm 6.3041(11.1132) | Total Time 0.00(0.00)\nIter 4780 | Time 11.1290(11.0975) | Bit/dim 0.8957(0.9120) | Xent 0.1102(0.1093) | Xent Color 0.0152(0.0207) | Loss 2.5628(2.9087) | Error 0.0333(0.0349) | Error Color 0.0033(0.0041) |Steps 476(454.90) | Grad Norm 5.1985(9.6237) | Total Time 0.00(0.00)\nIter 4790 | Time 10.8751(11.0430) | Bit/dim 0.8972(0.9088) | Xent 0.1391(0.1084) | Xent Color 0.0160(0.0197) | Loss 2.5630(2.8161) | Error 0.0444(0.0342) | Error Color 0.0033(0.0039) |Steps 488(451.34) | Grad Norm 3.1934(8.7157) | Total Time 0.00(0.00)\nIter 4800 | Time 10.9269(11.0048) | Bit/dim 0.8969(0.9044) | Xent 0.1029(0.1076) | Xent Color 0.0183(0.0189) | Loss 2.5906(2.7500) | Error 0.0311(0.0343) | Error Color 0.0044(0.0038) |Steps 434(451.27) | Grad Norm 5.5558(7.8922) | Total Time 0.00(0.00)\nIter 4810 | Time 10.5343(10.9960) | Bit/dim 0.8953(0.9011) | Xent 0.0944(0.1062) | Xent Color 0.0118(0.0173) | Loss 2.4820(2.6963) | Error 0.0289(0.0337) | Error Color 0.0011(0.0032) |Steps 434(454.38) | Grad Norm 2.0089(6.8728) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0073 | Time 64.7044, Epoch Time 815.4135(778.9767), Bit/dim 0.8892(best: 0.9080), Xent 0.0671, Xent Color 0.0028. Loss 0.9067, Error 0.0210(best: 0.0221), Error Color 0.0002(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4820 | Time 10.7092(11.0217) | Bit/dim 0.8936(0.8981) | Xent 0.0865(0.1049) | Xent Color 0.0105(0.0164) | Loss 2.5488(3.2218) | Error 0.0322(0.0334) | Error Color 0.0000(0.0027) |Steps 440(454.99) | Grad Norm 5.3356(6.2989) | Total Time 0.00(0.00)\nIter 4830 | Time 12.0769(11.0452) | Bit/dim 0.8867(0.8954) | Xent 0.0964(0.1043) | Xent Color 0.0140(0.0155) | Loss 2.5820(3.0475) | Error 0.0400(0.0342) | Error Color 0.0011(0.0025) |Steps 506(455.00) | Grad Norm 7.7008(6.0849) | Total Time 0.00(0.00)\nIter 4840 | Time 10.6606(11.0252) | Bit/dim 0.8879(0.8942) | Xent 0.0883(0.1047) | Xent Color 0.0138(0.0149) | Loss 2.5217(2.9185) | Error 0.0300(0.0340) | Error Color 0.0022(0.0024) |Steps 446(453.33) | Grad Norm 8.3886(6.8207) | Total Time 0.00(0.00)\nIter 4850 | Time 10.3349(11.0234) | Bit/dim 0.8885(0.8921) | Xent 0.0996(0.1040) | Xent Color 0.0114(0.0145) | Loss 2.5555(2.8211) | Error 0.0378(0.0338) | Error Color 0.0022(0.0023) |Steps 440(450.77) | Grad Norm 6.0562(7.4238) | Total Time 0.00(0.00)\nIter 4860 | Time 10.4748(11.0193) | Bit/dim 0.8792(0.8893) | Xent 0.1390(0.1052) | Xent Color 0.0120(0.0138) | Loss 2.5516(2.7432) | Error 0.0533(0.0338) | Error Color 0.0011(0.0019) |Steps 440(445.28) | Grad Norm 3.3728(6.9072) | Total Time 0.00(0.00)\nIter 4870 | Time 10.7824(10.9779) | Bit/dim 0.8740(0.8875) | Xent 0.1238(0.1061) | Xent Color 0.0128(0.0138) | Loss 2.4965(2.6904) | Error 0.0400(0.0337) | Error Color 0.0011(0.0020) |Steps 422(442.12) | Grad Norm 8.6185(7.2318) | Total Time 0.00(0.00)\nIter 4880 | Time 10.8104(10.9238) | Bit/dim 0.8793(0.8846) | Xent 0.1039(0.1049) | Xent Color 0.0081(0.0133) | Loss 2.5372(2.6430) | Error 0.0289(0.0331) | Error Color 0.0011(0.0019) |Steps 452(443.22) | Grad Norm 2.4485(6.4766) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0074 | Time 63.6873, Epoch Time 809.2891(779.8861), Bit/dim 0.8942(best: 0.8892), Xent 0.0624, Xent Color 0.0047. Loss 0.9110, Error 0.0209(best: 0.0210), Error Color 0.0005(best: 0.0000)\n===> Using batch size 900. Total 66 iterations/epoch.\nIter 4890 | Time 10.6669(10.8854) | Bit/dim 0.8729(0.8848) | Xent 0.1104(0.1031) | Xent Color 0.0148(0.0140) | Loss 2.5325(3.0945) | Error 0.0322(0.0324) | Error Color 0.0022(0.0021) |Steps 446(442.35) | Grad Norm 6.9647(7.9128) | Total Time 0.00(0.00)\nIter 4900 | Time 10.2333(10.8478) | Bit/dim 0.8686(0.8832) | Xent 0.1032(0.1034) | Xent Color 0.0135(0.0137) | Loss 2.4645(2.9455) | Error 0.0367(0.0324) | Error Color 0.0022(0.0018) |Steps 434(444.96) | Grad Norm 9.5204(8.3229) | Total Time 0.00(0.00)\nIter 4910 | Time 10.3570(10.8855) | Bit/dim 0.8703(0.8824) | Xent 0.1156(0.1030) | Xent Color 0.0141(0.0137) | Loss 2.4807(2.8347) | Error 0.0300(0.0322) | Error Color 0.0022(0.0020) |Steps 440(443.71) | Grad Norm 6.1625(8.9185) | Total Time 0.00(0.00)\nIter 4920 | Time 10.7328(10.8409) | Bit/dim 0.8727(0.8811) | Xent 0.1061(0.1045) | Xent Color 0.0093(0.0145) | Loss 2.5145(2.7575) | Error 0.0322(0.0323) | Error Color 0.0011(0.0023) |Steps 458(446.47) | Grad Norm 5.7268(10.0351) | Total Time 0.00(0.00)\nIter 4930 | Time 11.2225(10.8717) | Bit/dim 0.8772(0.8787) | Xent 0.1192(0.1036) | Xent Color 0.0156(0.0139) | Loss 2.5363(2.6922) | Error 0.0322(0.0319) | Error Color 0.0033(0.0021) |Steps 422(444.01) | Grad Norm 10.3617(9.7026) | Total Time 0.00(0.00)\nIter 4940 | Time 11.1679(10.8871) | Bit/dim 0.9120(0.8816) | Xent 0.0787(0.1025) | Xent Color 0.1628(0.0213) | Loss 2.6559(2.6576) | Error 0.0267(0.0318) | Error Color 0.0622(0.0052) |Steps 440(443.77) | Grad Norm 50.7377(13.1521) | Total Time 0.00(0.00)\nIter 4950 | Time 16.6078(11.8831) | Bit/dim 2.2892(1.2317) | Xent 1.0228(0.5160) | Xent Color 1.3565(1.1235) | Loss 6.4887(4.0077) | Error 0.3256(0.1387) | Error Color 0.4989(0.1512) |Steps 692(480.00) | Grad Norm 13.3803(36.6409) | Total Time 0.00(0.00)\nvalidating...\nEpoch 0075 | Time 90.9583, Epoch Time 864.9465(782.4379), Bit/dim 2.3095(best: 0.8892), Xent 0.5704, Xent Color 0.8185. Loss 2.6567, Error 0.1754(best: 0.0209), Error Color 0.3454(best: 0.0000)\n"
]
]
] | [
"code"
] | [
[
"code",
"code"
]
] |
d0c9c4ccb7ed3825074a09804975658f4a7b2ef2 | 3,830 | ipynb | Jupyter Notebook | 2021-22/Code_11_LanguageModels/_b_ANN_FeedforwardNN.ipynb | ranieri-unimi/notes-ferrara-2022 | 505736d6492d30f63e39b76f688bc028fecda056 | [
"MIT"
] | null | null | null | 2021-22/Code_11_LanguageModels/_b_ANN_FeedforwardNN.ipynb | ranieri-unimi/notes-ferrara-2022 | 505736d6492d30f63e39b76f688bc028fecda056 | [
"MIT"
] | null | null | null | 2021-22/Code_11_LanguageModels/_b_ANN_FeedforwardNN.ipynb | ranieri-unimi/notes-ferrara-2022 | 505736d6492d30f63e39b76f688bc028fecda056 | [
"MIT"
] | null | null | null | 26.232877 | 90 | 0.497128 | [
[
[
"# FEEDFORWARD NEURAL NETWORK\n#---------------------------------------------------\nimport numpy as np\nf = lambda x: 1.0/(1.0 + np.exp(-x)) # activation function (use sigmoid)\nx = np.array([[-1], [1], [1]]) # random input vector of three numbers (3x1)\n\nW1 = np.random.uniform(-0.5, 0.5, 12).reshape(4, 3)\nb1 = np.random.uniform(-0.05, 0.05, 4).reshape(4, 1)\nW2 = np.random.uniform(-0.5, 0.5, 16).reshape(4, 4)\nb2 = np.random.uniform(-0.05, 0.05, 4).reshape(4, 1)\nW3 = np.random.uniform(-0.5, 0.5, 4).reshape(1, 4)\n\nprint(x)",
"[[-1]\n [ 1]\n [ 1]]\n"
],
[
"# Feedforward Neural Networks\nh1 = f(np.dot(W1, x) + b1) # calculate first hidden layer activations (4x1)\nh2 = f(np.dot(W2, h1) + b2) # calculate second hidden layer activations (4x1)\nout = np.dot(W3, h2) # output neuron (1x1)",
"_____no_output_____"
],
[
"# Feedforward Neural Networks\n#Check the Activation\nif out>0:\n print(\"Activated\")\nelse:\n print(\"Not Activated\")",
"Not Activated\n"
],
[
"import numpy as np\nfor i in range(0, 10):\n f = lambda x: 1.0/(1.0 + np.exp(-x)) # activation function (use sigmoid)\n x = np.array([[0], [0], [0]]) # if is set to 0 everything depend by the bias\n W1 = np.random.uniform(-0.5, 0.5, 12).reshape(4, 3)\n b1 = np.random.uniform(-0.05, 0.05, 4).reshape(4, 1)\n W2 = np.random.uniform(-0.5, 0.5, 16).reshape(4, 4)\n b2 = np.random.uniform(-0.05, 0.05, 4).reshape(4, 1)\n W3 = np.random.uniform(-0.5, 0.5, 4).reshape(1, 4)\n # Feedforward Neural Networks\n h1 = f(np.dot(W1, x) + b1) # calculate first hidden layer activations (4x1)\n h2 = f(np.dot(W2, h1) + b2) # calculate second hidden layer activations (4x1)\n out = np.dot(W3, h2) # output neuron (1x1)\n # Feedforward Neural Networks\n #Check the Activation\n if out>0:\n print(\"Activated\")\n else:\n print(\"Not Activated\")",
"Not Activated\nNot Activated\nActivated\nActivated\nNot Activated\nNot Activated\nNot Activated\nActivated\nActivated\nNot Activated\n"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code"
]
] |
d0c9c6e284c6bc9a3019ee13a1a3e110bf751c40 | 21,983 | ipynb | Jupyter Notebook | site/en-snapshot/hub/tutorials/tf2_text_classification.ipynb | rapsealk/docs-l10n | e549cdcd84620fe4ac8571cff38628cb5e4d745b | [
"Apache-2.0"
] | null | null | null | site/en-snapshot/hub/tutorials/tf2_text_classification.ipynb | rapsealk/docs-l10n | e549cdcd84620fe4ac8571cff38628cb5e4d745b | [
"Apache-2.0"
] | null | null | null | site/en-snapshot/hub/tutorials/tf2_text_classification.ipynb | rapsealk/docs-l10n | e549cdcd84620fe4ac8571cff38628cb5e4d745b | [
"Apache-2.0"
] | null | null | null | 39.185383 | 429 | 0.571715 | [
[
[
"##### Copyright 2019 The TensorFlow Hub Authors.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");",
"_____no_output_____"
]
],
[
[
"# Copyright 2019 The TensorFlow Hub Authors. All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n# ==============================================================================",
"_____no_output_____"
],
[
"#@title MIT License\n#\n# Copyright (c) 2017 François Chollet\n#\n# Permission is hereby granted, free of charge, to any person obtaining a\n# copy of this software and associated documentation files (the \"Software\"),\n# to deal in the Software without restriction, including without limitation\n# the rights to use, copy, modify, merge, publish, distribute, sublicense,\n# and/or sell copies of the Software, and to permit persons to whom the\n# Software is furnished to do so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in\n# all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\n# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n# DEALINGS IN THE SOFTWARE.",
"_____no_output_____"
]
],
[
[
"# Text Classification with Movie Reviews",
"_____no_output_____"
],
[
"<table class=\"tfo-notebook-buttons\" align=\"left\">\n <td>\n <a target=\"_blank\" href=\"https://www.tensorflow.org/hub/tutorials/tf2_text_classification\"><img src=\"https://www.tensorflow.org/images/tf_logo_32px.png\" />View on TensorFlow.org</a>\n </td>\n <td>\n <a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/hub/blob/master/examples/colab/tf2_text_classification.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\" />Run in Google Colab</a>\n </td>\n <td>\n <a target=\"_blank\" href=\"https://github.com/tensorflow/hub/blob/master/examples/colab/tf2_text_classification.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\" />View source on GitHub</a>\n </td>\n <td>\n <a href=\"https://storage.googleapis.com/tensorflow_docs/hub/examples/colab/tf2_text_classification.ipynb\"><img src=\"https://www.tensorflow.org/images/download_logo_32px.png\" />Download notebook</a>\n </td>\n</table>",
"_____no_output_____"
],
[
"This notebook classifies movie reviews as *positive* or *negative* using the text of the review. This is an example of *binary*—or two-class—classification, an important and widely applicable kind of machine learning problem. \n\nWe'll use the [IMDB dataset](https://www.tensorflow.org/api_docs/python/tf/keras/datasets/imdb) that contains the text of 50,000 movie reviews from the [Internet Movie Database](https://www.imdb.com/). These are split into 25,000 reviews for training and 25,000 reviews for testing. The training and testing sets are *balanced*, meaning they contain an equal number of positive and negative reviews. \n\nThis notebook uses [tf.keras](https://www.tensorflow.org/guide/keras), a high-level API to build and train models in TensorFlow, and [TensorFlow Hub](https://www.tensorflow.org/hub), a library and platform for transfer learning. For a more advanced text classification tutorial using `tf.keras`, see the [MLCC Text Classification Guide](https://developers.google.com/machine-learning/guides/text-classification/).",
"_____no_output_____"
],
[
"## Setup",
"_____no_output_____"
]
],
[
[
"import numpy as np\n\nimport tensorflow as tf\nimport tensorflow_hub as hub\nimport tensorflow_datasets as tfds\n\nimport matplotlib.pyplot as plt\n\nprint(\"Version: \", tf.__version__)\nprint(\"Eager mode: \", tf.executing_eagerly())\nprint(\"Hub version: \", hub.__version__)\nprint(\"GPU is\", \"available\" if tf.config.list_physical_devices('GPU') else \"NOT AVAILABLE\")",
"_____no_output_____"
]
],
[
[
"## Download the IMDB dataset\n\nThe IMDB dataset is available on [TensorFlow datasets](https://github.com/tensorflow/datasets). The following code downloads the IMDB dataset to your machine (or the colab runtime):",
"_____no_output_____"
]
],
[
[
"train_data, test_data = tfds.load(name=\"imdb_reviews\", split=[\"train\", \"test\"], \n batch_size=-1, as_supervised=True)\n\ntrain_examples, train_labels = tfds.as_numpy(train_data)\ntest_examples, test_labels = tfds.as_numpy(test_data)",
"_____no_output_____"
]
],
[
[
"## Explore the data \n\nLet's take a moment to understand the format of the data. Each example is a sentence representing the movie review and a corresponding label. The sentence is not preprocessed in any way. The label is an integer value of either 0 or 1, where 0 is a negative review, and 1 is a positive review.",
"_____no_output_____"
]
],
[
[
"print(\"Training entries: {}, test entries: {}\".format(len(train_examples), len(test_examples)))",
"_____no_output_____"
]
],
[
[
"Let's print first 10 examples.",
"_____no_output_____"
]
],
[
[
"train_examples[:10]",
"_____no_output_____"
]
],
[
[
"Let's also print the first 10 labels.",
"_____no_output_____"
]
],
[
[
"train_labels[:10]",
"_____no_output_____"
]
],
[
[
"## Build the model\n\nThe neural network is created by stacking layers—this requires three main architectural decisions:\n\n* How to represent the text?\n* How many layers to use in the model?\n* How many *hidden units* to use for each layer?\n\nIn this example, the input data consists of sentences. The labels to predict are either 0 or 1.\n\nOne way to represent the text is to convert sentences into embeddings vectors. We can use a pre-trained text embedding as the first layer, which will have two advantages:\n* we don't have to worry about text preprocessing,\n* we can benefit from transfer learning.\n\nFor this example we will use a model from [TensorFlow Hub](https://www.tensorflow.org/hub) called [google/tf2-preview/gnews-swivel-20dim/1](https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1).\n\nThere are three other models to test for the sake of this tutorial:\n* [google/tf2-preview/gnews-swivel-20dim-with-oov/1](https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim-with-oov/1) - same as [google/tf2-preview/gnews-swivel-20dim/1](https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1), but with 2.5% vocabulary converted to OOV buckets. This can help if vocabulary of the task and vocabulary of the model don't fully overlap.\n* [google/tf2-preview/nnlm-en-dim50/1](https://tfhub.dev/google/tf2-preview/nnlm-en-dim50/1) - A much larger model with ~1M vocabulary size and 50 dimensions.\n* [google/tf2-preview/nnlm-en-dim128/1](https://tfhub.dev/google/tf2-preview/nnlm-en-dim128/1) - Even larger model with ~1M vocabulary size and 128 dimensions.",
"_____no_output_____"
],
[
"Let's first create a Keras layer that uses a TensorFlow Hub model to embed the sentences, and try it out on a couple of input examples. Note that the output shape of the produced embeddings is a expected: `(num_examples, embedding_dimension)`.",
"_____no_output_____"
]
],
[
[
"model = \"https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1\"\nhub_layer = hub.KerasLayer(model, output_shape=[20], input_shape=[], \n dtype=tf.string, trainable=True)\nhub_layer(train_examples[:3])",
"_____no_output_____"
]
],
[
[
"Let's now build the full model:",
"_____no_output_____"
]
],
[
[
"model = tf.keras.Sequential()\nmodel.add(hub_layer)\nmodel.add(tf.keras.layers.Dense(16, activation='relu'))\nmodel.add(tf.keras.layers.Dense(1))\n\nmodel.summary()",
"_____no_output_____"
]
],
[
[
"The layers are stacked sequentially to build the classifier:\n\n1. The first layer is a TensorFlow Hub layer. This layer uses a pre-trained Saved Model to map a sentence into its embedding vector. The model that we are using ([google/tf2-preview/gnews-swivel-20dim/1](https://tfhub.dev/google/tf2-preview/gnews-swivel-20dim/1)) splits the sentence into tokens, embeds each token and then combines the embedding. The resulting dimensions are: `(num_examples, embedding_dimension)`.\n2. This fixed-length output vector is piped through a fully-connected (`Dense`) layer with 16 hidden units.\n3. The last layer is densely connected with a single output node. This outputs logits: the log-odds of the true class, according to the model.",
"_____no_output_____"
],
[
"### Hidden units\n\nThe above model has two intermediate or \"hidden\" layers, between the input and output. The number of outputs (units, nodes, or neurons) is the dimension of the representational space for the layer. In other words, the amount of freedom the network is allowed when learning an internal representation.\n\nIf a model has more hidden units (a higher-dimensional representation space), and/or more layers, then the network can learn more complex representations. However, it makes the network more computationally expensive and may lead to learning unwanted patterns—patterns that improve performance on training data but not on the test data. This is called *overfitting*, and we'll explore it later.",
"_____no_output_____"
],
[
"### Loss function and optimizer\n\nA model needs a loss function and an optimizer for training. Since this is a binary classification problem and the model outputs a probability (a single-unit layer with a sigmoid activation), we'll use the `binary_crossentropy` loss function. \n\nThis isn't the only choice for a loss function, you could, for instance, choose `mean_squared_error`. But, generally, `binary_crossentropy` is better for dealing with probabilities—it measures the \"distance\" between probability distributions, or in our case, between the ground-truth distribution and the predictions.\n\nLater, when we are exploring regression problems (say, to predict the price of a house), we will see how to use another loss function called mean squared error.\n\nNow, configure the model to use an optimizer and a loss function:",
"_____no_output_____"
]
],
[
[
"model.compile(optimizer='adam',\n loss=tf.losses.BinaryCrossentropy(from_logits=True),\n metrics=[tf.metrics.BinaryAccuracy(threshold=0.0, name='accuracy')])",
"_____no_output_____"
]
],
[
[
"## Create a validation set\n\nWhen training, we want to check the accuracy of the model on data it hasn't seen before. Create a *validation set* by setting apart 10,000 examples from the original training data. (Why not use the testing set now? Our goal is to develop and tune our model using only the training data, then use the test data just once to evaluate our accuracy).",
"_____no_output_____"
]
],
[
[
"x_val = train_examples[:10000]\npartial_x_train = train_examples[10000:]\n\ny_val = train_labels[:10000]\npartial_y_train = train_labels[10000:]",
"_____no_output_____"
]
],
[
[
"## Train the model\n\nTrain the model for 40 epochs in mini-batches of 512 samples. This is 40 iterations over all samples in the `x_train` and `y_train` tensors. While training, monitor the model's loss and accuracy on the 10,000 samples from the validation set:",
"_____no_output_____"
]
],
[
[
"history = model.fit(partial_x_train,\n partial_y_train,\n epochs=40,\n batch_size=512,\n validation_data=(x_val, y_val),\n verbose=1)",
"_____no_output_____"
]
],
[
[
"## Evaluate the model\n\nAnd let's see how the model performs. Two values will be returned. Loss (a number which represents our error, lower values are better), and accuracy.",
"_____no_output_____"
]
],
[
[
"results = model.evaluate(test_data, test_labels)\n\nprint(results)",
"_____no_output_____"
]
],
[
[
"This fairly naive approach achieves an accuracy of about 87%. With more advanced approaches, the model should get closer to 95%.",
"_____no_output_____"
],
[
"## Create a graph of accuracy and loss over time\n\n`model.fit()` returns a `History` object that contains a dictionary with everything that happened during training:",
"_____no_output_____"
]
],
[
[
"history_dict = history.history\nhistory_dict.keys()",
"_____no_output_____"
]
],
[
[
"There are four entries: one for each monitored metric during training and validation. We can use these to plot the training and validation loss for comparison, as well as the training and validation accuracy:",
"_____no_output_____"
]
],
[
[
"acc = history_dict['accuracy']\nval_acc = history_dict['val_accuracy']\nloss = history_dict['loss']\nval_loss = history_dict['val_loss']\n\nepochs = range(1, len(acc) + 1)\n\n# \"bo\" is for \"blue dot\"\nplt.plot(epochs, loss, 'bo', label='Training loss')\n# b is for \"solid blue line\"\nplt.plot(epochs, val_loss, 'b', label='Validation loss')\nplt.title('Training and validation loss')\nplt.xlabel('Epochs')\nplt.ylabel('Loss')\nplt.legend()\n\nplt.show()",
"_____no_output_____"
],
[
"plt.clf() # clear figure\n\nplt.plot(epochs, acc, 'bo', label='Training acc')\nplt.plot(epochs, val_acc, 'b', label='Validation acc')\nplt.title('Training and validation accuracy')\nplt.xlabel('Epochs')\nplt.ylabel('Accuracy')\nplt.legend()\n\nplt.show()",
"_____no_output_____"
]
],
[
[
"In this plot, the dots represent the training loss and accuracy, and the solid lines are the validation loss and accuracy.\n\nNotice the training loss *decreases* with each epoch and the training accuracy *increases* with each epoch. This is expected when using a gradient descent optimization—it should minimize the desired quantity on every iteration.\n\nThis isn't the case for the validation loss and accuracy—they seem to peak after about twenty epochs. This is an example of overfitting: the model performs better on the training data than it does on data it has never seen before. After this point, the model over-optimizes and learns representations *specific* to the training data that do not *generalize* to test data.\n\nFor this particular case, we could prevent overfitting by simply stopping the training after twenty or so epochs. Later, you'll see how to do this automatically with a callback.",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0c9cba54fc66fa48df19ad71d80abfc64294095 | 10,112 | ipynb | Jupyter Notebook | notebooks/cross_validation_grouping.ipynb | mehrdad-dev/scikit-learn-mooc | 9c03fb14784ab447a2477039c07f8e8a0d191742 | [
"CC-BY-4.0"
] | null | null | null | notebooks/cross_validation_grouping.ipynb | mehrdad-dev/scikit-learn-mooc | 9c03fb14784ab447a2477039c07f8e8a0d191742 | [
"CC-BY-4.0"
] | null | null | null | notebooks/cross_validation_grouping.ipynb | mehrdad-dev/scikit-learn-mooc | 9c03fb14784ab447a2477039c07f8e8a0d191742 | [
"CC-BY-4.0"
] | null | null | null | 29.310145 | 86 | 0.589498 | [
[
[
"# Sample grouping\nWe are going to linger into the concept of sample groups. As in the previous\nsection, we will give an example to highlight some surprising results. This\ntime, we will use the handwritten digits dataset.",
"_____no_output_____"
]
],
[
[
"from sklearn.datasets import load_digits\n\ndigits = load_digits()\ndata, target = digits.data, digits.target",
"_____no_output_____"
]
],
[
[
"We will recreate the same model used in the previous exercise:\na logistic regression classifier with preprocessor to scale the data.",
"_____no_output_____"
]
],
[
[
"from sklearn.preprocessing import StandardScaler\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.pipeline import make_pipeline\n\nmodel = make_pipeline(StandardScaler(), LogisticRegression())",
"_____no_output_____"
]
],
[
[
"We will use the same baseline model. We will use a `KFold` cross-validation\nwithout shuffling the data at first.",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import cross_val_score, KFold\n\ncv = KFold(shuffle=False)\ntest_score_no_shuffling = cross_val_score(model, data, target, cv=cv,\n n_jobs=-1)\nprint(f\"The average accuracy is \"\n f\"{test_score_no_shuffling.mean():.3f} +/- \"\n f\"{test_score_no_shuffling.std():.3f}\")",
"_____no_output_____"
]
],
[
[
"Now, let's repeat the experiment by shuffling the data within the\ncross-validation.",
"_____no_output_____"
]
],
[
[
"cv = KFold(shuffle=True)\ntest_score_with_shuffling = cross_val_score(model, data, target, cv=cv,\n n_jobs=-1)\nprint(f\"The average accuracy is \"\n f\"{test_score_with_shuffling.mean():.3f} +/- \"\n f\"{test_score_with_shuffling.std():.3f}\")",
"_____no_output_____"
]
],
[
[
"We observe that shuffling the data improves the mean accuracy.\nWe could go a little further and plot the distribution of the testing\nscore. We can first concatenate the test scores.",
"_____no_output_____"
]
],
[
[
"import pandas as pd\n\nall_scores = pd.DataFrame(\n [test_score_no_shuffling, test_score_with_shuffling],\n index=[\"KFold without shuffling\", \"KFold with shuffling\"],\n).T",
"_____no_output_____"
]
],
[
[
"Let's plot the distribution now.",
"_____no_output_____"
]
],
[
[
"import matplotlib.pyplot as plt\nimport seaborn as sns\n\nall_scores.plot.hist(bins=10, edgecolor=\"black\", density=True, alpha=0.7)\nplt.xlim([0.8, 1.0])\nplt.xlabel(\"Accuracy score\")\nplt.legend(bbox_to_anchor=(1.05, 0.8), loc=\"upper left\")\n_ = plt.title(\"Distribution of the test scores\")",
"_____no_output_____"
]
],
[
[
"The cross-validation testing error that uses the shuffling has less\nvariance than the one that does not impose any shuffling. It means that some\nspecific fold leads to a low score in this case.",
"_____no_output_____"
]
],
[
[
"print(test_score_no_shuffling)",
"_____no_output_____"
]
],
[
[
"Thus, there is an underlying structure in the data that shuffling will break\nand get better results. To get a better understanding, we should read the\ndocumentation shipped with the dataset.",
"_____no_output_____"
]
],
[
[
"print(digits.DESCR)",
"_____no_output_____"
]
],
[
[
"If we read carefully, 13 writers wrote the digits of our dataset, accounting\nfor a total amount of 1797 samples. Thus, a writer wrote several times the\nsame numbers. Let's suppose that the writer samples are grouped.\nSubsequently, not shuffling the data will keep all writer samples together\neither in the training or the testing sets. Mixing the data will break this\nstructure, and therefore digits written by the same writer will be available\nin both the training and testing sets.\n\nBesides, a writer will usually tend to write digits in the same manner. Thus,\nour model will learn to identify a writer's pattern for each digit instead of\nrecognizing the digit itself.\n\nWe can solve this problem by ensuring that the data associated with a writer\nshould either belong to the training or the testing set. Thus, we want to\ngroup samples for each writer.\n\nHere, we will manually define the group for the 13 writers.",
"_____no_output_____"
]
],
[
[
"from itertools import count\nimport numpy as np\n\n# defines the lower and upper bounds of sample indices\n# for each writer\nwriter_boundaries = [0, 130, 256, 386, 516, 646, 776, 915, 1029,\n 1157, 1287, 1415, 1545, 1667, 1797]\ngroups = np.zeros_like(target)\nlower_bounds = writer_boundaries[:-1]\nupper_bounds = writer_boundaries[1:]\n\nfor group_id, lb, up in zip(count(), lower_bounds, upper_bounds):\n groups[lb:up] = group_id",
"_____no_output_____"
]
],
[
[
"We can check the grouping by plotting the indices linked to writer ids.",
"_____no_output_____"
]
],
[
[
"plt.plot(groups)\nplt.yticks(np.unique(groups))\nplt.xticks(writer_boundaries, rotation=90)\nplt.xlabel(\"Target index\")\nplt.ylabel(\"Writer index\")\n_ = plt.title(\"Underlying writer groups existing in the target\")",
"_____no_output_____"
]
],
[
[
"Once we group the digits by writer, we can use cross-validation to take this\ninformation into account: the class containing `Group` should be used.",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import GroupKFold\n\ncv = GroupKFold()\ntest_score = cross_val_score(model, data, target, groups=groups, cv=cv,\n n_jobs=-1)\nprint(f\"The average accuracy is \"\n f\"{test_score.mean():.3f} +/- \"\n f\"{test_score.std():.3f}\")",
"_____no_output_____"
]
],
[
[
"We see that this strategy is less optimistic regarding the model statistical\nperformance. However, this is the most reliable if our goal is to make\nhandwritten digits recognition writers independent. Besides, we can as well\nsee that the standard deviation was reduced.",
"_____no_output_____"
]
],
[
[
"all_scores = pd.DataFrame(\n [test_score_no_shuffling, test_score_with_shuffling, test_score],\n index=[\"KFold without shuffling\", \"KFold with shuffling\",\n \"KFold with groups\"],\n).T",
"_____no_output_____"
],
[
"all_scores.plot.hist(bins=10, edgecolor=\"black\", density=True, alpha=0.7)\nplt.xlim([0.8, 1.0])\nplt.xlabel(\"Accuracy score\")\nplt.legend(bbox_to_anchor=(1.05, 0.8), loc=\"upper left\")\n_ = plt.title(\"Distribution of the test scores\")",
"_____no_output_____"
]
],
[
[
"As a conclusion, it is really important to take any sample grouping pattern\ninto account when evaluating a model. Otherwise, the results obtained will\nbe over-optimistic in regards with reality.",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0c9cebf4a2b54d5bdbb45f174ede2c80aabcb07 | 82,154 | ipynb | Jupyter Notebook | uniform_to_normal_distribution.ipynb | mberneti/statistic | ec6f77d3b50400e0da83f5418e42df36476af808 | [
"MIT"
] | null | null | null | uniform_to_normal_distribution.ipynb | mberneti/statistic | ec6f77d3b50400e0da83f5418e42df36476af808 | [
"MIT"
] | null | null | null | uniform_to_normal_distribution.ipynb | mberneti/statistic | ec6f77d3b50400e0da83f5418e42df36476af808 | [
"MIT"
] | null | null | null | 507.123457 | 45,012 | 0.945712 | [
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib import pyplot as plt\nimport random\nfrom numba import njit, prange, cuda\nimport math",
"_____no_output_____"
],
[
"@njit\ndef uniform_samples(n=10000):\n samples=[]\n for i in range (0, n):\n samples.append(random.random())\n return samples;\n\nu_samples = uniform_samples()\n\nplt.figure(figsize=(9, 5))\n\nplt.hlines(y=1, xmin=0, xmax=1, colors='r',zorder=3, lw=1, label=\"PDF\") # f(x)=1/a+b\nplt.hist(u_samples,alpha=.9, rwidth=0.9, bins=20, density=True, label=\"uniform distribution bins:20\")\n\nhistogram, bins = np.histogram(u_samples,bins=100,density=True)\nbin_centers = 0.5*(bins[1:] + bins[:-1])\nplt.plot(bin_centers, histogram, color='black',alpha=.5, label=\"uniform distribution bins:100\")\n\n\nplt.legend()\nplt.show()",
"_____no_output_____"
],
[
"@njit\ndef u_samples_sum(n=10000):\n total=0\n for i in range (0, n):\n total+=random.random()\n return total;\n\n@njit\ndef get_normal_samples(n=10000):\n samples=[]\n total=0\n for i in range (0, n):\n uniform_sample_total = u_samples_sum()\n samples.append(uniform_sample_total)\n total+=uniform_sample_total\n return samples,total;\n\ndef get_mu_std(normal_samples,total,n):\n mu = total/n\n std =math.sqrt(1/n * sum(pow(x-mu,2) for x in normal_samples))\n return mu,std;\n\n#mu: mean, std: standard di\ndef get_normal_pdf(mu,std):\n pi = math.pi\n e = math.e\n sqrt = math.sqrt\n return lambda x:(1/(std*sqrt(2*pi))) * pow(e,(-1/2)*(pow((x-mu)/std,2)));\n\nn = 10000\n\nnormal_samples,total = get_normal_samples(n)\n\nmu,std = get_mu_std(normal_samples,total,n)\n\npdf = get_normal_pdf(mu,std)\n\nplt.figure(figsize=(9, 5))\n\nplt.hist(normal_samples,rwidth=0.9, bins=20,density=True, label=\"normal distribution bins:20\")\n\nhistogram, bins = np.histogram(normal_samples,bins=500,density=True)\nbin_centers = 0.5*(bins[1:] + bins[:-1])\nplt.plot(bin_centers, histogram,color='black',alpha=.4, label=\"normal distribution bins:500\")\n\npdf_normal_samples=[pdf(x) for x in bin_centers]\n\nplt.plot(bin_centers, pdf_normal_samples,color='red',alpha=1, label=\"normal PDF\")\n\n\nplt.legend()\nplt.show()",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code"
]
] |
d0c9cf5b49cf890543826b5028eb8b1bb564e622 | 7,958 | ipynb | Jupyter Notebook | osmnx-examples/14-osmnx-to-igraph.ipynb | w3labkr/ipynb-gis | 1070d9a55a4e323028ccab94dfbc4d4b3b9ec867 | [
"MIT"
] | null | null | null | osmnx-examples/14-osmnx-to-igraph.ipynb | w3labkr/ipynb-gis | 1070d9a55a4e323028ccab94dfbc4d4b3b9ec867 | [
"MIT"
] | null | null | null | osmnx-examples/14-osmnx-to-igraph.ipynb | w3labkr/ipynb-gis | 1070d9a55a4e323028ccab94dfbc4d4b3b9ec867 | [
"MIT"
] | null | null | null | 24.946708 | 532 | 0.558557 | [
[
[
"# OSMnx + igraph for faster performance\n\nAuthor: [Geoff Boeing](https://geoffboeing.com/)\n\nNetworkX is ubiquitous, easy to use, and sufficiently fast for most use cases. But it can be slow for analyzing very large graphs because it is pure Python, trading off speed for ease of use. Fortunately, converting OSMnx-created NetworkX graphs to other graph libraries' types is relatively quick and simple and makes analysis much faster for those use cases where it's needed. For example, you might consider converting your NetworkX graph to igraph, graph-tool, or cugraph for analysis. This example demonstrates igraph.\n\nFirst install [igraph](https://igraph.org/python/) or run Jupyter from the [Docker container](https://hub.docker.com/r/gboeing/osmnx) (which already has it installed along with OSMnx and NetworkX).\n\n - [Overview of OSMnx](http://geoffboeing.com/2016/11/osmnx-python-street-networks/)\n - [GitHub repo](https://github.com/gboeing/osmnx)\n - [Examples, demos, tutorials](https://github.com/gboeing/osmnx-examples)\n - [Documentation](https://osmnx.readthedocs.io/en/stable/)\n - [Journal article/citation](http://geoffboeing.com/publications/osmnx-complex-street-networks/)",
"_____no_output_____"
]
],
[
[
"import operator\n\nimport igraph as ig\nimport networkx as nx\nimport numpy as np\nimport osmnx as ox\n\n%matplotlib inline\nox.config(use_cache=True, log_console=False)\nprint(ox.__version__)\nprint(ig.__version__)\n\nweight = \"length\"",
"1.1.2\n0.9.9\n"
]
],
[
[
"## Construct graphs",
"_____no_output_____"
]
],
[
[
"# create networkx graph\nG_nx = ox.graph_from_place(\"Piedmont, CA, USA\", network_type=\"drive\")\nosmids = list(G_nx.nodes)\nG_nx = nx.relabel.convert_node_labels_to_integers(G_nx)\n\n# give each node its original osmid as attribute since we relabeled them\nosmid_values = {k: v for k, v in zip(G_nx.nodes, osmids)}\nnx.set_node_attributes(G_nx, osmid_values, \"osmid\")",
"/Users/junhyun/.pyenv/versions/3.8.5/envs/openstreetmap/lib/python3.8/site-packages/osmnx/geocoder.py:110: FutureWarning: The frame.append method is deprecated and will be removed from pandas in a future version. Use pandas.concat instead.\n gdf = gdf.append(_geocode_query_to_gdf(q, wr, by_osmid))\n"
],
[
"%%time\n# convert networkx graph to igraph\nG_ig = ig.Graph(directed=True)\nG_ig.add_vertices(G_nx.nodes)\nG_ig.add_edges(G_nx.edges())\nG_ig.vs[\"osmid\"] = osmids\nG_ig.es[weight] = list(nx.get_edge_attributes(G_nx, weight).values())",
"CPU times: user 1.56 ms, sys: 27 µs, total: 1.59 ms\nWall time: 1.6 ms\n"
],
[
"assert len(G_nx.nodes()) == G_ig.vcount()\nassert len(G_nx.edges()) == G_ig.ecount()",
"_____no_output_____"
]
],
[
[
"## Shortest paths",
"_____no_output_____"
]
],
[
[
"source = list(G_nx.nodes())[0]\ntarget = list(G_nx.nodes())[-1]",
"_____no_output_____"
],
[
"%%time\npath1 = G_ig.get_shortest_paths(v=source, to=target, weights=weight)[0]",
"CPU times: user 168 µs, sys: 19 µs, total: 187 µs\nWall time: 193 µs\n"
],
[
"%%time\npath2 = nx.shortest_path(G_nx, source, target, weight=weight)",
"CPU times: user 543 µs, sys: 1 µs, total: 544 µs\nWall time: 549 µs\n"
],
[
"assert path1 == path2",
"_____no_output_____"
],
[
"%%time\npath_length1 = G_ig.shortest_paths(source=source, target=target, weights=weight)[0][0]",
"CPU times: user 106 µs, sys: 13 µs, total: 119 µs\nWall time: 122 µs\n"
],
[
"%%time\npath_length2 = nx.shortest_path_length(G_nx, source, target, weight)",
"CPU times: user 482 µs, sys: 0 ns, total: 482 µs\nWall time: 485 µs\n"
],
[
"assert path_length1 == path_length2",
"_____no_output_____"
]
],
[
[
"## Centrality analysis",
"_____no_output_____"
]
],
[
[
"%%time\ncloseness1 = G_ig.closeness(vertices=None, mode=\"ALL\", cutoff=None, weights=weight, normalized=True)\nmax_closeness1 = np.argmax(closeness1)",
"CPU times: user 10.3 ms, sys: 259 µs, total: 10.6 ms\nWall time: 10.6 ms\n"
],
[
"%%time\ncloseness2 = nx.closeness_centrality(G_nx, distance=weight, wf_improved=True)\nmax_closeness2 = max(closeness2.items(), key=operator.itemgetter(1))[0]",
"CPU times: user 573 ms, sys: 7.44 ms, total: 580 ms\nWall time: 587 ms\n"
],
[
"# confirm same node has max closeness in both graphs\nassert G_nx.nodes[max_closeness2][\"osmid\"] == G_ig.vs[max_closeness1][\"osmid\"]",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
] |
d0c9da1524ece38595e23be76f6db1737edc6601 | 146,277 | ipynb | Jupyter Notebook | tf data API.ipynb | harnalashok/deeplearning-sequences | 4880dfb46608c1fab4aa6da64047e8ffd6a34941 | [
"Apache-2.0"
] | null | null | null | tf data API.ipynb | harnalashok/deeplearning-sequences | 4880dfb46608c1fab4aa6da64047e8ffd6a34941 | [
"Apache-2.0"
] | null | null | null | tf data API.ipynb | harnalashok/deeplearning-sequences | 4880dfb46608c1fab4aa6da64047e8ffd6a34941 | [
"Apache-2.0"
] | 1 | 2021-11-22T08:02:44.000Z | 2021-11-22T08:02:44.000Z | 49.301314 | 33,307 | 0.617042 | [
[
[
"<a href=\"https://colab.research.google.com/github/harnalashok/deeplearning-sequences/blob/main/tf%20data%20API.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
]
],
[
[
"#Last amended: 12th March, 2021\r\n# My folder: harnalashok/github/deeplearning-sequences\r\n# References:\r\n# https://www.tensorflow.org/tutorials/text/text_classification_rnn\r\n# https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/guide/data.ipynb#scrollTo=m5bz7R1xhX1f\r\n# https://stackoverflow.com/a/49579995/3282777\r\n# https://www.tensorflow.org/tutorials/load_data/text\r\n\r\n# Objectives:\r\n# i) Learning to work with tensors\r\n# ii) Learning to work with tf.data API\r\n# iii) Text Classification--Work in progess",
"_____no_output_____"
],
[
"# 1.0 Call libraries\r\nimport numpy as np\r\nimport tensorflow_datasets as tfds\r\nimport tensorflow as tf\r\nimport matplotlib.pyplot as plt\r\nimport os",
"_____no_output_____"
],
[
"# 1.1 More libraries\r\nfrom tensorflow.keras import utils\r\nfrom tensorflow.keras import preprocessing\r\nfrom tensorflow.keras.layers.experimental.preprocessing import TextVectorization\r\n",
"_____no_output_____"
],
[
"# 1.2 Set numpy decimal printoptions\r\n# Limit display to precision of 3\r\n\r\nnp.set_printoptions(precision=3)",
"_____no_output_____"
],
[
"# 1.3\r\nfrom IPython.core.interactiveshell import InteractiveShell\r\nInteractiveShell.ast_node_interactivity = \"all\"",
"_____no_output_____"
]
],
[
[
"# Introduction to tensors\r\nRefer this [page](https://www.tensorflow.org/guide/tensor)\r\n\r\nTensors are (kind of) like np.arrays. All tensors are immutable like Python numbers and strings: you can never update the contents of a tensor, only create a new one. \r\nRank in tensor is akin to dimensions in numpy.",
"_____no_output_____"
],
[
"### Basics",
"_____no_output_____"
]
],
[
[
"# 2.0 Rank 0\r\n# A \"scalar\" or \"rank-0\" tensor . \r\n# A scalar contains a single value,\r\n# and no \"axes\".\r\n\r\nprint( tf.constant(4))",
"tf.Tensor(4, shape=(), dtype=int32)\n"
],
[
"# 2.1 Rank 1\r\n# A \"vector\" or \"rank-1\" tensor is like\r\n# a list of values. A vector has one axis:\r\n\r\nprint(tf.constant([2.0, 3.0, 4.0]))",
"tf.Tensor([2. 3. 4.], shape=(3,), dtype=float32)\n"
],
[
"# 2.2 Rank 2\r\n# A \"matrix\" or \"rank-2\" tensor has two axes:\r\n\r\ns=tf.constant(\r\n [\r\n [1, 2],\r\n [3, 4],\r\n [5, 6]\r\n ]\r\n )\r\n\r\nprint(s)",
"_____no_output_____"
],
[
"# 2.3 Rank 3\r\n# There can be an arbitrary number of\r\n# axes (sometimes called \"dimensions\")\r\n\r\nrank_3_tensor = tf.constant(\r\n [\r\n [\r\n [0, 1, 2, 3, 4],\r\n [5, 6, 7, 8, 9]\r\n ],\r\n [\r\n [10, 11, 12, 13, 14],\r\n [15, 16, 17, 18, 19]\r\n ],\r\n [\r\n [20, 21, 22, 23, 24],\r\n [25, 26, 27, 28, 29]\r\n ],\r\n ]\r\n )\r\n\r\nrank_3_tensor\r\n",
"_____no_output_____"
]
],
[
[
"### Tensor to numpy\r\n\r\nConvert a tensor to numpy array using `np.array` method or using `tensor.numpy` method:",
"_____no_output_____"
]
],
[
[
"# 3.0 Tensor to numpy\r\nnp.array(s)\r\nprint()\r\ns.numpy()\r\nprint()\r\nnp.array(rank_3_tensor)\r\nprint()\r\nrank_3_tensor.numpy()",
"_____no_output_____"
]
],
[
[
"### Basic maths on tensors\r\n\r\nBasic math on tensors, including addition, element-wise multiplication, and matrix multiplication.",
"_____no_output_____"
]
],
[
[
"# 3.1\r\na = tf.constant([[1, 2],\r\n [3, 4]])\r\nb = tf.constant([[1, 2],\r\n [1, 0]])\r\nc = tf.ones([2,3])",
"_____no_output_____"
],
[
"# 3.2\r\na+b\r\nprint()\r\ntf.add(a,b)\r\n\r\nprint()\r\na * b\r\nprint()\r\ntf.multiply(a,b)\r\n\r\nprint()\r\ntf.matmul(a,b)\r\n",
"_____no_output_____"
],
[
"# 3.3 This fails. Tensors are very sensitive \r\n# to data types\r\n\r\nr = tf.constant([1.0,2.0], shape = [2,1])\r\np = tf.constant(5)\r\nr * p",
"_____no_output_____"
],
[
"# 3.4 This also fails\r\n# even though both operands\r\n# are floats\r\n\r\nr = tf.constant([1.0,2.0], shape = [2,1])\r\nr\r\np = tf.constant(5)\r\nr * tf.cast(p, tf.float16)",
"_____no_output_____"
],
[
"# 3.5 This succeeds\r\n\r\nr = tf.constant([1.0,2.0], shape = [2,1])\r\nr\r\np = tf.constant(5)\r\nr * tf.cast(p, tf.float32)",
"_____no_output_____"
]
],
[
[
"#### Some operations on tensors",
"_____no_output_____"
]
],
[
[
"# 4.0\r\nc = tf.constant([[4.0, 5.0], [10.0, 1.0]])\r\n\r\n# 4.1 Find the largest value\r\nprint(tf.reduce_max(c))\r\n\r\n# 4.2 Find the index of the largest value\r\nprint(tf.argmax(c))\r\n\r\n# 4.3 Compute the softmax\r\n# Note that each 'row'\r\n# (or axis 0) or putput \r\n# sums to 1\r\nprint(tf.nn.softmax(c))\r\n",
"_____no_output_____"
]
],
[
[
"#### Some vocabulary\r\nTensors have shapes. Some vocabulary:\r\n\r\n> **Shape**: The length (number of elements) of each of the axes of a tensor. \r\n> **Rank**: Number of tensor axes. A scalar has rank 0, a vector has rank 1, a matrix is rank 2. \r\n> **Axis** or Dimension: A particular dimension of a tensor. \r\n> **Size**: The total number of items in the tensor, the product shape vector.\r\n",
"_____no_output_____"
]
],
[
[
"# 5.0\r\nrank_4_tensor = tf.zeros([3, 2, 4, 5])\r\n# axis 0 is 3\r\n# axis -1 is 5",
"_____no_output_____"
]
],
[
[
"\r\n\r\n\r\n",
"_____no_output_____"
]
],
[
[
"# 5.2 Like in numpy arrays, we have attributes:\r\n# dtype, ndim, shape\r\n\r\nrank_4_tensor.dtype\r\nprint()\r\nrank_4_tensor.ndim\r\nprint()\r\nrank_4_tensor.shape\r\nprint()\r\nrank_4_tensor.shape[0]\r\nprint()\r\nrank_4_tensor.shape[-1]\r\nprint()\r\ntf.size(rank_4_tensor).numpy()",
"_____no_output_____"
]
],
[
[
"It is important to keep in mind inherent or implied meaning of each axis. In the above example, here are the implied meanings: \r\n\r\n*Batch size:* 3 \r\n*Depth*: 2 \r\n*Width*: 4 \r\n*Height*: 5 ",
"_____no_output_____"
],
[
"### Indexing (See [here](https://www.tensorflow.org/guide/tensor#indexing))",
"_____no_output_____"
],
[
"Single-axis indexing\r\n\r\nTensorFlow follows standard Python indexing rules, similar to indexing a list or a string in Python, and the basic rules for NumPy indexing.\r\n\r\n> indexes start at 0 \r\n> negative indices count backwards from the end \r\n> colons, :, are used for slices: start:stop:step",
"_____no_output_____"
]
],
[
[
"# 6.0 Sample 1-axes tensor\r\nrank_1_tensor = tf.constant([0, 1, 1, 2, 3, 5, 8, 13, 21, 34])\r\nprint(rank_1_tensor.numpy())\r\n",
"[ 0 1 1 2 3 5 8 13 21 34]\n"
],
[
"# 6.2 Indexing with a : slice keeps the axis:\r\n\r\n#6.2.1 Everything\r\nrank_1_tensor[:].numpy()\r\nprint()\r\n\r\n#6.2.2 Before 4:\r\nrank_1_tensor[:4].numpy()\r\nprint()\r\n\r\n#6.2.3 From 4 to the end\r\nrank_1_tensor[4:].numpy()\r\nprint()\r\n\r\n#6.2.4 From 2, before 7:\r\nrank_1_tensor[2:7].numpy()\r\nprint()\r\n\r\n#6.2.5 Every other item\r\nrank_1_tensor[::2].numpy()\r\nprint()\r\n\r\n#6.2.6 Reversed\r\nrank_1_tensor[::-1].numpy()\r\nprint()",
"_____no_output_____"
]
],
[
[
"### Manipulating shapes",
"_____no_output_____"
]
],
[
[
"# 7.0 Shape returns a `TensorShape` object\r\n# that shows the size along each axis\r\n\r\nx = tf.constant([[1], [2], [3]])\r\nprint(x.shape)\r\n",
"_____no_output_____"
]
],
[
[
"You can reshape a tensor into a new shape. The tf.reshape operation is fast and cheap as the underlying data does not need to be duplicated.",
"_____no_output_____"
]
],
[
[
"# 7.1 You can reshape a tensor to a new shape.\r\n# Note that you're passing in a list\r\n\r\nreshaped = tf.reshape(x, [1, 3])\r\nreshaped.shape",
"_____no_output_____"
],
[
"# 7.2 We created this tensor earlier\r\n\r\nprint(rank_3_tensor)",
"_____no_output_____"
]
],
[
[
"If you flatten a tensor you can see what order it is laid out in memory.",
"_____no_output_____"
]
],
[
[
"#7.3 A `-1` passed in the `shape` argument\r\n# says \"Whatever fits\".\r\n\r\nprint(tf.reshape(rank_3_tensor, [-1]))",
"_____no_output_____"
]
],
[
[
"Typically the only reasonable use of tf.reshape is to combine or split adjacent axes (or add/remove 1s).\r\n\r\nFor this 3x2x5 tensor, reshaping to (3x2)x5 or 3x(2x5) are both reasonable things to do, as the slices do not mix:",
"_____no_output_____"
]
],
[
[
"# 7.4\r\nprint(tf.reshape(rank_3_tensor, [3*2, 5]), \"\\n\")\r\nprint(tf.reshape(rank_3_tensor, [3, -1]))",
"_____no_output_____"
]
],
[
[
"#### Reshaping can be a mess\r\n\r\nReshaping will \"work\" for any new shape with the same total number of elements, but it will not do anything useful if you do not respect the order of the axes. It will be a mess.",
"_____no_output_____"
]
],
[
[
"# 8.0 Bad examples: don't do this\r\n# Only multiply adjacent indices\r\n\r\n# 8.1 You can't reorder axes with reshape.\r\nprint(tf.reshape(rank_3_tensor, [2, 3, 5]), \"\\n\") \r\n\r\n# 8.2 This is a mess\r\nprint(tf.reshape(rank_3_tensor, [5, 6]), \"\\n\")\r\n",
"_____no_output_____"
]
],
[
[
"### Broadcasting",
"_____no_output_____"
],
[
"Broadcasting is a concept borrowed from the equivalent feature in NumPy. In short, under certain conditions, smaller tensors are \"stretched\" automatically to fit larger tensors when running combined operations on them.\r\n\r\nThe simplest and most common case is when you attempt to multiply or add a tensor to a scalar. In that case, the scalar is broadcast to be the same shape as the other argument. ",
"_____no_output_____"
]
],
[
[
"# 9.0\r\nx = tf.constant([1, 2, 3])\r\ny = tf.constant(2)\r\nz = tf.constant([2, 2, 2])",
"_____no_output_____"
],
[
"# 9.1\r\nx * y\r\nx + z",
"_____no_output_____"
]
],
[
[
"Likewise, axes with length 1 can be stretched out to match the other arguments. Both arguments can be stretched in the same computation.\r\n\r\nIn this case a 3x1 matrix is element-wise multiplied by a 1x4 matrix to produce a 3x4 matrix. Note how the leading 1 is optional: The shape of y is [4].",
"_____no_output_____"
]
],
[
[
"# 9.2 These are the same computations\r\nx = tf.reshape(x,[3,1])\r\ny = tf.range(1, 5)\r\n\r\n# 9.2.1\r\nprint(x, \"\\n\")\r\nprint(y, \"\\n\")\r\nprint(tf.multiply(x, y))\r\n",
"_____no_output_____"
],
[
"# 9.2.2\r\nx = tf.constant([1, 2, 3])\r\ny = tf.constant(2)\r\nz = tf.constant([2, 2, 2])\r\n\r\n# 9.2.3 All of these are the same computation\r\nprint(tf.multiply(x, 2))\r\nprint(x * y)\r\nprint(x * z)\r\n",
"_____no_output_____"
]
],
[
[
"#### Logical operations",
"_____no_output_____"
]
],
[
[
"# 9.3 Logical operations on tensors\r\n# Pl refer: tf.math\r\n# https://www.tensorflow.org/api_docs/python/tf/math\r\n\r\nprint(tf.constant([1,2,10]) < 5)\r\nprint(tf.constant([True, False, True,True], dtype = tf.bool))\r\n\r\n# 9.4 A tensor can be reshaped as per its shape argument\r\n\r\nprint(tf.constant(np.arange(20), shape = [5,4])) \r\nx = tf.constant(np.arange(20), shape = [5,4])\r\n# Display Ist two rows and columns\r\nx[: 2, :2]",
"_____no_output_____"
],
[
"# 9.5 Show first and third rows\r\n# This works as an exception\r\n\r\nx[tf.constant([True, False,True,False, False], dtype = tf.bool)]\r\n\r\n# But the following do not work:\r\n# Valid indices are: integers, slices (`:`),\r\n# ellipsis (`...`), tf.newaxis (`None`)\r\n# and scalar tf.int32/tf.int64 tensors \r\n\r\n#x[\r\n# tf.constant([True, False,True,False, False], dtype = tf.bool),\r\n# tf.constant([True, False,True,False], dtype = tf.bool)\r\n# ]\r\n\r\n#x[\r\n# tf.constant([1,0,0,1,0], dtype = tf.int32),\r\n# tf.constant([1,0,1,0], dtype = tf.int32)\r\n# ]\r\n",
"_____no_output_____"
]
],
[
[
"### Define custom loss function\r\nRefer: Page 384 of Book by Aurelion",
"_____no_output_____"
]
],
[
[
"# 10.0 Define a model\r\nimport pandas as pd\r\nfrom tensorflow import keras\r\nfrom sklearn.datasets import load_boston\r\n# 10.1\r\nX,y = load_boston(return_X_y= True)\r\nX.shape # (506, 13)\r\n# 10.2\r\nmodel = keras.models.Sequential(\r\n [\r\n keras.layers.Dense(5, activation = 'relu'),\r\n keras.layers.Dense(1,activation = 'sigmoid')\r\n ]\r\n )\r\n",
"_____no_output_____"
]
],
[
[
"#### Huber loss\r\n\r\nFor a comparative picture of loss functions being used in Regression, see [here](https://heartbeat.fritz.ai/5-regression-loss-functions-all-machine-learners-should-know-4fb140e9d4b0). Briefly, if data is noisy, use MAE and if their are more outliers or noise, use huber loss. \r\n\r\nHuber loss is less sensitive to outliers in data than the squared error loss. It’s also differentiable at 0 (unlike MAE). It’s basically absolute error, which becomes quadratic when error is small. How small that error has to be to make it quadratic depends on a hyperparameter, 𝛿 (delta), which can be tuned. \r\n\r\n\r\n\r\n\r\n\r\n\r\n",
"_____no_output_____"
]
],
[
[
"# 10.3 Custom loss function\r\ndef huber_loss(y_true,y_pred):\r\n error = y_true - y_pred\r\n is_small_error = tf.abs(error) < 1.0\r\n squared_loss = tf.square(error) / 2.0\r\n linear_loss = tf.abs(error) - 0.5\r\n return tf.where(is_small_error, squared_loss, linear_loss)\r\n\r\n",
"_____no_output_____"
],
[
"# 10.4 Compile and run the model with our loss function\r\nmodel.compile(loss= huber_loss, metrics = \"mse\", optimizer = \"nadam\")\r\nmodel.fit(X,y,epochs = 20)",
"_____no_output_____"
]
],
[
[
"### Generate random tensors\r\nRefer this [article](https://www.tensorflow.org/guide/random_numbers)",
"_____no_output_____"
]
],
[
[
"# 11.0 Generate random data using\r\n# Generator object\r\ng1 = tf.random.Generator.from_seed(1)\r\n\r\n# 2.0.1 Use object 'g1'\r\ng1.normal([2,3])\r\nprint()\r\n# 2.0.2\r\ng1.uniform([1])\r\nprint()\r\n\r\n# 11.1 Generate random data\r\n# directly\r\ntf.random.uniform([4]) # shape is (4,)\r\nprint()\r\ntf.random.uniform([4]).shape\r\nprint()\r\ntf.random.uniform([4]).numpy()\r\nprint()\r\n\r\n# 11.2\r\ntf.random.normal(shape = (10,4), mean = 3,stddev=1.3)\r\nprint()\r\ntf.random.normal(shape = (10,4), mean = 3,stddev=1.3).shape\r\nprint()\r\n\r\n# 2.2\r\ntf.random.uniform([4, 100], maxval=100, dtype=tf.int32)",
"_____no_output_____"
]
],
[
[
"# tf.data.Dataset API\r\nUnderstanding Dataset object. The `tf.data.Dataset` API supports writing descriptive and efficient **input pipelines**. Dataset usage follows a common pattern (see [the right-panel here](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) and a colab page with example [here](https://colab.research.google.com/github/tensorflow/docs/blob/master/site/en/guide/data.ipynb#scrollTo=k_5N7CdNGYAa) ):\r\n\r\n> Create a source dataset from your input data.\r\n\r\n> Write dataset transformations to preprocess the data.\r\n\r\n> Iterate over the dataset and process the elements.\r\n\r\nIteration happens in a streaming fashion, so the full dataset does not need to fit into memory. That is processing is performed batch-wise. \r\n\r\nThe simplest way to create a dataset is to create it from a python list:",
"_____no_output_____"
],
[
"## from_tensors() vs from_tensor_slices()\r\nSee this [stackoverflow answer](https://stackoverflow.com/a/49579995/3282777) \r\n\r\nRead `from_tensor_slices()` as `to_tensor_slices()`",
"_____no_output_____"
]
],
[
[
"# 1.0 Call libraries\r\nimport numpy as np\r\nimport tensorflow_datasets as tfds\r\nimport tensorflow as tf\r\nimport matplotlib.pyplot as plt\r\nimport os",
"_____no_output_____"
],
[
"# 1.1 More libraries\r\nfrom tensorflow.keras import utils\r\nfrom tensorflow.keras import preprocessing\r\nimport pathlib\r\nfrom tensorflow.keras.layers.experimental.preprocessing import TextVectorization",
"_____no_output_____"
],
[
"# 1.2 Set numpy decimal printoptions\r\n# Limit display to precision of 3\r\n\r\nnp.set_printoptions(precision=3)",
"_____no_output_____"
],
[
"# 1.3\r\nfrom IPython.core.interactiveshell import InteractiveShell\r\nInteractiveShell.ast_node_interactivity = \"all\"",
"_____no_output_____"
],
[
"# 2.0 Read from_tensor_slices as to_tensor_slices()\r\n# 2.0.1 from_tensor_slices()\r\ndataset1 = tf.data.Dataset.from_tensor_slices([[1,2],[3,4],[5,6]])\r\n# 2.0.2 from_tensors\r\ndataset2 = tf.data.Dataset.from_tensors([[1,2],[3,4],[5,6]])",
"_____no_output_____"
],
[
"# 2.1 Print the two objects\r\ndataset1\r\nprint()\r\ndataset2",
"_____no_output_____"
],
[
"# 2.2 Extract each element from\r\n# dataset. dataset is iterable.\r\n# Four elements. Each has two values\r\n\r\nfor elem in dataset1:\r\n print(\"--\")\r\n print(elem.numpy())",
"--\n[1 2]\n--\n[3 4]\n--\n[5 6]\n"
],
[
"# 2.2.1 Just one element\r\nfor elem in dataset2:\r\n print(\"--\")\r\n print(elem)",
"_____no_output_____"
],
[
"# 2.3\r\ndataset3 = tf.data.Dataset.from_tensor_slices(\r\n (\r\n tf.random.uniform([4]), # shape [4]\r\n tf.random.normal(\r\n [4, 6],\r\n mean=1.5,\r\n stddev=2.2\r\n ) \r\n )\r\n )",
"_____no_output_____"
],
[
"# 2.3.1 Print contents\r\nfor elem in dataset3:\r\n # Four elements.\r\n # Each element is a tuple of two tensors\r\n # one from uniform and the other from normal dist\r\n print(elem) \r\n",
"(<tf.Tensor: shape=(), dtype=float32, numpy=0.2308768>, <tf.Tensor: shape=(6,), dtype=float32, numpy=array([-1.476, 7.276, 0.228, 3.193, 2.923, 0.521], dtype=float32)>)\n(<tf.Tensor: shape=(), dtype=float32, numpy=0.8270308>, <tf.Tensor: shape=(6,), dtype=float32, numpy=array([ 2.976, -1.021, 1.489, -1.378, 5.806, -1.429], dtype=float32)>)\n(<tf.Tensor: shape=(), dtype=float32, numpy=0.14125514>, <tf.Tensor: shape=(6,), dtype=float32, numpy=array([0.491, 4.323, 2.083, 3.948, 2.935, 2.654], dtype=float32)>)\n(<tf.Tensor: shape=(), dtype=float32, numpy=0.57362044>, <tf.Tensor: shape=(6,), dtype=float32, numpy=array([ 1.875, 1.325, 1.823, -1.774, 5.792, 3.923], dtype=float32)>)\n"
],
[
"# 2.4 Next same internal contents but using from_tensors\r\ndataset4 = tf.data.Dataset.from_tensors(\r\n (\r\n tf.random.uniform([4]), # shape [4]\r\n tf.random.normal([4, 6], mean=1.5,stddev=2.2) # [4,100]\r\n )\r\n )",
"_____no_output_____"
],
[
"# 2.4.1\r\nfor elem in dataset4:\r\n # One element\r\n # This elem is a tuple of two tensors\r\n print()\r\n print(elem) ",
"\n(<tf.Tensor: shape=(4,), dtype=float32, numpy=array([0.52 , 0.01 , 0.11 , 0.324], dtype=float32)>, <tf.Tensor: shape=(4, 6), dtype=float32, numpy=\narray([[ 2.189, 1.342, 2.591, -0.121, 0.247, 2.917],\n [ 2.694, 2.623, 1.488, 5.46 , -0.065, 1.36 ],\n [ 0.13 , 2.027, -3.341, 3.226, 4.435, 2.126],\n [ 0.062, -0.098, 0.346, -0.038, 2.953, 2.251]], dtype=float32)>)\n"
],
[
"# Two tensors can be combined into one Dataset object.\r\nfeatures = tf.constant([[1, 3], [2, 1], [3, 3]]) # ==> 3x2 tensor\r\nlabels = tf.constant(['A', 'B', 'A']) # ==> 3x1 tensor\r\ndataset = tf.data.Dataset.from_tensor_slices((features, labels))\r\n",
"_____no_output_____"
],
[
"# Both the features and the labels tensors can be converted\r\n# to a Dataset object separately and combined after.\r\nfeatures_dataset = tf.data.Dataset.from_tensor_slices(features)\r\nlabels_dataset = tf.data.Dataset.from_tensor_slices(labels)\r\ndataset = tf.data.Dataset.zip((features_dataset, labels_dataset))\r\n",
"_____no_output_____"
],
[
"#help(tfds.load)",
"_____no_output_____"
]
],
[
[
"## Dataset objects from numpy-arrays in memory",
"_____no_output_____"
],
[
"If all data is in memory, to create a `Dataset` object, use `Dataset.from_tensor_slices()` on numpy arrays (in memory).",
"_____no_output_____"
]
],
[
[
"# 3.0 Download numpy arrays to \r\n# two objects (train,test) in memory\r\n\r\n# 3.0.1 First delete any existing folder\r\n\r\n!rm -rf /root/.keras/datasets\r\n!ls -la /root/.keras",
"total 16\ndrwxr-xr-x 2 root root 4096 Mar 11 05:52 .\ndrwx------ 1 root root 4096 Mar 11 05:52 ..\n-rw-r--r-- 1 root root 123 Mar 11 05:52 keras.json\n"
],
[
"# 3.0.2 Next download data:\r\ntrain, test = tf.keras.datasets.fashion_mnist.load_data()",
"Downloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-labels-idx1-ubyte.gz\n32768/29515 [=================================] - 0s 0us/step\nDownloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/train-images-idx3-ubyte.gz\n26427392/26421880 [==============================] - 1s 0us/step\nDownloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/t10k-labels-idx1-ubyte.gz\n8192/5148 [===============================================] - 0s 0us/step\nDownloading data from https://storage.googleapis.com/tensorflow/tf-keras-datasets/t10k-images-idx3-ubyte.gz\n4423680/4422102 [==============================] - 0s 0us/step\n"
],
[
"# 3.0.3 Check downloaded files\r\n! ls -la /root/.keras/datasets",
"total 12\ndrwxr-xr-x 3 root root 4096 Mar 11 06:07 .\ndrwxr-xr-x 3 root root 4096 Mar 11 06:07 ..\ndrwxr-xr-x 2 root root 4096 Mar 11 06:07 fashion-mnist\n"
],
[
"# 4.1 Little more checking:\r\n\r\ntype(train)\r\nprint()\r\ntype(train[0])\r\nprint()\r\ntype(test[0])",
"_____no_output_____"
],
[
"# 4.2 Separate images and labels:\r\nimages,labels = train\r\n\r\n# 4.2.1 Do something with images\r\nimages = images/255",
"_____no_output_____"
],
[
"# 4.3 Create Dataset object. \r\n# It is similar to way we did in #3.3 above:\r\n\r\ndataset = tf.data.Dataset.from_tensor_slices((images, labels))\r\ntype(dataset)\r\ndataset",
"_____no_output_____"
]
],
[
[
"## Dataset objects from textfiles on disk\r\nPlease see this [tutorial](https://www.tensorflow.org/tutorials/load_data/text). We are downloading files from stackoverflow. The file contains questions asked on some subjects. (This section is to be completed.)",
"_____no_output_____"
],
[
"### Consuming CSV file",
"_____no_output_____"
],
[
"See [Loading CSV Files](../tutorials/load_data/csv.ipynb), and [Loading Pandas DataFrames](../tutorials/load_data/pandas.ipynb) for more examples. The CSV file format is a popular format for storing tabular data in plain text. For example: \r\n",
"_____no_output_____"
]
],
[
[
"# 5.0 Download titanic file 'train.csv'\r\n# from a URL:\r\n\r\nimport pandas as pd\r\ntitanic_file = tf.keras.utils.get_file(\r\n \"train.csv\",\r\n \"https://storage.googleapis.com/tf-datasets/titanic/train.csv\"\r\n )",
"Downloading data from https://storage.googleapis.com/tf-datasets/titanic/train.csv\n32768/30874 [===============================] - 0s 0us/step\n"
],
[
"# 5.1 Read downloaded file:\r\n\r\ndf = pd.read_csv(titanic_file)\r\ndf.head()",
"_____no_output_____"
],
[
"# 5.2 Transform pandas dataframe to dictionary\r\ndict(df)",
"_____no_output_____"
],
[
"# 6.0 Create tf.data.Dataset objects:\r\n# tensor_slice: Slices along along first dimension. \r\n# This operation preserves the structure of the input\r\n# tensors, removing the first dimension of each tensor\r\n# and using it as the dataset dimension. \r\n\r\ntitanic_slices = tf.data.Dataset.from_tensor_slices(dict(df))\r\ntype(titanic_slices) # TensorSliceDataset",
"_____no_output_____"
],
[
"# 6.1 Just extract one row/batch\r\nn = 1\r\nfor feature_batch in titanic_slices.take(n):\r\n for key, value in feature_batch.items():\r\n print(\" {}:{}\".format(key, value))",
" survived:0\n sex:b'male'\n age:22.0\n n_siblings_spouses:1\n parch:0\n fare:7.25\n class:b'Third'\n deck:b'unknown'\n embark_town:b'Southampton'\n alone:b'n'\n"
]
],
[
[
"A more scalable approach is to load from disk as necessary. The tf.data module provides methods to extract records from one or more CSV files fron disk.\r\n\r\nThe `experimental.make_csv_dataset` function is the high level interface for reading sets of csv files. It supports column type inference and many other features, like batching and shuffling, to make usage simple.",
"_____no_output_____"
]
],
[
[
"# 6.2\r\nbatch_size = 4\r\ntitanic_batches = tf.data.experimental.make_csv_dataset(\r\n titanic_file,\r\n batch_size=batch_size,\r\n label_name=\"survived\"\r\n )",
"_____no_output_____"
],
[
"# 6.3 Get just one batch\r\n# Batch size is 4\r\n\r\nhowManyBatches = 1\r\nfor feature_batch, label_batch in titanic_batches.take(howManyBatches):\r\n print(\"'survived': {}\".format(label_batch))\r\n print(\"features:\")\r\n for key, value in feature_batch.items():\r\n print(\" {!r:20s}: {}\".format(key, value))",
"'survived': [0 0 1 0]\nfeatures:\n 'sex' : [b'male' b'female' b'female' b'male']\n 'age' : [45. 22. 38. 28.]\n 'n_siblings_spouses': [1 0 0 0]\n 'parch' : [0 0 0 0]\n 'fare' : [ 83.475 10.517 227.525 13. ]\n 'class' : [b'First' b'Third' b'First' b'Second']\n 'deck' : [b'C' b'unknown' b'C' b'unknown']\n 'embark_town' : [b'Southampton' b'Southampton' b'Cherbourg' b'Southampton']\n 'alone' : [b'n' b'y' b'y' b'y']\n"
],
[
"# 6.4\r\ntitanic_batches = tf.data.experimental.make_csv_dataset(\r\n titanic_file, batch_size=4,\r\n label_name=\"survived\", select_columns=['class', 'fare', 'survived'])",
"_____no_output_____"
],
[
"# 6.5\r\nfor feature_batch, label_batch in titanic_batches.take(1):\r\n print(\"'survived': {}\".format(label_batch))\r\n for key, value in feature_batch.items():\r\n print(\" {!r:20s}: {}\".format(key, value))",
"_____no_output_____"
]
],
[
[
"You can use the select_columns argument if you only need a subset of columns.",
"_____no_output_____"
]
],
[
[
"# 6.6\r\ntitanic_batches = tf.data.experimental.make_csv_dataset(\r\n titanic_file, batch_size=4,\r\n label_name=\"survived\", select_columns=['class', 'fare', 'survived'])",
"_____no_output_____"
],
[
"# 6.7\r\nfor feature_batch, label_batch in titanic_batches.take(1):\r\n print(\"'survived': {}\".format(label_batch))\r\n for key, value in feature_batch.items():\r\n print(\" {!r:20s}: {}\".format(key, value))",
"'survived': [1 0 0 1]\n 'fare' : [12.288 8.654 52. 7.142]\n 'class' : [b'Third' b'Third' b'First' b'Third']\n"
]
],
[
[
"### Consuming text files",
"_____no_output_____"
],
[
"#### Download file from a url\r\nHow to download a file from a URL.\r\nThis way any file can also be downloaded from *gdrive* without mounting it. Uses [`get_file()`](https://www.tensorflow.org/api_docs/python/tf/keras/utils/get_file) utility of `tf.keras.utils`. See this [example](https://www.tensorflow.org/tutorials/load_data/text).",
"_____no_output_____"
]
],
[
[
"# 7.0 Which files are where:\r\n\r\n!ls -la /root/.keras/\r\n!ls -la /root/.keras/datasets\r\n\r\n# 7.0.1 Deleting datasets dir\r\n!rm -rf /root/.keras/datasets\r\n",
"_____no_output_____"
],
[
"# 7.1 Specify file URL from stackoverflow.\r\n# Our file: stack_overflow_16k.tar.gz\r\n\r\ndata_url = 'https://storage.googleapis.com/download.tensorflow.org/data/stack_overflow_16k.tar.gz'\r\n\r\n# 7.1.1 Use keras get_file() utility\r\ndnld = utils.get_file(\r\n 'stack_overflow_16k.tar.gz', \r\n data_url,\r\n untar=True,\r\n )\r\n\r\n# 7.1.2 Where is 'dnld' object?\r\n# Get its path\r\ndnld_dir = pathlib.Path(dnld).parent\r\ndnld_dir # '/root/.keras/datasets'",
"Downloading data from https://storage.googleapis.com/download.tensorflow.org/data/stack_overflow_16k.tar.gz\n6053888/6053168 [==============================] - 0s 0us/step\n"
],
[
"# 7.1.3\r\n! ls -la /root/.keras/datasets\r\n\r\n# 5.1.4 Result after untarring\r\n! ls -la /root/.keras/datasets/train\r\n! ls -la /root/.keras/datasets/test",
"_____no_output_____"
]
],
[
[
"#### Create a dataset of text-lines",
"_____no_output_____"
]
],
[
[
"# 8.0 Files in 'train/python' folder\r\ntrain_dir = \"/root/.keras/datasets/train/\"\r\npython_files = os.listdir(train_dir + \"python\")\r\npython_files[:3]\r\nprint()\r\n\r\n# 8.0.1 Join directory path to file-names\r\nfiles_with_path = [os.path.join(train_dir, file) for file in python_files]\r\nfiles_with_path[:4]",
"_____no_output_____"
],
[
"# 8.1 tf.data.Dataset of just filepaths\r\n# Prepare a dataset of all files matching\r\n# one or more glob patterns.\r\n\r\nfilepath_dataset_py = tf.data.Dataset.list_files(\"/root/.keras/datasets/train/python/*.txt\")",
"_____no_output_____"
],
[
"# 8.2 Create a datset comprising lines from one or more text files.\r\n\r\ndata_lines = tf.data.TextLineDataset(filepath_dataset_py)",
"_____no_output_____"
],
[
"# 8.2.1 Examine 5 files:\r\n\r\nfor line in data_lines.take(5):\r\n print(line.numpy)",
"<bound method _EagerTensorBase.numpy of <tf.Tensor: shape=(), dtype=string, numpy=b'\"blank submodule imports using __init__.py i\\'m learning blank, and i can\\'t figure out how imports in __init__.py work...i understand from the blank tutorial that the __init__.py file initializes a package, and that i can import subpackages here...i\\'m doing something wrong, though. could you explain for me (and for future blank-learners) what i\\'m doing wrong?..here\\'s a simplified example of what i\\'m trying to do...this is my file structure:..package. __init__.py. test.py. subpackage. __init__.py. hello_world.py...the contents of hello_world.py:..def do_something():. print \"\"hello, world!\"\"...subpackage/__init__.py is empty...package/__init__.py contains:..import test.submodule.do_something...and finally, test.py contains:..do_something()...this is how i attempt to run hello_world.py using osx terminal and blank 3:..blank test.py...blank then throws the following error:..nameerror: name \\'do_something\\' is not defined\"'>>\n<bound method _EagerTensorBase.numpy of <tf.Tensor: shape=(), dtype=string, numpy=b'\"blank - is there a way to get all the attributes of an object so i have a class called \\'car\\' in another .py file (myclasses.py)..class car:. tires = 4. color = \"\"\"\". speed = 0. engine = \"\"\"\"...and in my main..import myclasses..ferrari = myclasses.car().ferrari.color = \"\"red\"\".ferrari.engine = \"\"fast\"\".ferrari.speed = 200..for prpty in ferrari:. print(prpty)...the output i want is like this:..tires = 4.color = red.speed = 200.engine = fast...i know the format of the output depends on me. only if in my for-loop i can get the property name and its value base on my object.\"'>>\n<bound method _EagerTensorBase.numpy of <tf.Tensor: shape=(), dtype=string, numpy=b'\"sequence switch in blank i am solving a problem in blank. ..the general idea is that given a sequence of numbers, then pick out the numbers form this sequence according to a rule, then this pick-out numbers form a new list...step1, pick out the numbers in odd position (the position count from zero) and append to a new list. ..step2, the remaining numbers form a new sequence...step3, in the next round, pick out the numbers in even position of the new sequence, and append to a new list...step4, after this round, the remaining numbers forms a a new sequences. ..repeat this procedure until all the number in the original sequence have been pick out to for a new list. ..for example, given a sequence [0, 1, 2, 3, 4, 5, 6, 7, 8], ..step1, pick out the numbers in odd position, new_list = [1, 3, 5, 7] ..step2, the remaining numbers form a new sequence is [0, 2, 4, 6, 8]..step3, pick out the numbers in even position of the new sequence, then the numbers [0, 4, 8] are picked out from the new sequence, and append to new list. then new_list = [1, 3, 5, 7, 0, 4, 8] ..step4, the remaining numbers form a new sequence is [2, 6]..repeat step 1, then 6 is picked out append to new_list = [1, 3, 5, 7, 0, 4, 8, 6] .repeat step 2, then 2 is picked out append to new_list = [1, 3, 5, 7, 0, 4, 8, 6, 2], then all numbers in original list are picked out. and the final result is the new_list...i do not know how to implement it in blank. i got stuck in the first step, i want to use a for loop over the sequence and pick out the numbers according to odd or even index. but after picking out the numbers, the sequence changes. then i have to start over a new for loop to loop over this new sequence, if the original sequence is very long. i will be too long and inefficient coding. could someone gives me idea how to deal with this problem?\"'>>\n<bound method _EagerTensorBase.numpy of <tf.Tensor: shape=(), dtype=string, numpy=b'\"input variables in one line i have a problem with reading variables in one line. i used a map(int, input().splite()) when i know the number of variables, but in this case in every run of code this number is different. (blank 3)\"'>>\n<bound method _EagerTensorBase.numpy of <tf.Tensor: shape=(), dtype=string, numpy=b'\"print line in specific order i want to print around 10 lines in such a way that in every sequence 9 lines print with sign \\'-\\'. for example, if x=[1,2,3,4,5]. now i want to print in following sequence,.. 1.-2.-3.-4.-5..-1.2.-3.-4.-5..-1.-2.3.-4.-5...etc. ...please help me to solve this.\"'>>\n"
]
],
[
[
"#### Downloading data from gdrive",
"_____no_output_____"
]
],
[
[
"# 8.3 gdrive download: May also download a shared file from gdrive\r\n# No need to mount gdrive\r\n# Download 'archive.csv.zip' from my gdrive:\r\n\r\ngdrive_url = \"https://drive.google.com/file/d/14gjcWMRJORJ4bQ2QerWaodDpLi5oDcxM/view?usp=sharing\"\r\n\r\n# 8.3.1 Use keras get_file() utility\r\ndnld_gdrive = utils.get_file(\r\n 'archive.csv.zip', \r\n gdrive_url,\r\n )\r\n\r\n# 8.3.2 Where is 'dataset' object?\r\n# Get its path\r\ngdrive_dir = pathlib.Path(dnld_gdrive).parent\r\ngdrive_dir # PosixPath('/root/.keras/datasets')",
"_____no_output_____"
],
[
"# 8.3.3 Check folders under 'train'\r\n! ls -la /root/.keras/datasets/train",
"_____no_output_____"
]
],
[
[
"## preprocessing data\r\nThe Keras preprocessing layers API allows developers to build Keras-native input processing pipelines. These input processing pipelines can be used as independent preprocessing code in non-Keras workflows, combined directly with Keras models, and exported as part of a Keras SavedModel. \r\n\r\nWith Keras preprocessing layers, you can build and export models that are truly end-to-end: models that accept raw images or raw structured data as input; models that handle feature normalization or feature value indexing on their own.\r\n\r\nSee this [link](https://www.tensorflow.org/guide/keras/preprocessing_layers) for usage of preprocessing library methods. Pay attention to the panel on the right. \r\n\r\n",
"_____no_output_____"
],
[
"### preprocessing.text_dataset_from_directory\r\nRefer this [link](https://www.tensorflow.org/api_docs/python/tf/keras/preprocessing/text_dataset_from_directory). \r\n\r\nThe `preprocessing.text_dataset_from_directory()` expects a directory structure as follows. See an example [here](https://www.tensorflow.org/tutorials/keras/text_classification).\r\n\r\nmain_directory/<br>\r\n...class_a/<br>\r\n......a_text_1.txt<br>\r\n......a_text_2.txt<br>\r\n...class_b/<br>\r\n......b_text_1.txt<br>\r\n......b_text_2.txt<br>\r\n\r\n\r\nWhen running a machine learning experiment, it is a best practice to divide your dataset into three splits: train, validation, and test. The Stack Overflow dataset has already been divided into train and test, but it lacks a validation set. Create a validation set using an 80:20 split of the training data by using the validation_split argument below.\r\n\r\n\r\n\r\n\r\n",
"_____no_output_____"
]
],
[
[
"# 9.0 Our stackoverflow training data is here:\r\ntrain_dir = \"/root/.keras/datasets/train\"\r\n\r\n# 9.0.1 Some constants\r\nbatch_size = 32\r\nseed = 42\r\n\r\n# 9.1 Create a training dataset object\r\nraw_train_ds = preprocessing.text_dataset_from_directory(\r\n train_dir,\r\n labels = \"inferred\",\r\n batch_size=batch_size,\r\n # fraction of data to \r\n # reserve for validation. \r\n validation_split=0.2, \r\n # Return back 'train' subset\r\n # but in batches\r\n subset='training',\r\n seed =2 \r\n )\r\n",
"Found 8000 files belonging to 4 classes.\nUsing 6400 files for training.\n"
],
[
"# 9.1.1\r\ntype(raw_train_ds) # BatchDataset",
"_____no_output_____"
],
[
"# 9.2\r\n# Dataset.take(n) object is iterable.\r\n# Iterate over the dataset and print out a few examples,\r\n# to get a feel for the data.\r\n# take(n): Reads n batches\r\n\r\nfor text_batch, label_batch in raw_train_ds.take(1):\r\n print(text_batch.numpy().shape) # 32: batch_size\r\n # Change batch_size to see how it changes\r\n for i in range(10):\r\n print(\"Question: \", text_batch.numpy()[i])\r\n print(\"Label:\", label_batch.numpy()[i])\r\n",
"_____no_output_____"
],
[
"# 9.3 Get class_names in the dataset:\r\nfor i, label in enumerate(raw_train_ds.class_names):\r\n print(\"Label\", i, \"corresponds to\", label)\r\n",
"Label 0 corresponds to csharp\nLabel 1 corresponds to java\nLabel 2 corresponds to javascript\nLabel 3 corresponds to python\n"
],
[
"# 10.0 From train_dir pick-up remaining validation\r\n# dataset but in batches:\r\n\r\nraw_validation_ds = preprocessing.text_dataset_from_directory(\r\n train_dir,\r\n batch_size=batch_size,\r\n validation_split=0.2,\r\n # Return validation data\r\n # but in batches\r\n subset='validation',\r\n seed = 2\r\n )\r\n",
"Found 8000 files belonging to 4 classes.\nUsing 1600 files for validation.\n"
],
[
"# 11.0 Test dataset\r\n\r\ntest_dir = \"/root/.keras/datasets/test\"\r\n\r\n# 11.1\r\nraw_test_ds = preprocessing.text_dataset_from_directory(\r\n test_dir,\r\n batch_size=batch_size\r\n )\r\n",
"Found 8000 files belonging to 4 classes.\n"
]
],
[
[
"### Text Vectorization\r\nOnce our train, test and validation datasets are ready, we proceed to feed textvectorization layer.\r\n",
"_____no_output_____"
],
[
"#### Using `preprocessing.TextVectorization` layer. Its [full syntax](https://www.tensorflow.org/api_docs/python/tf/keras/layers/experimental/preprocessing/TextVectorization) is:\r\n\r\n`tf.keras.layers.experimental.preprocessing.TextVectorization(\r\n max_tokens=None, standardize=LOWER_AND_STRIP_PUNCTUATION,\r\n split=SPLIT_ON_WHITESPACE, ngrams=None, output_mode=INT,\r\n output_sequence_length=None, pad_to_max_tokens=True, vocabulary=None, **kwargs\r\n)\r\n`",
"_____no_output_____"
],
[
"`TextVectorization` layer will standardize, tokenize, and vectorize the data using the preprocessing.TextVectorization layer.\r\n\r\n> Standardization refers to preprocessing the text, typically to remove punctuation or HTML elements to simplify the dataset.\r\n\r\n> Tokenization refers to splitting strings into tokens (for example, splitting a sentence into individual words by splitting on whitespace).\r\n\r\n> Vectorization refers to converting tokens into numbers so they can be fed into a neural network.\r\n\r\nAll of these tasks can be accomplished with this layer. You can learn more about each of these in the API doc.\r\n\r\n> The default standardization converts text to lowercase and removes punctuation.\r\n\r\n> The default tokenizer splits on whitespace.\r\n\r\n> The default vectorization mode is int. This outputs integer indices (one per token). This mode can be used to build models that take word order into account. You can also use other modes, like binary, to build bag-of-word models.\r\n",
"_____no_output_____"
]
],
[
[
"from tensorflow.keras.layers.experimental import preprocessing ",
"_____no_output_____"
]
],
[
[
"##### Simple **experiment**",
"_____no_output_____"
]
],
[
[
"data = [\r\n \"The title of Rachel Levin’s book, Look Big, is\"\r\n \"just about the best two words of advice one can\"\r\n \" give about how to survive most animal encounters.\"\r\n \"In her illustrated service manual, Levin breaks down\"\r\n \"how to handle 50 different kinds of animals common in \"\r\n \"North America, based on expert advice. Let’s look at her\"\r\n \" tips for dealing with five of these creatures and see\"\r\n \" how they stack up with what the experts say—and with\"\r\n \" real-world experience. \"\r\n ]\r\nlayer = preprocessing.TextVectorization()\r\nlayer.adapt(data)\r\nvectorized_text = layer(data)\r\nprint(vectorized_text)\r\n",
"tf.Tensor(\n[[ 4 15 2 25 31 53 6 54 35 10 4 55 14 11 2 9 26 51 39 10 7 5 19 29\n 59 45 8 37 21 30 32 52 46 5 38 62 47 34 2 58 50 36 28 61 56 27 43 9\n 33 6 57 8 16 40 48 3 41 2 18 49 60 22 7 17 20 13 3 12 4 42 23 3\n 24 44]], shape=(1, 74), dtype=int64)\n"
],
[
"data = [ [\r\n \"The title of Rachel Levin’s book, Look Big, is\"\r\n \"just about the best two words of advice one can\"\r\n \" give about how to survive most animal encounters.\"\r\n \"In her illustrated service manual, Levin breaks down\"\r\n ],\r\n [\"how to handle 50 different kinds of animals common in \"\r\n \"North America, based on expert advice. Let’s look at her\"\r\n \" tips for dealing with five of these creatures and see\"\r\n \" how they stack up with what the experts say—and with\"\r\n \" real-world experience. \"\r\n ]\r\n ]\r\nlayer = preprocessing.TextVectorization()\r\nlayer.adapt(data)\r\nvectorized_text = layer(data)\r\nprint(vectorized_text)\r\n",
"tf.Tensor(\n[[ 4 15 2 25 31 53 7 54 35 10 4 55 14 11 2 9 26 51 39 10 5 6 19 29\n 59 45 8 37 21 30 32 52 46 0 0 0 0 0 0 0 0 0]\n [ 5 6 38 62 47 34 2 58 50 36 28 61 56 27 43 9 33 7 57 8 16 40 48 3\n 41 2 18 49 60 22 5 17 20 13 3 12 4 42 23 3 24 44]], shape=(2, 42), dtype=int64)\n"
],
[
"# 12.0\r\nVOCAB_SIZE = 10000\r\nMAX_SEQUENCE_LENGTH = 250\r\n\r\n# 12.1 Instantiate TextVectorization class\r\nint_vectorize_layer = TextVectorization(\r\n max_tokens=VOCAB_SIZE,\r\n output_mode='int',\r\n output_sequence_length=MAX_SEQUENCE_LENGTH\r\n )\r\n",
"_____no_output_____"
],
[
"#binary_vectorize_layer = TextVectorization(\r\n# max_tokens=VOCAB_SIZE,\r\n# output_mode='binary'\r\n# )",
"_____no_output_____"
],
[
"# 12.2 Make a text-only dataset (without labels), then call adapt\r\n\r\ntrain_text = raw_train_ds.map(lambda text, labels: text)\r\n",
"_____no_output_____"
],
[
"# 12.3 'adapt' or 'fit' over 'int_vectorize_layer'\r\n# object. 'adpat' fits the state of the preprocessing\r\n# layer to the dataset.\r\n\r\nint_vectorize_layer.adapt(\r\n # The data to train on. \r\n # It can be passed either as\r\n # a tf.data Dataset, as a NumPy array\r\n train_text # \r\n )\r\n#binary_vectorize_layer.adapt(train_text)",
"_____no_output_____"
],
[
"# 12.3.1\r\nint_vectorize_layer.get_vocabulary()[:4]",
"_____no_output_____"
],
[
"# 12.4 Retrieve a batch (of 32 reviews and labels) from the dataset\r\n\r\ntext_batch, label_batch = next(iter(raw_train_ds))\r\nfirst_question, first_label = text_batch[0], label_batch[0]\r\nprint(\"Question\", first_question)\r\nprint(\"Label\", first_label)",
"Question tf.Tensor(b'\"error loading report i have a report named \"\"relatorio1.rdlc\"\", in windows forms with report viewer...the code have no errors when built in vs studio ..sqlconnection conec1 = tconex.getconnection();..private void verrelatorio_load(object sender, eventargs e).{. sqlcommand cmdreport = new sqlcommand();. sqldatareader drreport;. dataset dsreport = new dsbairros();.. try. {. cmdreport.commandtype = commandtype.text;. cmdreport.connection = conec1;. cmdreport.commandtext = \"\"select codigo,descricao from tblbairros \"\";. drreport = cmdreport.executereader();. dsreport.tables[0].load(drreport);. drreport.close();.. reportviewer1.localreport.reportembeddedresource = \"\"contatroco.relatorio1.rdlc\"\";.. reportdatasource rds = new reportdatasource();.. rds.name = \"\"dsbairros\"\";. rds.value = dsreport.tables[0];. reportviewer1.localreport.datasources.add(rds);. reportviewer1.refreshreport();. }. catch (exception ex). {. messagebox.show(ex.message);. }. finally. {. if (conec1.state == connectionstate.open). { conec1.close(); }. }.}...the reportviewer shows me the name of the fields codigo, descri\\xc3\\xa7ao but does not show me any data. ..dsbairros is a typed dataset. i need to make it this way because i changed the origin connection of the datasource to don\\'t update and now the report does not work.\"\\n', shape=(), dtype=string)\nLabel tf.Tensor(0, shape=(), dtype=int32)\n"
],
[
"# 12.5.1 Expand \r\ntype(first_question)\r\nprint(\"\\n--------------\\n\")\r\n# 12.5.2\r\nfirst_question.get_shape()\r\nprint(\"\\n--------------\\n\")\r\n# 12.5.3\r\nt = tf.expand_dims(first_question,-1)\r\nt.get_shape()\r\nprint(\"\\n--------------\\n\")\r\n# 12.5.4\r\nprint(t)\r\nprint(\"\\n--------------\\n\")\r\n",
"_____no_output_____"
],
[
"12.6\r\nint_vectorize_layer(t)",
"_____no_output_____"
],
[
"def int_vectorize_text(text, label):\r\n text = tf.expand_dims(text, -1)\r\n return int_vectorize_layer(text) , label",
"_____no_output_____"
],
[
"# Retrieve a batch (of 32 reviews and labels) \r\n# from the dataset\r\ntext_batch, label_batch = next(iter(raw_train_ds))\r\nfirst_question, first_label = text_batch[0], label_batch[0]\r\nprint(\"Question\", first_question)\r\nprint(\"Label\", first_label)\r\n",
"Question tf.Tensor(b'\"simple program not giving desired output i am starting to learn blank and i have a simple program to request two numbers from the user and add them together. when i run my program , i get asked for the first number , i type it in and that\\'s it, the program doesn\\'t go any further. i am running it in visual studio..can anyone tell me what i\\'m doing wrong? ..using system;..namespace coding.{. class program. {. static void main(string[] args). {.. int number1;. int number2;. int result;... console.writeline(\"\"enter first number to be calculated\"\");. number1 = convert.toint32(console.readline());... console.writeline(\"\"enter second number to be calculated\"\");. number2 = convert.toint32(console.readline());.. result = number1 + number2;. console.writeline(\"\"the total is\"\" + \"\" \"\" + result);. }. }.}...result screenshot\"\\n', shape=(), dtype=string)\nLabel tf.Tensor(0, shape=(), dtype=int32)\n"
],
[
"print(\"'int' vectorized question:\",\r\n int_vectorize_text(first_question, first_label)[0])",
"_____no_output_____"
],
[
"print(\"'int' vectorized question:\",\r\n int_vectorize_text(first_question, first_label)[0])\r\n",
"_____no_output_____"
],
[
"######## I am done ###############",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0c9e020f36102c6768177a1c5af05ff3f7d0968 | 378,683 | ipynb | Jupyter Notebook | Zebrafish spinal locomotor circuit/Version 2/Double coiling model notebook.ipynb | Bui-lab/Code | 6ce5972a4bd0c059ab167522ab1d945f3b0f5707 | [
"MIT"
] | null | null | null | Zebrafish spinal locomotor circuit/Version 2/Double coiling model notebook.ipynb | Bui-lab/Code | 6ce5972a4bd0c059ab167522ab1d945f3b0f5707 | [
"MIT"
] | null | null | null | Zebrafish spinal locomotor circuit/Version 2/Double coiling model notebook.ipynb | Bui-lab/Code | 6ce5972a4bd0c059ab167522ab1d945f3b0f5707 | [
"MIT"
] | 2 | 2021-08-25T08:14:52.000Z | 2021-11-29T12:56:17.000Z | 805.708511 | 36,444 | 0.946924 | [
[
[
"# Zebrafish Double coiling model\n### Below is the block of code to run double coiling models",
"_____no_output_____"
],
[
"INITIALIZE - Run before running the models to set the parameters",
"_____no_output_____"
]
],
[
[
"%matplotlib inline\n\n### FIRST, run this code to set the simulation parameters. Then select from the codes below to run different models\n\n#Declare the duration of the simulation\nTIME_END = 100000\nSKIP = 200\nPLOT_INTERVAL = 10000\nPLOT_RESULT = True\nPRINT_PARAM = False\nSAVE_CSV = True\nSAVE_ANIM = True\n\nimport winsound\nduration = 1000 # milliseconds\nfreq = 440 # Hz",
"_____no_output_____"
]
],
[
[
"Base Model",
"_____no_output_____"
]
],
[
[
"\nfrom Double_coiling_model import Double_coil_base\n\nprint(\"Base Model\")\ntest = Double_coil_base(dt = 0.1, stim0 = 35, sigma = 0, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 10, nV0d = 10, nV0v=10, nV2a=10, nMuscle = 10)\n#test.setWeightParameters(V0d_IC_syn_weight = 2.0, V0d_MN_syn_weight = 2.0, V0d_V2a_syn_weight = 2.0)\ntest.setWeightParameters(V0d_IC_syn_weight = 8.0, V0d_MN_syn_weight = 8.0, V0d_V2a_syn_weight = 8.0)\n\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n \n#The code below produces a beeping sound af the code has been executed\nwinsound.Beep(freq, duration) \n",
"_____no_output_____"
]
],
[
[
"Glycine Null",
"_____no_output_____"
]
],
[
[
"from Double_coiling_glycine_null import Double_coil_glycine_null\n\nprint(\"Glycine Null Model\")\ntest = Double_coil_glycine_null(dt = 0.1, stim0 = 35, sigma = 0, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 10, nV0d = 10, nV0v=10, nV2a=10, nMuscle = 10)\ntest.setWeightParameters(V0d_IC_syn_weight=0, V0d_MN_syn_weight=0, V0d_V2a_syn_weight=0)\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n\n#The code below produces a beeping sound af the code has been executed\nwinsound.Beep(freq, duration) ",
"_____no_output_____"
]
],
[
[
"V0v Overexcitation",
"_____no_output_____"
]
],
[
[
"\nfrom Double_coiling_with_Tonic_drive_to_IC_overexcitation_of_V0v import Double_coil_with_Tonic_drive_to_IC_overexcitation_of_V0v\n\nprint(\"IC Tonic Drive Model\")\ntest = Double_coil_with_Tonic_drive_to_IC_overexcitation_of_V0v(dt = 0.1, stim0 = 35, sigma = 0.1, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 10, nV0d = 10, nV0v=10, nV2a=10, nMuscle = 10)\ntest.setWeightParameters(V0d_IC_syn_weight = 8.0, V0d_MN_syn_weight = 8.0, V0d_V2a_syn_weight = 8.0)\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n\n#The code below produces a beeping sound af the code has been executed\nwinsound.Beep(freq, duration) \n",
"_____no_output_____"
]
],
[
[
"V2a KO",
"_____no_output_____"
]
],
[
[
"\nfrom Double_coiling_V2a_KO import Double_coil_V2a_KO\n\nprint(\"V2a Knockout Model\")\ntest = Double_coil_V2a_KO(dt = 0.1, stim0 = 35, sigma = 0, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 10, nV0d = 10, nV0v=10, nV2a=10, nMuscle = 10)\ntest.setWeightParameters(V0d_IC_syn_weight = 8, V0d_MN_syn_weight = 8, V0d_V2a_syn_weight = 8)\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n\n#The code below produces a beeping sound af the code has been executed\nwinsound.Beep(freq, duration) ",
"_____no_output_____"
]
],
[
[
"No excitatory Synapse",
"_____no_output_____"
]
],
[
[
"\nfrom Double_coiling_no_excitatory_syn import Double_coil_no_excitatory_syn\n\nprint(\"No Excitatory Synapse Model\")\ntest = Double_coil_no_excitatory_syn(dt = 0.1, stim0 = 35, sigma = 0, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 10, nV0d = 10, nV0v=10, nV2a=10, nMuscle = 10)\ntest.setWeightParameters(V0d_IC_syn_weight = 2, V0d_MN_syn_weight = 2, V0d_V2a_syn_weight = 2)\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n\n#The code below produces a beeping sound af the code has been executed\nwinsound.Beep(freq, duration) ",
"_____no_output_____"
]
],
[
[
"V0v to IC Null",
"_____no_output_____"
]
],
[
[
"\nfrom Double_coiling_V0v_to_IC_null import Double_coil_V0v_to_IC_null\n\nprint(\"V0v to IC null Model\")\ntest = Double_coil_V0v_to_IC_null(dt = 0.1, stim0 = 35, sigma = 0.001, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 10, nV0d = 10, nV0v=10, nV2a=10, nMuscle = 10)\ntest.setWeightParameters(V0d_IC_syn_weight = 2, V0d_MN_syn_weight = 2, V0d_V2a_syn_weight = 2)\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n\n#The code below produces a beeping sound af the code has been executed\nwinsound.Beep(freq, duration) ",
"_____no_output_____"
]
],
[
[
"30 Somites",
"_____no_output_____"
]
],
[
[
"\nfrom Double_coiling_30_somites import Double_coil_30_somites\n\nprint(\"30 somites Model\")\ntest = Double_coil_30_somites(dt = 0.1, stim0 = 50, sigma = 0, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 30, nV0d = 30, nV0v=30, nV2a=30, nMuscle = 30)\ntest.setWeightParameters(V0d_IC_syn_weight = 2, V0d_MN_syn_weight = 2, V0d_V2a_syn_weight = 2)\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n\n#The code below produces a beeping sound af the code has been executed\nwinsound.Beep(freq, duration) ",
"30 somites Model\n"
]
],
[
[
"Sigma",
"_____no_output_____"
]
],
[
[
"from Double_coiling_with_sigmas import Double_coil_with_sigmas\n\nprint(\"Sigma Model\")\ntest = Double_coil_with_sigmas(dt = 0.1, stim0 = 35, sigmaD=0.2, sigmaL = 0, sigmaP = 0, sigmaW=0, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 10, nV0d = 10, nV0v=10, nV2a=10, nMuscle = 10)\ntest.setWeightParameters(V0d_IC_syn_weight = 2, V0d_MN_syn_weight = 2, V0d_V2a_syn_weight = 2)\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n\nwinsound.Beep(freq, duration)",
"_____no_output_____"
]
],
[
[
"Chemical and Gap Sigmas",
"_____no_output_____"
]
],
[
[
"from Double_coiling_with_sigmas_chem_syn_and_gap import Double_coil_with_gap_chem_sigma\n\nprint(\"Chemical and Gap Sigmas\")\ntest = Double_coil_with_gap_chem_sigma(dt = 0.1, stim0 = 35, sigma_chem = 0, sigma_gap = 0, \n E_glu = 0, E_gly = -58, cv = 1, nIC = 5, nMN = 10, nV0d = 10, nV0v=10, nV2a=10, nMuscle = 10)\ntest.setWeightParameters(V0d_IC_syn_weight = 2, V0d_MN_syn_weight = 2, V0d_V2a_syn_weight = 2)\n((VLIC, VRIC), (VLMN, VRMN), (VLV0d, VRV0d), (VLV0v, VRV0v), (VLV2a, VRV2a), \n (VLMuscle, VRMuscle), Time) = test.mainLoop(rand=0, tmax = TIME_END, tskip = SKIP, tplot_interval = PLOT_INTERVAL, plotResult = PLOT_RESULT, printParam = PRINT_PARAM, saveCSV = SAVE_CSV, saveAnim = SAVE_ANIM)\n\n#The code below produces a beeping sound af the code has been executed\nwinsound.Beep(freq, duration) ",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0c9e0809193ee05c0f09777286a2d7f87307907 | 766 | ipynb | Jupyter Notebook | notebooks/_build/html/_sources/content/visualizations.ipynb | eagle-robot/py-feat | 47a34b062dd5e6e07761c73d21285f085dfeaafa | [
"MIT"
] | 93 | 2021-04-09T02:34:41.000Z | 2022-03-14T01:18:59.000Z | notebooks/_build/html/_sources/content/visualizations.ipynb | eagle-robot/py-feat | 47a34b062dd5e6e07761c73d21285f085dfeaafa | [
"MIT"
] | 65 | 2018-02-04T02:39:13.000Z | 2021-03-25T05:31:03.000Z | notebooks/_build/html/_sources/content/visualizations.ipynb | eagle-robot/py-feat | 47a34b062dd5e6e07761c73d21285f085dfeaafa | [
"MIT"
] | 31 | 2021-04-12T09:37:22.000Z | 2022-03-11T17:48:05.000Z | 17.813953 | 63 | 0.528721 | [
[
[
"# Visualizations\n\n## How to visuzalize facial expression data with Feat.\n*Written by Jin Hyun Cheong*",
"_____no_output_____"
]
]
] | [
"markdown"
] | [
[
"markdown"
]
] |
d0c9f147ab298a8491a62a1a418ed3f7d72d5ce9 | 62,204 | ipynb | Jupyter Notebook | 04-rossman/kaggle-rossmann-master/01-data-visualization.ipynb | rocioparra/redes-neuronales | ebad4367b6b98e7b11af1c4e4ac429837fa39a34 | [
"MIT"
] | null | null | null | 04-rossman/kaggle-rossmann-master/01-data-visualization.ipynb | rocioparra/redes-neuronales | ebad4367b6b98e7b11af1c4e4ac429837fa39a34 | [
"MIT"
] | null | null | null | 04-rossman/kaggle-rossmann-master/01-data-visualization.ipynb | rocioparra/redes-neuronales | ebad4367b6b98e7b11af1c4e4ac429837fa39a34 | [
"MIT"
] | null | null | null | 62,204 | 62,204 | 0.450871 | [
[
[
"!pip install pandas-summary",
"Collecting pandas-summary\n Downloading https://files.pythonhosted.org/packages/f5/20/865d4785f86e86f7ad7ebd52fc14810ef59ef13cd959f1363a2615d1c665/pandas_summary-0.0.7-py2.py3-none-any.whl\nRequirement already satisfied: numpy in /usr/local/lib/python3.6/dist-packages (from pandas-summary) (1.18.5)\nRequirement already satisfied: pandas in /usr/local/lib/python3.6/dist-packages (from pandas-summary) (1.1.2)\nRequirement already satisfied: python-dateutil>=2.7.3 in /usr/local/lib/python3.6/dist-packages (from pandas->pandas-summary) (2.8.1)\nRequirement already satisfied: pytz>=2017.2 in /usr/local/lib/python3.6/dist-packages (from pandas->pandas-summary) (2018.9)\nRequirement already satisfied: six>=1.5 in /usr/local/lib/python3.6/dist-packages (from python-dateutil>=2.7.3->pandas->pandas-summary) (1.15.0)\nInstalling collected packages: pandas-summary\nSuccessfully installed pandas-summary-0.0.7\n"
],
[
"import pandas as pd\n# pip install pandas_summary\nfrom pandas_summary import DataFrameSummary",
"_____no_output_____"
]
],
[
[
"# Competencia de Kaggle\n\n[ir a Kaggle](https://www.kaggle.com/c/rossmann-store-sales/data)\n\n[3er puesto](https://github.com/entron/entity-embedding-rossmann)",
"_____no_output_____"
],
[
"# Métrica de la competencia",
"_____no_output_____"
],
[
"$$\n\\textrm{RMSPE} = \\sqrt{\\frac{1}{n} \\sum_{i=1}^{n} \\left(\\frac{\\hat{y}_i - y_i}{y_i}\\right)^2}\n$$\n\ndonde:\n\n- $y_i$ las ventas de un día particular de un store\n- $\\hat{y}_i$ ventas estimadas por el modelo\n- $n$ es el número de predicciones realizadas",
"_____no_output_____"
]
],
[
[
"from google.colab import drive\ndrive.mount('/content/drive')",
"Mounted at /content/drive\n"
]
],
[
[
"## Importamos dataset",
"_____no_output_____"
],
[
"La competencia permitía agregar datos externos para realizar la predicción",
"_____no_output_____"
],
[
"The following tables are available in the datasets:\n\n| Archivo | Descripción| Origen de Datos|\n|--------------|--------------------------------------------------------------------|--|\n| train.csv | training set: información del store día a día, ventas, clientes, si es feriado, etc | Kaggle |\n| store.csv | Información general del store, por ejemplo datos del competidor | Kaggle |\n| store_states.csv | Mapea de store a estado - Dato externo| Externos |\n| state_names.csv | Mapea estados a acronimo de estado | Externos |\n| googletrend.csv | Tendencias por semana - Dato externo| Externos|\n| weather.csv | Condiciones meteorológicas por día | Externos|",
"_____no_output_____"
]
],
[
[
"PATH = '/content/drive/My Drive/Colab Notebooks/kaggle-rossmann-master/rossmann/rossmann/'",
"_____no_output_____"
],
[
"table_names = ['train', 'store', 'store_states', 'state_names', 'googletrend', 'weather']\ntrain, store, store_states, state_names, googletrend, weather = [pd.read_csv(PATH + fname+'.csv', \n low_memory=False) for fname in table_names]",
"_____no_output_____"
],
[
"display(train.head())\ndisplay(DataFrameSummary(train).summary())",
"_____no_output_____"
]
],
[
[
"- Mirar counts que todos tienen la misma cantidad\n- Ninguno tiene missing\n- Los tipos tambien es interesante observar",
"_____no_output_____"
]
],
[
[
"train['StateHoliday'].value_counts()",
"_____no_output_____"
],
[
"display(store.head())\ndisplay(DataFrameSummary(store).summary())",
"_____no_output_____"
]
],
[
[
"Descripción de algunas columnas que quizas no sean tan claras:\n\n- `Customers`: La cantidad de clientes por día\n- `Open`: Indicador si el store estaba abierto o cerrado: 0 = closed, 1 = open\n- `StateHoliday`: Indica feriado en ese estado. a = public holiday, b = Easter holiday, c = Christmas, 0 = None\n- `SchoolHoliday`: Inidica si el store fue afectado por el feriado escolar\n- `StoreType`: Tipos de store: a, b, c, d\n- `Assortment`: Describe el nivel de surtido de la tienda: a = basic, b = extra, c = extended\n- `CompetitionDistance`: Distancia en metros al competidor\n- `CompetitionOpenSince[Month/Year]`: Fecha en que abrío la competencia\n- `Promo`: Si el store esta corriendo una promoción ese día\n- `Promo2`: Promo2 is a continuing and consecutive promotion for some stores: 0 = store is not participating, 1 = store is participating\n- `Promo2Since[Year/Week]`: describes the year and calendar week when the store started participating in Promo2\n- `PromoInterval`: describes the consecutive intervals Promo2 is started, naming the months the promotion is started anew. E.g. \"Feb,May,Aug,Nov\" means each round starts in February, May, August, November of any given year for that store\n",
"_____no_output_____"
]
],
[
[
"store['StoreType'].value_counts()",
"_____no_output_____"
],
[
"store['PromoInterval'].value_counts()",
"_____no_output_____"
],
[
"display(store_states.head(20))\ndisplay(DataFrameSummary(store_states).summary())",
"_____no_output_____"
],
[
"display(state_names.head(20))\ndisplay(DataFrameSummary(state_names).summary())",
"_____no_output_____"
],
[
"display(googletrend)\ndisplay(DataFrameSummary(googletrend).summary())",
"_____no_output_____"
],
[
"display(weather)\ndisplay(DataFrameSummary(weather[['Max_TemperatureC', 'Mean_TemperatureC', 'Min_TemperatureC',\n 'Max_Humidity', 'Mean_Humidity', 'Min_Humidity', 'Max_Wind_SpeedKm_h', \n 'Mean_Wind_SpeedKm_h', 'CloudCover', 'Precipitationmm']]).summary())",
"_____no_output_____"
],
[
"weather.columns",
"_____no_output_____"
],
[
"",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0c9f4f0d6b9014cf034517250a57c2deab3f379 | 40,385 | ipynb | Jupyter Notebook | Immigration.ipynb | hlab-repo/purity-and-danger | 65170e288e949cb3b1ea42be5a03565d74478b91 | [
"MIT"
] | null | null | null | Immigration.ipynb | hlab-repo/purity-and-danger | 65170e288e949cb3b1ea42be5a03565d74478b91 | [
"MIT"
] | 6 | 2021-04-17T13:46:22.000Z | 2022-02-28T03:56:12.000Z | Immigration.ipynb | hlab-repo/purity-and-danger | 65170e288e949cb3b1ea42be5a03565d74478b91 | [
"MIT"
] | null | null | null | 55.780387 | 2,105 | 0.589773 | [
[
[
"<a href=\"https://colab.research.google.com/github/hlab-repo/purity-and-danger/blob/master/Immigration.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
],
[
"# Creating a Model for Immigration and Outsider Language\n\nThis notebook starts with a baseline system and then provides users the opportunity to attempt to improve performance with their own custom, complete system.",
"_____no_output_____"
],
[
"## Set-up",
"_____no_output_____"
]
],
[
[
"%%capture\n!pip install datasets\n!pip install transformers",
"_____no_output_____"
],
[
"import re\nfrom collections import Counter\nimport datasets\nimport pandas as pd\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nfrom sklearn.feature_extraction.text import TfidfVectorizer\nfrom sklearn.metrics import accuracy_score, confusion_matrix, f1_score, precision_score, recall_score\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.naive_bayes import MultinomialNB\nfrom torch.utils.data import DataLoader\nfrom transformers import BertTokenizer, BertForSequenceClassification",
"_____no_output_____"
]
],
[
[
"## Getting a test dataset",
"_____no_output_____"
],
[
"We can start with the Common Crawl news corpus (January 2017 - December 2019). See here for details:\n\nhttps://huggingface.co/datasets/cc_news\n\nThis will constitute our test dataset. Note that the pseudolabels were generated from the beginning of this dataset but that the dataset (of 708,241 news articles) was in no way exhausted. You could perhaps skip the first 20,000 or so articles to deal only with new data.",
"_____no_output_____"
]
],
[
[
"# this could take several minutes\ndataset = datasets.load_dataset('cc_news')",
"_____no_output_____"
],
[
"dataset",
"_____no_output_____"
],
[
"# look at the first 10 samples\nfor i, s in enumerate(dataset['train']):\n print(s)\n if i >= 10:\n break",
"{'date': '2017-04-17 00:00:00', 'description': \"Officials unsealed court documents Monday (April 17) to reveal details surrounding the first searches of Prince's Paisley Park estate.\", 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/04/prince-young-and-sad.jpg?w=946', 'text': 'By Abby Hassler\\nOfficials unsealed court documents Monday (April 17) to reveal details surrounding the first searches of Prince’s Paisley Park estate following his untimely death.\\nRelated: Prince’s Ex-Wife Mayte Garcia Says Memoir is not a Tell-All\\nThe unsealed search warrants don’t confirm the source of the drug, fentanyl, that led to the 57-year-old singer’s accidental, self-administered overdose last April, according to The Star Tribune.\\nInvestigators found no prescriptions in Prince’s name, however, Dr. Michael Todd Schulenberg told detectives he had written a prescription for oxycodone, which is also an opioid, under the name of long-time Prince associate and drummer Kirk Johnson.\\nBetween April 21 and Sept. 19, 2016, Carver County authorities conducted investigations into Prince’s death with a total of 11 search warrants.', 'title': 'Prince Search Warrants Unsealed, Answer Few Questions', 'url': 'http://1041jackfm.cbslocal.com/2017/04/17/prince-search-warrants-unsealed-2/'}\n{'date': '2017-08-14 00:00:00', 'description': '\"The spirit of Green Day has always been about rising above oppression.\"', 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/08/billie-joe-armstrong-theo-wargo-getty-images.jpg?w=946', 'text': 'By Abby Hassler\\nGreen Day’s Billie Joe Armstrong has always been outspoken about his political beliefs. Following the tragedy in Charlottesville, Virgina, over the weekend, Armstrong felt the need to speak out against the white supremacists who caused much of the violence.\\nRelated: Billie Joe Armstrong Wins #TBT with Childhood Studio Photo\\n“My heart feels heavy. I feel like what happened in Charlottesville goes beyond the point of anger,” Armstrong wrote on Facebook. “It makes me sad and desperate. shocked. I f—— hate racism more than anything.”\\n“The spirit of Green Day has always been about rising above oppression. and sticking up for what you believe in and singing it at the top of your lungs,” Armstrong continued. “We grew up fearing nuclear holocaust because of the cold war. those days are feeling way too relevant these days. these issues are our ugly past.. and now it’s coming to haunt us. always resist these doomsday politicians. and in the words of our punk forefathers .. Nazi punks f— off.”', 'title': 'Green Day’s Billie Joe Armstrong Rails Against White Nationalists', 'url': 'http://1041jackfm.cbslocal.com/2017/08/14/billie-joe-armstrong-white-nationalists/'}\n{'date': '2017-02-15 00:00:00', 'description': 'The concept, which has broken YouTube records and dominated social media, remains as simple and delightful as ever. Only this time, a rotating cast of celebrities will replace James Corden.', 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/02/metallica-carpool.jpg?w=946', 'text': 'By Hayden Wright\\nA trailer has been released for the next sequence of Carpool Karaoke videos, and the lineup is stellar. The CBS late-night segment will stream on Apple Music in a similar format, but with new guests and even crazier moments behind the wheel. The concept, which has broken YouTube records and dominated social media, remains as simple and delightful as ever. Only this time, a rotating cast of celebrities will replace James Corden.\\nRelated: Adele’s ‘Carpool Karaoke’ is the Most Popular Viral Video of 2016\\nHere are the moments we’re most excited for:\\nMetallica making their headbanging mark on Rihanna’s “Diamonds” with Billy Eichner.\\nJohn Legend duetting on with Alicia Keys on her breakout hit, “Falling.”\\nAriana Grande belting the Little Shop of Horrors soundtrack with Seth MacFarlane.\\nJames Corden’s return with Will Smith — they rap the Fresh Prince theme!\\nChelsea Handler slinging whiskey and singing Bon Jovi’s “Living on a Prayer” with Blake Shelton.\\nCorden also presides over an epic, R. Kelly-inspired key change for the Carpool Karaoke franchise — there’s a helicopter.\\nA new installment will drop on Apple Music each week and the premiere is “coming soon.”\\nWatch the preview here:', 'title': 'Upcoming ‘Carpool Karaoke’ Series Looks Epic', 'url': 'http://1041jackfm.cbslocal.com/2017/02/15/carpool-karaoke-series-epic/'}\n{'date': '2017-01-01 00:00:00', 'description': '\"S--- happens,\" said Carey.', 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/01/mariah-carey-getty.jpg?w=946', 'text': 'By Brian Ives\\nSo, you’re Mariah Carey, one of the world’s biggest stars for a quarter of a century, and you fail on national TV, big time. How do you handle it?\\nAs it turns out, you handle it with humor.\\nRelated: Mariah Carey Shades Ariana Grande, Demi Lovato\\nFor those just waking up now: in case you were totally absent from social media on New Year’s Eve (and if so, good for you!), Mariah Carey had a disastrous performance—or perhaps, non-performance is a better way to describe it—on Dick Clark’s New Year’s Rockin’ Eve last night. As CBS News reported, Carey “paced the stage without singing. It’s unclear what exactly were the technical difficulties, but the disaster was obvious as it unfolded live.”\\nPredictably, twitter erupted with mockery, including memes about 2016 claiming its final victim (Mariah Carey’s career).\\nCarey’s response was a single [NSFW] tweet, “S— happens. Have a happy and healthy new year everybody! Here’s to making more headlines in 2017.”', 'title': 'Mariah Carey Reacts to Her NYE Performance with Humor', 'url': 'http://1041jackfm.cbslocal.com/2017/01/01/mariah-carey-reacts-to-her-nye-performance-with-humor/'}\n{'date': '2017-10-06 00:00:00', 'description': 'Dubbed the \"Raw Sessions Versions,\" the tracks are prototypes for the songs we know.', 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/10/queen-photo-by-rogers-express-getty-images.jpg?w=946', 'text': 'By Hayden Wright\\nLast month, Queen announced a deluxe box set celebrating the 40th anniversary of their 1977 album News of the World. In the press release, the band promised “Every lead vocal is different, as are most of the lead guitar parts and a great many other instrumental details.” Now Queen have revealed the reissue versions of “We Are the Champions” and “We Will Rock You,” two of the band’s best-loved songs.\\nRelated: Queen Detail ‘News of the World’ Deluxe Box Set\\nDubbed the “Raw Sessions Versions,” the tracks are prototypes for the songs we know: Freddie Mercury’s vocals are a bit looser on “We Will Rock You,” which begins with a few warmup bars of singing. Brian May’s guitar solo is quite different, too. You get the sense that Queen were feeling their way through the tracks as they recorded earlier versions. The piano arrangement on “We Are the Champions” is brighter and happier.\\nThe News of the World box set debuts November 17. Listen to the never-before-heard raw sessions here:', 'title': 'Queen Release Alternate Takes of Classic Songs \" 104.1 Jack FM', 'url': 'http://1041jackfm.cbslocal.com/2017/10/06/queen-studio-outtakes-we-will-rock-you-we-are-the-champions/'}\n{'date': '2017-02-14 00:00:00', 'description': 'Katy Perry, Paul McCarteny and Miley Cyrus are just a few of the artists to spread the love.', 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/02/grammy-red-carpet-43.jpg?w=946', 'text': \"By Radio.com Staff\\nIt’s Valentine’s day and artists are taking to social media to show love for their fans and significant others.\\nRelated: John Mayer is Cupid’s Secret Weapon\\nKaty Perry, Paul McCartney and Miley Cyrus are just a few of the musicians to spread the love.\\nChris Young had his tongue planted firmly in his cheek when he wished fans a “Happy Taco Tuesday,” and then there was Kesha, who loves her fans, but worries her cats will eat her. Valid concern.\\nCheck out the best Valentine’s Day messages below.\\n❤✨So much love for my #KatyCats on this mushy day! Thanks for keeping me floating and grounded all at the same time… twitter.com/i/web/status/8… —\\nKATY PERRY (@katyperry) February 14, 2017\\nAll we need is love. Happy Valentine's Day. X #ValentinesDay https://t.co/DsxieopcYJ —\\nPaul McCartney (@PaulMcCartney) February 14, 2017\\nHappy Valentine's Day https://t.co/p4VIPntyHx —\\nKim Kardashian West (@KimKardashian) February 14, 2017\\nHave a Happy Hippie Valentimezzzzz! TBTuesday to my date night with @tywrent!!!!!! It's all about L-O-V-E everyday.… twitter.com/i/web/status/8… —\\nMiley Ray Cyrus (@MileyCyrus) February 14, 2017\\nHappy Valentine's Day to all our fans ❤️ https://t.co/IzYZEVsyEX —\\nPearl Jam (@PearlJam) February 14, 2017\\nHappy Valentine's Day ❤😘😍 I love you —\\nAustin Mahone (@AustinMahone) February 14, 2017\\nHappy Valentines Day X Adam https://t.co/eiKiysyNE3 —\\n(@U2) February 14, 2017\\nHappy Valentine's Day, ya creeps. —\\nMark Hoppus (@markhoppus) February 14, 2017\\nI think I'm forgetting something today... Oh yeah! Happy Taco Tuesday everybody! —\\n(@ChrisYoungMusic) February 14, 2017\", 'title': 'Musicians Wish Fans a Happy Valentine’s Day', 'url': 'http://1041jackfm.cbslocal.com/2017/02/14/musicians-happy-valentines-day/'}\n{'date': '2017-08-14 00:00:00', 'description': \"The lineup for the four tour dates will feature Don Henley, Joe Walsh and Timothy B. Schmit with Frey's son Deacon and Vince Gill.\", 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/08/the-eagles-kennedy-center.jpg?w=946', 'text': \"By Annie Reuter\\nThe Eagles have announced four new concert dates. The lineup for the short run will feature Don Henley, Joe Walsh and Timothy B. Schmit with Frey’s son, Deacon, and Vince Gill filling in for the late Glenn Frey.\\nRelated: Vince Gill to Join Eagles for Classic East and West Shows\\nAn Evening with the Eagles will stop at the Greensboro Coliseum in North Carolina on October 17 followed by a show a Philips Arena in Atlanta, Georgia. on October 20. The band will return to Louisville, Kentucky on October 24 at KFC Yum! Center before traveling to the late Glenn Frey’s hometown of Detroit, Michigan on October 27 to wrap up the run at Little Caesars Arena.\\nTickets for the four new dates go on sale at Saturday (Aug. 19) at 10 am. An American Express card member pre-sale starts on Tuesday while VIP packages will be available through Eagles.com.\\nThe four new tour dates follow the success of the band’s Classic West and East shows, earlier this summer. Deacon and Gill also played with the band for those shows.\\n“Bringing Deacon in was my idea,” Don Henley told the LA Times. “I think of the guild system, which in both Eastern and Western cultures is a centuries-old tradition of the father passing down the trade to his son, and to me, that makes perfect moral and ethical sense. The primary thing is I think Glenn would be good with it—with both of these guys. I think he’d go, ‘That’s the perfect way to do this.'”\", 'title': 'The Eagles Add Four New Dates to 2017 Tour \" 104.1 Jack FM', 'url': 'http://1041jackfm.cbslocal.com/2017/08/14/the-eagles-2017-tour-dates/'}\n{'date': '2017-02-14 00:00:00', 'description': \"George Michael's manager, Michael Lippman, wanted the three artists as well as host James Corden to perform a mashup of Michael's hits.\", 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/02/grammy-show-60.jpg?w=946', 'text': 'By Annie Reuter\\nAdele’s tribute to George Michael on Sunday (Feb. 12) at the GRAMMY Awards was a memorable one despite an early glitch that caused her to start the song over. But the original plans for the performance were far different. At one point the tribute could have included Beyoncé and Rihanna.\\nRelated: Adele Tributes George Michael after Rocky Start at 2017 GRAMMYs\\nGeorge Michael’s manager, Michael Lippman, wanted the three artists as well as host James Corden to perform a mashup of Michael’s hits including “Freedom” and “One More Try,” GRAMMY executive producer Ken Ehrlich told Billboard,\\nThat decision shifted when Lippman found out “how passionate Adele was,” Ehrlich says, “and that she had a vision for what she wanted to do with it.” Adele would go on to perform a ballad version of Michael’s 1996 hit “Fastlove” backed by an orchestra. It was a song she recalls hearing for the first time at the age of 10 and she instantly “heard the vulnerability in that song,” Ehrlich says.\\nBackstage following her emotional GRAMMY performance, Adele raved about Michael, adding that “it was an honor” to show her respects to the singer. Later that night, Adele won GRAMMYs for Record of the Year and Album of the Year.', 'title': 'George Michael GRAMMY Tribute Plans Included Beyoncé, Rihanna', 'url': 'http://1041jackfm.cbslocal.com/2017/02/14/george-michael-grammy-tribute-plans-beyonce-rihanna/'}\n{'date': '2017-02-15 00:00:00', 'description': '\"In these trying times we need some fun. We’re very serious about fun.”', 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/02/deborah-harry-getty.jpg?w=946', 'text': 'By Jon Wiederhorn\\nBlondie have released a video for “Fun,” the first single from their upcoming album Pollinator. Directed by Beyoncé collaborator Dikyal Rimmasch, the clip lives up to the song’s title, featuring the band in a space ship, wandering another planet and animated footage of galactic travel contrasted with performance shots and images of people partying on the dance floor.\\nRelated: Blondie and Garbage Announce Co-Headlining Summer Tour\\nGuitarist Chris Stein said the interstellar theme was an effort to escape the stress and turmoil of modern day events. “Quoting Emma Goldman, ‘If I can’t dance I don’t want to be part of your revolution.’ In these trying times we need some fun. We’re very serious about fun,” he told NME.\\n“The video was shot in two places,” he added. “The color stuff was all shot in LA without us and the black and white stuff was shot in New York. It’s got some good cameos—it’s got a pretty big cameo from Raja, who’s one of the Drag Race superstars, and little cameos from Grace McKagan, Duff McKagan’s daughter who has a band called The Pink Slips, and also Tony Maserati, who was a producer and mixer for us.”\\nStein and vocalist Debbie Harry wrote the upbeat, disco-inflected “Fun” with TV On The Radio member Dave Sitek. Pollinator, which is scheduled for release May 5, also features writing by Johnny Marr, Sia, Charli XCX, The Strokes guitarist Nick Valensi and Dev Hynes. It will be Blondie’s first record since 2014’s Ghost of Download.', 'title': 'Blondie Release Galactic Video for New Song ‘Fun’', 'url': 'http://1041jackfm.cbslocal.com/2017/02/15/blondie-video-new-song-fun/'}\n{'date': '2017-06-14 00:00:00', 'description': 'Check out the latest from the Las Vegas rockers.', 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://s0.wp.com/wp-content/themes/vip/cbs-local/images/global/facebook/facebook-share-260x260.png', 'text': 'The Killers have released a new single titled “The Man” from their forthcoming album, Wonderful Wonderful.\\nRelated: The Killers Perform New Track, ‘Run for Cover’\\nThe track is the first new music from the band since their 2012 album Battle Born (assuming you don’t count their 2016 Christmas album Don’t Waste Your Wishes). Hopefully, this signals a fifth studio effort is imminent. “The Man” was recorded with the producer Jacknife Lee during album sessions in Las Vegas and Los Angeles. The song finds frontman Brandon Flowers looking back on his younger self, the persona from their Grammy-nominated debut Hot Fuss, and reconciling that wide-eyed character with the man he is now.\\nCheck out the latest from The Killers below.', 'title': 'Listen to The Killers’ New Track ‘The Man’', 'url': 'http://1041jackfm.cbslocal.com/2017/06/14/the-killers-the-man-3/'}\n{'date': '2017-06-14 00:00:00', 'description': \"The song is featured in the upcoming film 'The Book of Henry.'\", 'domain': '1041jackfm.cbslocal.com', 'image_url': 'https://cbs1041jackfm.files.wordpress.com/2017/06/stevienickspress.jpg?w=946', 'text': 'By Abby Hassler\\nStevie Nicks debuted a new ballad “Your Hand I Will Never Let Go” today (June 14). The track is featured in the Naomi Wats-drama, The Book of Henry, which will hit theaters this Friday (June 16).\\nRelated: Lana Del Rey Taps Stevie Nicks for New Track: Report\\nWritten by Thomas Barlett and Ryan Miller, Nicks’ song will fall alongside original music composed by Michael Giacchino on the film’s soundtrack.\\n“Drowned in thought and caught in a stare/ Talking to ghosts who were not there,” Nicks sings. “Then you took my hand/ Transformation began/ Commotion where it once was still/ Fireworks explode/ Front row tickets to the show/ This hand I will never let it go.”\\nListen to “Your Hand I Will Never Let It Go” below.', 'title': 'Stevie Nicks Debuts New Single ‘Your Hand I Will Never Let It Go’', 'url': 'http://1041jackfm.cbslocal.com/2017/06/14/stevie-nicks-your-hand-i-will-never-let-it-go/'}\n"
]
],
[
[
"## Getting pseudo-labeled data for training\n\n`0` represents viral language, `1` immigration language, and `2` a blend of the two. These categorizations are fuzzy and inexact and are not the result of manual annotations. They should be improved upon during the training process (or adjusted manually) when possible.",
"_____no_output_____"
]
],
[
[
"df = pd.read_csv('https://www.dropbox.com/s/kfbja23kisimedm/immigration.csv?dl=1')\ndf.head()",
"_____no_output_____"
],
[
"X_train, X_valid, y_train, y_valid = train_test_split(df['text'], df['target'], train_size=0.7, random_state=42)",
"_____no_output_____"
],
[
"X_valid, y_valid",
"_____no_output_____"
]
],
[
[
"# Baseline 1\n\nLet's use Naive Bayes. For the sake of simplicity, I will not add weighting to the classes here (we probably should!), but sklearn wants its weights to correspond to samples in the train dataset (when using the fit method). So you would need to feed in a list of weights the same length as your samples. Think about the weights in a table corresponding to class like this:\n\n| Sample | Class | Weight |\n| --- | --- | --- |\n| sample 1 | 1 | 0.05 |\n| sample 2 | 2 | 0.8 |\n| sample 3 | 1 | 0.05 |\n| sample 4 | 0 | 0.15 |\n| sample 5 | 2 | 0.8 |",
"_____no_output_____"
]
],
[
[
"vectorizer = TfidfVectorizer()\ntrain_vectorized = vectorizer.fit_transform(X_train)\nvalid_vectorized = vectorizer.transform(X_valid)\ntrain_vectorized",
"_____no_output_____"
],
[
"naive_bayes = MultinomialNB()\nnaive_bayes.fit(train_vectorized, y_train)",
"_____no_output_____"
],
[
"predictions = naive_bayes.predict(valid_vectorized)\npredictions",
"_____no_output_____"
],
[
"print(f'Accuracy: {accuracy_score(y_valid, predictions)}\\n'\n f'Precision: {precision_score(y_valid, predictions, average=None)}\\n'\n f'Recall: {recall_score(y_valid, predictions, average=None)}\\n'\n f'F1 Score: {f1_score(y_valid, predictions, average=None)}\\n')",
"Accuracy: 0.9649855444908448\nPrecision: [0.99604156 0.95005945 0. ]\nRecall: [0.92424242 0.99875 0. ]\nF1 Score: [0.95879971 0.97379647 0. ]\n\n"
],
[
"# y-axis (rows) == true label and x-axis (columns) == predicted label\nconfusion_matrix(y_valid, predictions)",
"_____no_output_____"
]
],
[
[
"# Baseline 2",
"_____no_output_____"
]
],
[
[
"model = BertForSequenceClassification.from_pretrained('bert-large-uncased', num_labels=3)\ntokenizer = BertTokenizer.from_pretrained('bert-large-uncased')",
"_____no_output_____"
],
[
"device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\nmodel = model.to(device)",
"_____no_output_____"
],
[
"# the classes are extremely unbalanced; let's generate weights that we can feed to loss function\nunbalanced_weights = 1 / (y_train.value_counts() / len(y_train)).sort_index()\nweights = unbalanced_weights / unbalanced_weights.sum()\nweights",
"_____no_output_____"
],
[
"# I will exclude datasets, dataloaders, etc. for the sake of simplicity\ncriterion = nn.CrossEntropyLoss(weight=torch.tensor(weights.values).float().to(device))\noptimizer = optim.AdamW(model.parameters(), lr=1e-5)\nfor epoch in range(1): # make this up to 3!\n running_loss = 0.\n for batch_start in range(0, len(X_train), 4):\n X = X_train[batch_start:batch_start + 4].tolist()\n y = torch.tensor(y_train[batch_start:batch_start + 4].values).to(device)\n\n predictions = model(**tokenizer(X, return_tensors='pt', padding=True).to(device))\n loss = criterion(torch.softmax(predictions.logits, dim=-1), y)\n optimizer.zero_grad()\n loss.backward()\n optimizer.step()\n running_loss += loss.item()\n print(f'Finished epoch {epoch} with running loss of {running_loss / len(X_train)}')",
"_____no_output_____"
],
[
"# make predictions on validation set\nvalid_predictions = torch.zeros_like(torch.tensor(y_valid.values))\nfor batch_start in range(0, len(X_valid), 4):\n X = X_valid[batch_start:batch_start + 4].tolist()\n\n with torch.no_grad():\n predictions = model(**tokenizer(X, return_tensors='pt', padding=True).to(device))\n indices = torch.argmax(torch.softmax(predictions.logits, dim=-1), dim=-1)\n valid_predictions[batch_start:batch_start + 4] = indices",
"_____no_output_____"
],
[
"print(f'Accuracy: {accuracy_score(y_valid, valid_predictions.numpy())}\\n'\n f'Precision: {precision_score(y_valid, valid_predictions.numpy(), average=None)}\\n'\n f'Recall: {recall_score(y_valid, valid_predictions.numpy(), average=None)}\\n'\n f'F1 Score: {f1_score(y_valid, valid_predictions.numpy(), average=None)}\\n')",
"_____no_output_____"
],
[
"# y-axis (rows) == true label and x-axis (columns) == predicted label\nconfusion_matrix(y_valid, valid_predictions.numpy())",
"_____no_output_____"
]
],
[
[
"# Your Original System\n\nImprove upon the baselines above. Feel free to copy cells from one of the baselines above, paste it here, and tweak it for improvements. You have several models to select from from sklearn (both for classification and for vectorization of text). And even just trying different architectures for Basline 2 (such as RoBERTa, distilbert, etc.) would help.",
"_____no_output_____"
]
],
[
[
"",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0ca042d8cc927896c4426004188709743e7f635 | 60,717 | ipynb | Jupyter Notebook | class_11-2/592B-F19-class_11-2.ipynb | ling592b-f19/592b-f19-class | e3f009b1bfbc5566e92ec0b843d3645859c6c497 | [
"MIT"
] | 1 | 2019-09-05T12:01:47.000Z | 2019-09-05T12:01:47.000Z | class_11-2/592B-F19-class_11-2.ipynb | ling592b-f19/592b-f19-class | e3f009b1bfbc5566e92ec0b843d3645859c6c497 | [
"MIT"
] | null | null | null | class_11-2/592B-F19-class_11-2.ipynb | ling592b-f19/592b-f19-class | e3f009b1bfbc5566e92ec0b843d3645859c6c497 | [
"MIT"
] | 3 | 2019-09-05T19:59:42.000Z | 2019-09-10T20:06:40.000Z | 290.511962 | 39,032 | 0.923135 | [
[
[
"%matplotlib inline",
"_____no_output_____"
]
],
[
[
"# 592B, Class 11.2 (11/14). Filtering review",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\nimport scipy.io.wavfile as wavfile \nimport scipy.signal as signal\nfrom scipy import fftpack\n\nfrom ipywidgets import interactive\nfrom IPython.display import Audio, display",
"_____no_output_____"
]
],
[
[
"## Review question: filtering and \"translating\" to cepstral analysis\n\nRemember this from last week? Here I've chosen a small frequency for `y1` and a higher frequency for `y2`. ",
"_____no_output_____"
]
],
[
[
"def plot_play_summed_sines(f1 = 50, f2 = 880, t_start = 0, t_stop = 1, fs = 2000, xlim_max = 0.01):\n x = np.linspace(t_start, t_stop, fs * (t_stop - t_start))\n y1 = np.sin(2*np.pi*f1*x)\n y2 = np.sin(2*np.pi*f2*x)\n \n plt.xlim(t_start,xlim_max)\n plt.plot(x , y1, \"-g\", label=\"y1\") \n plt.plot(x , y2, \"-b\", label=\"y2\") \n plt.plot(x , y1 + y2, \"-r\", label=\"y1+y2\") \n plt.legend(loc=\"upper right\") \n plt.xlabel('Time (s)')\n plt.ylabel('Amplitude (dB)')\n plt.title(\"Adding up sines\") \n \n display(Audio(data=y1, rate=fs))\n display(Audio(data=y2, rate=fs))\n display(Audio(data=y1+y2, rate=fs))\n \n return (x, y1, y2) #I've added this return line. What does this do?",
"_____no_output_____"
],
[
"x, y1, y2 = plot_play_summed_sines()",
"_____no_output_____"
]
],
[
[
"**1. Modify the code to add an additional sinusoidal signal `y3` in, with frequency `f3`. Set the default frequency of `f3` to be 300 Hz.**",
"_____no_output_____"
],
[
"**2. Perform a computation so you can separate out and visualize the individual component frequencies contributing to `y1 + y2 + y3`.**",
"_____no_output_____"
],
[
"**3. Design and implement filters so that you can separate out: (a) the highest frequency component, (b) the lowest frequency component, (c) the middle frequency componenent. What are these different kinds of filters called?** *Hint: you may find [this sample code](https://stackoverflow.com/questions/19122157/fft-bandpass-filter-in-python#19124329) helpful.*",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
]
] |
d0ca07fe931554671b29fdcf87bd78a81f7c559a | 7,639 | ipynb | Jupyter Notebook | examples/notebooks/09Import_timeseries.ipynb | bdestombe/python-dts-calibration | 4e2b5b5633f030cd9e759417763f3b9a03ae71cb | [
"BSD-3-Clause"
] | 4 | 2018-07-31T23:32:27.000Z | 2018-11-19T16:52:00.000Z | examples/notebooks/09Import_timeseries.ipynb | bdestombe/python-dts-calibration | 4e2b5b5633f030cd9e759417763f3b9a03ae71cb | [
"BSD-3-Clause"
] | 11 | 2018-09-19T11:51:51.000Z | 2018-12-22T20:11:37.000Z | examples/notebooks/09Import_timeseries.ipynb | bdestombe/python-dts-calibration | 4e2b5b5633f030cd9e759417763f3b9a03ae71cb | [
"BSD-3-Clause"
] | 1 | 2018-10-03T08:04:33.000Z | 2018-10-03T08:04:33.000Z | 28.188192 | 265 | 0.53685 | [
[
[
"# 9. Import a time series",
"_____no_output_____"
],
[
"In this tutorial we are adding a timeseries to the DataStore object. This might be useful if the temperature in one of the calibration baths was measured with an external device. It requires three steps to add the measurement files to the DataStore object:\n1. Load the measurement files (e.g., csv, txt) with pandas into a pandas.Series object\n2. Add the pandas.Series object to the DataStore\n3. Align the time to that of the DTS measurement (required for calibration)",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport os\n\nfrom dtscalibration import read_silixa_files",
"/Users/bfdestombe/anaconda3/envs/dts/lib/python3.7/typing.py:847: FutureWarning: xarray subclass DataStore should explicitly define __slots__\n super().__init_subclass__(*args, **kwargs)\n"
]
],
[
[
"## Step 1: load the measurement files",
"_____no_output_____"
]
],
[
[
"filepath = os.path.join('..', '..', 'tests', 'data', \n 'external_temperature_timeseries', \n 'Loodswaternet2018-03-28 02h.csv')\n\n# Bonus:\nprint(filepath, '\\n')\nwith open(filepath, 'r') as f:\n head = [next(f) for _ in range(5)]\nprint(' '.join(head))",
"../../tests/data/external_temperature_timeseries/Loodswaternet2018-03-28 02h.csv \n\n\"time\",\"Pt100 2\"\n 2018-03-28 02:00:05, 12.748\n 2018-03-28 02:00:10, 12.747\n 2018-03-28 02:00:15, 12.746\n 2018-03-28 02:00:20, 12.747\n\n"
],
[
"ts = pd.read_csv(filepath, sep=',', index_col=0, parse_dates=True, \n squeeze=True, engine='python') # the latter 2 kwargs are to ensure a pd.Series is returned\nts = ts.tz_localize('Europe/Amsterdam') # set the timezone",
"_____no_output_____"
],
[
"ts.head() # Double check the timezone",
"_____no_output_____"
]
],
[
[
"Now we quickly create a DataStore from xml-files with Stokes measurements to add the external timeseries to",
"_____no_output_____"
]
],
[
[
"filepath_ds = os.path.join('..', '..', 'tests', 'data', 'double_ended2')\nds = read_silixa_files(directory=filepath_ds,\n timezone_netcdf='UTC',\n file_ext='*.xml')",
"6 files were found, each representing a single timestep\n6 recorded vars were found: LAF, ST, AST, REV-ST, REV-AST, TMP\nRecorded at 1693 points along the cable\nThe measurement is double ended\nReading the data from disk\n"
]
],
[
[
"## Step 2: Add the temperature measurements of the external probe to the DataStore.\n\nFirst add the coordinates",
"_____no_output_____"
]
],
[
[
"ds.coords['time_external'] = ts.index.values",
"_____no_output_____"
]
],
[
[
"Second we add the measured values",
"_____no_output_____"
]
],
[
[
"ds['external_probe'] = (('time_external',), ts)",
"_____no_output_____"
]
],
[
[
"## Step 3: Align the time of the external measurements to the Stokes measurement times\nWe linearly interpolate the measurements of the external sensor to the times we have DTS measurements",
"_____no_output_____"
]
],
[
[
"ds['external_probe_dts'] = ds['external_probe'].interp(time_external=ds.time)",
"_____no_output_____"
],
[
"print(ds.data_vars)",
"Data variables:\n st (x, time) float64 1.281 -0.5321 ... -43.44 -41.08\n ast (x, time) float64 0.4917 1.243 ... -30.14 -32.09\n rst (x, time) float64 0.4086 -0.568 ... 4.822e+03\n rast (x, time) float64 2.569 -1.603 ... 4.224e+03\n tmp (x, time) float64 196.1 639.1 218.7 ... 8.442 18.47\n acquisitionTime (time) float32 2.098 2.075 2.076 2.133 2.085 2.062\n referenceTemperature (time) float32 21.0536 21.054 ... 21.0531 21.057\n probe1Temperature (time) float32 4.36149 4.36025 ... 4.36021 4.36118\n probe2Temperature (time) float32 18.5792 18.5785 ... 18.5805 18.5723\n referenceProbeVoltage (time) float32 0.121704 0.121704 ... 0.121705\n probe1Voltage (time) float32 0.114 0.114 0.114 0.114 0.114 0.114\n probe2Voltage (time) float32 0.121 0.121 0.121 0.121 0.121 0.121\n userAcquisitionTimeFW (time) float32 2.0 2.0 2.0 2.0 2.0 2.0\n userAcquisitionTimeBW (time) float32 2.0 2.0 2.0 2.0 2.0 2.0\n external_probe (time_external) float64 12.75 12.75 ... 12.76 12.76\n external_probe_dts (time) float64 12.75 12.75 12.75 12.75 12.75 12.75\n"
]
],
[
[
"Now we can use `external_probe_dts` when we define sections and use it for calibration",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0ca0ba04e063e8521e2895da8c76ed211803c83 | 162,518 | ipynb | Jupyter Notebook | main.ipynb | nsadural/Udacity-P1-CarND-Finding-Lane-Lines | ad9352c58479d9c9e07fbf2f50b5523552c83769 | [
"MIT"
] | null | null | null | main.ipynb | nsadural/Udacity-P1-CarND-Finding-Lane-Lines | ad9352c58479d9c9e07fbf2f50b5523552c83769 | [
"MIT"
] | null | null | null | main.ipynb | nsadural/Udacity-P1-CarND-Finding-Lane-Lines | ad9352c58479d9c9e07fbf2f50b5523552c83769 | [
"MIT"
] | null | null | null | 189.194412 | 116,168 | 0.822887 | [
[
[
"\"\"\"Udacity - Self-Driving Engineer Nanodegree\nProject 1: Finding Lane Lines on the Road\nNikko Sadural\"\"\"\n\nimport matplotlib.pyplot as plt\nimport matplotlib.image as mpimg\nimport numpy as np\nimport cv2\nimport math\nfrom moviepy.editor import VideoFileClip\nfrom IPython.display import HTML\n%matplotlib inline\n\ndef grayscale(img):\n \"\"\"Applies the Grayscale transform\n This will return an image with only one color channel\n but NOTE: to see the returned image as grayscale\n (assuming your grayscaled image is called 'gray')\n you should call plt.imshow(gray, cmap='gray')\"\"\"\n return cv2.cvtColor(img, cv2.COLOR_RGB2GRAY)\n # Or use BGR2GRAY if you read an image with cv2.imread()\n # return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)\n\ndef canny(img, low_threshold, high_threshold):\n \"\"\"Applies the Canny transform\"\"\"\n return cv2.Canny(img, low_threshold, high_threshold)\n\ndef gaussian_blur(img, kernel_size):\n \"\"\"Applies the Gaussian Noise kernel\"\"\"\n return cv2.GaussianBlur(img, (kernel_size, kernel_size), 0)\n\ndef region_of_interest(img, vertices):\n \"\"\"\n Applies an image mask.\n \n Only keeps the region of the image defined by the polygon\n formed from 'vertices'. The rest of the image is set to black.\n 'vertices' should be a numpy array of integer points.\n \"\"\"\n #defining a blank mask to start with\n mask = np.zeros_like(img)\n \n #defining a 3 channel or 1 channel color to fill the mask with depending on the input image\n if len(img.shape) > 2:\n channel_count = img.shape[2]\n ignore_mask_color = (255,) * channel_count\n else:\n ignore_mask_color = 255\n \n #filling pixels inside the polygon defined by \"vertices\" with the fill color\n cv2.fillPoly(mask, vertices, ignore_mask_color)\n \n #returning the image only where mask pixels are nonzero\n masked_image = cv2.bitwise_and(img, mask)\n return masked_image\n\ndef draw_lines(img, lines, top_left_y, top_right_y, color=[255, 0, 0], thickness=10):\n \"\"\"\n NOTE: this is the function you might want to use as a starting point once you want to\n average/extrapolate the lines segments you detect to map out the full\n extent of the lane (going from the result shown in raw-lines-example.mp4\n to that shown in P1_example.mp4.)\n \n Think about things like separating lines segments by their\n slope ((y2-y1)/(x2-x1)) to decide which segments are part of the left\n line vs. the right line. Then, you can average the position of each of\n the lines and extrapolate to the top and bottom of the lane.\n \n This function draws 'lines' with 'color' and 'thickness'.\n Lines are drawn on the image inplace (mutates the image).\n If you want to make the lines semi-transparent, think about combining\n this function with the weighted_img() function below\n \"\"\"\n \n #Initialize variables for holding high/low x/y values and counters\n x1_low1_pos = img.shape[1]\n y1_low1_pos = img.shape[0]\n x1_low2_pos = img.shape[1]\n y1_low2_pos = img.shape[0]\n x2_high1_pos = 0\n y2_high1_pos = 0\n x2_high2_pos = 0\n y2_high2_pos = 0\n x1_low1_neg = img.shape[1]\n y1_low1_neg = img.shape[0]\n x1_low2_neg = img.shape[1]\n y1_low2_neg = img.shape[0]\n x2_high1_neg = 0\n y2_high1_neg = 0\n x2_high2_neg = 0\n y2_high2_neg = 0\n m_sum_pos = 0\n sum_count_pos = 0\n m_sum_neg = 0\n sum_count_neg = 0\n \n for line in lines:\n \n for x1,y1,x2,y2 in line:\n \n #Get slope and print line variables\n m = ((y2-y1)/(x2-x1))\n \n #For positive/negative slopes, get two smallest x1's and two largest x2's \n #(x1_low2 < x1_low1)\n #(x2_high2 > x2_high1) \n \n if m > 0.55 and m < 0.9:\n #Get two smallest x1's\n if x1 < x1_low1_pos and x1 < x1_low2_pos:\n x1_low1_pos = x1_low2_pos\n y1_low1_pos = y1_low2_pos\n x1_low2_pos = x1\n y1_low2_pos = y1\n elif x1 < x1_low1_pos and x1 > x1_low2_pos:\n x1_low1_pos = x1\n y1_low1_pos = y1\n \n #Get two largest x2's\n if x2 > x2_high1_pos and x2 > x2_high2_pos:\n x2_high1_pos = x2_high2_pos\n y2_high1_pos = y2_high2_pos\n x2_high2_pos = x2\n y2_high2_pos = y2\n elif x2 > x2_high1_pos and x2 < x2_high2_pos:\n x2_high1_pos = x2\n y2_high1_pos = y2\n m_sum_pos = m_sum_pos + m\n sum_count_pos = sum_count_pos + 1\n \n elif m < -0.55 and m > -0.9:\n #Get two smallest x1's\n if x1 < x1_low1_neg and x1 < x1_low2_neg:\n x1_low1_neg = x1_low2_neg\n y1_low1_neg = y1_low2_neg\n x1_low2_neg = x1\n y1_low2_neg = y1\n elif x1 < x1_low1_neg and x1 > x1_low2_neg:\n x1_low1_neg = x1\n y1_low1_neg = y1\n \n #Get two largest x2's\n if x2 > x2_high1_neg and x2 > x2_high2_neg:\n x2_high1_neg = x2_high2_neg\n y2_high1_neg = y2_high2_neg\n x2_high2_neg = x2\n y2_high2_neg = y2\n elif x2 > x2_high1_neg and x2 < x2_high2_neg:\n x2_high1_neg = x2\n y2_high1_neg = y2\n m_sum_neg = m_sum_neg + m\n sum_count_neg = sum_count_neg + 1\n \n #Calculate positive line slope from average of detected line slopes\n m_pos = round(m_sum_pos / sum_count_pos,2)\n \n #Calculate endpoints for extrapolated line with positive slope\n x2_calc_pos = int(x1_low2_pos + (1/m_pos)*(img.shape[0] - y1_low2_pos))\n x1_calc_pos = (math.floor(x2_calc_pos - (1/m_pos)*(img.shape[0] - top_right_y)))\n x2_calc_pos = (math.floor(x1_calc_pos + (1/m_pos)*(img.shape[0] - top_right_y)))\n \n #Calculate negative line slope from average of detected line slopes\n m_neg = round(m_sum_neg / sum_count_neg,2)\n \n #Calculate endpoints for extrapolated line with negative slope\n x1_calc_neg = int(x2_high2_neg - (1/m_neg)*(y2_high2_neg - img.shape[0]))\n x2_calc_neg = (math.floor(x1_calc_neg + (1/m_neg)*(top_left_y - img.shape[0])))\n x1_calc_neg = (math.floor(x2_calc_neg - (1/m_neg)*(top_left_y - img.shape[0])))\n \n #Draw extrapolated lines with positive and negative slopes onto image\n new_img = cv2.line(img, (x1_calc_pos, top_right_y), (x2_calc_pos, img.shape[0]), color, thickness)\n cv2.line(new_img, (x1_calc_neg, img.shape[0]), (x2_calc_neg, top_left_y), color, thickness)\n \ndef hough_lines(img, rho, theta, threshold, min_line_len, max_line_gap, top_left_y, top_right_y):\n \"\"\"\n 'img' should be the output of a Canny transform.\n \n Returns an image with hough lines drawn.\n \"\"\"\n lines = cv2.HoughLinesP(img, rho, theta, threshold, np.array([]), minLineLength=min_line_len, maxLineGap=max_line_gap)\n line_img = np.zeros((img.shape[0], img.shape[1], 3), dtype=np.uint8)\n draw_lines(line_img, lines, top_left_y, top_right_y)\n return line_img\n\ndef weighted_img(img, initial_img, α=0.8, β=1., γ=0.):\n \"\"\"\n 'img' is the output of the hough_lines(), an image with lines drawn on it.\n Should be a blank image (all black) with lines drawn on it.\n \n 'initial_img' should be the image before any processing.\n \n The result image is computed as follows:\n \n initial_img * α + img * β + γ\n NOTE: initial_img and img must be the same shape!\n \"\"\"\n return cv2.addWeighted(initial_img, α, img, β, γ)\n\ndef process_image(image):\n #Read in image and convert to grayscale\n gray = grayscale(image)\n\n #Gaussian smoothing to suppress noise/gradients by averaging\n kernel_size = 3\n blur_gray = gaussian_blur(gray, kernel_size)\n\n #Canny edge detection to find edges\n low_threshold = 150\n high_threshold = 250\n masked_edges = canny(blur_gray, low_threshold, high_threshold)\n\n #Define polygon for region masking\n imshape = masked_edges.shape\n top_left_x = 440\n top_left_y = 330\n top_right_x = 530\n top_right_y = 330\n vertices = np.array([[(152,imshape[0]),(top_left_x, top_left_y),(top_right_x, top_right_y),(imshape[1]-70,imshape[0])]],dtype=np.int32)\n masked_image = region_of_interest(masked_edges, vertices)\n \n #Hough to find line segments on edge-detected Canny image\n rho = 1 # distance resolution in pixels of Hough grid\n theta = np.pi/180 # angular resolution in radians of Hough grid\n threshold = 15 # 15 minimum number of votes (Hough grid cell intersections)\n min_line_length = 20 # 20 minimum number of pixels making up a line\n max_line_gap = 1000 # maximum gap between connectable line segments\n lines_image = hough_lines(masked_image, rho, theta, threshold, min_line_length, max_line_gap, top_left_y, top_right_y)\n \n #Draw lines on the edge image\n lines_edges = weighted_img(lines_image, image)\n plt.imshow(lines_edges)\n \n return lines_edges\n\n\nwhite_output = 'test_videos_output/solidWhiteRight.mp4'\nclip1 = VideoFileClip(\"test_videos/solidWhiteRight.mp4\")\nwhite_clip = clip1.fl_image(process_image)\n%time white_clip.write_videofile(white_output, audio=False)\n\nyellow_output = 'test_videos_output/solidYellowLeft.mp4'\nclip2 = VideoFileClip('test_videos/solidYellowLeft.mp4')\nyellow_clip = clip2.fl_image(process_image)\n%time yellow_clip.write_videofile(yellow_output, audio=False)\n\nimage = mpimg.imread('test_images/whiteCarLaneSwitch.jpg')\nprocess_image(image)",
"[MoviePy] >>>> Building video test_videos_output/solidWhiteRight.mp4\n[MoviePy] Writing video test_videos_output/solidWhiteRight.mp4\n"
]
]
] | [
"code"
] | [
[
"code"
]
] |
d0ca10018522bd6e737359a4429c4cedc65e3ac1 | 531,796 | ipynb | Jupyter Notebook | _build/jupyter_execute/j06.ipynb | AndreaPozo/Master_thesis | 42150c2ca6d2316beef1d47a6bc0505aa91f0cf8 | [
"MIT"
] | null | null | null | _build/jupyter_execute/j06.ipynb | AndreaPozo/Master_thesis | 42150c2ca6d2316beef1d47a6bc0505aa91f0cf8 | [
"MIT"
] | null | null | null | _build/jupyter_execute/j06.ipynb | AndreaPozo/Master_thesis | 42150c2ca6d2316beef1d47a6bc0505aa91f0cf8 | [
"MIT"
] | null | null | null | 324.463697 | 195,256 | 0.894247 | [
[
[
"# basic\nimport sys\nimport os\n\n# common\nimport numpy as np\nimport pandas as pd\nimport xarray as xr\nimport matplotlib.pyplot as plt\nfrom datetime import datetime, timedelta\nfrom sklearn.cluster import KMeans\nimport pickle\nimport warnings\nwarnings.filterwarnings('ignore')\nfrom IPython.display import Image\n\n#lib\nfrom lib.validation_methodology_plots import *\n",
"_____no_output_____"
],
[
"path_p = r'/home/administrador/Documentos/seasonal/seasonal_forecast/new/'",
"_____no_output_____"
],
[
"df_2021 = pd.read_pickle(path_p+'df_coordinates_pmin_sst_mld_2021.pkl')\nxs = xr.open_dataset(path_p+'xs_index_vars_19822019_2deg_new.nc')\nxds_kma = xr.open_dataset(path_p+'kma_model/xds_kma_index_vars_1b.nc')\nxs_dwt_counts = xr.open_dataset(path_p+'kma_model/xds_count_tcs8.nc')\nxs_dwt_counts_964 = xr.open_dataset(path_p+'kma_model/xds_count_tcs8_964.nc')\nxds_timeM = xr.open_dataset(path_p+'xds_timeM8.nc')\nxds_PCA = xr.open_dataset(path_p+'xds_PCA.nc')\nxds_kma_ord = xr.open_dataset(path_p+'xds_kma_ord.nc')",
"_____no_output_____"
]
],
[
[
"<br>\n<br>\n<br>\n\n# <font color='navy'>**Model Validation** </font> \n",
"_____no_output_____"
],
[
">[Index predictor](#p)<br> <br>\n>[Cluster comparison](#cc)<br> <br>\n>[Predictand computation and plotting](#plv)<br> <br>\n\n\n\n\n\n\n\n\n\n\n\n",
"_____no_output_____"
],
[
"<br>\n<br>\n\n**After analizing the tailor-made predictor along the hindcast data for the calibration period (1982-2019), the performace of the model will be validated for year 2020, which has not been included in the predictor calibration process.**",
"_____no_output_____"
],
[
"<br>\n\n\n<div style=\"padding: 15px; border: 1px solid transparent; border-color: transparent; margin-bottom: 20px; border-radius: 4px; color: rgb(0,0,0); background-color: #fcf8e3; border-color: #faebcc; \">\n \n\n**Steps:**\n* **1.** Download and preprocess (file conversion and resolution interpolation) SST and MLD data for the validation time period.\n* **2.** Generation of the index predictor based on the index function obtained at the calibration period.\n* **3.** The fitted Principal Component Analysis for the calibration is used to predict the index principal components in that same temporal-spatial space.\n* **4.** The predicted PCs are assigned to the best match unit group from the fitted K-means clustering -> based on the index predictor a DWT is assigned to each day.\n* **5.** From the DWT the expected daily mean number of TCs in 8x8º cells map in the target area is known.\n \n\n</div>",
"_____no_output_____"
],
[
"<br />\n<br />\n\n## <font color='royalblue'>**Index predictor and DWTs**</font> <a name=\"p\"></a>",
"_____no_output_____"
],
[
"\n\n**Download and preprocess (file conversion and resolution interpolation) SST and MLD data for the validation time period.**",
"_____no_output_____"
]
],
[
[
"path_val = r'/home/administrador/Documentos/seasonal/seasonal_forecast/validation/'\nyear_val = 2020",
"_____no_output_____"
],
[
"change_sst_resolution_val(path_val,year_val)",
"Start time: 2021-04-12 09:57:46.179185\nEnd time: 2021-04-12 10:01:47.651739\n"
]
],
[
[
"<br>\n\n**Generation of the index predictor based on the index function obtained at the calibration period.**",
"_____no_output_____"
]
],
[
[
"xs_val = ds_index_over_time_val(path_val,path_p,year_val)\nxs_val",
"_____no_output_____"
]
],
[
[
"<br>\n<br>\n\n**The fitted Principal Component Analysis for the calibration is used to predict the index principal components in that same temporal-spatial space and the predicted PCs are assigned to the best match unit group from the fitted K-means clustering -> based on the index predictor a DWT is assigned to each day.**",
"_____no_output_____"
]
],
[
[
"val_bmus = PCA_k_means_val(path_p,path_val,xs_val)",
"K-means order previously obtained in the calibration period: \n\n[11 27 28 45 16 23 47 19 7 14 0 31 46 30 34 35 15 2 8 33 37 41 5 10\n 48 4 40 21 3 20 42 29 38 26 32 43 13 17 18 39 25 22 44 9 1 24 6 12\n 36]\n\n\n DWTs for the validation period and their counting: \n\n(array([ 6, 8, 9, 12, 15, 17, 18, 24, 25, 26, 27, 30, 32, 35, 36, 37, 40,\n 42, 43, 45, 49]), array([31, 1, 37, 11, 33, 18, 18, 8, 13, 30, 8, 5, 1, 21, 1, 10, 27,\n 22, 8, 3, 60]))\n"
]
],
[
[
"<br>\n<br>\n\n**Chronology of the DWTs:**",
"_____no_output_____"
]
],
[
[
"fig_bmus = plot_bmus_chronology(xs_val,val_bmus,year_val)",
"_____no_output_____"
]
],
[
[
"<br>\n\n**The resulting classification can be seen in the PCs space of the predictor index data. The obtained centroids (black dots), span the wide variability of the data.**",
"_____no_output_____"
]
],
[
[
"fig = plot_scatter_kmeans(xds_kma_ord, val_bmus, xds_kma_ord.cenEOFs.values, size_l=12, size_h=10);",
"_____no_output_____"
]
],
[
[
"<br />\n<br />\n\n## <font color='royalblue'>**Cluster comparison**</font> <a name=\"cc\"></a>",
"_____no_output_____"
]
],
[
[
"fig = plot_bmus_comparison_validation_calibration(xs,xds_kma,xs_val,val_bmus,9,49)",
"_____no_output_____"
]
],
[
[
"<br />\n<br />\n\n## <font color='royalblue'>**Predictand computation and plotting**</font> <a name=\"plv\"></a>",
"_____no_output_____"
],
[
"**From the DWT the daily expected mean number of TCs in 8x8º cells in the target area is known for each day and thus maps at different time scales can be computed.**",
"_____no_output_____"
],
[
"**Daily mean expected number of TCs**",
"_____no_output_____"
]
],
[
[
"xds_timeline_val,xs_M_val = ds_monthly_probabilities_val(df_2021,val_bmus,xs_val,xs_dwt_counts,xs_dwt_counts_964)",
"_____no_output_____"
]
],
[
[
"<br>\n\n**Monthly aggregated mean expected number of TCs**",
"_____no_output_____"
]
],
[
[
"xs_M_val",
"_____no_output_____"
],
[
"fig_val_year_8 = plot_validation_year(df_2021,xs_M_val,xds_timeline_val,35)",
"_____no_output_____"
]
],
[
[
"<br>\n\n**Whole period aggregated mean expected number of TCs**",
"_____no_output_____"
]
],
[
[
"fig_val_year_8 = plot_validation_full_season(df_2021,xs_M_val,xds_timeline_val,35)",
"_____no_output_____"
]
],
[
[
"<br>\n<br>\n\n<div style=\"padding: 15px; border: 1px solid transparent; border-color: transparent; margin-bottom: 20px; border-radius: 4px; color: rgb(0,0,0); background-color: #fcf8e3; border-color: #faebcc; \">\n \n\n* **The model performs very well when estimating the expected TC activity (number and intensity of TCs), not understimating the threat.** \n \n* **In some cells adjacents to the cells including TC tracks it overstimates TC activity.**\n \n</div>",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
]
] |
d0ca104d11aa3a3f682864fa0f95b8a58f256a7c | 30,307 | ipynb | Jupyter Notebook | comp-cientifica-I-2018-2/Teste8.ipynb | mirandagil/university-courses | e70ce5262555e84cffb13e53e139e7eec21e8907 | [
"MIT"
] | 1 | 2019-12-23T16:39:01.000Z | 2019-12-23T16:39:01.000Z | comp-cientifica-I-2018-2/Teste8.ipynb | mirandagil/university-courses | e70ce5262555e84cffb13e53e139e7eec21e8907 | [
"MIT"
] | null | null | null | comp-cientifica-I-2018-2/Teste8.ipynb | mirandagil/university-courses | e70ce5262555e84cffb13e53e139e7eec21e8907 | [
"MIT"
] | null | null | null | 27.906998 | 4,784 | 0.597519 | [
[
[
"import numpy as np\nimport matplotlib.pyplot as plt",
"_____no_output_____"
]
],
[
[
"# Parte 1: Iteração de Rayleigh\n\nVimos que podemos iterar um vetor $v$ pela matriz $A$, obtendo a sequência de vetores $A^nv$, por multiplicações sucessivas, e que isso permite encontrar um autovetor.",
"_____no_output_____"
],
[
"## Questão 1\n\nImplemente uma função `itera(A,v,tol,debug)` que itera o vetor $v$, normalizando a cada iteração, e que retorna $(v_\\lambda, \\lambda, n)$, respectivamente:\n- uma estimativa do autovetor\n- uma estimativa do autovalor correspondente\n- o número de iterações realizadas até atingir a precisão `tol`.\n\nSe `debug == True`, retorne também a lista dos vetores (unitários) produzidos ao longo do processo.",
"_____no_output_____"
]
],
[
[
"def itera(A,v, tol=1e-12, maxiter=1000, debug=False):\n v = np.array(v)\n n,m = np.shape(A)\n assert n==m, 'A must be square'\n \n def eigenvector_normalizer(A,v,n=29):\n answ = []\n answ.append(v)\n for i in range(0,n):\n v_next = A @ answ[-1]\n answ.append(v_next/np.linalg.norm(v_next))\n return answ,n\n \n def eigenvalue_picker(v,u):\n v_max = vs[-1]\n print(v_max)\n return v_max/u\n \n vs,it = eigenvector_normalizer(A,v)\n l = np.linalg.norm(A@vs[-1])\n if debug == True:\n return vs[-1],l,it,vs\n else:\n return vs[-1],l,it ",
"_____no_output_____"
],
[
"# Autovetores conhecidos\nA = [[1,2],[2,1]]\nalvo = np.array([1,1])/np.sqrt(2)\n\nv, l, n = itera(A,[1,2])\n\nassert(abs(l-3) < 1e-15)\nassert(all(abs(v-alvo) < 1e-12))\nassert(n < 30)",
"_____no_output_____"
],
[
"# Autovetores aleatórios: verificando que satisfaz (aproximadamente) a definição\nnp.random.seed(4444)\nA = np.random.rand(4,4)\nv, l, n = itera(A, np.random.rand(4))\nerr = np.dot(A,v) - l*v\nassert(np.linalg.norm(err) < 1e-12)\nassert(n < 30)",
"_____no_output_____"
]
],
[
[
"## Questão 2: Convergência\n\nTemos o número de iterações, mas não vimos como o algoritmo \"converge\" para o autovetor.\nAssim, use os vetores intermediários e faça um gráfico da evolução do erro entre os $v$'s produzidos e o autovetor $v_\\lambda$.",
"_____no_output_____"
]
],
[
[
"ax = None\nv,l,n, vs_intermediarios = itera(A, np.random.rand(4), debug=True)\ntam = len(vs_intermediarios)\nrng = (0,n)\nks = [([v]*tam)/i for i in vs_intermediarios]\n#plt.plot(ks,rng)\n\nax = plt.gca()\nplt.show()",
"30\n"
],
[
"assert ax.title.get_text() != \"\"\nassert len(ax.lines) == 1\n\nys = ax.lines[0].get_ydata()\n\nassert min(ys) < 1e-12\nassert np.all(ys[:-1] > ys[1:])",
"_____no_output_____"
]
],
[
[
"O que o último assert quer dizer?",
"_____no_output_____"
],
[
"Compara se o $ys[i]$ é menor que $ys[i-1]$, ou seja, se a lista está convergindo",
"_____no_output_____"
],
[
"## Questão 3: Convergência comparada\n\nPara cada um dos vetores `d1` e `d2` abaixo, considere a matriz $A = \\operatorname{diag}(d_i)$ correspondente.",
"_____no_output_____"
]
],
[
[
"d1 = [1,10,20,30,31,32]\nd2 = [1,10,20,29,30,32]",
"_____no_output_____"
]
],
[
[
"Qual é o autovetor com o maior autovalor para $A_1$ e $A_2$?",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"Agora, compare a velocidade de convergência do autovetor usando `itera` para cada uma destas matrizes,\nfazendo o gráfico do erro entre os vetores gerados para $A_1$ e $A_2$ no mesmo eixo.",
"_____no_output_____"
]
],
[
[
"ax = []\n\n_,_,_,l_1 = itera(np.diag(d1), np.ones_like(d1), debug=True)\n_,_,_,l_2 = itera(np.diag(d2), np.ones_like(d2), debug=True)\n\n# YOUR CODE HERE\nraise NotImplementedError()\n\nax = plt.gca()\nplt.show()",
"_____no_output_____"
],
[
"assert ax.title.get_text() != \"\"\nassert len(ax.lines) == 2\nassert len(ax.legend().texts) == 2",
"_____no_output_____"
]
],
[
[
"Para qual matriz há convergência mais rápida? Como você explicaria isso?",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"## Questão 4: Convergência?\n\nSejam $\\theta \\in [0,2\\pi]$ e $\\alpha \\in \\mathbb{R}$,\ne considere a matriz \n$$A(\\theta, \\alpha) = \\begin{bmatrix} \n\\cos(\\theta) & \\sin(\\theta) & 0\\\\\n-\\sin(\\theta) &\\cos(\\theta) & 0\\\\\n0 & 0 & \\alpha\\\\\n\\end{bmatrix}.$$\n\nQual a interpretação geométrica dessa matriz?",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"Quais são os autovetores de $A$ (em função de $\\theta$ e $\\alpha$)?",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"Implemente a função abaixo que gera a matriz $A$:",
"_____no_output_____"
]
],
[
[
"def make_matrix(theta,alpha):\n # YOUR CODE HERE\n raise NotImplementedError()",
"_____no_output_____"
],
[
"assert np.allclose(make_matrix(0,1),np.eye(3))\nassert np.allclose(make_matrix(np.pi,0.5),[[-1,0,0],[0,-1,0],[0,0,0.5]])",
"_____no_output_____"
]
],
[
[
"Fixando $\\theta = \\dfrac{\\pi}{4}$,\nfaça um gráfico do número de iterações necessários para calcular o maior autovetor,\nem função de $\\alpha \\in [0.5,1.5]$.",
"_____no_output_____"
]
],
[
[
"alphas = np.linspace(0.5,1.5,100)\nax = []\n# YOUR CODE HERE\nraise NotImplementedError()\n\nax = plt.gca()\nplt.show()",
"_____no_output_____"
],
[
"assert ax.title.get_text() != \"\"\nassert len(ax.lines) == 1\nassert ax.get_xlabel() != \"\"\n\nys = ax.lines[0].get_ydata()\n\nassert 100 > ys.min() > 60\nassert ys[55] < 600\nassert ys[50] > 900",
"_____no_output_____"
]
],
[
[
"Agora, faça o gráfico com a estimativa do autovalor, novamente em função de $\\alpha$.",
"_____no_output_____"
]
],
[
[
"ax = []\n\n# YOUR CODE HERE\nraise NotImplementedError()\n\nax = plt.gca()\nplt.show()",
"_____no_output_____"
],
[
"assert ax.title.get_text() != \"\"\nassert len(ax.lines) == 1\nassert ax.get_xlabel() != \"\"\n\nys = ax.lines[0].get_ydata()\n\nassert np.all(0.7 <= ys) and np.all(ys <= 1.5)",
"_____no_output_____"
]
],
[
[
"Como explicar a variação no número de iterações? O que isso tem a ver com o autovalor retornado?",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"# Parte 2: Generalizando\n\n## Questão 5: Outra iteração, novos limites\n\nEm vez de iterar $A^n v$, é possível iterar $A^{-n} v$.\nAssim, em vez de \"aumentar\" os vetores correspondentes aos autovalores de módulo grande,\nestes serão \"diminuídos\", e sobra o vetor do \"menor\" (de novo, em módulo) autovalor.\n\nMostre que $\\dfrac{A^{-n}v_0}{\\lVert A^{-n}v_0 \\rVert} \\rightarrow v_{min}$, onde $v_{min}$ é o \"menor\" autovalor de $A$.",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"Agora, generalize um pouco mais:\n\nSeja $\\alpha \\in C$ um número complexo qualquer.\nMostre que\n$$\\frac{(A - \\alpha I)^{-n}v_0}{\\lVert (A - \\alpha I)^{-n}v_0 \\rVert} \\rightarrow v_{\\alpha},$$\nonde $v_{\\alpha}$ é o autovetor de $A$ com autovalor mais próximo de $\\alpha$.\n\nEste método é conhecido como \"Iteração inversa deslocada\".",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"## Questão 6: Iteração inversa com deslocamento\n\nImplemente a iteração inversa com deslocamento, com argumentos semelhantes a função `itera`.",
"_____no_output_____"
]
],
[
[
"def inverse_iteration(A, v, alpha=0, tol=1e-12, maxiter=1000, debug=False):\n\n v = np.array(v)\n n,m = np.shape(A)\n assert n==m, 'A must be square'\n\n # YOUR CODE HERE\n raise NotImplementedError()",
"_____no_output_____"
],
[
"A = [[1,2],[2,1]]\nans = np.array([-1,1])/np.sqrt(2)\n\nv, l, n = inverse_iteration(A,[1,2])\n\nassert np.allclose(np.linalg.norm(v),1)\nassert np.allclose(v,ans) or np.allclose(v, -ans)\nassert 20 < n < 40",
"_____no_output_____"
],
[
"A = [[1,2],[2,1]]\nans = np.array([1,1])/np.sqrt(2)\n\nv, l, n = inverse_iteration(A,[1,2], alpha=2, maxiter=50)\n\nassert np.allclose(np.linalg.norm(v),1)\nassert np.allclose(v,ans) or np.allclose(v, -ans)\nassert 20 < n < 40",
"_____no_output_____"
],
[
"A = [[1,2],[2,1]]\nans = np.array([1,1])/np.sqrt(2)\n\nv, l, n = inverse_iteration(A,[1,2], alpha=2.5, maxiter=50)\n\nassert np.allclose(np.linalg.norm(v),1)\nassert np.allclose(v,ans) or np.allclose(v, -ans)\nassert 10 < n < 20",
"_____no_output_____"
]
],
[
[
"## Questão 7: Convergência comparada\n\nFaça o gráfico da velocidade de convergência dos autovetores da iteração inversa aplicada à matriz $A$ acima,\npara $\\alpha \\in \\{-2,0,2\\}$.",
"_____no_output_____"
]
],
[
[
"np.random.seed(1234)\n\nax = []\nv0 = np.random.rand(2)\n\n\n# YOUR CODE HERE\nraise NotImplementedError()\n\nplt.ylabel('Distance to eigenvector')\n\nax = plt.gca()\nplt.show()",
"_____no_output_____"
],
[
"assert ax.title.get_text() != \"\"\nassert len(ax.lines) == 3\nassert len(ax.legend().texts) == 3\nassert ax.get_xlabel() != \"\"\n\nys = [l.get_ydata() for l in ax.lines]\n\nassert np.isclose(max(max(y) for y in ys),2)\nassert min(min(y) for y in ys) <= 1e-16",
"_____no_output_____"
]
],
[
[
"Qual valor de $\\alpha$ levou à convergência mais rápida?\nComo você explicaria isso?",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"O que mais você observa neste gráfico?",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
],
[
"## Questão 8: Zoom da convergência",
"_____no_output_____"
],
[
"Agora, repita o mesmo gráfico para $\\alpha \\in \\{2, 2.5, 2.9, 2.99 \\}$.",
"_____no_output_____"
]
],
[
[
"np.random.seed(1234)\n\nax = []\nv0 = np.random.rand(2)\n\n\n# YOUR CODE HERE\nraise NotImplementedError()\n\nplt.ylabel('Distance to eigenvector')\n\nax = plt.gca()\nplt.show()",
"_____no_output_____"
],
[
"assert ax.title.get_text() != \"\"\nassert len(ax.lines) == 4\nassert len(ax.legend().texts) == 4\nassert ax.get_xlabel() != \"\"\n\nys = [l.get_ydata() for l in ax.lines]\n\nassert min(min(y) for y in ys) <= 1e-16",
"_____no_output_____"
]
],
[
[
"O que este gráfico sugere quanto à velocidade de convergência da iteração inversa?\nSerá que isso já era possível de \"ver\" no outro gráfico?",
"_____no_output_____"
],
[
"YOUR ANSWER HERE",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
]
] |
d0ca1999074d6e9464e044b933a0b3a09a8d0508 | 84,289 | ipynb | Jupyter Notebook | homework 1/1a/homework_1_1a_b.ipynb | sriharshams/cs498aml | 8eeb900c133ffa2a14a0c99468e4911932fb5bde | [
"MIT"
] | null | null | null | homework 1/1a/homework_1_1a_b.ipynb | sriharshams/cs498aml | 8eeb900c133ffa2a14a0c99468e4911932fb5bde | [
"MIT"
] | null | null | null | homework 1/1a/homework_1_1a_b.ipynb | sriharshams/cs498aml | 8eeb900c133ffa2a14a0c99468e4911932fb5bde | [
"MIT"
] | null | null | null | 60.639568 | 31,328 | 0.742968 | [
[
[
"# Homework 1: Classification With Naive Bayes\n\n",
"_____no_output_____"
],
[
"## Problem 1: Diabetes Classification\n\nPoints: 40\n\nA famous collection of data on whether a patient has diabetes, known as the Pima Indians dataset, and originally owned by the National Institute of Diabetes and Digestive and Kidney Diseases can be found at Kaggle. Download this dataset from https://www.kaggle.com/kumargh/pimaindiansdiabetescsv. This data has a set of attributes of patients, and a categorical variable telling whether the patient is diabetic or not. For several attributes in this data set, a value of 0 may indicate a missing value of the variable. There are a total of 767 data-points.\n\n",
"_____no_output_____"
],
[
"## Part 1A \nBuild a simple naive Bayes classifier to classify this data set. You should use a normal distribution to model each of the class-conditional distributions.\n\nCompute an estimate of the accuracy of the classifier by averaging over 10 test-train splits. Each split should randomly assign 20% of the data to test, and the rest to train.\nYou should write this classifier and the test-train split code yourself (it's quite straight-forward). Libraries can be used to load & hold the data.\n",
"_____no_output_____"
],
[
"### Answer Part 1A\n\nTo build a somple naive Bayes classifier to classify Pima Indians dataset. We will be using Python 3 in Google Colab.\n\n",
"_____no_output_____"
],
[
"#### Set up\n\nLoad required libraries\n",
"_____no_output_____"
]
],
[
[
"!pip install pandas_profiling",
"Collecting pandas_profiling\n Downloading https://files.pythonhosted.org/packages/a7/7c/84f15ee705793a3cdd43bc65e6166d65d36f743b815ea517b02582989533/pandas_profiling-1.4.1-py2.py3-none-any.whl\nRequirement already satisfied: six>=1.9 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from pandas_profiling) (1.12.0)\nRequirement already satisfied: pandas>=0.19 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from pandas_profiling) (0.23.4)\nRequirement already satisfied: jinja2>=2.8 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from pandas_profiling) (2.10)\nRequirement already satisfied: matplotlib>=1.4 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from pandas_profiling) (3.0.2)\nRequirement already satisfied: python-dateutil>=2.5.0 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from pandas>=0.19->pandas_profiling) (2.7.5)\nRequirement already satisfied: pytz>=2011k in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from pandas>=0.19->pandas_profiling) (2018.7)\nRequirement already satisfied: numpy>=1.9.0 in /Users/sms/.local/lib/python3.6/site-packages (from pandas>=0.19->pandas_profiling) (1.16.0)\nRequirement already satisfied: MarkupSafe>=0.23 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from jinja2>=2.8->pandas_profiling) (1.1.0)\nRequirement already satisfied: cycler>=0.10 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from matplotlib>=1.4->pandas_profiling) (0.10.0)\nRequirement already satisfied: kiwisolver>=1.0.1 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from matplotlib>=1.4->pandas_profiling) (1.0.1)\nRequirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from matplotlib>=1.4->pandas_profiling) (2.3.0)\nRequirement already satisfied: setuptools in /Users/sms/anaconda3/envs/insight/lib/python3.6/site-packages (from kiwisolver>=1.0.1->matplotlib>=1.4->pandas_profiling) (40.6.3)\nInstalling collected packages: pandas-profiling\nSuccessfully installed pandas-profiling-1.4.1\n"
],
[
"import pandas as pd\nimport numpy as np\nimport math\nfrom scipy.stats import norm\n\nimport pandas_profiling\n\nimport pickle\n\nimport matplotlib.pyplot as plt\n%matplotlib inline\n\nimport warnings\nwarnings.filterwarnings(\"ignore\")",
"_____no_output_____"
]
],
[
[
"#### Load dataset\n\nAccess https://www.kaggle.com/kumargh/pimaindiansdiabetescsv, download the dataset, it will download pimaindiansdiabetescsv.zip.\n\n\n\n",
"_____no_output_____"
],
[
"##### Dataset dictionary\n\nFollowing are the datset details as per kaggle.\n\nAbout this file\nThis dataset describes the medical records for Pima Indians and whether or not each patient will have an onset of diabetes within \fve years.\n\nFields description follow:\n\npreg = Number of times pregnant\n\nplas = Plasma glucose concentration a 2 hours in an oral glucose tolerance test\n\npres = Diastolic blood pressure (mm Hg)\n\nskin = Triceps skin fold thickness (mm)\n\ntest = 2-Hour serum insulin (mu U/ml)\n\nmass = Body mass index (weight in kg/(height in m)^2)\n\npedi = Diabetes pedigree function\n\nage = Age (years)\n\nclass = Class variable (1:tested positive for diabetes, 0: tested negative for diabetes)\n\n\n\nColumns, first row is sample data, ignoring to obtain dataset of rows 767, as mentioned in home work assignment link.\n\n6 Pregnancies\n\n148 Glucose\n\n72 BloodPressure\n\n35 SkinThickness\n\n0 Insulin\n\n33.6 BMI\n\n0.627 DiabetesPedigreeFunction\n\n50 Age\n\n1 Class\n\n",
"_____no_output_____"
],
[
"To access the dataset in Google Colab you can either use Github or Google Drive. We will be accessing dataset via Google Drive. Unzip the pimaindiansdiabetescsv.zip, add pima-indians-diabetes.csv to a known folder in Google Drive, this folder path in drive will be accessed later to load dataset.\n\n\nWe added the pima-indians-diabetes.csv to Google Drive folder /My Drive/UISC-MCS-DS/CS498AML/homework_1/1a/data/.",
"_____no_output_____"
],
[
"This step is not required if you are using localhost\n* Mount Google Drive to access data Note: This is not required if you are not using Google colab\n\n",
"_____no_output_____"
],
[
"from google.colab import drive\ndrive.mount('/content/gdrive')",
"_____no_output_____"
],
[
"Load pima-indians-diabetes.csv Dataset and save it as a pickle object",
"_____no_output_____"
]
],
[
[
"#pima_indias_diabetes_data = pd.read_csv(\"/content/gdrive/My Drive/UIUC-MCS-DS/CS498AML/homework_1/1a/data/pima-indians-diabetes.csv\")\n#pickle.dump(pima_indias_diabetes_data, open( '/content/gdrive/My Drive/UIUC-MCS-DS/CS498AML/homework_1/1a/data/pima_indias_diabetes_data.pkl','wb'))\n\npima_indias_diabetes_data = pd.read_csv(\"/MS2/academics/MCS-DS-UIUC/Coursera/CS-498-AML/homework 1/1a/data/pima-indians-diabetes.csv\")\npickle.dump(pima_indias_diabetes_data, open('/MS2/academics/MCS-DS-UIUC/Coursera/CS-498-AML/homework 1/1a/data/pima_indias_diabetes_data.pkl','wb'))\n\n\npima_indias_diabetes_data.head()",
"_____no_output_____"
]
],
[
[
"#### Exploratory Data Analysis\n\n",
"_____no_output_____"
],
[
"##### Validate dataset",
"_____no_output_____"
]
],
[
[
"# rename column names\npima_indias_diabetes_data.columns = ['Pregnancies', 'Glucose', 'BloodPressure', 'SkinThickness', 'Insulin', 'BMI', 'DiabetesPedigreeFunction', 'Age', 'Class']\npima_indias_diabetes_data.head()",
"_____no_output_____"
],
[
"# count number of dataset\nprint(\"There are a total of\", len(pima_indias_diabetes_data),\"data-points\")",
"There are a total of 767 data-points\n"
],
[
"pima_indias_diabetes_data_features = pima_indias_diabetes_data[['Pregnancies', 'Glucose', 'BloodPressure', 'SkinThickness', 'Insulin', 'BMI', 'DiabetesPedigreeFunction', 'Age']]\npima_indias_diabetes_data_labels = pima_indias_diabetes_data[['Class']]\nprint(pima_indias_diabetes_data_features.shape)\nprint(pima_indias_diabetes_data_labels.shape)",
"(767, 8)\n(767, 1)\n"
]
],
[
[
"There are 767 observations of 8 different features.\n\n",
"_____no_output_____"
],
[
"##### Analyse label",
"_____no_output_____"
]
],
[
[
"count_classes = pd.value_counts(pima_indias_diabetes_data['Class'], sort = True).sort_index()\ncount_classes.plot(kind = 'bar')\nplt.title(\"Pima Indians diabetes class histogram\")\nplt.xlabel(\"Class\")\nplt.ylabel(\"Frequency\")\n\n# 284315 normal transactions (class 0)\n# 492 fraud transactions (class 1)\n\npima_indias_diabetes_data.groupby('Class')['Class'].count()",
"_____no_output_____"
]
],
[
[
"There are 500 Pima Indians 0: tested negative for diabetes, 267 :tested positive for diabetes. ",
"_____no_output_____"
],
[
"##### Data distribution analysis for each feature and class label\n\nPlot the data by each feature",
"_____no_output_____"
]
],
[
[
"axarr = [[]]*len(pima_indias_diabetes_data_features.columns)\ncolumns = 4\nrows = int( np.ceil( len(pima_indias_diabetes_data_features.columns) / columns ) )\nf, fig = plt.subplots( figsize=(columns*3.5, rows*2) )\n\nf.suptitle('Data Distributions by Feature and Class', size=16)\n\nfor i, col in enumerate(pima_indias_diabetes_data_features.columns[:]):\n axarr[i] = plt.subplot2grid( (int(rows), int(columns)), (int(i//columns), int(i%columns)) )\n axarr[i].hist( [ pima_indias_diabetes_data.loc[ pima_indias_diabetes_data.Class == 0, col ], pima_indias_diabetes_data.loc[ pima_indias_diabetes_data.Class == 1, col ] ], label=['tested negative','tested positive'], \n bins=np.linspace( np.percentile(pima_indias_diabetes_data[col],0.1), np.percentile(pima_indias_diabetes_data[col],99.9), 30 ),\n normed=True )\n axarr[i].set_xlabel(col, size=12)\n axarr[i].set_ylim([0,0.8])\n axarr[i].tick_params(axis='both', labelsize=10)\n if i == 0: \n legend = axarr[i].legend()\n legend.get_frame().set_facecolor('white')\n if i%4 != 0 : \n axarr[i].tick_params(axis='y', left='off', labelleft='off')\n else:\n axarr[i].set_ylabel('Fraction',size=12)\n\nplt.tight_layout(rect=[0,0,1,0.95]) # xmin, ymin, xmax, ymax\nplt.show()",
"_____no_output_____"
]
],
[
[
"#### Classify Dataset - Build a simple naive Bayes classifier ",
"_____no_output_____"
],
[
"##### Split data\n",
"_____no_output_____"
]
],
[
[
"\ndef train_test_split(features, labels, test_size=0.2):\n np.random.seed(4)\n id = np.random.rand(len(features))>test_size\n #print(id)\n features_train = features[id]\n labels_train = labels[id]\n features_test = features[np.invert(id)]\n labels_test = labels[np.invert(id)]\n return features_train, labels_train, features_test, labels_test\n\n\nfeatures = pima_indias_diabetes_data.drop('Class', axis = 1)\nlabels = pima_indias_diabetes_data['Class']\n\n\n\n",
"_____no_output_____"
]
],
[
[
"#### Gaussian Naive Bayes classifier\n\nIn Gaussian Naive Bayes, continuous values associated with each feature are assumed to be distributed according to a Gaussian distribution. A Gaussian distribution is also called Normal distribution. \n\nThe likelihood of the features is assumed to be Gaussian, hence, conditional probability is given by:\n\n >$P(x_i | y) = \\frac{1}{\\sqrt{2\\pi\\sigma _{y}^{2} }} exp \\left (-\\frac{(x_i-\\mu _{y})^2}{2\\sigma _{y}^{2}} \\right ) $\n \n we will use norm.pdf to calculate probablity density function.",
"_____no_output_____"
]
],
[
[
"class GaussianNaiveBayes():\n \"\"\"The Gaussian Naive Bayes classifier. \"\"\"\n def fit(self,features, labels):\n \"\"\"\n for each label and feature combination we need to calculate the std and mean value from the features & labels.\n \"\"\"\n self.min_std = 0.00000001\n self.ntargets= np.unique(labels).shape[0]\n self.target_labels = np.unique(labels)\n self.nfeatures = features.shape[1]\n self.means = np.zeros((self.ntargets,self.nfeatures))\n self.stds = np.zeros((self.ntargets,self.nfeatures))\n self.priors = np.zeros(self.ntargets)\n for _index in range(self.ntargets):\n # Get the boolean vector to filter for labels = i\n where_label = [label==self.target_labels[_index] for label in labels]\n self.means[_index] = np.nanmean(features[where_label],axis=0)\n # To avoid devide by 0/very small value issue, add a min for standard deviation to min_std = 0.00000001\n self.stds[_index] = np.clip(np.nanstd(features[where_label],axis=0),self.min_std,None)\n #print(self.means[_index], self.stds[_index])\n #Calculate the prior for given label \n self.priors[_index] = np.log(np.sum(where_label)/len(labels))\n \n def predict(self,test_features):\n \"\"\" Classification using Bayes Rule P(Y|X) = P(X|Y)*P(Y)/P(X),\n or Posterior = Likelihood * Prior / Scaling Factor\n P(Y|X) - The posterior is the probability that sample x is of class y given the\n feature values of x being distributed according to distribution of y and the prior.\n P(X|Y) - Likelihood of data X given class distribution Y.\n Gaussian distribution (given by _calculate_likelihood)\n P(Y) - Prior (given by _calculate_prior)\n P(X) - Scales the posterior to make it a proper probability distribution.\n This term is ignored in this implementation since it doesn't affect\n which class distribution the sample is most likely to belong to.\n Classifies the sample as the class that results in the largest P(Y|X) (posterior)\n \"\"\"\n test_samples = test_features.shape[0]\n posterior = np.zeros((test_samples,self.ntargets))\n # Naive assumption (independence):\n # P(x1,x2,x3|Y) = P(x1|Y)*P(x2|Y)*P(x3|Y)\n # Posterior is product of prior and likelihoods (ignoring scaling factor)\n for target_label in range(self.ntargets):\n posterior[:,target_label] = self.priors[target_label] + np.nansum(np.log(norm.pdf(test_features,self.means[target_label],self.stds[target_label])),axis=1)\n label = self.target_labels[np.argmax(posterior, axis=1)]\n return label \n \n \n def score(self,X_test, y_test):\n y_predict = self.predict(X_test)\n return (y_predict == y_test).mean()",
"_____no_output_____"
]
],
[
[
"Compute an estimate of the accuracy of the classifier by averaging over 10 test-train splits. Each split should randomly assign 20% of the data to test, and the rest to train.",
"_____no_output_____"
]
],
[
[
"print(features.shape)\n\n\n\ntest_accuracy_iterations =[]\n# for 10 iterations\nfor i in range(10):\n features_train, labels_train, features_test, labels_test = train_test_split(features.values, \n labels.values, test_size=0.2)\n nb = GaussianNaiveBayes()\n\n nb.fit(features_train, labels_train)\n test_accuracy = nb.score(features_test, labels_test)\n test_accuracy_iterations.append(test_accuracy)\n\nprint(test_accuracy_iterations)\nprint(\"Average test accuracy\", np.mean(test_accuracy_iterations))",
"(767, 8)\n[0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593]\nAverage test accuracy 0.7724550898203593\n"
]
],
[
[
"Validate using scikit learn naive bayes",
"_____no_output_____"
]
],
[
[
"from sklearn import naive_bayes\n\ntest_accuracy_iterations =[]\n# for 10 iterations\nfor i in range(10):\n features_train, labels_train, features_test, labels_test = train_test_split(features.values, labels.values, test_size=0.2)\n snb = naive_bayes.GaussianNB()\n\n snb.fit(features_train, labels_train)\n test_accuracy = snb.score(features_test, labels_test)\n test_accuracy_iterations.append(test_accuracy)\n\nprint(test_accuracy_iterations)\nprint(\"Average test accuracy\", np.mean(test_accuracy_iterations))",
"[0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593, 0.7724550898203593]\nAverage test accuracy 0.7724550898203593\n"
]
],
[
[
"## Part 1B\n\nNow adjust your code so that, for attribute 3 (Diastolic blood pressure), attribute 4 (Triceps skinfold thickness), attribute 6 (Body mass index), and attribute 8 (Age), it regards a value of 0 as a missing value when estimating the class-conditional distributions, and the posterior. \n\n* Compute an estimate of the accuracy of the classifier by averaging over 10 test-train splits.\n\n\n",
"_____no_output_____"
],
[
"### Answer Part 1B\n\nAll the above work done for Part 1A will be reused for Part 1B.\n\nWe will mainly be processing data to remove missing values which are 0.",
"_____no_output_____"
],
[
"Impute missing values 0 for attributes 3 (Diastolic blood pressure), attribute 4 (Triceps skinfold thickness), attribute 6 (Body mass index), and attribute 8 (Age) as np.NaN.\n\nCheck how many missing values are present.",
"_____no_output_____"
]
],
[
[
"pima_indias_diabetes_data[['BloodPressure','SkinThickness','BMI','Age']]= pima_indias_diabetes_data[['BloodPressure','SkinThickness','BMI','Age']].replace(0, np.NaN)\n\nprint(pima_indias_diabetes_data.isnull().sum())",
"Pregnancies 0\nGlucose 0\nBloodPressure 35\nSkinThickness 227\nInsulin 0\nBMI 11\nDiabetesPedigreeFunction 0\nAge 0\nClass 0\ndtype: int64\n"
],
[
"#pima_indias_diabetes_data.dropna(inplace=True)\n\nprint(pima_indias_diabetes_data.isnull().sum())\n",
"Pregnancies 0\nGlucose 0\nBloodPressure 35\nSkinThickness 227\nInsulin 0\nBMI 11\nDiabetesPedigreeFunction 0\nAge 0\nClass 0\ndtype: int64\n"
],
[
"pima_indias_diabetes_data.shape",
"_____no_output_____"
]
],
[
[
"After processing the missing data split data and build new model with new train dataset and test he accuracy.",
"_____no_output_____"
]
],
[
[
"processed_features = pima_indias_diabetes_data.drop('Class', axis = 1)\nprocessed_labels = pima_indias_diabetes_data['Class']\n\n#scaler = StandardScaler()\n#normal_processed_features = scaler.fit_transform(processed_features)",
"_____no_output_____"
],
[
"processed_test_accuracy_iterations =[]\n# for 10 iterations\nfor i in range(10):\n p_features_train, p_labels_train, p_features_test, p_labels_test = train_test_split(processed_features.values, processed_labels.values, test_size=0.2)\n p_nb = GaussianNaiveBayes()\n\n p_nb.fit(p_features_train, p_labels_train)\n p_test_accuracy = p_nb.score(p_features_test, p_labels_test)\n processed_test_accuracy_iterations.append(p_test_accuracy)\n\nprint(processed_test_accuracy_iterations)\nprint(\"Average test accuracy for processed data\", np.mean(processed_test_accuracy_iterations))",
"[0.7425149700598802, 0.7425149700598802, 0.7425149700598802, 0.7425149700598802, 0.7425149700598802, 0.7425149700598802, 0.7425149700598802, 0.7425149700598802, 0.7425149700598802, 0.7425149700598802]\nAverage test accuracy for processed data 0.7425149700598802\n"
]
],
[
[
"## References\nFollowing are various resources referred while writing this solution\n\n* Github projects https://github.com/sriharshams/mlnd/\n* Code of codyznash https://github.com/codyznash/GANs_for_Credit_Card_Data\n* Tutorials of https://machinelearningmastery.com/naive-bayes-classifier-scratch-python/\n* [Naive Bayes in Scikit-Learn](https://github.com/scikit-learn/scikit-learn/blob/7389dba/sklearn/naive_bayes.py#L107): Implementation of naive bayes in the scikit-learn library.\n* [ ML from scratch] (https://github.com/eriklindernoren/ML-From-Scratch)\n* [Naive Bayes documentation](https://scikit-learn.org/stable/modules/naive_bayes.html): Scikit-Learn documentation and sample code for Naive Bayes\n* Naive Bayes Classifiers https://www.geeksforgeeks.org/naive-bayes-classifiers/\n* [Naive Bayes Classifier From Scratch](https://chrisalbon.com/machine_learning/naive_bayes/naive_bayes_classifier_from_scratch/)\n* https://chrisalbon.com/machine_learning/naive_bayes/naive_bayes_classifier_from_scratch/\n* Naive Bayes from scratch in python http://kenzotakahashi.github.io/naive-bayes-from-scratch-in-python.html\n* [Applied Machine Learning, D.A. Forsyth, (approximate 18'th draft)](http://luthuli.cs.uiuc.edu/~daf/courses/AML-18-Fall/AMLbook-3-Dec-18.pdf)\n* Piazza & Slack discussions on CS-498 Spring 2019\n\n\n\n",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0ca19a9d7a867385417a91b5023b5aa025d443e | 2,356 | ipynb | Jupyter Notebook | notebooks/two_dimensional_trend.ipynb | charnley/matplotlib-views | a141fe799cead6ed17b05f301bc1610823aab5f6 | [
"MIT"
] | 1 | 2020-05-05T08:51:19.000Z | 2020-05-05T08:51:19.000Z | notebooks/two_dimensional_trend.ipynb | charnley/matplotlib-views | a141fe799cead6ed17b05f301bc1610823aab5f6 | [
"MIT"
] | null | null | null | notebooks/two_dimensional_trend.ipynb | charnley/matplotlib-views | a141fe799cead6ed17b05f301bc1610823aab5f6 | [
"MIT"
] | null | null | null | 18.40625 | 50 | 0.509338 | [
[
[
"%load_ext autoreload\n%autoreload 2\n%matplotlib inline",
"_____no_output_____"
],
[
"import sys\nimport pathlib",
"_____no_output_____"
],
[
"try:\n import matplotlib_views as views\nexcept ModuleNotFoundError:\n cwd = pathlib.Path().resolve().parent\n sys.path.append(str(cwd))\n import matplotlib_views as views",
"_____no_output_____"
]
],
[
[
"## Create some fake data",
"_____no_output_____"
]
]
] | [
"code",
"markdown"
] | [
[
"code",
"code",
"code"
],
[
"markdown"
]
] |
d0ca1e1a559bcd96bae5a3e1fd26857e34eb42b6 | 61,874 | ipynb | Jupyter Notebook | notebooks/explora_siconv.ipynb | JoaoCarabetta/100diascongresso | abe5257e5891ea00f1988e27319ca8ad71135e14 | [
"MIT"
] | 1 | 2021-01-25T19:14:42.000Z | 2021-01-25T19:14:42.000Z | notebooks/explora_siconv.ipynb | gabinete-compartilhado-acredito/100-dias-congresso | ab2138fa2975818a6ea04c0d67dba174e09849b2 | [
"MIT"
] | null | null | null | notebooks/explora_siconv.ipynb | gabinete-compartilhado-acredito/100-dias-congresso | ab2138fa2975818a6ea04c0d67dba174e09849b2 | [
"MIT"
] | null | null | null | 47.779151 | 91 | 0.473365 | [
[
[
"import pandas as pd\nimport numpy as np\nfrom glob import glob",
"_____no_output_____"
],
[
"# Lista arquivos CSV:\ndataPath = '/home/skems/gabinete/dados/siconv/siconv/'\ndataFiles = glob(dataPath+'/*.csv')\ndataFiles.sort()",
"_____no_output_____"
],
[
"#Carrega um arquivo:\ndata = pd.read_csv(dataFiles[1], sep=';')",
"_____no_output_____"
],
[
"data",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code"
]
] |
d0ca2860f5e49e255318c2e072f811266b56f05f | 634 | ipynb | Jupyter Notebook | examples/reference/settings/understanding_transient_transport_settings.ipynb | xu-kai-xu/OpenPNM | 61d5fc4729a0a29291cf6c53c07c4246e7a13714 | [
"MIT"
] | 2 | 2019-08-24T09:17:40.000Z | 2020-07-05T07:21:21.000Z | examples/reference/settings/understanding_transient_transport_settings.ipynb | xu-kai-xu/OpenPNM | 61d5fc4729a0a29291cf6c53c07c4246e7a13714 | [
"MIT"
] | null | null | null | examples/reference/settings/understanding_transient_transport_settings.ipynb | xu-kai-xu/OpenPNM | 61d5fc4729a0a29291cf6c53c07c4246e7a13714 | [
"MIT"
] | null | null | null | 17.135135 | 50 | 0.542587 | [
[
[
"# Understanding Transient Transport Settings",
"_____no_output_____"
]
]
] | [
"markdown"
] | [
[
"markdown"
]
] |
d0ca32dc72bd59429418b52fa69a34e9c5738a5a | 12,058 | ipynb | Jupyter Notebook | aa2021/notebooks/N-Queens.ipynb | gianlucacovini/opt4ds | c8927ad36cace51c501527b2f8e8e93857c80d95 | [
"MIT"
] | 14 | 2020-03-04T18:02:47.000Z | 2022-02-27T17:40:09.000Z | aa2021/notebooks/N-Queens.ipynb | gianlucacovini/opt4ds | c8927ad36cace51c501527b2f8e8e93857c80d95 | [
"MIT"
] | 1 | 2021-03-23T11:47:24.000Z | 2021-03-28T12:23:21.000Z | notebooks/N-Queens.ipynb | mathcoding/opt4ds | 42904fd56c18a83fd5ff6f068bbd20b055a40734 | [
"MIT"
] | 7 | 2020-03-12T23:41:21.000Z | 2022-03-03T13:41:29.000Z | 30.145 | 807 | 0.516504 | [
[
[
"<a rel=\"license\" href=\"http://creativecommons.org/licenses/by/4.0/\"><img alt=\"Creative Commons License\" style=\"border-width:0\" src=\"https://i.creativecommons.org/l/by/4.0/88x31.png\" /></a><br /><span xmlns:dct=\"http://purl.org/dc/terms/\" property=\"dct:title\"><b>The Knapsack Problem</b></span> by <a xmlns:cc=\"http://creativecommons.org/ns#\" href=\"http://mate.unipv.it/gualandi\" property=\"cc:attributionName\" rel=\"cc:attributionURL\">Stefano Gualandi</a> is licensed under a <a rel=\"license\" href=\"http://creativecommons.org/licenses/by/4.0/\">Creative Commons Attribution 4.0 International License</a>.<br />Based on a work at <a xmlns:dct=\"http://purl.org/dc/terms/\" href=\"https://github.com/mathcoding/opt4ds\" rel=\"dct:source\">https://github.com/mathcoding/opt4ds</a>.",
"_____no_output_____"
],
[
"**NOTE:** Run the following script whenever running this script on a Google Colab.",
"_____no_output_____"
]
],
[
[
"import shutil\nimport sys\nimport os.path\n\nif not shutil.which(\"pyomo\"):\n !pip install -q pyomo\n assert(shutil.which(\"pyomo\"))\n\nif not (shutil.which(\"glpk\") or os.path.isfile(\"glpk\")):\n if \"google.colab\" in sys.modules:\n !apt-get install -y -qq glpk-utils\n else:\n try:\n !conda install -c conda-forge glpk \n except:\n pass",
"_____no_output_____"
]
],
[
[
"# $n$-Queens Problem\nThe $n$-Queens puzzle is the problem of placing eight chess queens on an $n \\times n$ chessboard so that no two queens threaten each other; thus, a solution requires that no two queens share the same row, column, or diagonal (source: [wikipedia](https://en.wikipedia.org/wiki/Eight_queens_puzzle)). \n\nA solution exists for all natural numbers n with the exception of $n = 2$ and $n = 3$.",
"_____no_output_____"
],
[
" **Example:** For $n=8$, we have the following solution:\n\n```\n1 . . . . . Q . .\n2 . . . Q . . . . \n3 . . . . . . Q .\n4 Q . . . . . . .\n5 . . . . . . . Q\n6 . Q . . . . . .\n7 . . . . Q . . .\n8 . . Q . . . . .\n a b c d e f g h \n```",
"_____no_output_____"
],
[
"## Integer Linear Programming Model\nThe $n$-Queens problem can be formalized with the following **ILP** model.\n\n**Data:** Size of the board $n\\times n$. Let $I=:\\{1,\\dots,n\\}$ a set of indices.\n\n**Decision Variables:** The variable $x_{ij} \\in \\{0,1\\}$ is equal to 1 if we place a queen in position $(i,j)$ on the chessboard.\n\n**Objective function:** Since the problem is a feasibility problem, we can set the objective function equal to any constant value.\n\n**Constraints:** We need the following linear constraints, which encode the puzzle rules:\n\n1. Each queen appears once per row:\n$$\n \\sum_{j \\in I} x_{ij} = 1, \\forall i \\in I\n$$\n2. Each queen appears once per column:\n$$\n \\sum_{i \\in I} x_{ij} = 1, \\forall j \\in I\n$$\n3. Each queen appears once per main diagonals:\n$$\n \\sum_{(i,j) \\in D_k} x_{ij} \\leq 1, D_k \\mbox{ main diagonals}\n$$\n4. Each queen appears once per off-diagonals:\n$$\n \\sum_{(i,j) \\in O_k} x_{ij} \\leq 1, O_k \\mbox{ off diagonals}\n$$",
"_____no_output_____"
],
[
"### Main Diagonals $D_k$\nSince we need to specify the pairs of indices that define as a function of $n$, we first defined the following nested loop:",
"_____no_output_____"
]
],
[
[
"n = 5\nfor j in range(-n+2,n-1):\n for i in range(1, n+1):\n if 0 < j+i <= n:\n print(i, j+i, end='\\t')\n else:\n print(' ', end='\\t')\n print()",
"_____no_output_____"
]
],
[
[
"### Off Diagonals $_k$\nSimilarly, we can define the off diagonals as follows:",
"_____no_output_____"
]
],
[
[
"for i in reversed(range(-n+3, n)):\n for j in range(1, n):\n if 0 < n - j+i <= n:\n print(j, n-j+i, end='\\t')\n else:\n print(' ', end='\\t')\n print()",
"_____no_output_____"
]
],
[
[
"### Full Model defined in Pyomo\nIf we put all the definitions together, we can solve the $n$-Queens problem with the script below.\n\nPlease, note the following Pyomo syntax used to define variable $x_{ij}$ over the [RangeSet](https://pyomo.readthedocs.io/en/stable/library_reference/aml/index.html#pyomo.environ.RangeSet) $I$ and $J$:\n\n```\nmodel.I = RangeSet(1, n)\nmodel.J = RangeSet(1, n)\nmodel.x = Var(model.I, model.J, within=Binary)\n```\n\nNotice also the syntax used to define the row and column constraints, which uses `lambda` function to define constraint rules:\n\n```\nmodel.row = Constraint(model.I, \n rule = lambda mod, i: sum(mod.x[i,j] for j in mod.J) == 1)\n```\n\nFinally, to define the main and of diagonals, we use the [ConstraintList](https://pyomo.readthedocs.io/en/stable/working_models.html) class:\n\n```\nmodel.mainD = ConstraintList()\n#...\n model.mainD.add( expr <= 1 )\n```\n\nThe complete Pyomo script is as follows.",
"_____no_output_____"
]
],
[
[
"# Import the libraries\nfrom pyomo.environ import ConcreteModel, Var, Objective, Constraint, SolverFactory\nfrom pyomo.environ import maximize, Binary, RangeSet, ConstraintList\n\n\nn = 8\n\n# Create concrete model\nmodel = ConcreteModel()\n\nmodel.I = RangeSet(1, n)\nmodel.J = RangeSet(1, n)\n\n# Variables\nmodel.x = Var(model.I, model.J, within=Binary)\n\n# Objective Function: Maximize Profit\nmodel.obj = Objective(expr = n, sense = maximize)\n\n# 1. Row constraints\ndef VincoloRighe(mod, i):\n return sum(mod.x[i,j] for j in mod.J) == 1\n\nmodel.row = Constraint(model.I, \n rule = VincoloRighe)\n\n# 2. Column constraints\nmodel.column = Constraint(model.J, \n rule = lambda mod, j: sum(mod.x[i,j] for i in mod.I) == 1)\n\n# 3. Main Diagonal constraints\nmodel.mainD = ConstraintList()\n# Build the list of possible pairs\nfor j in range(-n+2,n-1):\n expr = 0\n for i in model.I:\n if 0 < j+i <= n:\n expr += model.x[i, j+i] \n model.mainD.add( expr <= 1 )\n\n# 4. Off Diagonal constraints\nmodel.offD = ConstraintList()\n# Build the list of possible pairs\nfor i in range(-n+3,n+1):\n expr = 0\n for j in model.J:\n if 0 < n-j+i <= n:\n expr += model.x[j, n-j+i] \n model.offD.add( expr <= 1 )",
"_____no_output_____"
]
],
[
[
"To solve the script, we use a solver factory, specifying the GLPK solver, and we inspect the Solver **status** (infeasible, unbounded, or optimal).",
"_____no_output_____"
]
],
[
[
"# Solve the model\nsol = SolverFactory('glpk').solve(model)\n\n# Basic info about the solution process\nfor info in sol['Solver']:\n print(info)",
"_____no_output_____"
]
],
[
[
"We aspect the optimal decision variables (only the positive variables).",
"_____no_output_____"
]
],
[
[
"# Report solution value\nprint(\"Optimal solution value: z =\", model.obj())\nprint(\"Decision variables:\")\nfor i in model.I:\n for j in model.J:\n if model.x[i,j]() > 0:\n print(\"x({},{}) = {}\".format(i, j, model.x[i,j]()))",
"_____no_output_____"
]
],
[
[
"And finally, we print a solution on a simplified chessboard $n\\times n$.",
"_____no_output_____"
]
],
[
[
"print('\\nChessboard Solution:')\nfor i in model.I:\n for j in model.J:\n if model.x[i,j]() > 0:\n print('Q', end=' ')\n else:\n print('.', end=' ')\n print()",
"_____no_output_____"
]
],
[
[
"## Plotting a solution with a Chessboard",
"_____no_output_____"
]
],
[
[
"# CREDIT: Solution original appeared on Stackoverflow at:\n# https://stackoverflow.com/questions/60608055/insert-queen-on-a-chessboard-with-pyplot\n\ndef PlotSolution(n, x, size=6):\n import matplotlib.pyplot as plt\n import numpy as np\n\n chessboard = np.zeros((n, n))\n\n chessboard[1::2,0::2] = 1\n chessboard[0::2,1::2] = 1\n\n plt.figure(figsize=(size, size))\n plt.imshow(chessboard, cmap='binary')\n\n for i, j in x:\n if x[i,j]() > 0:\n plt.text(i-1, j-1, '♕', color='darkorange',\n fontsize=56*size/n, fontweight='bold', ha='center', va='center')\n plt.xticks([])\n plt.yticks([])\n plt.show()",
"_____no_output_____"
],
[
"PlotSolution(n, model.x)",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
] |
d0ca6642c4f71a8644542a79b69e44ed33f17288 | 13,095 | ipynb | Jupyter Notebook | import/kaggle_pneumonia_chestxray.ipynb | flywheel-apps/flywheel-tutorials | 7fc6ac9bb262573584260beaa83506eb1c5d8b58 | [
"MIT"
] | null | null | null | import/kaggle_pneumonia_chestxray.ipynb | flywheel-apps/flywheel-tutorials | 7fc6ac9bb262573584260beaa83506eb1c5d8b58 | [
"MIT"
] | null | null | null | import/kaggle_pneumonia_chestxray.ipynb | flywheel-apps/flywheel-tutorials | 7fc6ac9bb262573584260beaa83506eb1c5d8b58 | [
"MIT"
] | null | null | null | 35.584239 | 1,772 | 0.591065 | [
[
[
"**Title**: Upload kaggle chest X-Ray. \n**Date**: 12-Oct-2020 \n**Description**: \nPneumonia accounts for over 15% of all deaths of children under 5 years old internationally. Advanced detection of pneumonia could save thousands of lives a year.\n\nIn 2018 the RSNA Pneumonia Detection Challenge was posted on Kaggle, an organization for machine learning training and purpose-driven competitions in Data Science.\n\nThis notebook downloads the entire RSNA Pneumonia Detection Challenge Dataset (3.6 GB) and incorporates it into a Flywheel instance specified by the supplied API-Key. A Data Use Agreement (DUA) is required to download this dataset.\n\nReference:\n* https://www.kaggle.com/c/rsna-pneumonia-detection-challenge/data ",
"_____no_output_____"
],
[
"# Data Use Aggreement\nBefore downloading this data, or any data, from kaggle, you must agree to the rules of this competition: \n\n* https://www.kaggle.com/c/rsna-pneumonia-detection-challenge/rules",
"_____no_output_____"
]
],
[
[
"%reload_ext autoreload\n%autoreload 2 \n%matplotlib inline",
"_____no_output_____"
]
],
[
[
"# Requirements:\n- **Python** (Preferably >= 3.6): \n\n- Have admin permissions to create Flywheel Groups and Projects.",
"_____no_output_____"
],
[
"# Install and import dependencies",
"_____no_output_____"
]
],
[
[
"!pip install pandas pydicom flywheel-sdk tqdm kaggle jupyter ipywidgets",
"_____no_output_____"
],
[
"import json\nimport logging\nimport os\nimport re\nimport time\nimport zipfile\nfrom getpass import getpass\nfrom pathlib import Path\n\nimport flywheel\nimport pandas as pd\nimport pydicom\nfrom tqdm.notebook import tqdm",
"_____no_output_____"
],
[
"# Instantiate a logger\nlogging.basicConfig(level=logging.INFO, format='%(asctime)s %(levelname)s %(message)s')\nlog = logging.getLogger('root')",
"_____no_output_____"
]
],
[
[
"# Download kaggle dataset\n\nThis requires that you have stored your Kaggle credentials in ~/.kaggle/kaggle.json. These can be acquired by creating a kaggle account at kaggle.com and using \"Create New API Token\" on the user account page. \n\nThis dataset is currently 3.7 GB and may change in the future. Depending on the bandwidth of your internet connection, this may take some time to download.",
"_____no_output_____"
]
],
[
[
"!kaggle competitions download -c rsna-pneumonia-detection-challenge",
"_____no_output_____"
]
],
[
[
"# Initialize Constants\nInitialize path to dowload directory, default session label, and default acquisition label.",
"_____no_output_____"
]
],
[
[
"ROOT_KAGGLE_DATA = '/path/to/repository/rsna-pneumonia-detection-challenge'\nDEFAULT_SESSION_LABEL = 'NA'\nDEFAULT_ACQ_LABEL = 'Chest XR'",
"_____no_output_____"
]
],
[
[
"# Flywheel API Key and Client\nGet an API_KEY. More on this in the Flywheel SDK doc [here](https://flywheel-io.gitlab.io/product/backend/sdk/branches/master/python/getting_started.html#api-key).",
"_____no_output_____"
]
],
[
[
"API_KEY = getpass('Enter API_KEY here: ')",
"_____no_output_____"
]
],
[
[
"Instantiate the Flywheel API client",
"_____no_output_____"
]
],
[
[
"fw_client = flywheel.Client(API_KEY if 'API_KEY' in locals() else os.environ.get('FW_KEY'))",
"_____no_output_____"
]
],
[
[
"Show Flywheel logging information",
"_____no_output_____"
]
],
[
[
"log.info('You are now logged in as %s to %s', fw_client.get_current_user()['email'], fw_client.get_config()['site']['api_url'])",
"_____no_output_____"
]
],
[
[
"# Read the csv\nThe CSV file consists of the patient id, whether the pnemonia was diagnosed (Target 0/1), and the rectangular region of the image it was found in (x,y,width,height).\n\n```\npatientId,x,y,width,height,Target\n0004cfab-14fd-4e49-80ba-63a80b6bddd6,,,,,0\n00436515-870c-4b36-a041-de91049b9ab4,264.0,152.0,213.0,379.0,1\n```",
"_____no_output_____"
]
],
[
[
"df = pd.read_csv(Path(ROOT_KAGGLE_DATA) / 'stage_2_train_labels.csv')",
"_____no_output_____"
]
],
[
[
"# Container helpers\nImport container helper functions to find existing or create new containers.",
"_____no_output_____"
]
],
[
[
"from container_helpers import (\n find_or_create_group, \n find_or_create_project, \n find_or_create_subject, \n find_or_create_session, \n find_or_create_acquisition,\n upload_file_to_acquisition\n)",
"_____no_output_____"
]
],
[
[
"# Create the project",
"_____no_output_____"
]
],
[
[
"# Initialize the group\npublic_data_group = find_or_create_group(fw_client, 'public_data', 'public_data')\n# Initialize the project\nproject_label = 'kaggle-rsna-pneumonia-detection-challenge'\nreadme = 'https://www.kaggle.com/c/rsna-pneumonia-detection-challenge/data'\nchestxray_project = find_or_create_project(project_label, public_data_group)\nif chestxray_project:\n chestxray_project.update(description=readme)",
"_____no_output_____"
]
],
[
[
"# Iterate through dataframe and upload\nIterate through the training data csv to create the container hierarchy for this project:\n\n1. find or create each subject encountered\n\n a. Encode presence/absence of pneumonia (Target=0/1) and the rectangular region it was found in (box) into a dictionary.\n2. find or create each session (with `DEFAULT_SESSION_LABEL`) encountered\n3. find or create each acquisition (with 'SeriesDescription' or `DEFAULT_ACQ_LABEL`) and add enclosed files.\n\n a. Incorporate presence/absence of pneumonia (Target) and--if found--the rectangular region it was found in (box) into the metadata of the acquisition file.\n",
"_____no_output_____"
]
],
[
[
"for i, row in tqdm(df.iterrows(), total=len(df)):\n log.info('Processing Subject %s.', row['patientId'])\n # (1) Find or create subject\n subject = find_or_create_subject(row['patientId'], chestxray_project)\n # (1a) Encode pneumonia status and rectangular region of positive status in dictionary.\n if row['Target']:\n row_dict = {\n 'box': {\n 'x': row['x'], \n 'y': row['y'], \n 'width': row['width'], \n 'height': row['height']\n }, \n 'Target': row['Target']\n }\n else:\n row_dict = {'Target': row['Target']}\n if subject:\n log.info('Processing Session %s.', DEFAULT_SESSION_LABEL)\n # (2) Find or create session \n session = find_or_create_session(DEFAULT_SESSION_LABEL, subject)\n if session:\n filepath = str(Path(ROOT_KAGGLE_DATA) / 'stage_2_train_images' / f\"{row['patientId']}.dcm\")\n dcm = pydicom.read_file(filepath, stop_before_pixels=True, force=True)\n # Pack dicoms into zip file\n with zipfile.ZipFile(f'/tmp/{row[\"patientId\"]}.zip', 'w') as myzip:\n myzip.write(filepath)\n\n acq_label = dcm.get('SeriesDescription', DEFAULT_ACQ_LABEL)\n log.info('Processing Acquisition %s.', acq_label)\n # (3) Find or create acquisition\n acq = find_or_create_acquisition(acq_label, session)\n log.info(\n 'Uploading file, %s, to acquisition, %s',\n f'/tmp/{row[\"patientId\"]}.zip',\n acq.label\n )\n kwarg_dict = {\"type\": \"dicom\", \"modality\": \"X-ray\"}\n kwarg_dict[\"info\"] = row_dict\n # Upload file to acquisition and\n # (3a) incorporate Target and box into file metadata\n upload_file_to_acquisition(acq, f'/tmp/{row[\"patientId\"]}.zip', **kwarg_dict)\n # remove temporary zipped dicom file\n os.remove(f'/tmp/{row[\"patientId\"]}.zip')",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0ca6b41908ed27b01a94ae324c2219b53ebb55f | 30,276 | ipynb | Jupyter Notebook | Session 5/Acled - Niger.ipynb | Josedbarnes/applications | bd14211aca6b49ad2ebfb8f4f3513807b0f64f1e | [
"MIT"
] | null | null | null | Session 5/Acled - Niger.ipynb | Josedbarnes/applications | bd14211aca6b49ad2ebfb8f4f3513807b0f64f1e | [
"MIT"
] | null | null | null | Session 5/Acled - Niger.ipynb | Josedbarnes/applications | bd14211aca6b49ad2ebfb8f4f3513807b0f64f1e | [
"MIT"
] | null | null | null | 30.957055 | 149 | 0.4746 | [
[
[
"#import libraries\nimport requests\nfrom datetime import datetime as dt\nfrom datetime import timedelta\nimport pandas as pd\n",
"_____no_output_____"
],
[
"# get events from n days ago\niso = 887 #Pike I changed this to Yemen\nlimit = 400\n\napi_url = 'https://api.acleddata.com/acled/read?terms=accept&iso={}'.format(iso)\nprint (api_url, type(api_url)) #creates request according to ACLED format specifications - p. 13",
"https://api.acleddata.com/acled/read?terms=accept&iso=887 <class 'str'>\n"
],
[
"response = requests.get(api_url)\ndata = response.json()\ndata.keys()\ndata['count'] ",
"_____no_output_____"
]
],
[
[
"### From the documentation we know this is the max return --- How can we get all the results?",
"_____no_output_____"
]
],
[
[
"# Let's mkae a function that updates our search to get the new pages\n\ndef ping_acled(api_url): \n '''\n Takes one parameter search term for API\n '''\n \n response = requests.get(api_url)\n data = response.json()\n return data\n ",
"_____no_output_____"
],
[
"\nresults = [] # empty data strcture to store results\nnum_results = 500 # condition to continue adding pages\ncount = 0 # tracker of results\npage = 1 #Per the documentation each page will give us more results\n\nwhile num_results == 500: #if less 500 or 0 we know we have all the results\n print (\"starting \", page, \" \", num_results) #just to see our progress\n api_url = 'https://api.acleddata.com/acled/read?terms=accept&iso={}&page={}'.format(iso,page) #the search\n data = ping_acled(api_url) #call the previous function \n results.append(data['data']) #store in our results\n count += data['count'] #Track number of results\n num_results = data['count'] #update our condition\n page += 1 #update our page variable\n print (\"Total Results \", count) #Track our progress\n #Pike this is a bit intimidating I know Yemen is a mess but damn\n #I was worried that the 58000 entries would break the code Does that ever happen\n \n\n",
"starting 1 500\nTotal Results 500\nstarting 2 500\nTotal Results 1000\nstarting 3 500\nTotal Results 1500\nstarting 4 500\nTotal Results 2000\nstarting 5 500\nTotal Results 2500\nstarting 6 500\nTotal Results 3000\nstarting 7 500\nTotal Results 3500\nstarting 8 500\nTotal Results 4000\nstarting 9 500\nTotal Results 4500\nstarting 10 500\nTotal Results 5000\nstarting 11 500\nTotal Results 5500\nstarting 12 500\nTotal Results 6000\nstarting 13 500\nTotal Results 6500\nstarting 14 500\nTotal Results 7000\nstarting 15 500\nTotal Results 7500\nstarting 16 500\nTotal Results 8000\nstarting 17 500\nTotal Results 8500\nstarting 18 500\nTotal Results 9000\nstarting 19 500\nTotal Results 9500\nstarting 20 500\nTotal Results 10000\nstarting 21 500\nTotal Results 10500\nstarting 22 500\nTotal Results 11000\nstarting 23 500\nTotal Results 11500\nstarting 24 500\nTotal Results 12000\nstarting 25 500\nTotal Results 12500\nstarting 26 500\nTotal Results 13000\nstarting 27 500\nTotal Results 13500\nstarting 28 500\nTotal Results 14000\nstarting 29 500\nTotal Results 14500\nstarting 30 500\nTotal Results 15000\nstarting 31 500\nTotal Results 15500\nstarting 32 500\nTotal Results 16000\nstarting 33 500\nTotal Results 16500\nstarting 34 500\nTotal Results 17000\nstarting 35 500\nTotal Results 17500\nstarting 36 500\nTotal Results 18000\nstarting 37 500\nTotal Results 18500\nstarting 38 500\nTotal Results 19000\nstarting 39 500\nTotal Results 19500\nstarting 40 500\nTotal Results 20000\nstarting 41 500\nTotal Results 20500\nstarting 42 500\nTotal Results 21000\nstarting 43 500\nTotal Results 21500\nstarting 44 500\nTotal Results 22000\nstarting 45 500\nTotal Results 22500\nstarting 46 500\nTotal Results 23000\nstarting 47 500\nTotal Results 23500\nstarting 48 500\nTotal Results 24000\nstarting 49 500\nTotal Results 24500\nstarting 50 500\nTotal Results 25000\nstarting 51 500\nTotal Results 25500\nstarting 52 500\nTotal Results 26000\nstarting 53 500\nTotal Results 26500\nstarting 54 500\nTotal Results 27000\nstarting 55 500\nTotal Results 27500\nstarting 56 500\nTotal Results 28000\nstarting 57 500\nTotal Results 28500\nstarting 58 500\nTotal Results 29000\nstarting 59 500\nTotal Results 29500\nstarting 60 500\nTotal Results 30000\nstarting 61 500\nTotal Results 30500\nstarting 62 500\nTotal Results 31000\nstarting 63 500\nTotal Results 31500\nstarting 64 500\nTotal Results 32000\nstarting 65 500\nTotal Results 32500\nstarting 66 500\nTotal Results 33000\nstarting 67 500\nTotal Results 33500\nstarting 68 500\nTotal Results 34000\nstarting 69 500\nTotal Results 34500\nstarting 70 500\nTotal Results 35000\nstarting 71 500\nTotal Results 35500\nstarting 72 500\nTotal Results 36000\nstarting 73 500\nTotal Results 36500\nstarting 74 500\nTotal Results 37000\nstarting 75 500\nTotal Results 37500\nstarting 76 500\nTotal Results 38000\nstarting 77 500\nTotal Results 38500\nstarting 78 500\nTotal Results 39000\nstarting 79 500\nTotal Results 39500\nstarting 80 500\nTotal Results 40000\nstarting 81 500\nTotal Results 40500\nstarting 82 500\nTotal Results 41000\nstarting 83 500\nTotal Results 41500\nstarting 84 500\nTotal Results 42000\nstarting 85 500\nTotal Results 42500\nstarting 86 500\nTotal Results 43000\nstarting 87 500\nTotal Results 43500\nstarting 88 500\nTotal Results 44000\nstarting 89 500\nTotal Results 44500\nstarting 90 500\nTotal Results 45000\nstarting 91 500\nTotal Results 45500\nstarting 92 500\nTotal Results 46000\nstarting 93 500\nTotal Results 46500\nstarting 94 500\nTotal Results 47000\nstarting 95 500\nTotal Results 47500\nstarting 96 500\nTotal Results 48000\nstarting 97 500\nTotal Results 48500\nstarting 98 500\nTotal Results 49000\nstarting 99 500\nTotal Results 49500\nstarting 100 500\nTotal Results 50000\nstarting 101 500\nTotal Results 50500\nstarting 102 500\nTotal Results 51000\nstarting 103 500\nTotal Results 51500\nstarting 104 500\nTotal Results 52000\nstarting 105 500\nTotal Results 52500\nstarting 106 500\nTotal Results 53000\nstarting 107 500\nTotal Results 53500\nstarting 108 500\nTotal Results 54000\nstarting 109 500\nTotal Results 54500\nstarting 110 500\nTotal Results 55000\nstarting 111 500\nTotal Results 55500\nstarting 112 500\nTotal Results 56000\nstarting 113 500\nTotal Results 56500\nstarting 114 500\nTotal Results 57000\nstarting 115 500\nTotal Results 57500\nstarting 116 500\nTotal Results 57820\n"
],
[
"#Now I want to put them together into one giant result\nsuper_list = []\nfor res in results: \n super_list += res\n print (len(super_list))\n #This is a giant result",
"500\n1000\n1500\n2000\n2500\n3000\n3500\n4000\n4500\n5000\n5500\n6000\n6500\n7000\n7500\n8000\n8500\n9000\n9500\n10000\n10500\n11000\n11500\n12000\n12500\n13000\n13500\n14000\n14500\n15000\n15500\n16000\n16500\n17000\n17500\n18000\n18500\n19000\n19500\n20000\n20500\n21000\n21500\n22000\n22500\n23000\n23500\n24000\n24500\n25000\n25500\n26000\n26500\n27000\n27500\n28000\n28500\n29000\n29500\n30000\n30500\n31000\n31500\n32000\n32500\n33000\n33500\n34000\n34500\n35000\n35500\n36000\n36500\n37000\n37500\n38000\n38500\n39000\n39500\n40000\n40500\n41000\n41500\n42000\n42500\n43000\n43500\n44000\n44500\n45000\n45500\n46000\n46500\n47000\n47500\n48000\n48500\n49000\n49500\n50000\n50500\n51000\n51500\n52000\n52500\n53000\n53500\n54000\n54500\n55000\n55500\n56000\n56500\n57000\n57500\n57820\n"
],
[
"#Pike changed the name to reflect the proper country\nyemen_res = pd.DataFrame(super_list)\nyemen_res.head()",
"_____no_output_____"
]
],
[
[
"### Do the right thing, take some time to look at the codebook and see what these columns are",
"_____no_output_____"
]
],
[
[
"yemen_res.columns\n",
"_____no_output_____"
]
],
[
[
"### Homework --- Make a map of some ACLED Data (absolutely use the code from the Global Terrorism Database exercise)",
"_____no_output_____"
]
],
[
[
"from bokeh.tile_providers import get_provider, Vendors \nfrom pyproj import Transformer\ntile_provider =get_provider('STAMEN_TERRAIN')\nimport math\nfrom bokeh.plotting import figure, output_notebook, show\n#Pike got help from my coworker Brandon Mohr on this\n#Will be borrowing this technique for other mapping projects \n#as I like this better than the GTD method",
"_____no_output_____"
],
[
"yemen_map = yemen_res[[\"latitude\", 'longitude', 'data_id']]",
"_____no_output_____"
],
[
"yemen_map['latitude'] = yemen_map['latitude'].astype(float)\nyemen_map['longitude'] = yemen_map['longitude'].astype(float)\nyemen_map['data_id'] = yemen_map['data_id'].astype(float)\n#Pike the conversion fix you described in class",
"<ipython-input-33-268010bd8d27>:1: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame.\nTry using .loc[row_indexer,col_indexer] = value instead\n\nSee the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n yemen_map['latitude'] = yemen_map['latitude'].astype(float)\n<ipython-input-33-268010bd8d27>:2: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame.\nTry using .loc[row_indexer,col_indexer] = value instead\n\nSee the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n yemen_map['longitude'] = yemen_map['longitude'].astype(float)\n<ipython-input-33-268010bd8d27>:3: SettingWithCopyWarning: \nA value is trying to be set on a copy of a slice from a DataFrame.\nTry using .loc[row_indexer,col_indexer] = value instead\n\nSee the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n yemen_map['data_id'] = yemen_map['data_id'].astype(float)\n"
],
[
"transformer = Transformer.from_crs('epsg:4326','epsg:3857')",
"_____no_output_____"
],
[
"map_dict = {}\nnan_count = {}\n\nfor idx, row in yemen_map.iterrows():\n if row['data_id'] in map_dict.keys():\n if math.isnan(row[\"latitude\"]):\n if row['data_id'] in nan_count.keys():\n nan_count[row['data_id']] += 1\n else:\n nan_count[row['data_id']] = 1\n \n else:\n point = transformer.transform(row[\"latitude\"],row[\"longitude\"])\n map_dict[row['data_id']].append([point[0],point[1]])\n \n else:\n if math.isnan(row[\"latitude\"]):\n nan_count[row['data_id']] = 1\n else:\n point = transformer.transform(row[\"latitude\"],row[\"longitude\"])\n map_dict[row['data_id']] =[[point[0],point[1]]]\n#Pike this portion of the code is essentially unchanged save for data id for gname \nnan_count",
"_____no_output_____"
]
],
[
[
"for idx, row in yemen_map.iterrows():\n if row['data_id'] in map_dict.keys():\n if math.isnan(row[\"latitude\"]):\n if row['data_id'] in nan_count.keys():\n nan_count[row['data_id']] += 1\n else:\n nan_count[row['data_id']] = 1\n else:\n point - transformer.transform(row[\"latitude\"],row{\"longitude\"])\n map_dict[row['data_id']].append([point[0],point[1]])",
"_____no_output_____"
]
],
[
[
"pts = [(19.07, 41.68), (12.01, 54.87)]\nbbox = []\nfor pt in transformer.itransform(pts):\n bbox.append(pt)\n \n#Pike included the Red Sea Bab al Mandab strait and island of Socotra for completeness sake",
"_____no_output_____"
],
[
"NPA_x = []\nNPA_y = []\nfor k, v in map_dict.items():\n for pt in v:\n NPA_x.append(pt[0])\n NPA_y.append(pt[1])",
"_____no_output_____"
],
[
"p = figure(x_range=(bbox[0][0], bbox[1][0]),y_range=(bbox[0][1], bbox[1][1]), x_axis_type=\"mercator\", y_axis_type=\"mercator\")\np.add_tile(tile_provider)\np.circle(x = NPA_x, y = NPA_y, color= \"firebrick\")\n\nshow(p)\n\n#Pike as my old ops chief would say Yemen is a show\n",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
] |
d0ca6bfc2cadc9a3d259169dae2433a55619b18c | 253,202 | ipynb | Jupyter Notebook | notebooks_Pk/Pk_inference_shethTormen_pivot01.ipynb | dangilman/lenslikelihood | 1490ee9756b4d2ed108a2478977609bbe0ba2e17 | [
"MIT"
] | null | null | null | notebooks_Pk/Pk_inference_shethTormen_pivot01.ipynb | dangilman/lenslikelihood | 1490ee9756b4d2ed108a2478977609bbe0ba2e17 | [
"MIT"
] | null | null | null | notebooks_Pk/Pk_inference_shethTormen_pivot01.ipynb | dangilman/lenslikelihood | 1490ee9756b4d2ed108a2478977609bbe0ba2e17 | [
"MIT"
] | null | null | null | 462.047445 | 99,764 | 0.932595 | [
[
[
"from lenslikelihood.power_spectra import *\nmass_function_model = 'shethTormen'\nnormalization = 'As'\npivot_string = '01'\npivot = 0.1\n\nstructure_formation_interp_As = load_interpolated_mapping(mass_function_model, pivot_string)\n\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.cm as cm\nimport os\n\nplt.rcParams['axes.linewidth'] = 2.5\nplt.rcParams['xtick.major.width'] = 2.5\nplt.rcParams['xtick.major.size'] = 8\nplt.rcParams['xtick.minor.size'] = 5\nplt.rcParams['ytick.major.width'] = 2.5\nplt.rcParams['ytick.major.size'] = 8\nplt.rcParams['ytick.minor.size'] = 4\nplt.rcParams['ytick.labelsize'] = 15\nplt.rcParams['xtick.labelsize'] = 15",
"_____no_output_____"
],
[
"from lenslikelihood.measurements import *\nfrom lenslikelihood.sampling import InterpolatedLikelihood\nimport dill as pickle\nfrom trikde.pdfs import DensitySamples, IndepdendentLikelihoods, MultivariateNormalPriorHyperCube, CustomPriorHyperCube\n\nnbins = 20\nparam_names = ['LOS_normalization', 'beta', 'log10c0', 'delta_power_law_index', 'sigma_sub']\nparam_ranges = [all_param_ranges_version2[name] for name in param_names]\nload_from_pickle = True \nsave_to_pickle = False \n\nfilename_extension = '_joint_logprior'\nbase_path = './../lenslikelihood/precomputed_likelihoods/'\nlikelihoods = []\nfor lens in all_lens_names:\n fname = base_path + lens + filename_extension\n print('loading joint likelihoods for lens '+lens+' ...')\n f = open(fname, 'rb')\n single_lens_likelihood = pickle.load(f)\n f.close()\n likelihoods.append(single_lens_likelihood)\n \nlikelihood_noprior = IndepdendentLikelihoods(likelihoods)",
"loading joint likelihoods for lens HE0435 ...\nloading joint likelihoods for lens WGD2038 ...\nloading joint likelihoods for lens B1422 ...\nloading joint likelihoods for lens WFI2033 ...\nloading joint likelihoods for lens PSJ1606 ...\nloading joint likelihoods for lens WFI2026 ...\nloading joint likelihoods for lens RXJ0911 ...\nloading joint likelihoods for lens MG0414 ...\nloading joint likelihoods for lens PG1115 ...\nloading joint likelihoods for lens RXJ1131 ...\nloading joint likelihoods for lens WGDJ0405 ...\n"
]
],
[
[
"## Priors on the subhalo and field halo mass functions\n\nA reasonable assumption to impose on the inference is that the number of subhalos varies proportionally with the number of field halos, since subhalos are accreted from the field. We can enforce this by choosing an expected amplitude for the subhalo mass function in $\\Lambda$CDM, and then coupling variations to $\\Sigma_{\\rm{sub}}$ around this value to $\\delta_{\\rm{LOS}}$. ",
"_____no_output_____"
]
],
[
[
"def couple_mass_functions(samples, sigma_sub_theory=0.025, coupling_strength=0.2):\n \n delta_los_samples = samples[:, 0]\n sigma_sub_samples = samples[:, -1]\n delta_sigma_sub = sigma_sub_samples/sigma_sub_theory\n chi2 = (delta_sigma_sub - delta_los_samples)**2/coupling_strength**2 \n return chi2\n\nextrapolate_likelihood = True\nsigma_sub_theory = 0.05\nkwargs_prior = {'sigma_sub_theory': sigma_sub_theory}\nprior_on_mass_functions = CustomPriorHyperCube(couple_mass_functions, param_names, param_ranges, nbins, kwargs_prior)\n\nlikelihood = IndepdendentLikelihoods(likelihoods + [prior_on_mass_functions])\ninterpolated_lens_likelihood = InterpolatedLikelihood(likelihood, param_names, param_ranges, extrapolate=extrapolate_likelihood)",
"_____no_output_____"
]
],
[
[
"### Plot the likelihood\n\nFirst we show the likelihood as inferred from the lenses with no additional modeling assumptions",
"_____no_output_____"
]
],
[
[
"from trikde.triangleplot import TrianglePlot\nfig = plt.figure()\ncmap = 'jet'\ntriangle_plot = TrianglePlot([likelihood_noprior])\ntriangle_plot.set_cmap(cmap, marginal_col='k')\ntriangle_plot.truth_color = 'k'\ntruths = {'sigma_sub': 1.05, 'LOS_normalization': 1., 'beta': 0.85, 'log10c0': np.log10(18.5), 'delta_power_law_index': 0.}\naxes = triangle_plot.make_triplot(filled_contours=False, show_intervals=False, contour_alpha=1.,\n contour_colors=['k', 'k'],\n show_contours=True, contour_levels=[0.32], truths=truths)\n\nbeta = r'$\\beta$'\nbeta_ticks = [-0.2, 3, 6, 9, 12, 15]\nc0 = r'$\\log_{10} c_8$'\nc0_ticks = [0., 1.0, 2.0, 3.0, 4.0]\ndelta_power_law_index = r'$\\Delta \\alpha$'\ndpli_ticks = [-0.6, -0.3, 0., 0.3, 0.6, 0.9]\nsigma_sub = r'$\\Sigma_{\\rm{sub}} \\ \\left[\\rm{kpc^{-2}}\\right]$'\nsigma_sub_ticks = [0., 0.025, 0.05, 0.075, 0.1]\ndelta_LOS = r'$\\delta_{\\rm{LOS}}$'\ndlos_ticks = [0.0, 0.5, 1., 1.5, 2., 2.5]\nticksize = 14\nlabelsize = 18\nrotation = 40\n\naxes[5].set_ylabel(beta, fontsize=labelsize)\naxes[5].set_yticks(beta_ticks)\naxes[5].set_yticklabels(beta_ticks, fontsize=ticksize)\n\naxes[10].set_ylabel(c0, fontsize=labelsize)\naxes[10].set_yticks(c0_ticks)\naxes[10].set_yticklabels(c0_ticks, fontsize=ticksize)\n\naxes[15].set_ylabel(delta_power_law_index, fontsize=labelsize)\naxes[15].set_yticks(dpli_ticks)\naxes[15].set_yticklabels(dpli_ticks, fontsize=ticksize)\n\naxes[20].set_ylabel(sigma_sub, fontsize=labelsize)\naxes[20].set_yticks(sigma_sub_ticks)\naxes[20].set_yticklabels(sigma_sub_ticks, fontsize=ticksize)\n\naxes[20].set_xlabel(delta_LOS, fontsize=labelsize)\naxes[20].set_xticks(dlos_ticks)\naxes[20].set_xticklabels(dlos_ticks, fontsize=ticksize, rotation=rotation)\n\naxes[21].set_xlabel(beta, fontsize=labelsize)\naxes[21].set_xticks(beta_ticks)\naxes[21].set_xticklabels(beta_ticks, fontsize=ticksize, rotation=rotation)\n\naxes[22].set_xlabel(c0, fontsize=labelsize)\naxes[22].set_xticks(c0_ticks)\naxes[22].set_xticklabels(c0_ticks, fontsize=ticksize, rotation=rotation)\n\n\naxes[23].set_xlabel(delta_power_law_index, fontsize=labelsize)\naxes[23].set_xticks(dpli_ticks)\naxes[23].set_xticklabels(dpli_ticks, fontsize=ticksize, rotation=rotation)\n\naxes[24].set_xlabel(sigma_sub, fontsize=labelsize)\naxes[24].set_xticks(sigma_sub_ticks)\naxes[24].set_xticklabels(sigma_sub_ticks, fontsize=ticksize, rotation=rotation)\n\nfrom mpl_toolkits.axes_grid1 import make_axes_locatable\nfrom mpl_toolkits.axes_grid1.inset_locator import inset_axes\n\nax_idx = 9\naxins1 = inset_axes(axes[ax_idx],\n width=\"300%\", # width = 50% of parent_bbox width\n height=\"15%\", # height : 5%\n loc='upper right')\nempty = np.zeros((20, 20))\nempty[0,0] = 1\n\nim1 = axes[ax_idx].imshow(empty, interpolation='None', cmap=cmap)\ncb = fig.colorbar(im1, cax=axins1, orientation=\"horizontal\", ticks=[0, 0.25, 0.5, 0.75, 1])\naxes[ax_idx].set_visible(False)\ncb.set_label('probability', fontsize=15)\n#plt.savefig('./figures/lensing_likelihood.pdf')\n",
"/Users/danielgilman/.local/lib/python3.6/site-packages/matplotlib/contour.py:1173: UserWarning: No contour levels were found within the data range.\n warnings.warn(\"No contour levels were found\"\n"
]
],
[
[
"### Likelihood with a prior\n\nNow we show the likelihood after adding the prior coupling $\\Sigma_{\\rm{sub}}$ to $\\delta_{LOS}$, assuming $\\Sigma_{\\rm{sub}} = 0.05 \\rm{kpc^{-1}}$ in $\\Lambda$CDM, corresponding to doubly efficient tidal disruption of halos between in the Milky Way relative to massive ellipticals",
"_____no_output_____"
]
],
[
[
"fig = plt.figure()\ntriangle_plot = TrianglePlot([likelihood])\ntriangle_plot.set_cmap(cmap, marginal_col='k')\ntriangle_plot.truth_color = 'k'\ntruths= {'sigma_sub': 1.05, 'LOS_normalization': 1., 'beta': 0.85, 'log10c0': np.log10(18.5), 'delta_power_law_index': 0.}\naxes = triangle_plot.make_triplot(filled_contours=False, show_intervals=False, show_contours=True,\n contour_levels=[0.32], contour_colors=['k', 'k'],\n display_params=['LOS_normalization', 'beta', 'log10c0', 'delta_power_law_index'],\n truths=truths)\n\naxes[4].set_ylabel(beta, fontsize=labelsize)\naxes[4].set_yticks(beta_ticks)\naxes[4].set_yticklabels(beta_ticks, fontsize=ticksize)\n\naxes[8].set_ylabel(c0, fontsize=labelsize)\naxes[8].set_yticks(c0_ticks)\naxes[8].set_yticklabels(c0_ticks, fontsize=ticksize)\n\naxes[12].set_ylabel(delta_power_law_index, fontsize=labelsize)\naxes[12].set_yticks(dpli_ticks)\naxes[12].set_yticklabels(dpli_ticks, fontsize=ticksize)\n\naxes[12].set_xlabel(delta_LOS, fontsize=labelsize)\naxes[12].set_xticks(dlos_ticks)\naxes[12].set_xticklabels(dlos_ticks, fontsize=ticksize, rotation=rotation)\n\naxes[13].set_xlabel(beta, fontsize=labelsize)\naxes[13].set_xticks(beta_ticks)\naxes[13].set_xticklabels(beta_ticks, fontsize=ticksize, rotation=rotation)\n\naxes[14].set_xlabel(c0, fontsize=labelsize)\naxes[14].set_xticks(c0_ticks)\naxes[14].set_xticklabels(c0_ticks, fontsize=ticksize, rotation=rotation)\n\naxes[15].set_xlabel(delta_power_law_index, fontsize=labelsize)\naxes[15].set_xticks(dpli_ticks)\naxes[15].set_xticklabels(dpli_ticks, fontsize=ticksize, rotation=rotation)\n\naxes[2].annotate(r'$\\Sigma_{\\rm{sub(predicted)}} = 0.05 \\rm{kpc^{-2}}$', fontsize=22,\n xy=(0.26, 0.1), xycoords='axes fraction')\nax_idx = 7\naxins1 = inset_axes(axes[ax_idx],\n width=\"200%\", # width = 50% of parent_bbox width\n height=\"10%\", # height : 5%\n loc='upper right')\nempty = np.zeros((20, 20))\nempty[0,0] = 1\n\nim1 = axes[ax_idx].imshow(empty, interpolation='None', cmap=cmap)\ncb = fig.colorbar(im1, cax=axins1, orientation=\"horizontal\", ticks=[0, 0.25, 0.5, 0.75, 1])\naxes[ax_idx].set_visible(False)\ncb.set_label('probability', fontsize=15)\n\n#plt.savefig('./figures/lensing_likelihood_w.pdf')",
"_____no_output_____"
]
],
[
[
"## Systematic modeling errors\n\nWe allow for systematic errors in the model by changing the internal mapping between the parameters describing the mass function and concentration-mass relation",
"_____no_output_____"
]
],
[
[
"error_type = 'INTERPOLATED_GRID'\n\nif error_type == 'INTERPOLATED_GRID':\n \n f = open('./systematic_error_interpolations/systematic_error_interpolation_lowfit_'+mass_function_model+'_pivot'+pivot_string+'_3D', 'rb')\n systematic_interp_lowfit = pickle.load(f)\n f.close()\n\n f = open('./systematic_error_interpolations/systematic_error_interpolation_highfit_'+mass_function_model+'_pivot'+pivot_string+'_3D', 'rb')\n systematic_interp_highfit = pickle.load(f)\n f.close()\n \nelif error_type == 'RELATIVE':\n delta_delta_los = 0.1\n delta_beta = 0.2\n delta_c8 = 0.2\n delta_delta_alpha = 0.05",
"_____no_output_____"
]
],
[
[
"## Final setup",
"_____no_output_____"
]
],
[
[
"delta_los_range = [0., 2.5]\nbeta_range = [-0.2, 15.]\nlog10c0_range = [0., 4.]\ndelta_alpha_range = [-0.6, 0.9]\nsigma_sub_range = [0., 0.125]\nparam_ranges_lensing = [delta_los_range, beta_range, log10c0_range, delta_alpha_range, sigma_sub_range]\nn_draw = 50000\nextrapolate_ranges = [[0., 2.5], \n [-0.2, 15.],\n [0., 4.0], \n delta_alpha_range,\n sigma_sub_range]\n\nparam_ranges_pk = [[0.6645, 1.2645], [-0.1, 0.1], [-0.01, 0.01]]\narun_ticks = [-0.10, -0.05, 0.00, 0.05, 0.10]\nbrun_ticks = [-0.010, -0.005, 0.000, 0.005, 0.01]\nns_ticks = [0.7645, 0.9645, 1.1645]",
"_____no_output_____"
]
],
[
[
"## Compute the likelihood of the power spectrum parameters\n\nWe can compute the likelihood the parameters describing $P\\left(k\\right)$, adding systematic models errors by hand",
"_____no_output_____"
]
],
[
[
"if error_type == 'INTERPOLATED_GRID':\n \n samples_no_sys, like_no_sys = sample_power_spectra_with_systematic_interp(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n systematic_interp_highfit, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges, log10c8_sys=False, delta_los_sys=False,\n delta_alpha_sys=False, beta_sys=False, three_D=True)\n \n samples_sys1, like_sys1 = sample_power_spectra_with_systematic_interp(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n systematic_interp_lowfit, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges, three_D=True)\n\n samples_sys2, like_sys2 = sample_power_spectra_with_systematic_interp(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n systematic_interp_highfit, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges, three_D=True)\n\n\n samples_sys_noamp_1, like_sys_noamp_1 = sample_power_spectra_with_systematic_interp(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n systematic_interp_lowfit, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges, log10c8_sys=False, delta_los_sys=False, three_D=True)\n\n samples_sys_noamp_2, like_sys_noamp_2 = sample_power_spectra_with_systematic_interp(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n systematic_interp_highfit, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges, log10c8_sys=False, delta_los_sys=False, three_D=True)\n\n samples_sys_noslope, like_sys_noslope = sample_power_spectra_with_systematic_interp(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n systematic_interp_lowfit, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges, delta_alpha_sys=False, beta_sys=False, three_D=True)\n \nelif error_type == 'RELATIVE':\n \n samples_sys1, like_sys1 = sample_power_spectra(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n delta_c8, delta_beta, delta_delta_los, delta_delta_alpha, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges)\n\n samples_sys2, like_sys2 = sample_power_spectra(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n -delta_c8, -delta_beta, -delta_delta_los, -delta_delta_alpha, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges)\n\n samples_no_sys, like_no_sys = sample_power_spectra(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n 0., 0., 0., 0., extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges)\n\n samples_sys_noamp_1, like_sys_noamp_1 = sample_power_spectra(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n 0., delta_beta, 0., delta_delta_alpha, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges)\n\n samples_sys_noamp_2, like_sys_noamp_2 = sample_power_spectra(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n 0., -delta_beta, 0., delta_delta_alpha, extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges)\n\n samples_sys_noslope, like_sys_noslope = sample_power_spectra(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n -delta_c8, 0., 0., 0., extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges)\n \n samples_sys_noslope_2, like_sys_noslope_2 = sample_power_spectra(n_draw, param_ranges_pk, param_ranges_lensing, structure_formation_interp_As, interpolated_lens_likelihood,\n delta_c8, 0., 0., 0., extrapolate=extrapolate_likelihood, extrapolate_ranges=extrapolate_ranges)\n \n \n ",
"_____no_output_____"
]
],
[
[
"## Plot the likelihood of the parameters describing the power spectrum",
"_____no_output_____"
]
],
[
[
"nbins = 20\nparam_names_pk = [r'$n_s$', r'$a_{\\rm{run}}$', r'$b_{\\rm{run}}$'] \n\nsamples_marginalized = np.vstack((np.vstack((np.vstack((np.vstack((np.vstack((samples_no_sys, samples_sys1)), samples_sys2)), samples_sys_noamp_1)), samples_sys_noamp_2)), samples_sys_noslope))\nlikelihood_marginalized = np.append(np.append(np.append(np.append(np.append(like_no_sys, like_sys1), like_sys2), like_sys_noamp_1), like_sys_noamp_2), like_sys_noslope)\n# samples_marginalized = samples_no_sys\n# likelihood_marginalized = like_no_sys\ndensity_marginalized = DensitySamples(samples_marginalized, param_names_pk, likelihood_marginalized, \n param_ranges_pk, nbins=nbins, use_kde=False, bandwidth_scale=1.)\npk_likelihood_marginalized = IndepdendentLikelihoods([density_marginalized])\n\ntriplot = TrianglePlot([pk_likelihood_marginalized])\ncmap = 'jet'\ntriplot.set_cmap(cmap, marginal_col='k')\ntriplot.truth_color = 'k'\ntruths= {r'$n_s$': 0.9645, r'$a_{\\rm{run}}$': 0., r'$b_{\\rm{run}}$': 0.}\naxes = triplot.make_triplot(filled_contours=False, show_intervals=False, show_contours=True,\n contour_levels=[0.32], contour_colors=['k', 'k'])\n\naxes[3].set_yticks(arun_ticks)\naxes[3].set_yticklabels(arun_ticks, fontsize=ticksize)\n\naxes[6].set_yticks(brun_ticks)\naxes[6].set_yticklabels(brun_ticks, fontsize=ticksize)\n\naxes[6].set_xticks(ns_ticks)\naxes[6].set_xticklabels(ns_ticks, fontsize=ticksize)\n\naxes[7].set_xticks(arun_ticks)\naxes[7].set_xticklabels(arun_ticks, fontsize=ticksize)\n\naxes[8].set_xticks(brun_ticks)\naxes[8].set_xticklabels(brun_ticks, fontsize=ticksize)\n\nax_idx = 1\naxins1 = inset_axes(axes[ax_idx],\n width=\"200%\", # width = 50% of parent_bbox width\n height=\"10%\", # height : 5%\n loc=6)\nempty = np.zeros((20, 20))\nempty[0,0] = 1\n\nim1 = axes[ax_idx].imshow(empty, interpolation='None', cmap=cmap)\ncb = fig.colorbar(im1, cax=axins1, orientation=\"horizontal\", ticks=[0, 0.25, 0.5, 0.75, 1])\naxes[ax_idx].set_visible(False)\ncb.set_label('probability', fontsize=15)\nplt.savefig('./figures/qP_likelihood_'+mass_function_model+'_pivot'+pivot_string+'.pdf')\n\nimport pickle\nf = open('./interpolated_pq_likelihoods/Pk_likelihood_'+mass_function_model+'_pivot'+pivot_string, 'wb')\npk_likelihood_marginalized_interp = InterpolatedLikelihood(pk_likelihood_marginalized, param_names_pk, param_ranges_pk)\npickle.dump(pk_likelihood_marginalized_interp, f)\n",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0ca741c596bc40355b3a408e3ec9780192e4470 | 115,061 | ipynb | Jupyter Notebook | notebooks/.ipynb_checkpoints/nm_08_RootFinding-checkpoint.ipynb | raghurama123/NumericalMethods | b31737b97e155b0b9b38b0c8bc7a20e90e9c5401 | [
"MIT"
] | 1 | 2022-01-01T01:12:51.000Z | 2022-01-01T01:12:51.000Z | notebooks/.ipynb_checkpoints/nm_08_RootFinding-checkpoint.ipynb | raghurama123/NumericalMethods | b31737b97e155b0b9b38b0c8bc7a20e90e9c5401 | [
"MIT"
] | null | null | null | notebooks/.ipynb_checkpoints/nm_08_RootFinding-checkpoint.ipynb | raghurama123/NumericalMethods | b31737b97e155b0b9b38b0c8bc7a20e90e9c5401 | [
"MIT"
] | 5 | 2022-01-25T03:40:30.000Z | 2022-02-22T05:38:21.000Z | 126.579758 | 23,728 | 0.856867 | [
[
[
"# Content:\n1. [Definitions](#1.-Definitions)\n2. [The root finding problem](#2.-The-root-finding-problem)\n3. [Fixed point iteration](#3.-Fixed-point-iteration)\n>3.1 [The cobweb diagram](#3.1-The-cobweb-diagram) \n>3.2 [Fixed point iteration theorem](#3.2-Fixed-point-iteration-theorem) \n>3.3 [The code](#3.3-The-code)\n4. [Bisection method](#4.-Bisection-method)",
"_____no_output_____"
],
[
"# 1. Definitions",
"_____no_output_____"
],
[
"",
"_____no_output_____"
],
[
"[Weierstrass function](https://en.wikipedia.org/wiki/Weierstrass_function) is a peculiar function. It is continuous on the real number line but not differentiable anywhere.",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\n\ndef weierstrass(a,b,M,x):\n val = 0.0\n for n in range(0,M):\n val = val + a**n * np.cos(b**n*np.pi*x)\n return val\n\nx = np.linspace(-2,2,1000) # 1000 points between -2 and +2\na=0.5\nb=3.0\n\nN=x.size\ny=np.zeros(N)\n\nM=1\nfor i in range(N):\n y[i]=weierstrass(a,b,M,x[i])\nplt.plot(x, y, 'b-', label='M=1')\n\nplt.title('Weierstrass function, M=1')\nplt.legend()\nplt.show()",
"_____no_output_____"
],
[
"M=3\nfor i in range(N):\n y[i]=weierstrass(a,b,M,x[i])\nplt.plot(x, y, 'b-', label='M=3')\n\nplt.title('Weierstrass function, M=3')\nplt.legend()\nplt.show()",
"_____no_output_____"
],
[
"M=10\nfor i in range(N):\n y[i]=weierstrass(a,b,M,x[i])\nplt.plot(x, y, 'b-', label='M=10')\n\nplt.title('Weierstrass function, M=10')\nplt.legend()\nplt.show()",
"_____no_output_____"
]
],
[
[
"---\nHomework-16: Find examples for polynomial, rational, trigonometric, exponential and logarithmic functions that are in $C^\\infty[{\\bf R}],~{\\rm where}~{\\bf R}$ is the real number line.\n \n---",
"_____no_output_____"
],
[
"## 2. The root-finding problem",
"_____no_output_____"
],
[
"",
"_____no_output_____"
],
[
"## 3. Fixed point iteration ",
"_____no_output_____"
],
[
"",
"_____no_output_____"
]
],
[
[
"import numpy as np\n\ndef f(x):\n val=x-np.sqrt(10.0/x)\n return val\n\ndef g(x):\n val=np.sqrt(10.0/x)\n return val\n\nx=1 # initial guess, x0\n\ndx=x\n\ni=0\nwhile dx > 1e-3:\n dx=np.abs(x-g(x))\n print('Iteration: ',i,' x:',x,' g(x):',g(x),' f(x): ', f(x))\n x=g(x)\n i=i+1\n\nprint('Exact root is x:',np.power(10.0,1.0/3.0))",
"Iteration: 0 x: 1 g(x): 3.1622776601683795 f(x): -2.1622776601683795\nIteration: 1 x: 3.1622776601683795 g(x): 1.7782794100389228 f(x): 1.3839982501294568\nIteration: 2 x: 1.7782794100389228 g(x): 2.3713737056616555 f(x): -0.5930942956227327\nIteration: 3 x: 2.3713737056616555 g(x): 2.053525026457146 f(x): 0.31784867920450965\nIteration: 4 x: 2.053525026457146 g(x): 2.20673406908459 f(x): -0.15320904262744417\nIteration: 5 x: 2.20673406908459 g(x): 2.1287516617963727 f(x): 0.07798240728821737\nIteration: 6 x: 2.1287516617963727 g(x): 2.1673921695684175 f(x): -0.03864050777204486\nIteration: 7 x: 2.1673921695684175 g(x): 2.1479850285170086 f(x): 0.01940714105140895\nIteration: 8 x: 2.1479850285170086 g(x): 2.157666779453667 f(x): -0.00968175093665824\nIteration: 9 x: 2.157666779453667 g(x): 2.152820461347157 f(x): 0.004846318106509706\nIteration: 10 x: 2.152820461347157 g(x): 2.155242258210635 f(x): -0.0024217968634778764\nIteration: 11 x: 2.155242258210635 g(x): 2.1540310194228653 f(x): 0.0012112387877696307\nIteration: 12 x: 2.1540310194228653 g(x): 2.154636553703824 f(x): -0.0006055342809587749\nExact root is x: 2.154434690031884\n"
]
],
[
[
"Here is another elegant way to print the output ",
"_____no_output_____"
]
],
[
[
"x=1.0\n\nfor i in range(0,15):\n gx=g(x)\n fx=f(x)\n fstring=(f'''Iteration={i:5d} x={x:10.4f} g(x)={gx:10.4f} f(x)={np.abs(fx):10.4f}''') # using f-string\n print(fstring)\n x=g(x)\n\nout=(f'''Exact root is x={np.power(10.0,1.0/3.0):10.4f}''')\nprint(out)\n\n#other way for formatted print\n#mynumber=3.14\n#print('{:10.8f}'.format(mynumber))",
"Iteration= 0 x= 1.0000 g(x)= 3.1623 f(x)= 2.1623\nIteration= 1 x= 3.1623 g(x)= 1.7783 f(x)= 1.3840\nIteration= 2 x= 1.7783 g(x)= 2.3714 f(x)= 0.5931\nIteration= 3 x= 2.3714 g(x)= 2.0535 f(x)= 0.3178\nIteration= 4 x= 2.0535 g(x)= 2.2067 f(x)= 0.1532\nIteration= 5 x= 2.2067 g(x)= 2.1288 f(x)= 0.0780\nIteration= 6 x= 2.1288 g(x)= 2.1674 f(x)= 0.0386\nIteration= 7 x= 2.1674 g(x)= 2.1480 f(x)= 0.0194\nIteration= 8 x= 2.1480 g(x)= 2.1577 f(x)= 0.0097\nIteration= 9 x= 2.1577 g(x)= 2.1528 f(x)= 0.0048\nIteration= 10 x= 2.1528 g(x)= 2.1552 f(x)= 0.0024\nIteration= 11 x= 2.1552 g(x)= 2.1540 f(x)= 0.0012\nIteration= 12 x= 2.1540 g(x)= 2.1546 f(x)= 0.0006\nIteration= 13 x= 2.1546 g(x)= 2.1543 f(x)= 0.0003\nIteration= 14 x= 2.1543 g(x)= 2.1545 f(x)= 0.0002\nExact root is x= 2.1544\n"
]
],
[
[
"### 3.1 The cobweb diagram ",
"_____no_output_____"
],
[
"\n\n",
"_____no_output_____"
]
],
[
[
"def g_fn(x):\n val=np.sqrt(10.0/x)\n return val\n\nN=15\nx=np.zeros(N,float)\ng=np.zeros(N,float)\n\nx0=1.0 # initial guess\n\nNi=10\nfor i in range(0,Ni):\n x[i]=x0\n g[i]=g_fn(x0)\n x0=g[i] \n \n#print(x,g)",
"_____no_output_____"
],
[
"import numpy as np\nimport matplotlib.pyplot as plt\n\nfig = plt.figure() # comment if square plot is not needed\nax = fig.add_subplot(111) # comment if square plot is not needed\n\nplt.xlim(0, 4)\nplt.ylim(0, 4)\n\nx_grids = np.linspace(0,4,100) \nN=x_grids.size\ng_grids=np.zeros(N)\n\nfor i in range(N):\n g_grids[i]=g_fn(x_grids[i])\n\nplt.plot(x_grids,x_grids,'k-',label='x')\nplt.plot(x_grids,g_grids,'b-',label='g(x)')\n\nxval=[x[0],x[0]]\ngval=[x[0],g[0]]\nplt.plot(xval,gval)\n\nplt.grid()\n\nfor i in range(0,6):\n\n # horizontal line, same y-value\n xval=[x[i],g[i]]\n gval=[g[i],g[i]]\n plt.plot(xval,gval)\n\n # vertical line, same x-value \n xval=[g[i],x[i+1]]\n gval=[g[i],g[i+1]]\n plt.plot(xval,gval)\n\nax.set_aspect('equal', adjustable='box') # comment if square plot is not needed\n\nplt.title('Cobweb diagram for $x=\\sqrt{10/x}$')\nplt.legend()\nplt.show()",
"<ipython-input-6-348e80d82643>:2: RuntimeWarning: divide by zero encountered in double_scalars\n val=np.sqrt(10.0/x)\n"
]
],
[
[
"### Let's try another problem: $x - 1/x^2 = 0;~g(x)=1/x^2;~x_0 = 0.1$",
"_____no_output_____"
]
],
[
[
"import numpy as np\n\ndef g_fn(x):\n val=1.0/x**2\n return val\n\ndef f_fn(x):\n val=x-1.0/x**2\n return val\n\nx=0.1\n\nfor i in range(0,4):\n gx=g_fn(x)\n fx=f_fn(x)\n fstring=(f'''Iteration={i:5d} x={x:10.4f} g(x)={gx:10.4f} f(x)={np.abs(fx):10.4f}''') # using f-string\n print(fstring)\n x=g_fn(x)",
"Iteration= 0 x= 0.1000 g(x)= 100.0000 f(x)= 99.9000\nIteration= 1 x= 100.0000 g(x)= 0.0001 f(x)= 99.9999\nIteration= 2 x= 0.0001 g(x)=100000000.0000 f(x)=99999999.9999\nIteration= 3 x=100000000.0000 g(x)= 0.0000 f(x)=100000000.0000\n"
]
],
[
[
"Diverges! ",
"_____no_output_____"
],
[
"### 3.2 Fixed point iteration theorem",
"_____no_output_____"
],
[
"\n\n\n\n\n",
"_____no_output_____"
],
[
"### 3.3 The code",
"_____no_output_____"
]
],
[
[
"import numpy as np\n\n# fn is the g(x) in x = g(x) that we want to solve\n# x is the initial guess, x0\n# xthresh is convergence thershold\n# maxeval - maximum number of evaluation of fn\n# iprint control printing, iprint = 1 for extra output\ndef fixedpoint(fn, x, xthresh, maxeval, iprint):\n \n if iprint == 1:\n print('#iter x g(x) dx')\n\n ieval=0\n \n g=fn(x)\n ieval=ieval+1\n \n dx=np.abs(x-g)\n\n iiter=0 \n while dx > xthresh:\n g=fn(x)\n ieval=ieval+1\n \n dx=np.abs(x-g)\n \n if iprint == 1:\n print('{:5d}{:15.6e}{:15.6e}{:15.6e}'.format(iiter,x, g, dx))\n\n if ieval >= maxeval:\n print('Exiting fixed-point iteration, maximum function evaluations reached')\n break\n \n x=g\n iiter=iiter+1\n\n return x \n print('Exiting fixed-point iteration, convergence reached') ",
"_____no_output_____"
],
[
"def fn_g(x):\n val=np.sqrt(10.0/x)\n return val",
"_____no_output_____"
],
[
"x0 = 1.0\nxthresh = 1E-5\nmaxeval = 100 \niprint=1\nx = fixedpoint(fn_g, x0, xthresh, maxeval,iprint)\nprint('The solution is: ',x)",
"#iter x g(x) dx\n 0 1.000000e+00 3.162278e+00 2.162278e+00\n 1 3.162278e+00 1.778279e+00 1.383998e+00\n 2 1.778279e+00 2.371374e+00 5.930943e-01\n 3 2.371374e+00 2.053525e+00 3.178487e-01\n 4 2.053525e+00 2.206734e+00 1.532090e-01\n 5 2.206734e+00 2.128752e+00 7.798241e-02\n 6 2.128752e+00 2.167392e+00 3.864051e-02\n 7 2.167392e+00 2.147985e+00 1.940714e-02\n 8 2.147985e+00 2.157667e+00 9.681751e-03\n 9 2.157667e+00 2.152820e+00 4.846318e-03\n 10 2.152820e+00 2.155242e+00 2.421797e-03\n 11 2.155242e+00 2.154031e+00 1.211239e-03\n 12 2.154031e+00 2.154637e+00 6.055343e-04\n 13 2.154637e+00 2.154334e+00 3.027884e-04\n 14 2.154334e+00 2.154485e+00 1.513889e-04\n 15 2.154485e+00 2.154409e+00 7.569577e-05\n 16 2.154409e+00 2.154447e+00 3.784755e-05\n 17 2.154447e+00 2.154428e+00 1.892386e-05\n 18 2.154428e+00 2.154438e+00 9.461909e-06\nThe solution is: 2.15443784400631\n"
]
],
[
[
"### Let's try another problem: $\\exp(-x) + x/5 - 1 = 0$",
"_____no_output_____"
],
[
"Let's look at the graphical solution by plotting the function $f(x)$ and see where it takes the value zero.",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\n\ndef f(x):\n val=np.exp(-x)+x/5.0-1\n return val\n\nxmin=-5.0\nxmax=10.0\nplt.xlim(xmin, xmax)\n\nplt.ylim(-3, 10)\n\nx = np.linspace(xmin,xmax,100) \nN=x_grids.size\ny=np.zeros(N)\n\nfor i in range(N):\n y[i]=f(x[i])\n\nplt.plot(x,x*0,'k-')\nplt.plot(x,y,'b-')\nplt.grid()\nplt.show()",
"_____no_output_____"
]
],
[
[
"There are two roots for this equation. One at 0.0 and another near 5.0.",
"_____no_output_____"
],
[
"There are two ways of rearranging the equation to apply the fixed-point iteration $x_{n+1}=g(x_n)$.\n* Option-1: $g_1(x)=5\\left[ 1- \\exp(-x) \\right]$ \n* Option-2: $g_2(x)=-\\log\\left[ 1 - x/5 \\right]$",
"_____no_output_____"
]
],
[
[
"def g1(x):\n val=5 * ( 1 - np.exp(-x) )\n return val\n\nx0 = 2 # somewhere in between both the solutions\nmaxeval = 20\nxthresh = 0.0001\niprint=1\nx = fixedpoint(g1, x0, xthresh, maxeval,iprint)\nprint('The solution is: ',x)",
"#iter x g(x) dx\n 0 2.000000e+00 4.323324e+00 2.323324e+00\n 1 4.323324e+00 4.933721e+00 6.103976e-01\n 2 4.933721e+00 4.964002e+00 3.028046e-02\n 3 4.964002e+00 4.965075e+00 1.073707e-03\n 4 4.965075e+00 4.965113e+00 3.747867e-05\nThe solution is: 4.965112876983948\n"
],
[
"def g2(x):\n val=-np.log(1-x/5.0)\n return val\n\nx0 = 2.0 # somewhere in between both the solutions\nmaxeval = 10\nxthresh = 0.0001\niprint=1\nx = fixedpoint(g2, x0, xthresh, maxeval,iprint)\nprint('The solution is: ',x)",
"#iter x g(x) dx\n 0 2.000000e+00 5.108256e-01 1.489174e+00\n 1 5.108256e-01 1.077691e-01 4.030565e-01\n 2 1.077691e-01 2.178950e-02 8.597961e-02\n 3 2.178950e-02 4.367423e-03 1.742207e-02\n 4 4.367423e-03 8.738663e-04 3.493557e-03\n 5 8.738663e-04 1.747885e-04 6.990778e-04\n 6 1.747885e-04 3.495832e-05 1.398302e-04\n 7 3.495832e-05 6.991688e-06 2.796663e-05\nThe solution is: 6.991687951052522e-06\n"
]
],
[
[
"---\nHomework-17: $For~the~above~example,~using~the~fixed~point~convergence~relation~explain~why~using~g_1(x)~results~in~the~solution~x^*=4.965~while~g_2(x)~results~in~x^*=0.0.~In~both~cases,~use~x_0=2.0~as~the~initial~guess.$\n \n---",
"_____no_output_____"
],
[
"## 4. Bisection method",
"_____no_output_____"
],
[
"\n\n",
"_____no_output_____"
]
],
[
[
"import numpy as np\n\ndef bisection(fn, a0, b0, xthresh, maxeval, iprint):\n \n if iprint == 1:\n print('#iter a b x dx')\n \n ieval=0\n iiter=1\n \n a=a0\n b=b0\n \n dx = abs(a-b)\n \n while dx > xthresh or iiter < 10:\n \n x = (a+b)/2.0\n \n dx = abs(a-b) \n \n fx = fn(x)\n fb = fn(b)\n \n if (fb < xthresh): # handle an exception\n print('The upper limit seems to be a root. Stopping program.')\n x=b\n break\n \n if iprint == 1:\n print('{:5d}{:15.6e}{:15.6e}{:15.6e}{:15.6e}{:15.6e}{:15.6e}'.format(iiter, a, b, x, dx,fx,fb))\n \n if fx*fb > 0:\n b = x\n else:\n a = x \n \n ieval=ieval+2\n if ieval >= maxeval:\n print('Exiting fixed-point iteration, maximum function evaluations reached')\n break\n \n iiter=iiter+1\n\n print('Exiting fixed-point iteration, convergence reached') \n return x ",
"_____no_output_____"
],
[
"def fn_f(x):\n val=np.exp(-x)+x/5.0-1\n return val",
"_____no_output_____"
],
[
"a = -25.0\nb = 30.0\nmaxeval = 100\nxthresh = 0.0001\niprint=1\nx = bisection(fn_f, a, b, xthresh, maxeval,iprint)\nprint('The solution is: ',x)",
"#iter a b x dx\n 1 -2.500000e+01 3.000000e+01 2.500000e+00 5.500000e+01 -4.179150e-01 5.000000e+00\n 2 2.500000e+00 3.000000e+01 1.625000e+01 2.750000e+01 2.250000e+00 5.000000e+00\n 3 2.500000e+00 1.625000e+01 9.375000e+00 1.375000e+01 8.750848e-01 2.250000e+00\n 4 2.500000e+00 9.375000e+00 5.937500e+00 6.875000e+00 1.901386e-01 8.750848e-01\n 5 2.500000e+00 5.937500e+00 4.218750e+00 3.437500e+00 -1.415330e-01 1.901386e-01\n 6 4.218750e+00 5.937500e+00 5.078125e+00 1.718750e+00 2.185658e-02 1.901386e-01\n 7 4.218750e+00 5.078125e+00 4.648438e+00 8.593750e-01 -6.073595e-02 2.185658e-02\n 8 4.648438e+00 5.078125e+00 4.863281e+00 4.296875e-01 -1.961866e-02 2.185658e-02\n 9 4.863281e+00 5.078125e+00 4.970703e+00 2.148438e-01 1.078893e-03 2.185658e-02\n 10 4.863281e+00 4.970703e+00 4.916992e+00 1.074219e-01 -9.280444e-03 1.078893e-03\n 11 4.916992e+00 4.970703e+00 4.943848e+00 5.371094e-02 -4.103346e-03 1.078893e-03\n 12 4.943848e+00 4.970703e+00 4.957275e+00 2.685547e-02 -1.512860e-03 1.078893e-03\n 13 4.957275e+00 4.970703e+00 4.963989e+00 1.342773e-02 -2.171413e-04 1.078893e-03\n 14 4.963989e+00 4.970703e+00 4.967346e+00 6.713867e-03 4.308366e-04 1.078893e-03\n 15 4.963989e+00 4.967346e+00 4.965668e+00 3.356934e-03 1.068378e-04 4.308366e-04\n 16 4.963989e+00 4.965668e+00 4.964828e+00 1.678467e-03 -5.515417e-05 1.068378e-04\n 17 4.964828e+00 4.965668e+00 4.965248e+00 8.392334e-04 2.584122e-05 1.068378e-04\nThe upper limit seems to be a root. Stopping program.\nExiting fixed-point iteration, convergence reached\nThe solution is: 4.965248107910156\n"
],
[
"def fn_f(x):\n val=(x-1)**2\n return val",
"_____no_output_____"
],
[
"a = -10\nb = 1\nmaxeval = 100\nxthresh = 0.0001\niprint=1\nx = bisection(fn_f, a, b, xthresh, maxeval,iprint)\nprint('The solution is: ',x)",
"#iter a b x dx\nThe upper limit seems to be a root. Stopping program.\nExiting fixed-point iteration, convergence reached\nThe solution is: 1\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
]
] |
d0ca7b3476ac4a099f4c141faa71c738bc083bc3 | 4,706 | ipynb | Jupyter Notebook | src/Linear Algebra/Lecture23.ipynb | JeraKrs/linear-algebra-notes | 31a2627d2187fd61f537c035ae84ff0e1bb794e5 | [
"Apache-2.0"
] | 4 | 2018-06-24T14:33:15.000Z | 2021-05-26T06:35:52.000Z | src/Linear Algebra/Lecture23.ipynb | JeraKrs/linear-algebra-notes | 31a2627d2187fd61f537c035ae84ff0e1bb794e5 | [
"Apache-2.0"
] | null | null | null | src/Linear Algebra/Lecture23.ipynb | JeraKrs/linear-algebra-notes | 31a2627d2187fd61f537c035ae84ff0e1bb794e5 | [
"Apache-2.0"
] | 1 | 2018-07-06T16:14:02.000Z | 2018-07-06T16:14:02.000Z | 52.288889 | 552 | 0.494263 | [
[
[
"# 第二十三讲 微分方程和$e^{At}$\n\n## 微分方程$\\frac{du}{dt} = Au$\n\n现有一阶(First-order)微分方程组:$\\left\\{\\begin{matrix} \\frac{du_1}{dt} & = & -u_1 & + 2u_2\\\\ \\frac{du_2}{dt} & = & u_1 & -2u_2 \\end{matrix}\\right.$,其中初始状态 $u(0) = \\begin{bmatrix}u_1 \\\\ u_2 \\end{bmatrix} = \\begin{bmatrix} 1 \\\\ 0 \\end{bmatrix}$,现在我们需要求解方程的一般形式 $u(t)$。\n\n首先,通过微分方程组可以得到系数矩阵 $A = \\begin{bmatrix} -1 & 2 \\\\ 1 & -2 \\end{bmatrix}$,并且该矩阵的特征值为 $\\left\\{\\begin{matrix} \\lambda_1 & = & 0\\\\ \\lambda_2 & = & -3 \\end{matrix}\\right.$,特征向量为 $\\left\\{\\begin{matrix} x_1 & = & \\begin{bmatrix} 2 \\\\ 1 \\end{bmatrix} \\\\ x_2 & = & \\begin{bmatrix} 1 \\\\ -1 \\end{bmatrix} \\end{matrix}\\right.$。此时,解可以写成 $u(t) = c_1 e^{\\lambda_1 t} x_1 + c_2 e^{\\lambda_2 t}x_2$,这里可以进行检验,取 $u = \\lambda_1 e^{\\lambda_1 t}x_1$,有 $\\frac{du}{dt} = \\lambda_1 e^{\\lambda_1 t}x_1 = A e^{\\lambda_1 t}x_1 = Au$。\n\n接下来,通过 $u(0)$ 解出 $c_1 = \\frac{1}{3}, c_2=\\frac{1}{3}$。于是最终的解形式为 $u(t) = \\frac{1}{3}\\begin{bmatrix}2 \\\\ 1\\end{bmatrix} + \\frac{1}{3}e^{-3t}\\begin{bmatrix}1 \\\\ -1\\end{bmatrix}$,并且方程有一个稳定的状态 $u(\\infty) = \\frac{1}{3}\\begin{bmatrix}2 \\\\ 1\\end{bmatrix}$,因为当 $t \\rightarrow \\infty$ 时,$e^{-3t} \\rightarrow 0$。\n\n这里引入方程趋势和特征向之间的关系:\n* 稳定态(Stability):方程的值最终会趋向于 $0$,即 $u(t) \\rightarrow 0$,这就要求 $e^{\\lambda t} \\rightarrow 0$,所以当所有的特征值的实数部分(虚数部分只是噪音)均小于 $0$ 时,方程具有稳定性。\n* 收敛态(Steady State):方程最终收敛于某个值,此时需要有一个特征值为 $0$,而剩余的特征值全小于 $0$。\n* 发散态(Blowup):如果存在一个特征值的实数部分大于零,那么函数不会收敛。\n\n小技巧:直接判断任意二阶矩阵的特征值是否均小于零。对于二阶矩阵 $A = \\begin{bmatrix} a & b \\\\ c & d \\end{bmatrix}$,特征值具有性质即 $\\lambda_1 + \\lambda_2 = a + d, \\lambda_1 * \\lambda_2 = detA = a * d - b * c$。如果特征向量均小于零,那么 $a + d < 0$ 且 $detA > 0$。\n\n总结:原方程组有两个相互耦合的未知函数,即 $u1,u2$ 相互耦合,而特征值和特征向量的作则就是解耦,也就是对角化。回到原方程 $\\frac{du}{dt} = Au$,如果将 $u$ 表示为特征向量的线性组合 $u=Sv$,那么有 $\\frac{du}{dt} = Au \\Rightarrow S\\frac{dv}{dt} = ASv \\Rightarrow \\frac{dv}{dt} = S^{-1}ASv = \\Lambda v$。此时新方程组线性无关 $\\left\\{\\begin{matrix} \\frac{dv_1}{dt} & = & \\lambda_1v1 \\\\ \\frac{dv_2}{dt} & = & \\lambda_2v_2 \\\\ & \\vdots & \\\\ \\frac{dv_n}{dt} & = & \\lambda_nv_n \\end{matrix}\\right.$,分向量的解形式为 $v(t) = e^{\\lambda t}v(0)$,而原方程的解形式为 $u(t)=Se^{\\Lambda t}S^{-1}u(0)$。",
"_____no_output_____"
],
[
"## 指数矩阵$e^{At}$\n\n指数矩阵(Exponential Matrix)为指数部分的矩阵,例如 $e^{At}$。上个部分中用到结论 $e^{At} = Se^{\\Lambda t}S^{-1}$,这里给出证明。\n\n根据泰勒级数 $e^x = \\sum ^{\\infty}_{0} \\frac{x^n}{n!}$ 将 $e^{At}$ 展开,得 $$e^{At} = I + At + \\frac{(At)^2}{2} + \\dots + \\frac{(At)^n}{n!}$$\n$$e^{At} = I + At + \\frac{A^2}{2}t^2 + \\dots + \\frac{A^n}{n!}t^n$$\n$$e^{At} = SS^{-1} + S\\Lambda S^{1}t + S\\frac{\\Lambda^2}{2}S^{-1}t^2 + \\dots + S\\frac{\\Lambda^n}{n!}S^{-1}t^n$$\n$$e^{At} = S(I + \\Lambda t + \\frac{\\Lambda^2}{2}t^2 + \\dots + \\frac{\\Lambda^n}{n!}t^n)S^{-1}$$\n$$e^{At} = Se^{\\Lambda t}S^{-1}$$\n\n拓展:\n* 几何级数:$\\frac{1}{1-x} = \\sum^{\\infty}_{0} x^n$\n* 第二个泰勒级数:$ (I - At)^{-1} = I + At + (At)^2 + \\dots (At)^n)$\n\n",
"_____no_output_____"
],
[
"## 高阶微分方程\n\n对于一个二阶(Second-order)微分方程 ${y}''+b{y}'+ky=0$,可以构造方程组 $\\left\\{\\begin{matrix}{y}'' & = & -b{y}' & -ky\\\\ {y}' & = & {y}' & \\end{matrix}\\right.$,写成矩阵形式有 $\\begin{bmatrix}{y}'' \\\\ {y}' \\end{bmatrix} = \\begin{bmatrix} -b & -k \\\\ 1 & 0 \\end{bmatrix}\\begin{bmatrix}{y}' \\\\ {y} \\end{bmatrix}$。\n\n拓展到五阶 ${y}'''''+b{y}''''+c{y}'''+d{y}''+ey′+fy=0$,矩阵形式有 $\\begin{bmatrix} {y}''''' \\\\ {y}'''' \\\\ {y}''' \\\\ {y}'' \\\\ {y}' \\end{bmatrix} = \\begin{bmatrix} -b & -c & -d & -e & -f \\\\ 1 & 0 & 0 & 0 & 0 \\\\ 0 & 1 & 0 & 0 & 0 \\\\ 0 & 0 & 1 & 0 & 0 \\\\ 0 & 0 & 0 & 1 & 0\\end{bmatrix}\\begin{bmatrix} {y}'''' \\\\ {y}''' \\\\ {y}'' \\\\ {y}' \\\\ y \\end{bmatrix}$。\n",
"_____no_output_____"
]
]
] | [
"markdown"
] | [
[
"markdown",
"markdown",
"markdown"
]
] |
d0ca85375c7861defb373e454c1231084f980c2a | 26,658 | ipynb | Jupyter Notebook | Predicting Costs Of Used Cars - MachineHack.ipynb | billumillu/Predicting-Costs-Of-Used-Cars | 14f55dd0c4582370a02202e3d165b150ab5a866d | [
"Apache-2.0"
] | null | null | null | Predicting Costs Of Used Cars - MachineHack.ipynb | billumillu/Predicting-Costs-Of-Used-Cars | 14f55dd0c4582370a02202e3d165b150ab5a866d | [
"Apache-2.0"
] | null | null | null | Predicting Costs Of Used Cars - MachineHack.ipynb | billumillu/Predicting-Costs-Of-Used-Cars | 14f55dd0c4582370a02202e3d165b150ab5a866d | [
"Apache-2.0"
] | null | null | null | 26,658 | 26,658 | 0.703166 | [
[
[
"Project No.: 3\n\nTime Taken: 3 days\n\nDifficulty: Intermediate.\n\n\nThis is the toughest dataset I've worked with. Learnt a lot. Still a long way to go...\n\nWould love it if you left a comment with advice on where I could have improved, what you liked/disliked about my work, or any thing else. And if you like it, please give it an upvote!",
"_____no_output_____"
]
],
[
[
"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nimport os\nprint(os.listdir(\"../input\"))\n\n# Any results you write to the current directory are saved as output.\n\n",
"_____no_output_____"
]
],
[
[
"# 1. The Problem\n\n**What is the problem?**\n\nTask(T): Predicting the cost of a used car in India.\n\nExperience(E): Data collected from various sources and distributed across various locations in India.\n\nPerformance(P): Mean Absolute Error\n\n**My plan of action:**\n\n* Clean the data (missing values and categorical variables).'.\n* Build the model and check the MAE.\n* Try to improve the model.\n\n\n* Brand matters too! I could select the brand name of the car and treat them as categorical data.\n* Filling the missing values in New_Price might help. I should get all the available values for each brand, get their avg, and fill that brand's missing values. For example, I could get all the available New_Price values for Honda, take their average and use that number for other Honda cars whose New_Price is missing.\n* Try converting Engine, Power and New_Price to numbers.\n* I'll try scaling in the end. Although, I don't think it has much effect on xgboost.",
"_____no_output_____"
]
],
[
[
"df_full = pd.read_excel(\"../input/Data_Train.xlsx\")\ndf_test = pd.read_excel(\"../input/Data_Test.xlsx\")\ndf_full.head(10)",
"_____no_output_____"
],
[
"df_full.shape",
"_____no_output_____"
]
],
[
[
"Mileage contains kmp/kg and kmpl, Engine contains CC, Power contains bhp and New_Price contains Lakh. By removing them I can convert them from 'object' to 'int'/'float'.",
"_____no_output_____"
]
],
[
[
"df_full.info()\ndf_full.isnull().sum()",
"_____no_output_____"
]
],
[
[
"# 2. Data Preparation\n\n",
"_____no_output_____"
],
[
"Let's first modify the 'Name' of the car and extract just the brand name.",
"_____no_output_____"
]
],
[
[
"df_full['Name'] = df_full.Name.str.split().str.get(0)\ndf_test['Name'] = df_test.Name.str.split().str.get(0)\ndf_full.head()",
"_____no_output_____"
],
[
"df_full['Name'].value_counts().sum()",
"_____no_output_____"
]
],
[
[
"df_full.shape = (6019,13). So I guess all rows have been modified.",
"_____no_output_____"
],
[
"Now I gotta modify 'Mileage', 'Power', 'Engine' and 'New_Price'. But first, I have to deal with missing values.",
"_____no_output_____"
],
[
"# 2.1 Missing Values",
"_____no_output_____"
]
],
[
[
"# Get names of columns with missing values\ncols_with_missing = [col for col in df_full.columns\n if df_full[col].isnull().any()]\nprint(\"Columns with missing values:\")\nprint(cols_with_missing)",
"_____no_output_____"
],
[
"# Let's deal with them one by one.\n\ndf_full['Seats'].fillna(df_full['Seats'].mean(),inplace=True)\ndf_test['Seats'].fillna(df_test['Seats'].mean(),inplace=True)",
"_____no_output_____"
]
],
[
[
"NOTE: To get more accurate values, we need more data. So I'll combine df_train and df_test data.",
"_____no_output_____"
]
],
[
[
"data = pd.concat([df_full,df_test], sort=False)",
"_____no_output_____"
],
[
"import matplotlib.pyplot as plt\n\nplt.figure(figsize=(20,5))\ndata['Mileage'].value_counts().head(100).plot.bar()\nplt.show()",
"_____no_output_____"
],
[
"df_full['Mileage'] = df_full['Mileage'].fillna('17.0 kmpl')\ndf_test['Mileage'] = df_test['Mileage'].fillna('17.0 kmpl')\n\n#I noticed the 14th entry (and others) have 0.0 kmpl. Let's replace that too.\n\ndf_full['Mileage'] = df_full['Mileage'].replace(\"0.0 kmpl\", \"17.0 kmpl\")\ndf_test['Mileage'] = df_test['Mileage'].replace(\"0.0 kmpl\", \"17.0 kmpl\")",
"_____no_output_____"
],
[
"plt.figure(figsize=(20,5))\ndata['Engine'].value_counts().head(100).plot.bar()\nplt.show()",
"_____no_output_____"
],
[
"df_full['Engine'] = df_full['Engine'].fillna('1197 CC')\ndf_test['Engine'] = df_test['Engine'].fillna('1197 CC')",
"_____no_output_____"
],
[
"plt.figure(figsize=(20,5))\ndata['Power'].value_counts().head(100).plot.bar()\nplt.show()",
"_____no_output_____"
],
[
"df_full['Power'] = df_full['Power'].fillna('74 bhp')\ndf_test['Power'] = df_test['Power'].fillna('74 bhp')\n\n#I noticed the 76th entry (and others) have null bhp. Let's replace that too. \n#This was creating problems during LabelEncoding.\n\ndf_full['Power'] = df_full['Power'].replace(\"null bhp\", \"74 bhp\")\ndf_test['Power'] = df_test['Power'].replace(\"null bhp\", \"74 bhp\")",
"_____no_output_____"
]
],
[
[
"Now let's deal with 'New_Price'.",
"_____no_output_____"
],
[
"**Appoach 1:** Fill the missing values with the value which occurs the most.",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(20,5))\ndata['New_Price'].value_counts().head(100).plot.bar()\nplt.show()",
"_____no_output_____"
],
[
"# # I'll select 4.78 cuz the others are way too high.\n\n# df_full['New_Price'] = df_full['New_Price'].fillna('4.78 Lakh')\n# df_test['New_Price'] = df_test['New_Price'].fillna('4.78 Lakh')\n\n# # Run the method get_number() defined below first.\n# # Converting it to float.\n\n# df_full['New_Price'] = df_full['New_Price'].apply(get_number).astype('float')\n# df_test['New_Price'] = df_test['New_Price'].apply(get_number).astype('float')",
"_____no_output_____"
]
],
[
[
"**Approach 2:** Group by Brand names and get the mean of the available values for 'New_Price'. Use these to fill the missing values for the respective brands.\n\nFirst of all I'll have to convert it into numeric data (or else mean() won't work). For that, I'll have to first deal with missing values. So! Here's what we're gonna do:\n\nFirst fill it with 0.0 Lakh, convert the column into float, group and mean, then finally replace all 0.0 values with their respective values. Capiche?\n\n**NOTE: TURNS OUT THIS WAS A COMPLETE AND UTTER WASTE OF MY TIME AND EFFORT. </3**",
"_____no_output_____"
]
],
[
[
"# Method to extract 'float' from 'object' \n\nimport re\n\ndef get_number(name):\n title_search = re.search('([\\d+\\.+\\d]+\\W)', name)\n \n if title_search:\n return title_search.group(1)\n return \"\"",
"_____no_output_____"
]
],
[
[
"I got the code for the above step from [here](https://www.kaggle.com/funxexcel/titanic-basic-solution-with-logistic-regression) and modified it.",
"_____no_output_____"
]
],
[
[
"data['New_Price'] = data['New_Price'].fillna('0.0 Lakh') # dealt with missing values.\n\ndata['New_Price'] = data['New_Price'].apply(get_number).astype('float') #converted to float\n\ntotal = data['New_Price'].groupby(data['Name'])\nprint(total.mean().round(2))",
"_____no_output_____"
]
],
[
[
"We got avg 'New_Price' values for more than half the brands. There are still 6 Brands whose values are not given. For that, another plan!\n\nFirst of all, deal with the brands that we have values for. After that, use a bar chart to get the value of the most occurring 'New_Price' value. Use that to fill the rest of them.",
"_____no_output_____"
]
],
[
[
"df_full['New_Price'] = df_full['New_Price'].fillna('0.0 Lakh') # dealt with missing values.\ndf_full['New_Price'] = df_full['New_Price'].apply(get_number).astype('float') #converted to float",
"_____no_output_____"
],
[
"df_full.loc[df_full['Name']==\"Audi\", 'New_Price'] = df_full.loc[df_full['Name']==\"Audi\", 'New_Price'].replace(0.0,5.02)\ndf_full.loc[df_full['Name']==\"BMW\", 'New_Price'] = df_full.loc[df_full['Name']==\"BMW\", 'New_Price'].replace(0.0,11.14)\ndf_full.loc[df_full['Name']==\"Bentley\", 'New_Price'] = df_full.loc[df_full['Name']==\"Bentley\", 'New_Price'].replace(0.0,1.88)\ndf_full.loc[df_full['Name']==\"Datsun\", 'New_Price'] = df_full.loc[df_full['Name']==\"Datsun\", 'New_Price'].replace(0.0,3.14)\ndf_full.loc[df_full['Name']==\"Fiat\", 'New_Price'] = df_full.loc[df_full['Name']==\"Fiat\", 'New_Price'].replace(0.0,0.95)\n\ndf_full.loc[df_full['Name']==\"Ford\", 'New_Price'] = df_full.loc[df_full['Name']==\"Ford\", 'New_Price'].replace(0.0,1.16)\ndf_full.loc[df_full['Name']==\"Honda\", 'New_Price'] = df_full.loc[df_full['Name']==\"Honda\", 'New_Price'].replace(0.0,1.30)\ndf_full.loc[df_full['Name']==\"Hyundai\", 'New_Price'] = df_full.loc[df_full['Name']==\"Hyundai\", 'New_Price'].replace(0.0,1.03)\ndf_full.loc[df_full['Name']==\"Isuzu\", 'New_Price'] = df_full.loc[df_full['Name']==\"Isuzu\", 'New_Price'].replace(0.0,16.84)\ndf_full.loc[df_full['Name']==\"ISUZU\", 'New_Price'] = df_full.loc[df_full['Name']==\"ISUZU\", 'New_Price'].replace(0.0,16.84)\n\ndf_full.loc[df_full['Name']==\"Jaguar\", 'New_Price'] = df_full.loc[df_full['Name']==\"Jaguar\", 'New_Price'].replace(0.0,8.52)\ndf_full.loc[df_full['Name']==\"Jeep\", 'New_Price'] = df_full.loc[df_full['Name']==\"Jeep\", 'New_Price'].replace(0.0,22.75)\ndf_full.loc[df_full['Name']==\"Land\", 'New_Price'] = df_full.loc[df_full['Name']==\"Land\", 'New_Price'].replace(0.0,4.39)\ndf_full.loc[df_full['Name']==\"Mahindra\", 'New_Price'] = df_full.loc[df_full['Name']==\"Mahindra\", 'New_Price'].replace(0.0,1.20)\ndf_full.loc[df_full['Name']==\"Maruti\", 'New_Price'] = df_full.loc[df_full['Name']==\"Maruti\", 'New_Price'].replace(0.0,1.29)\n\ndf_full.loc[df_full['Name']==\"Mercedes-Benz\", 'New_Price'] = df_full.loc[df_full['Name']==\"Mercedes-Benz\", 'New_Price'].replace(0.0,7.97)\ndf_full.loc[df_full['Name']==\"Mini\", 'New_Price'] = df_full.loc[df_full['Name']==\"Mini\", 'New_Price'].replace(0.0,25.06)\ndf_full.loc[df_full['Name']==\"Mitsubishi\", 'New_Price'] = df_full.loc[df_full['Name']==\"Mitsubishi\", 'New_Price'].replace(0.0,12.03)\ndf_full.loc[df_full['Name']==\"Nissan\", 'New_Price'] = df_full.loc[df_full['Name']==\"Nissan\", 'New_Price'].replace(0.0,1.89)\ndf_full.loc[df_full['Name']==\"Porsche\", 'New_Price'] = df_full.loc[df_full['Name']==\"Porsche\", 'New_Price'].replace(0.0,0.07)\n\ndf_full.loc[df_full['Name']==\"Renault\", 'New_Price'] = df_full.loc[df_full['Name']==\"Renault\", 'New_Price'].replace(0.0,1.49)\ndf_full.loc[df_full['Name']==\"Skoda\", 'New_Price'] = df_full.loc[df_full['Name']==\"Skoda\", 'New_Price'].replace(0.0,3.63)\ndf_full.loc[df_full['Name']==\"Tata\", 'New_Price'] = df_full.loc[df_full['Name']==\"Tata\", 'New_Price'].replace(0.0,2.00)\ndf_full.loc[df_full['Name']==\"Toyota\", 'New_Price'] = df_full.loc[df_full['Name']==\"Toyota\", 'New_Price'].replace(0.0,4.38)\ndf_full.loc[df_full['Name']==\"Volksvagen\", 'New_Price'] = df_full.loc[df_full['Name']==\"Volksvagen\", 'New_Price'].replace(0.0,1.53)\ndf_full.loc[df_full['Name']==\"Volvo\", 'New_Price'] = df_full.loc[df_full['Name']==\"Volvo\", 'New_Price'].replace(0.0,4.62)",
"_____no_output_____"
],
[
"df_test['New_Price'] = df_test['New_Price'].fillna('0.0 Lakh') # dealt with missing values.\ndf_test['New_Price'] = df_test['New_Price'].apply(get_number).astype('float') #converted to float",
"_____no_output_____"
],
[
"# Modify df_test too...\n\ndf_test.loc[df_full['Name']==\"Audi\", 'New_Price'] = df_test.loc[df_test['Name']==\"Audi\", 'New_Price'].replace(0.0,5.02)\ndf_test.loc[df_full['Name']==\"BMW\", 'New_Price'] = df_test.loc[df_test['Name']==\"BMW\", 'New_Price'].replace(0.0,11.14)\ndf_test.loc[df_full['Name']==\"Bentley\", 'New_Price'] = df_test.loc[df_test['Name']==\"Bentley\", 'New_Price'].replace(0.0,1.88)\ndf_test.loc[df_full['Name']==\"Datsun\", 'New_Price'] = df_test.loc[df_test['Name']==\"Datsun\", 'New_Price'].replace(0.0,3.14)\ndf_test.loc[df_full['Name']==\"Fiat\", 'New_Price'] = df_test.loc[df_test['Name']==\"Fiat\", 'New_Price'].replace(0.0,0.95)\n\ndf_test.loc[df_full['Name']==\"Ford\", 'New_Price'] = df_test.loc[df_test['Name']==\"Ford\", 'New_Price'].replace(0.0,1.16)\ndf_test.loc[df_full['Name']==\"Honda\", 'New_Price'] = df_test.loc[df_test['Name']==\"Honda\", 'New_Price'].replace(0.0,1.30)\ndf_test.loc[df_full['Name']==\"Hyundai\", 'New_Price'] = df_test.loc[df_test['Name']==\"Hyundai\", 'New_Price'].replace(0.0,1.03)\ndf_test.loc[df_full['Name']==\"Isuzu\", 'New_Price'] = df_test.loc[df_test['Name']==\"Isuzu\", 'New_Price'].replace(0.0,16.84)\ndf_test.loc[df_full['Name']==\"ISUZU\", 'New_Price'] = df_test.loc[df_test['Name']==\"ISUZU\", 'New_Price'].replace(0.0,16.84)\n\ndf_test.loc[df_full['Name']==\"Jaguar\", 'New_Price'] = df_test.loc[df_test['Name']==\"Jaguar\", 'New_Price'].replace(0.0,8.52)\ndf_test.loc[df_full['Name']==\"Jeep\", 'New_Price'] = df_test.loc[df_test['Name']==\"Jeep\", 'New_Price'].replace(0.0,22.75)\ndf_test.loc[df_full['Name']==\"Land\", 'New_Price'] = df_test.loc[df_test['Name']==\"Land\", 'New_Price'].replace(0.0,4.39)\ndf_test.loc[df_full['Name']==\"Mahindra\", 'New_Price'] = df_test.loc[df_test['Name']==\"Mahindra\", 'New_Price'].replace(0.0,1.20)\ndf_test.loc[df_full['Name']==\"Maruti\", 'New_Price'] = df_test.loc[df_test['Name']==\"Maruti\", 'New_Price'].replace(0.0,1.29)\n\ndf_test.loc[df_full['Name']==\"Mercedes-Benz\", 'New_Price'] = df_test.loc[df_test['Name']==\"Mercedes-Benz\", 'New_Price'].replace(0.0,7.97)\ndf_test.loc[df_full['Name']==\"Mini\", 'New_Price'] = df_test.loc[df_test['Name']==\"Mini\", 'New_Price'].replace(0.0,25.06)\ndf_test.loc[df_full['Name']==\"Mitsubishi\", 'New_Price'] = df_test.loc[df_test['Name']==\"Mitsubishi\", 'New_Price'].replace(0.0,12.03)\ndf_test.loc[df_full['Name']==\"Nissan\", 'New_Price'] = df_test.loc[df_test['Name']==\"Nissan\", 'New_Price'].replace(0.0,1.89)\ndf_test.loc[df_full['Name']==\"Porsche\", 'New_Price'] = df_test.loc[df_test['Name']==\"Porsche\", 'New_Price'].replace(0.0,0.07)\n\ndf_test.loc[df_full['Name']==\"Renault\", 'New_Price'] = df_test.loc[df_test['Name']==\"Renault\", 'New_Price'].replace(0.0,1.49)\ndf_test.loc[df_full['Name']==\"Skoda\", 'New_Price'] = df_test.loc[df_test['Name']==\"Skoda\", 'New_Price'].replace(0.0,3.63)\ndf_test.loc[df_full['Name']==\"Tata\", 'New_Price'] = df_test.loc[df_test['Name']==\"Tata\", 'New_Price'].replace(0.0,2.00)\ndf_test.loc[df_full['Name']==\"Toyota\", 'New_Price'] = df_test.loc[df_test['Name']==\"Toyota\", 'New_Price'].replace(0.0,4.38)\ndf_test.loc[df_full['Name']==\"Volksvagen\", 'New_Price'] = df_test.loc[df_test['Name']==\"Volksvagen\", 'New_Price'].replace(0.0,1.53)\ndf_test.loc[df_full['Name']==\"Volvo\", 'New_Price'] = df_test.loc[df_test['Name']==\"Volvo\", 'New_Price'].replace(0.0,4.62)",
"_____no_output_____"
]
],
[
[
"I must have filled most of the missing values. Now let's use a bar chart to get the most occurring values and fill the rest of them.",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(20,5))\ndf_full['New_Price'].value_counts().head(100).plot.bar()\nplt.show()\n\nplt.figure(figsize=(20,5))\ndf_test['New_Price'].value_counts().head(100).plot.bar()\nplt.show()",
"_____no_output_____"
],
[
"df_full.loc[df_full['Name']==\"Ambassador\", 'New_Price'] = df_full.loc[df_full['Name']==\"Ambassador\", 'New_Price'].replace(0.0,1.29)\ndf_full.loc[df_full['Name']==\"Chevrolet\", 'New_Price'] = df_full.loc[df_full['Name']==\"Chevrolet\", 'New_Price'].replace(0.0,1.29)\ndf_full.loc[df_full['Name']==\"Force\", 'New_Price'] = df_full.loc[df_full['Name']==\"Force\", 'New_Price'].replace(0.0,1.29)\ndf_full.loc[df_full['Name']==\"Lamborghini\", 'New_Price'] = df_full.loc[df_full['Name']==\"Lamborghini\", 'New_Price'].replace(0.0,1.29)\ndf_full.loc[df_full['Name']==\"OpelCorsa\", 'New_Price'] = df_full.loc[df_full['Name']==\"OpelCorsa\", 'New_Price'].replace(0.0,1.29)\n\ndf_test.loc[df_full['Name']==\"Ambassador\", 'New_Price'] = df_test.loc[df_test['Name']==\"Ambassador\", 'New_Price'].replace(0.0,1.29)\ndf_test.loc[df_full['Name']==\"Chevrolet\", 'New_Price'] = df_test.loc[df_test['Name']==\"Chevrolet\", 'New_Price'].replace(0.0,1.29)\ndf_test.loc[df_full['Name']==\"Force\", 'New_Price'] = df_test.loc[df_test['Name']==\"Force\", 'New_Price'].replace(0.0,1.29)\ndf_test.loc[df_full['Name']==\"Lamborghini\", 'New_Price'] = df_test.loc[df_test['Name']==\"Lamborghini\", 'New_Price'].replace(0.0,1.29)\ndf_test.loc[df_full['Name']==\"OpelCorsa\", 'New_Price'] = df_test.loc[df_test['Name']==\"OpelCorsa\", 'New_Price'].replace(0.0,1.29)",
"_____no_output_____"
],
[
"df_full.isnull().sum()",
"_____no_output_____"
],
[
"df_full.head(10)",
"_____no_output_____"
],
[
"df_full.info()",
"_____no_output_____"
]
],
[
[
"Now let's convert 'Mileage', 'Engine' and 'Power' into numbers.",
"_____no_output_____"
]
],
[
[
"#Using the above defined method get_number()\n\ndf_full['Mileage'] = df_full['Mileage'].apply(get_number).astype('float')\ndf_full['Engine'] = df_full['Engine'].apply(get_number).astype('int')\ndf_full['Power'] = df_full['Power'].apply(get_number).astype('float')\n\ndf_test['Mileage'] = df_test['Mileage'].apply(get_number).astype('float')\ndf_test['Engine'] = df_test['Engine'].apply(get_number).astype('int')\ndf_test['Power'] = df_test['Power'].apply(get_number).astype('float')\n\ndf_full.info()",
"_____no_output_____"
],
[
"help(re) # This baby was realy helpful!",
"_____no_output_____"
],
[
"df_test.info()",
"_____no_output_____"
],
[
"df_full.head()",
"_____no_output_____"
]
],
[
[
"Looks good!!",
"_____no_output_____"
],
[
"# 2.2 Categorical Variables",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import train_test_split\n\ny = df_full.Price\nX = df_full.drop(['Price'],axis=1)\n# df_test = df_test.drop('New_Price',axis=1)\n\nX_train, X_valid, y_train, y_valid = train_test_split(X,y,train_size=0.82,test_size=0.18,random_state=0)",
"_____no_output_____"
],
[
"from sklearn.preprocessing import LabelEncoder\n\nlabel_encoder = LabelEncoder()\n\n# X_train[object_cols] = label_encoder.fit_transform(X_train[object_cols])\n# X_valid[object_cols] = label_encoder.transform(X_valid[object_cols])\n# df_test[object_cols] = label_encoder.fit_transform(df_test[object_cols])\n\n# ValueError: bad input shape (4815, 5)\n# That's why I did it manually.\n\nX_train['Name'] = label_encoder.fit_transform(X_train['Name'])\nX_valid['Name'] = label_encoder.transform(X_valid['Name'])\ndf_test['Name'] = label_encoder.fit_transform(df_test['Name'])\n\nX_train['Location'] = label_encoder.fit_transform(X_train['Location'])\nX_valid['Location'] = label_encoder.transform(X_valid['Location'])\ndf_test['Location'] = label_encoder.fit_transform(df_test['Location'])\n\nX_train['Fuel_Type'] = label_encoder.fit_transform(X_train['Fuel_Type'])\nX_valid['Fuel_Type'] = label_encoder.transform(X_valid['Fuel_Type'])\ndf_test['Fuel_Type'] = label_encoder.fit_transform(df_test['Fuel_Type'])\n\nX_train['Transmission'] = label_encoder.fit_transform(X_train['Transmission'])\nX_valid['Transmission'] = label_encoder.transform(X_valid['Transmission'])\ndf_test['Transmission'] = label_encoder.fit_transform(df_test['Transmission'])\n\nX_train['Owner_Type'] = label_encoder.fit_transform(X_train['Owner_Type'])\nX_valid['Owner_Type'] = label_encoder.transform(X_valid['Owner_Type'])\ndf_test['Owner_Type'] = label_encoder.fit_transform(df_test['Owner_Type'])\n",
"_____no_output_____"
],
[
"X_train.head()",
"_____no_output_____"
],
[
"X_train.info()",
"_____no_output_____"
]
],
[
[
"Ah finally!! After 3 days!",
"_____no_output_____"
],
[
"Quickly tried scaling too. Not a cool move.",
"_____no_output_____"
]
],
[
[
"# # Let's try scaling too.\n\n# from sklearn.preprocessing import StandardScaler\n# scaler = StandardScaler().fit(X_train)\n# rescaled_X_train = scaler.transform(X_train)\n\n# scaler = StandardScaler().fit(X_valid)\n# rescaled_X_valid = scaler.transform(X_valid)\n\n# scaler = StandardScaler().fit(df_test)\n# rescaled_df_test = scaler.transform(df_test)\n\n# from xgboost import XGBRegressor\n# from sklearn.metrics import mean_absolute_error,mean_squared_error,mean_squared_log_error\n\n# my_model = XGBRegressor(n_estimators=1000, learning_rate=0.05)\n# my_model.fit(rescaled_X_train, y_train, \n# early_stopping_rounds=5, \n# eval_set=[(rescaled_X_valid, y_valid)], \n# verbose=False)\n\n# predictions = my_model.predict(rescaled_X_valid)\n# print(\"MAE: \" + str(mean_absolute_error(predictions, y_valid)))\n# print(\"MSE: \" + str(mean_squared_error(predictions, y_valid)))\n# print(\"MSLE: \" + str(mean_squared_log_error(predictions, y_valid)))\n\n# # MAE: 2.115451765105513\n# # MSE: 17.56415019000094\n# # MSLE: 0.058881434868999126",
"_____no_output_____"
]
],
[
[
"# 3. Model\n\nI will use XGBRegressor to build the model and MAE to check the performance. I will also check out mean_squared_error and mean_squared_log_error.",
"_____no_output_____"
]
],
[
[
"from xgboost import XGBRegressor\nfrom sklearn.metrics import mean_absolute_error,mean_squared_error,mean_squared_log_error\n\nmy_model = XGBRegressor(n_estimators=1000, learning_rate=0.05)\nmy_model.fit(X_train, y_train, \n early_stopping_rounds=5, \n eval_set=[(X_valid, y_valid)], \n verbose=False)\n\npredictions = my_model.predict(X_valid)\nprint(\"MAE: \" + str(mean_absolute_error(predictions, y_valid)))\nprint(\"MSE: \" + str(mean_squared_error(predictions, y_valid)))\nprint(\"MSLE: \" + str(mean_squared_log_error(predictions, y_valid)))",
"_____no_output_____"
]
],
[
[
"# 4. Predictions",
"_____no_output_____"
]
],
[
[
"preds_test = my_model.predict(df_test)\nprint(preds_test)\n\n# The Price is in the format xx.xx So let's round off and submit.\n\npreds_test = preds_test.round(2)\nprint(preds_test)",
"_____no_output_____"
],
[
"output = pd.DataFrame({'Price': preds_test})\noutput.to_excel('submission.xlsx', index=False)",
"_____no_output_____"
]
],
[
[
"# Notes\n\n* Treating 'Mileage' and the others as categorical variables was a mistake. Eg.: Mileage went up from 23.6 to around 338! Converting it to numbers fixed it.\n\n* LabelEncoder won't work if there are missing values.\n\n* ValueError: y contains previously unseen label 'Bentley'. Fixed it by increasing training_size in train_test_split.\n\n* Scaling all the columns made the model worse (as expected).\n\n* With 'New_Price' (33.36L) -\n\nMAE: 1.841521016220765\n\nMSE: 14.468386600963221\n\nMSLE: 0.05295155300850892\n\n* With 'New_Price' (4.78L) -\n\nMAE: 1.9925125514537205\n\nMSE: 15.974590365346188\n\nMSLE: 0.0599331113483451\n\n\n* Without 'New_Price' - \n\nMAE: 1.7999142406259514\n\nMSE: 12.915820113678437\n\nMSLE: 0.05128357937155652\n\n* After manually modifying 'New_Price'\n\nMAE: 1.8252445468636458 Higher! Ugh!\n\nMSE: 13.293730579850678\n\nMSLE: 0.048714052000441106 This is less though...\n",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0ca886a12eca75e6dbb899353c7475e30d0503e | 23,213 | ipynb | Jupyter Notebook | Know_what_you_want.ipynb | plvigarg/know-what-traits-you-want | c448e643ffa8d7979e46cb773bdbd730ad23da0b | [
"MIT"
] | null | null | null | Know_what_you_want.ipynb | plvigarg/know-what-traits-you-want | c448e643ffa8d7979e46cb773bdbd730ad23da0b | [
"MIT"
] | null | null | null | Know_what_you_want.ipynb | plvigarg/know-what-traits-you-want | c448e643ffa8d7979e46cb773bdbd730ad23da0b | [
"MIT"
] | null | null | null | 34.036657 | 632 | 0.31142 | [
[
[
"import pandas as pd\nfrom bs4 import BeautifulSoup as soup\nfrom urllib.request import urlopen\nimport numpy as np\nimport math",
"_____no_output_____"
],
[
"links = ['https://openpsychometrics.org/tests/characters/stats/FF/1/','https://openpsychometrics.org/tests/characters/stats/SL/1/','https://openpsychometrics.org/tests/characters/stats/MCU/1/','https://openpsychometrics.org/tests/characters/stats/B99/1/','https://openpsychometrics.org/tests/characters/stats/PC/1/','https://openpsychometrics.org/tests/characters/stats/GOT/5/','https://openpsychometrics.org/tests/characters/stats/GOT/2/','https://openpsychometrics.org/tests/characters/stats/F/5/','https://openpsychometrics.org/tests/characters/stats/VD/2/','https://openpsychometrics.org/tests/characters/stats/FF/2/']",
"_____no_output_____"
],
[
"col_headers = []\ndata = urlopen(links[0])\ndata_html = data.read()\ndata.close()\ndata_soup = soup(data_html, 'html.parser')\nheaders = data_soup.findAll('th')\ncol_headers = [ch.text for ch in headers]\nrows_data = data_soup.findAll('tr')",
"_____no_output_____"
],
[
"col_headers = col_headers[:2]\ncol_headers = ['Trait', 'rating']",
"_____no_output_____"
],
[
"table_rows = []\nfor link in links:\n data = urlopen(link)\n data_html = data.read()\n data.close()\n data_soup = soup(data_html, 'html.parser')\n rows_data = data_soup.findAll('tr')\n for row in rows_data:\n current_row = []\n row_data = row.findAll('td')\n for data in row_data:\n current_row.append(data.text)\n table_rows.append(current_row[:2])\n ",
"_____no_output_____"
],
[
"df = pd.DataFrame(table_rows, columns=col_headers)",
"_____no_output_____"
],
[
"df.rating = df.rating.apply(pd.to_numeric, errors='coerce')",
"_____no_output_____"
],
[
"df = df.dropna()",
"_____no_output_____"
],
[
"df = df.reset_index(drop=True)\ndf",
"_____no_output_____"
],
[
"df = df[df['rating']>=85]\ndf = df.reset_index(drop = True)\ndf",
"_____no_output_____"
],
[
"df['freq']=df.groupby(by='Trait')['Trait'].transform('count')\ndf = df.sort_values(by =['freq','rating'], ascending = (0,0))\ndf.drop_duplicates(subset =\"Trait\",keep ='first', inplace = True)\n\ndf = df.reset_index(drop=True)\ndf",
"_____no_output_____"
],
[
"want = df.iloc[:10,:]\nwant",
"_____no_output_____"
],
[
"",
"_____no_output_____"
],
[
"",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0ca93c65fdef18223cec279a7e4cd7a7c548944 | 67,282 | ipynb | Jupyter Notebook | fine_tuning/NER_Finetuning.ipynb | okanvk/Medical-Field-Specific-Electra-Model | a91f4ce784be4a52522bf1b1158f4bd4838a961b | [
"MIT"
] | 26 | 2020-11-13T14:55:59.000Z | 2022-01-27T17:30:30.000Z | fine_tuning/NER_Finetuning.ipynb | okanvk/Medical-Field-Specific-Electra-Model | a91f4ce784be4a52522bf1b1158f4bd4838a961b | [
"MIT"
] | null | null | null | fine_tuning/NER_Finetuning.ipynb | okanvk/Medical-Field-Specific-Electra-Model | a91f4ce784be4a52522bf1b1158f4bd4838a961b | [
"MIT"
] | 10 | 2020-11-02T19:18:48.000Z | 2021-05-23T22:02:32.000Z | 54.656377 | 1,177 | 0.63809 | [
[
[
"!git clone https://github.com/huggingface/transformers.git",
"fatal: destination path 'transformers' already exists and is not an empty directory.\r\n"
],
[
"%cd transformers",
"/home/ociftci/Untitled Folder/transformers\n"
],
[
"!pwd",
"/home/ociftci/Untitled Folder/transformers\r\n"
],
[
"!git reset --hard 52f44dd",
"HEAD is now at 52f44dd6 change TokenClassificationTask class methods to static methods (#7902)\r\n"
],
[
"!cp ./examples/token-classification/run_ner.py ../",
"_____no_output_____"
],
[
"%cd ..",
"/home/ociftci/Untitled Folder\n"
],
[
"#!wget https://raw.githubusercontent.com/huggingface/transformers/master/examples/token-classification/run_ner.py\n!wget https://raw.githubusercontent.com/huggingface/transformers/master/examples/token-classification/utils_ner.py\n!wget https://raw.githubusercontent.com/huggingface/transformers/master/examples/token-classification/tasks.py\n\n!git clone https://github.com/huggingface/transformers\n%cd transformers\n!pip install .\n!pip install -r ./examples/requirements.txt\n%cd ..",
"--2020-11-13 11:54:01-- https://raw.githubusercontent.com/huggingface/transformers/master/examples/token-classification/utils_ner.py\nResolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.240.133\nConnecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.240.133|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 15657 (15K) [text/plain]\nSaving to: ‘utils_ner.py.3’\n\nutils_ner.py.3 100%[===================>] 15,29K --.-KB/s in 0,001s \n\n2020-11-13 11:54:01 (20,1 MB/s) - ‘utils_ner.py.3’ saved [15657/15657]\n\n--2020-11-13 11:54:01-- https://raw.githubusercontent.com/huggingface/transformers/master/examples/token-classification/tasks.py\nResolving raw.githubusercontent.com (raw.githubusercontent.com)... 151.101.240.133\nConnecting to raw.githubusercontent.com (raw.githubusercontent.com)|151.101.240.133|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 5509 (5,4K) [text/plain]\nSaving to: ‘tasks.py.3’\n\ntasks.py.3 100%[===================>] 5,38K --.-KB/s in 0s \n\n2020-11-13 11:54:01 (33,0 MB/s) - ‘tasks.py.3’ saved [5509/5509]\n\nfatal: destination path 'transformers' already exists and is not an empty directory.\n/home/ociftci/Untitled Folder/transformers\nProcessing /home/ociftci/Untitled Folder/transformers\n Installing build dependencies ... \u001b[?25ldone\n\u001b[?25h Getting requirements to build wheel ... \u001b[?25ldone\n\u001b[?25h Preparing wheel metadata ... \u001b[?25ldone\n\u001b[?25hRequirement already satisfied: numpy in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (1.19.4)\nRequirement already satisfied: sentencepiece==0.1.91 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (0.1.91)\nRequirement already satisfied: tokenizers==0.9.2 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (0.9.2)\nRequirement already satisfied: regex!=2019.12.17 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (2020.11.11)\nRequirement already satisfied: protobuf in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (3.13.0)\nRequirement already satisfied: requests in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (2.25.0)\nRequirement already satisfied: tqdm>=4.27 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (4.51.0)\nRequirement already satisfied: dataclasses; python_version < \"3.7\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (0.7)\nRequirement already satisfied: filelock in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (3.0.12)\nRequirement already satisfied: packaging in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (20.4)\nRequirement already satisfied: sacremoses in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from transformers==3.4.0) (0.0.43)\nRequirement already satisfied: six>=1.9 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from protobuf->transformers==3.4.0) (1.15.0)\nRequirement already satisfied: setuptools in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from protobuf->transformers==3.4.0) (50.3.1.post20201107)\nRequirement already satisfied: urllib3<1.27,>=1.21.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from requests->transformers==3.4.0) (1.25.11)\nRequirement already satisfied: idna<3,>=2.5 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from requests->transformers==3.4.0) (2.10)\nRequirement already satisfied: certifi>=2017.4.17 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from requests->transformers==3.4.0) (2020.11.8)\nRequirement already satisfied: chardet<4,>=3.0.2 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from requests->transformers==3.4.0) (3.0.4)\nRequirement already satisfied: pyparsing>=2.0.2 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from packaging->transformers==3.4.0) (2.4.7)\nRequirement already satisfied: joblib in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from sacremoses->transformers==3.4.0) (0.17.0)\nRequirement already satisfied: click in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from sacremoses->transformers==3.4.0) (7.1.2)\nBuilding wheels for collected packages: transformers\n Building wheel for transformers (PEP 517) ... \u001b[?25ldone\n\u001b[?25h Created wheel for transformers: filename=transformers-3.4.0-py3-none-any.whl size=1293574 sha256=e865e6763cefa9f1f286d2f79378bd8aefee0eda20f71b6df0737f1a232ed0d9\n Stored in directory: /tmp/pip-ephem-wheel-cache-3imfab10/wheels/a0/07/9c/9e03b1038c15284ad824ae7fe624bb042b18d888f95ac4b12a\nSuccessfully built transformers\nInstalling collected packages: transformers\n Attempting uninstall: transformers\n Found existing installation: transformers 3.4.0\n Uninstalling transformers-3.4.0:\n Successfully uninstalled transformers-3.4.0\nSuccessfully installed transformers-3.4.0\nRequirement already satisfied: tensorboard in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 1)) (2.4.0)\nRequirement already satisfied: scikit-learn in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 2)) (0.23.2)\nRequirement already satisfied: seqeval in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 3)) (1.2.2)\nRequirement already satisfied: psutil in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 4)) (5.7.3)\nRequirement already satisfied: sacrebleu in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 5)) (1.4.14)\nRequirement already satisfied: rouge-score in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 6)) (0.0.4)\nRequirement already satisfied: tensorflow_datasets in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 7)) (4.1.0)\nRequirement already satisfied: pytorch-lightning==1.0.4 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 8)) (1.0.4)\nRequirement already satisfied: matplotlib in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 9)) (3.3.3)\nRequirement already satisfied: git-python==1.0.3 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 10)) (1.0.3)\nRequirement already satisfied: faiss-cpu in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 11)) (1.6.4.post2)\nRequirement already satisfied: streamlit in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 12)) (0.71.0)\nRequirement already satisfied: elasticsearch in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 13)) (7.10.0)\nRequirement already satisfied: nltk in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 14)) (3.5)\nRequirement already satisfied: pandas in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 15)) (1.1.4)\nRequirement already satisfied: datasets in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 16)) (1.1.2)\nRequirement already satisfied: fire in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 17)) (0.3.1)\nRequirement already satisfied: pytest in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 18)) (6.1.2)\nRequirement already satisfied: conllu in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 19)) (4.2.1)\nRequirement already satisfied: sentencepiece!=0.1.92 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from -r ./examples/requirements.txt (line 20)) (0.1.91)\nRequirement already satisfied: werkzeug>=0.11.15 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (1.0.1)\nRequirement already satisfied: google-auth<2,>=1.6.3 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (1.23.0)\nRequirement already satisfied: setuptools>=41.0.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (50.3.1.post20201107)\nRequirement already satisfied: protobuf>=3.6.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (3.13.0)\nRequirement already satisfied: six>=1.10.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (1.15.0)\nRequirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (0.4.2)\nRequirement already satisfied: absl-py>=0.4 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (0.11.0)\nRequirement already satisfied: markdown>=2.6.8 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (3.3.3)\nRequirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (1.7.0)\nRequirement already satisfied: wheel>=0.26; python_version >= \"3\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (0.35.1)\nRequirement already satisfied: numpy>=1.12.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (1.19.4)\nRequirement already satisfied: grpcio>=1.24.3 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (1.33.2)\nRequirement already satisfied: requests<3,>=2.21.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorboard->-r ./examples/requirements.txt (line 1)) (2.25.0)\nRequirement already satisfied: joblib>=0.11 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from scikit-learn->-r ./examples/requirements.txt (line 2)) (0.17.0)\nRequirement already satisfied: threadpoolctl>=2.0.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from scikit-learn->-r ./examples/requirements.txt (line 2)) (2.1.0)\nRequirement already satisfied: scipy>=0.19.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from scikit-learn->-r ./examples/requirements.txt (line 2)) (1.5.4)\nRequirement already satisfied: portalocker in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from sacrebleu->-r ./examples/requirements.txt (line 5)) (2.0.0)\nRequirement already satisfied: termcolor in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (1.1.0)\nRequirement already satisfied: typing-extensions; python_version < \"3.8\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (3.7.4.3)\nRequirement already satisfied: future in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (0.18.2)\nRequirement already satisfied: tensorflow-metadata in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (0.25.0)\nRequirement already satisfied: dataclasses; python_version < \"3.7\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (0.7)\nRequirement already satisfied: attrs>=18.1.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (20.3.0)\nRequirement already satisfied: importlib-resources; python_version < \"3.9\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (3.3.0)\nRequirement already satisfied: dill in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (0.3.3)\nRequirement already satisfied: tqdm in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (4.51.0)\nRequirement already satisfied: promise in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (2.3)\nRequirement already satisfied: PyYAML>=5.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pytorch-lightning==1.0.4->-r ./examples/requirements.txt (line 8)) (5.3.1)\nRequirement already satisfied: torch>=1.3 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pytorch-lightning==1.0.4->-r ./examples/requirements.txt (line 8)) (1.7.0+cu101)\nRequirement already satisfied: fsspec>=0.8.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pytorch-lightning==1.0.4->-r ./examples/requirements.txt (line 8)) (0.8.4)\nRequirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from matplotlib->-r ./examples/requirements.txt (line 9)) (2.4.7)\nRequirement already satisfied: pillow>=6.2.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from matplotlib->-r ./examples/requirements.txt (line 9)) (8.0.1)\nRequirement already satisfied: cycler>=0.10 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from matplotlib->-r ./examples/requirements.txt (line 9)) (0.10.0)\nRequirement already satisfied: kiwisolver>=1.0.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from matplotlib->-r ./examples/requirements.txt (line 9)) (1.3.1)\nRequirement already satisfied: python-dateutil>=2.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from matplotlib->-r ./examples/requirements.txt (line 9)) (2.8.1)\nRequirement already satisfied: gitpython in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from git-python==1.0.3->-r ./examples/requirements.txt (line 10)) (3.1.11)\nRequirement already satisfied: packaging in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (20.4)\nRequirement already satisfied: blinker in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (1.4)\nRequirement already satisfied: toml in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (0.10.2)\nRequirement already satisfied: watchdog in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (0.10.3)\nRequirement already satisfied: enum-compat in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (0.0.3)\nRequirement already satisfied: pyarrow in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (2.0.0)\nRequirement already satisfied: botocore>=1.13.44 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (1.19.16)\nRequirement already satisfied: altair>=3.2.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (4.1.0)\nRequirement already satisfied: cachetools>=4.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (4.1.1)\nRequirement already satisfied: validators in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (0.18.1)\nRequirement already satisfied: pydeck>=0.1.dev5 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (0.5.0)\nRequirement already satisfied: base58 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (2.0.1)\nRequirement already satisfied: boto3 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (1.16.16)\nRequirement already satisfied: tornado>=5.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (6.1)\nRequirement already satisfied: tzlocal in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (2.1)\nRequirement already satisfied: astor in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (0.8.1)\nRequirement already satisfied: click>=7.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from streamlit->-r ./examples/requirements.txt (line 12)) (7.1.2)\nRequirement already satisfied: urllib3<2,>=1.21.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from elasticsearch->-r ./examples/requirements.txt (line 13)) (1.25.11)\nRequirement already satisfied: certifi in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from elasticsearch->-r ./examples/requirements.txt (line 13)) (2020.11.8)\nRequirement already satisfied: regex in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nltk->-r ./examples/requirements.txt (line 14)) (2020.11.11)\nRequirement already satisfied: pytz>=2017.2 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pandas->-r ./examples/requirements.txt (line 15)) (2020.4)\nRequirement already satisfied: xxhash in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from datasets->-r ./examples/requirements.txt (line 16)) (2.0.0)\nRequirement already satisfied: multiprocess in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from datasets->-r ./examples/requirements.txt (line 16)) (0.70.11.1)\nRequirement already satisfied: filelock in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from datasets->-r ./examples/requirements.txt (line 16)) (3.0.12)\nRequirement already satisfied: importlib-metadata>=0.12; python_version < \"3.8\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pytest->-r ./examples/requirements.txt (line 18)) (2.0.0)\nRequirement already satisfied: pluggy<1.0,>=0.12 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pytest->-r ./examples/requirements.txt (line 18)) (0.13.1)\nRequirement already satisfied: iniconfig in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pytest->-r ./examples/requirements.txt (line 18)) (1.1.1)\nRequirement already satisfied: py>=1.8.2 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pytest->-r ./examples/requirements.txt (line 18)) (1.9.0)\nRequirement already satisfied: pyasn1-modules>=0.2.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard->-r ./examples/requirements.txt (line 1)) (0.2.8)\nRequirement already satisfied: rsa<5,>=3.1.4; python_version >= \"3.5\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from google-auth<2,>=1.6.3->tensorboard->-r ./examples/requirements.txt (line 1)) (4.6)\nRequirement already satisfied: requests-oauthlib>=0.7.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard->-r ./examples/requirements.txt (line 1)) (1.3.0)\nRequirement already satisfied: chardet<4,>=3.0.2 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard->-r ./examples/requirements.txt (line 1)) (3.0.4)\nRequirement already satisfied: idna<3,>=2.5 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from requests<3,>=2.21.0->tensorboard->-r ./examples/requirements.txt (line 1)) (2.10)\nRequirement already satisfied: googleapis-common-protos<2,>=1.52.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from tensorflow-metadata->tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (1.52.0)\nRequirement already satisfied: zipp>=0.4; python_version < \"3.8\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from importlib-resources; python_version < \"3.9\"->tensorflow_datasets->-r ./examples/requirements.txt (line 7)) (3.4.0)\nRequirement already satisfied: gitdb<5,>=4.0.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from gitpython->git-python==1.0.3->-r ./examples/requirements.txt (line 10)) (4.0.5)\nRequirement already satisfied: pathtools>=0.1.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from watchdog->streamlit->-r ./examples/requirements.txt (line 12)) (0.1.2)\nRequirement already satisfied: jmespath<1.0.0,>=0.7.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from botocore>=1.13.44->streamlit->-r ./examples/requirements.txt (line 12)) (0.10.0)\nRequirement already satisfied: jinja2 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from altair>=3.2.0->streamlit->-r ./examples/requirements.txt (line 12)) (2.11.2)\nRequirement already satisfied: toolz in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from altair>=3.2.0->streamlit->-r ./examples/requirements.txt (line 12)) (0.11.1)\nRequirement already satisfied: jsonschema in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from altair>=3.2.0->streamlit->-r ./examples/requirements.txt (line 12)) (3.2.0)\nRequirement already satisfied: entrypoints in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from altair>=3.2.0->streamlit->-r ./examples/requirements.txt (line 12)) (0.3)\nRequirement already satisfied: decorator>=3.4.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from validators->streamlit->-r ./examples/requirements.txt (line 12)) (4.4.2)\nRequirement already satisfied: traitlets>=4.3.2 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (4.3.3)\nRequirement already satisfied: ipykernel>=5.1.2; python_version >= \"3.4\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (5.3.4)\nRequirement already satisfied: ipywidgets>=7.0.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (7.5.1)\nRequirement already satisfied: s3transfer<0.4.0,>=0.3.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from boto3->streamlit->-r ./examples/requirements.txt (line 12)) (0.3.3)\nRequirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard->-r ./examples/requirements.txt (line 1)) (0.4.8)\nRequirement already satisfied: oauthlib>=3.0.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard->-r ./examples/requirements.txt (line 1)) (3.1.0)\nRequirement already satisfied: smmap<4,>=3.0.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from gitdb<5,>=4.0.1->gitpython->git-python==1.0.3->-r ./examples/requirements.txt (line 10)) (3.0.4)\nRequirement already satisfied: MarkupSafe>=0.23 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from jinja2->altair>=3.2.0->streamlit->-r ./examples/requirements.txt (line 12)) (1.1.1)\nRequirement already satisfied: pyrsistent>=0.14.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from jsonschema->altair>=3.2.0->streamlit->-r ./examples/requirements.txt (line 12)) (0.17.3)\nRequirement already satisfied: ipython-genutils in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from traitlets>=4.3.2->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.2.0)\nRequirement already satisfied: ipython>=5.0.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (5.8.0)\nRequirement already satisfied: jupyter-client in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (6.1.7)\nRequirement already satisfied: nbformat>=4.2.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (5.0.8)\nRequirement already satisfied: widgetsnbextension~=3.5.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (3.5.1)\nRequirement already satisfied: pygments in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (2.7.2)\nRequirement already satisfied: simplegeneric>0.8 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.8.1)\nRequirement already satisfied: pickleshare in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.7.5)\nRequirement already satisfied: prompt-toolkit<2.0.0,>=1.0.4 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (1.0.15)\nRequirement already satisfied: pexpect; sys_platform != \"win32\" in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from ipython>=5.0.0->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (4.8.0)\nRequirement already satisfied: jupyter-core>=4.6.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from jupyter-client->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (4.6.3)\nRequirement already satisfied: pyzmq>=13 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from jupyter-client->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (19.0.2)\nRequirement already satisfied: notebook>=4.4.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (6.1.5)\nRequirement already satisfied: wcwidth in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from prompt-toolkit<2.0.0,>=1.0.4->ipython>=5.0.0->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.2.5)\nRequirement already satisfied: ptyprocess>=0.5 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pexpect; sys_platform != \"win32\"->ipython>=5.0.0->ipykernel>=5.1.2; python_version >= \"3.4\"->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.6.0)\nRequirement already satisfied: Send2Trash in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (1.5.0)\nRequirement already satisfied: nbconvert in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (6.0.7)\nRequirement already satisfied: terminado>=0.8.3 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.9.1)\nRequirement already satisfied: argon2-cffi in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (20.1.0)\nRequirement already satisfied: prometheus-client in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.8.0)\nRequirement already satisfied: mistune<2,>=0.8.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.8.4)\nRequirement already satisfied: jupyterlab-pygments in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.1.2)\nRequirement already satisfied: pandocfilters>=1.4.1 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (1.4.2)\nRequirement already satisfied: testpath in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.4.4)\nRequirement already satisfied: defusedxml in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.6.0)\nRequirement already satisfied: nbclient<0.6.0,>=0.5.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.5.1)\nRequirement already satisfied: bleach in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (3.2.1)\nRequirement already satisfied: cffi>=1.0.0 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (1.11.5)\nRequirement already satisfied: async-generator in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (1.10)\nRequirement already satisfied: nest-asyncio in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from nbclient<0.6.0,>=0.5.0->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (1.4.2)\nRequirement already satisfied: webencodings in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from bleach->nbconvert->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (0.5.1)\nRequirement already satisfied: pycparser in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from cffi>=1.0.0->argon2-cffi->notebook>=4.4.1->widgetsnbextension~=3.5.0->ipywidgets>=7.0.0->pydeck>=0.1.dev5->streamlit->-r ./examples/requirements.txt (line 12)) (2.20)\n/home/ociftci/Untitled Folder\n"
],
[
"!pip install pyarrow --upgrade",
"Requirement already up-to-date: pyarrow in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (2.0.0)\r\nRequirement already satisfied, skipping upgrade: numpy>=1.14 in /home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages (from pyarrow) (1.19.4)\r\n"
],
[
"import transformers",
"_____no_output_____"
],
[
"!mkdir data\n# aynı dizinde data klasöründe train,test,dev tsv dosyaları yükleniyor.\n# eğer text dosyaları varsa hazır, direk run_ner.py çalıştırılabilir.\n\nblankLineIndicator = \"BlankLineIndicator\"\nblank = \"\"\nfirstColumnIndex = 0\nsecondColumnIndex = 1",
"mkdir: cannot create directory ‘data’: File exists\r\n"
],
[
"!cp -r ./NCBI-disease/ ./data/",
"cp: cannot stat './NCBI-disease/': No such file or directory\r\n"
],
[
"!mv ./data/NCBI-disease/devel.tsv ./data/NCBI-disease/dev.tsv",
"mv: cannot stat './data/NCBI-disease/devel.tsv': No such file or directory\r\n"
],
[
"!mv ./dev.tsv ./NCBI-disease/",
"mv: cannot stat './dev.tsv': No such file or directory\r\n"
],
[
"!pwd",
"/home/ociftci/Untitled Folder\r\n"
],
[
"#!unzip NERdata.zip -d data",
"_____no_output_____"
],
[
"#!ls data/",
"_____no_output_____"
],
[
"train_dev_tsv = []\n\nwith open('./data/NCBI-disease/train_dev.tsv', 'r') as f:\n train_dev_pd = f.readlines()\n\n\nfor row in train_dev_pd:\n row = row.split('\\n')[0].split('\\t')\n #Token Sütun İsmi\n if row:\n pass\n if row[firstColumnIndex] == '':\n train_dev_tsv.append(blank)\n else: #Token Sütun İsmi\n #print(row)\n train_dev_tsv.append(row[firstColumnIndex] + \" \" + row[secondColumnIndex])\n",
"_____no_output_____"
],
[
"train_dev_tsv[0]",
"_____no_output_____"
],
[
"test_tsv = []\n\nwith open('./data/NCBI-disease/test.tsv', 'r') as f:\n test_pd = f.readlines()\n\n\nfor row in test_pd:\n row = row.split('\\n')[0].split('\\t')\n #Token Sütun İsmi\n if row:\n pass\n if row[firstColumnIndex] == '':\n test_tsv.append(blank)\n else: #Token Sütun İsmi\n #print(row)\n test_tsv.append(row[firstColumnIndex] + \" \" + row[secondColumnIndex])\n",
"_____no_output_____"
],
[
"dev_tsv = []\n\nwith open('./data/NCBI-disease/dev.tsv', 'r') as f:\n test_pd = f.readlines()\n\n\nfor row in test_pd:\n row = row.split('\\n')[0].split('\\t')\n #Token Sütun İsmi\n if row:\n pass\n if row[firstColumnIndex] == '':\n dev_tsv.append(blank)\n else: #Token Sütun İsmi\n #print(row)\n dev_tsv.append(row[firstColumnIndex] + \" \" + row[secondColumnIndex])\n",
"_____no_output_____"
],
[
"print(len(train_dev_pd))\nprint(len(train_dev_tsv))",
"166017\n166017\n"
],
[
"train_dev_tsv[12288].split()[0]",
"_____no_output_____"
],
[
"train_dev_pd[0], train_dev_tsv[0]",
"_____no_output_____"
],
[
"l = []\nfor item in train_dev_tsv:\n try:\n item = item.split()[1]\n if item != 'B' and item != 'I' and item != 'O':\n print(item)\n l.append(item)\n except:\n pass\n\nl = set(l)\nprint(l)\n\nwith open('labels.txt', 'w') as f:\n for item in list(l):\n f.write(item + '\\n')\n",
"{'B', 'I', 'O'}\n"
],
[
"#!cut -f2 BC2GM/train.tsv | sort | uniq",
"_____no_output_____"
],
[
"dev_tsv[0]",
"_____no_output_____"
],
[
"def create_txt(file_name, lines):\n file = open(file_name, 'w') \n for line in lines:\n file.write(line + \"\\n\") \n file.close()\n\n#create_txt(\"./data/train.txt\",train_tsv)\ncreate_txt(\"data/train.txt\", train_dev_tsv)\ncreate_txt(\"data/test.txt\", test_tsv)\ncreate_txt(\"data/dev.txt\", dev_tsv)\n# txt file'a çeviriyoruz",
"_____no_output_____"
],
[
"# !cat data/NCBI-disease/train.tsv | tr \"\\t\" \" \" | head -10",
"_____no_output_____"
],
[
"#labels.txt -> unique varlık ismi sınıflarının olduğu text dosyası",
"_____no_output_____"
],
[
"OUTPUT_DIR = \"electra-ner\"",
"_____no_output_____"
],
[
"!cd data",
"_____no_output_____"
],
[
"!ls ./data",
"dev.txt NCBI-disease test.txt train.txt\r\n"
],
[
"!python3 run_ner.py --data_dir ./data/ \\\n--labels ./labels.txt \\\n--model_name_or_path enelpi/med-electra-small-discriminator \\\n--output_dir $OUTPUT_DIR \\\n--max_seq_length 128 \\\n--num_train_epochs 3 \\\n--per_device_train_batch_size 16 \\\n--overwrite_output_dir \\\n--save_steps 10000 \\\n--seed 41 \\\n--do_train \\\n--do_eval \\\n--do_predict",
"11/13/2020 22:18:13 - WARNING - __main__ - Process rank: -1, device: cuda:0, n_gpu: 2, distributed training: False, 16-bits training: False\n11/13/2020 22:18:13 - INFO - __main__ - Training/evaluation parameters TrainingArguments(output_dir='electra-ner', overwrite_output_dir=True, do_train=True, do_eval=True, do_predict=True, evaluate_during_training=False, evaluation_strategy=<EvaluationStrategy.NO: 'no'>, prediction_loss_only=False, per_device_train_batch_size=16, per_device_eval_batch_size=8, per_gpu_train_batch_size=None, per_gpu_eval_batch_size=None, gradient_accumulation_steps=1, eval_accumulation_steps=None, learning_rate=5e-05, weight_decay=0.0, adam_beta1=0.9, adam_beta2=0.999, adam_epsilon=1e-08, max_grad_norm=1.0, num_train_epochs=3.0, max_steps=-1, warmup_steps=0, logging_dir='runs/Nov13_22-18-13_inzva-GPU', logging_first_step=False, logging_steps=500, save_steps=10000, save_total_limit=None, no_cuda=False, seed=41, fp16=False, fp16_opt_level='O1', local_rank=-1, tpu_num_cores=None, tpu_metrics_debug=False, debug=False, dataloader_drop_last=False, eval_steps=500, dataloader_num_workers=0, past_index=-1, run_name='electra-ner', disable_tqdm=False, remove_unused_columns=True, label_names=None, load_best_model_at_end=False, metric_for_best_model=None, greater_is_better=None)\nSome weights of the model checkpoint at enelpi/med-electra-small-discriminator were not used when initializing ElectraForTokenClassification: ['discriminator_predictions.dense.weight', 'discriminator_predictions.dense.bias', 'discriminator_predictions.dense_prediction.weight', 'discriminator_predictions.dense_prediction.bias']\n- This IS expected if you are initializing ElectraForTokenClassification from the checkpoint of a model trained on another task or with another architecture (e.g. initializing a BertForSequenceClassification model from a BertForPretraining model).\n- This IS NOT expected if you are initializing ElectraForTokenClassification from the checkpoint of a model that you expect to be exactly identical (initializing a BertForSequenceClassification model from a BertForSequenceClassification model).\nSome weights of ElectraForTokenClassification were not initialized from the model checkpoint at enelpi/med-electra-small-discriminator and are newly initialized: ['classifier.weight', 'classifier.bias']\nYou should probably TRAIN this model on a down-stream task to be able to use it for predictions and inference.\n11/13/2020 22:18:18 - INFO - filelock - Lock 140716208148096 acquired on ./data/cached_train_ElectraTokenizer_128.lock\n11/13/2020 22:18:18 - INFO - utils_ner - Loading features from cached file ./data/cached_train_ElectraTokenizer_128\n11/13/2020 22:18:19 - INFO - filelock - Lock 140716208148096 released on ./data/cached_train_ElectraTokenizer_128.lock\n11/13/2020 22:18:19 - INFO - filelock - Lock 140716208148040 acquired on ./data/cached_dev_ElectraTokenizer_128.lock\n11/13/2020 22:18:19 - INFO - utils_ner - Loading features from cached file ./data/cached_dev_ElectraTokenizer_128\n11/13/2020 22:18:19 - INFO - filelock - Lock 140716208148040 released on ./data/cached_dev_ElectraTokenizer_128.lock\n 0%| | 0/597 [00:00<?, ?it/s]Traceback (most recent call last):\n File \"run_ner.py\", line 311, in <module>\n main()\n File \"run_ner.py\", line 247, in main\n model_path=model_args.model_name_or_path if os.path.isdir(model_args.model_name_or_path) else None\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/transformers/trainer.py\", line 775, in train\n tr_loss += self.training_step(model, inputs)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/transformers/trainer.py\", line 1112, in training_step\n loss = self.compute_loss(model, inputs)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/transformers/trainer.py\", line 1136, in compute_loss\n outputs = model(**inputs)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/modules/module.py\", line 727, in _call_impl\n result = self.forward(*input, **kwargs)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py\", line 157, in forward\n inputs, kwargs = self.scatter(inputs, kwargs, self.device_ids)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/data_parallel.py\", line 168, in scatter\n return scatter_kwargs(inputs, kwargs, device_ids, dim=self.dim)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py\", line 37, in scatter_kwargs\n kwargs = scatter(kwargs, target_gpus, dim) if kwargs else []\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py\", line 28, in scatter\n res = scatter_map(inputs)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py\", line 19, in scatter_map\n return list(map(type(obj), zip(*map(scatter_map, obj.items()))))\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py\", line 15, in scatter_map\n return list(zip(*map(scatter_map, obj)))\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/scatter_gather.py\", line 13, in scatter_map\n return Scatter.apply(target_gpus, None, dim, obj)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/_functions.py\", line 92, in forward\n outputs = comm.scatter(input, target_gpus, chunk_sizes, ctx.dim, streams)\n File \"/home/ociftci/anaconda3/envs/ner_env/lib/python3.6/site-packages/torch/nn/parallel/comm.py\", line 186, in scatter\n return tuple(torch._C._scatter(tensor, devices, chunk_sizes, dim, streams))\nRuntimeError: CUDA error: out of memory\n 0%| | 0/597 [00:00<?, ?it/s]\n"
],
[
"import torch\nprint(torch.__version__)\nprint(torch.cuda.is_available())",
"1.7.0+cu101\nTrue\n"
],
[
"!lshw -c video",
"WARNING: you should run this program as super-user.\n *-display \n description: VGA compatible controller\n product: GV102\n vendor: NVIDIA Corporation\n physical id: 0\n bus info: pci@0000:01:00.0\n version: a1\n width: 64 bits\n clock: 33MHz\n capabilities: vga_controller bus_master cap_list rom\n configuration: driver=nvidia latency=0\n resources: irq:136 memory:78000000-78ffffff memory:60000000-6fffffff memory:76000000-77ffffff ioport:5000(size=128) memory:c0000-dffff\n *-display\n description: VGA compatible controller\n product: GV102\n vendor: NVIDIA Corporation\n physical id: 0\n bus info: pci@0000:05:00.0\n version: a1\n width: 64 bits\n clock: 33MHz\n capabilities: vga_controller bus_master cap_list rom\n configuration: driver=nvidia latency=0\n resources: irq:137 memory:74000000-74ffffff memory:40000000-4fffffff memory:72000000-73ffffff ioport:3000(size=128) memory:75000000-7507ffff\nWARNING: output may be incomplete or inaccurate, you should run this program as super-user.\n"
],
[
"!nvcc --version",
"nvcc: NVIDIA (R) Cuda compiler driver\r\nCopyright (c) 2005-2018 NVIDIA Corporation\r\nBuilt on Sat_Aug_25_21:08:01_CDT_2018\r\nCuda compilation tools, release 10.0, V10.0.130\r\n"
],
[
"!modinfo nvidia",
"filename: /lib/modules/5.3.0-46-generic/updates/dkms/nvidia.ko\r\nalias: char-major-195-*\r\nversion: 435.21\r\nsupported: external\r\nlicense: NVIDIA\r\nsrcversion: 2D4143B613DF8762A7AAE09\r\nalias: pci:v000010DEd00000E00sv*sd*bc04sc80i00*\r\nalias: pci:v000010DEd*sv*sd*bc03sc02i00*\r\nalias: pci:v000010DEd*sv*sd*bc03sc00i00*\r\ndepends: ipmi_msghandler\r\nretpoline: Y\r\nname: nvidia\r\nvermagic: 5.3.0-46-generic SMP mod_unload \r\nparm: NvSwitchRegDwords:NvSwitch regkey (charp)\r\nparm: NVreg_Mobile:int\r\nparm: NVreg_ResmanDebugLevel:int\r\nparm: NVreg_RmLogonRC:int\r\nparm: NVreg_ModifyDeviceFiles:int\r\nparm: NVreg_DeviceFileUID:int\r\nparm: NVreg_DeviceFileGID:int\r\nparm: NVreg_DeviceFileMode:int\r\nparm: NVreg_InitializeSystemMemoryAllocations:int\r\nparm: NVreg_UsePageAttributeTable:int\r\nparm: NVreg_MapRegistersEarly:int\r\nparm: NVreg_RegisterForACPIEvents:int\r\nparm: NVreg_EnablePCIeGen3:int\r\nparm: NVreg_EnableMSI:int\r\nparm: NVreg_TCEBypassMode:int\r\nparm: NVreg_EnableStreamMemOPs:int\r\nparm: NVreg_EnableBacklightHandler:int\r\nparm: NVreg_RestrictProfilingToAdminUsers:int\r\nparm: NVreg_PreserveVideoMemoryAllocations:int\r\nparm: NVreg_DynamicPowerManagement:int\r\nparm: NVreg_EnableUserNUMAManagement:int\r\nparm: NVreg_MemoryPoolSize:int\r\nparm: NVreg_KMallocHeapMaxSize:int\r\nparm: NVreg_VMallocHeapMaxSize:int\r\nparm: NVreg_IgnoreMMIOCheck:int\r\nparm: NVreg_NvLinkDisable:int\r\nparm: NVreg_RegisterPCIDriver:int\r\nparm: NVreg_RegistryDwords:charp\r\nparm: NVreg_RegistryDwordsPerDevice:charp\r\nparm: NVreg_RmMsg:charp\r\nparm: NVreg_GpuBlacklist:charp\r\nparm: NVreg_TemporaryFilePath:charp\r\nparm: NVreg_AssignGpus:charp\r\n"
],
[
"# 11/06/2020 20:45:35 - INFO - __main__ - eval_accuracy_score = 0.9825284728742295\n# 11/06/2020 20:45:35 - INFO - __main__ - eval_precision = 0.8032166508987701\n# 11/06/2020 20:45:35 - INFO - __main__ - eval_recall = 0.884375\n# 11/06/2020 20:45:35 - INFO - __main__ - eval_f1 = 0.8418443232523549",
"_____no_output_____"
],
[
"!nvidia-smi",
"Thu Nov 12 22:15:55 2020 \r\n+-----------------------------------------------------------------------------+\r\n| NVIDIA-SMI 435.21 Driver Version: 435.21 CUDA Version: 10.1 |\r\n|-------------------------------+----------------------+----------------------+\r\n| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\r\n| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\r\n|===============================+======================+======================|\r\n| 0 GeForce RTX 208... Off | 00000000:01:00.0 On | N/A |\r\n| 37% 63C P0 71W / 260W | 195MiB / 11018MiB | 0% Default |\r\n+-------------------------------+----------------------+----------------------+\r\n| 1 GeForce RTX 208... Off | 00000000:05:00.0 Off | N/A |\r\n| 66% 79C P2 256W / 260W | 10910MiB / 11019MiB | 99% Default |\r\n+-------------------------------+----------------------+----------------------+\r\n \r\n+-----------------------------------------------------------------------------+\r\n| Processes: GPU Memory |\r\n| GPU PID Type Process name Usage |\r\n|=============================================================================|\r\n| 0 1280 G /usr/lib/xorg/Xorg 65MiB |\r\n| 0 1428 G /usr/bin/gnome-shell 99MiB |\r\n| 0 1845 G /opt/teamviewer/tv_bin/TeamViewer 17MiB |\r\n| 1 28158 C python 10899MiB |\r\n+-----------------------------------------------------------------------------+\r\n"
],
[
"Seq length 256 distilbert-base-uncased",
"_____no_output_____"
],
[
"torch.version.cuda",
"_____no_output_____"
],
[
"!export CUDA_VISIBLE_DEVICES=0",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0caafdcc80644be028b17ae3059ab720d318012 | 307,365 | ipynb | Jupyter Notebook | cifar10-augmentation/cifar10_augmentation_mine.ipynb | rhombhi/aind2-cnn | 46024553088b1003c77d890ee47fdae0f3ae7bfd | [
"MIT"
] | null | null | null | cifar10-augmentation/cifar10_augmentation_mine.ipynb | rhombhi/aind2-cnn | 46024553088b1003c77d890ee47fdae0f3ae7bfd | [
"MIT"
] | null | null | null | cifar10-augmentation/cifar10_augmentation_mine.ipynb | rhombhi/aind2-cnn | 46024553088b1003c77d890ee47fdae0f3ae7bfd | [
"MIT"
] | null | null | null | 375.29304 | 177,140 | 0.924129 | [
[
[
"# Artificial Intelligence Nanodegree\n\n## Convolutional Neural Networks\n\n---\n\nIn this notebook, we train a CNN on augmented images from the CIFAR-10 database.\n\n### 1. Load CIFAR-10 Database",
"_____no_output_____"
]
],
[
[
"import keras\nfrom keras.datasets import cifar10\n\n# load the pre-shuffled train and test data\n(x_train, y_train), (x_test, y_test) = cifar10.load_data()",
"Using TensorFlow backend.\n"
]
],
[
[
"### 2. Visualize the First 24 Training Images",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\n%matplotlib inline\n\nfig = plt.figure(figsize=(20,5))\nfor i in range(36):\n ax = fig.add_subplot(3, 12, i + 1, xticks=[], yticks=[])\n ax.imshow(np.squeeze(x_train[i]))",
"_____no_output_____"
]
],
[
[
"### 3. Rescale the Images by Dividing Every Pixel in Every Image by 255",
"_____no_output_____"
]
],
[
[
"# rescale [0,255] --> [0,1]\nx_train = x_train.astype('float32')/255\nx_test = x_test.astype('float32')/255 ",
"_____no_output_____"
]
],
[
[
"### 4. Break Dataset into Training, Testing, and Validation Sets",
"_____no_output_____"
]
],
[
[
"from keras.utils import np_utils\n\n# break training set into training and validation sets\n(x_train, x_valid) = x_train[5000:], x_train[:5000]\n(y_train, y_valid) = y_train[5000:], y_train[:5000]\n\n# one-hot encode the labels\nnum_classes = len(np.unique(y_train))\ny_train = keras.utils.to_categorical(y_train, num_classes)\ny_test = keras.utils.to_categorical(y_test, num_classes)\ny_valid = keras.utils.to_categorical(y_valid, num_classes)\n\n# print shape of training set\nprint('x_train shape:', x_train.shape)\n\n# print number of training, validation, and test images\nprint(x_train.shape[0], 'train samples')\nprint(x_test.shape[0], 'test samples')\nprint(x_valid.shape[0], 'validation samples')",
"x_train shape: (45000, 32, 32, 3)\n45000 train samples\n10000 test samples\n5000 validation samples\n"
]
],
[
[
"### 5. Create and Configure Augmented Image Generator",
"_____no_output_____"
]
],
[
[
"from keras.preprocessing.image import ImageDataGenerator\n\ndatagen_train = ImageDataGenerator(width_shift_range=.1, \n height_shift_range=.1, horizontal_flip=True)\n\ndatagen_train.fit(x_train)",
"_____no_output_____"
]
],
[
[
"### 6. Visualize Original and Augmented Images",
"_____no_output_____"
]
],
[
[
"fig = plt.figure(figsize=(20,2))\nfig.suptitle('Actual images', fontsize=20)\nfor i in range(10):\n ax = fig.add_subplot(1, 10, i+1, xticks=[], yticks=[])\n ax.imshow(np.squeeze(x_train[i]))\n \nfig = plt.figure(figsize=(20,2))\nfig.suptitle('Augmented images')\nfor x_batch in datagen_train.flow(x_train[:10]):\n for i in range(10):\n ax = fig.add_subplot(1, 10, i+1, xticks=[], yticks=[])\n ax.imshow(x_batch[i])\n break;\n",
"_____no_output_____"
]
],
[
[
"### 7. Define the Model Architecture ",
"_____no_output_____"
]
],
[
[
"from keras.models import Sequential\nfrom keras.layers import Conv2D, MaxPooling2D, Flatten, Dense, Dropout\n\nmodel = Sequential()\nmodel.add(Conv2D(filters=16, kernel_size=2, padding='same', activation='relu', \n input_shape=(32, 32, 3)))\nmodel.add(MaxPooling2D(pool_size=2))\nmodel.add(Conv2D(filters=32, kernel_size=2, padding='same', activation='relu'))\nmodel.add(MaxPooling2D(pool_size=2))\nmodel.add(Conv2D(filters=64, kernel_size=2, padding='same', activation='relu'))\nmodel.add(MaxPooling2D(pool_size=2))\nmodel.add(Dropout(0.3))\nmodel.add(Flatten())\nmodel.add(Dense(500, activation='relu'))\nmodel.add(Dropout(0.4))\nmodel.add(Dense(10, activation='softmax'))\n\nmodel.summary()",
"_________________________________________________________________\nLayer (type) Output Shape Param # \n=================================================================\nconv2d_1 (Conv2D) (None, 32, 32, 16) 208 \n_________________________________________________________________\nmax_pooling2d_1 (MaxPooling2 (None, 16, 16, 16) 0 \n_________________________________________________________________\nconv2d_2 (Conv2D) (None, 16, 16, 32) 2080 \n_________________________________________________________________\nmax_pooling2d_2 (MaxPooling2 (None, 8, 8, 32) 0 \n_________________________________________________________________\nconv2d_3 (Conv2D) (None, 8, 8, 64) 8256 \n_________________________________________________________________\nmax_pooling2d_3 (MaxPooling2 (None, 4, 4, 64) 0 \n_________________________________________________________________\ndropout_1 (Dropout) (None, 4, 4, 64) 0 \n_________________________________________________________________\nflatten_1 (Flatten) (None, 1024) 0 \n_________________________________________________________________\ndense_1 (Dense) (None, 500) 512500 \n_________________________________________________________________\ndropout_2 (Dropout) (None, 500) 0 \n_________________________________________________________________\ndense_2 (Dense) (None, 10) 5010 \n=================================================================\nTotal params: 528,054\nTrainable params: 528,054\nNon-trainable params: 0\n_________________________________________________________________\n"
]
],
[
[
"### 8. Compile the Model ",
"_____no_output_____"
]
],
[
[
"# compile the model\nmodel.compile(loss='categorical_crossentropy', optimizer='rmsprop', \n metrics=['accuracy'])",
"_____no_output_____"
]
],
[
[
"### 9. Train the Model ",
"_____no_output_____"
]
],
[
[
"from keras.callbacks import ModelCheckpoint \n\nbatch_size = 32\nepochs = 100\n\n# train the model\ncheckpointer = ModelCheckpoint(filepath='aug_model.weights.best.mine.hdf5', verbose=1, \n save_best_only=True)\nmodel.fit_generator(datagen_train.flow(x_train, y_train, batch_size=batch_size),\n steps_per_epoch=x_train.shape[0] // batch_size,\n epochs=epochs, verbose=2, callbacks=[checkpointer],\n validation_data=(x_valid, y_valid),\n validation_steps=x_valid.shape[0] // batch_size)",
"Epoch 1/100\n - 64s - loss: 1.6690 - acc: 0.3944 - val_loss: 1.5590 - val_acc: 0.4352\n\nEpoch 00001: val_loss improved from inf to 1.55902, saving model to aug_model.weights.best.hdf5\nEpoch 2/100\n - 54s - loss: 1.3915 - acc: 0.4976 - val_loss: 1.1726 - val_acc: 0.5744\n\nEpoch 00002: val_loss improved from 1.55902 to 1.17256, saving model to aug_model.weights.best.hdf5\nEpoch 3/100\n - 52s - loss: 1.2954 - acc: 0.5354 - val_loss: 1.2066 - val_acc: 0.5770\n\nEpoch 00003: val_loss did not improve from 1.17256\nEpoch 4/100\n - 55s - loss: 1.2305 - acc: 0.5648 - val_loss: 1.1527 - val_acc: 0.5934\n\nEpoch 00004: val_loss improved from 1.17256 to 1.15274, saving model to aug_model.weights.best.hdf5\nEpoch 5/100\n - 57s - loss: 1.2038 - acc: 0.5731 - val_loss: 1.1211 - val_acc: 0.6062\n\nEpoch 00005: val_loss improved from 1.15274 to 1.12108, saving model to aug_model.weights.best.hdf5\nEpoch 6/100\n - 57s - loss: 1.1766 - acc: 0.5859 - val_loss: 1.1099 - val_acc: 0.6174\n\nEpoch 00006: val_loss improved from 1.12108 to 1.10988, saving model to aug_model.weights.best.hdf5\nEpoch 7/100\n - 65s - loss: 1.1752 - acc: 0.5914 - val_loss: 0.9883 - val_acc: 0.6580\n\nEpoch 00007: val_loss improved from 1.10988 to 0.98825, saving model to aug_model.weights.best.hdf5\nEpoch 8/100\n - 67s - loss: 1.1651 - acc: 0.5979 - val_loss: 1.0768 - val_acc: 0.6416\n\nEpoch 00008: val_loss did not improve from 0.98825\nEpoch 9/100\n - 66s - loss: 1.1677 - acc: 0.5957 - val_loss: 1.2447 - val_acc: 0.6168\n\nEpoch 00009: val_loss did not improve from 0.98825\nEpoch 10/100\n - 80s - loss: 1.1747 - acc: 0.5972 - val_loss: 1.0569 - val_acc: 0.6564\n\nEpoch 00010: val_loss did not improve from 0.98825\nEpoch 11/100\n - 53s - loss: 1.1842 - acc: 0.5943 - val_loss: 0.9703 - val_acc: 0.6726\n\nEpoch 00011: val_loss improved from 0.98825 to 0.97035, saving model to aug_model.weights.best.hdf5\nEpoch 12/100\n - 71s - loss: 1.2000 - acc: 0.5913 - val_loss: 1.0361 - val_acc: 0.6450\n\nEpoch 00012: val_loss did not improve from 0.97035\nEpoch 13/100\n - 83s - loss: 1.2158 - acc: 0.5863 - val_loss: 1.0435 - val_acc: 0.6390\n\nEpoch 00013: val_loss did not improve from 0.97035\nEpoch 14/100\n - 55s - loss: 1.2252 - acc: 0.5841 - val_loss: 1.1879 - val_acc: 0.6378\n\nEpoch 00014: val_loss did not improve from 0.97035\nEpoch 15/100\n - 56s - loss: 1.2427 - acc: 0.5770 - val_loss: 0.9678 - val_acc: 0.6768\n\nEpoch 00015: val_loss improved from 0.97035 to 0.96785, saving model to aug_model.weights.best.hdf5\nEpoch 16/100\n - 63s - loss: 1.2540 - acc: 0.5767 - val_loss: 1.0361 - val_acc: 0.6394\n\nEpoch 00016: val_loss did not improve from 0.96785\nEpoch 17/100\n - 55s - loss: 1.2676 - acc: 0.5708 - val_loss: 0.9741 - val_acc: 0.6658\n\nEpoch 00017: val_loss did not improve from 0.96785\nEpoch 18/100\n - 59s - loss: 1.2829 - acc: 0.5672 - val_loss: 1.2069 - val_acc: 0.6016\n\nEpoch 00018: val_loss did not improve from 0.96785\nEpoch 19/100\n - 55s - loss: 1.3015 - acc: 0.5610 - val_loss: 1.1444 - val_acc: 0.6146\n\nEpoch 00019: val_loss did not improve from 0.96785\nEpoch 20/100\n - 52s - loss: 1.3232 - acc: 0.5571 - val_loss: 1.2112 - val_acc: 0.5716\n\nEpoch 00020: val_loss did not improve from 0.96785\nEpoch 21/100\n - 55s - loss: 1.3394 - acc: 0.5498 - val_loss: 1.2940 - val_acc: 0.5604\n\nEpoch 00021: val_loss did not improve from 0.96785\nEpoch 22/100\n - 52s - loss: 1.3635 - acc: 0.5419 - val_loss: 1.2010 - val_acc: 0.6032\n\nEpoch 00022: val_loss did not improve from 0.96785\nEpoch 23/100\n - 52s - loss: 1.3709 - acc: 0.5383 - val_loss: 1.1548 - val_acc: 0.6052\n\nEpoch 00023: val_loss did not improve from 0.96785\nEpoch 24/100\n - 52s - loss: 1.3855 - acc: 0.5360 - val_loss: 1.1610 - val_acc: 0.6080\n\nEpoch 00024: val_loss did not improve from 0.96785\nEpoch 25/100\n - 54s - loss: 1.4122 - acc: 0.5219 - val_loss: 1.1643 - val_acc: 0.6190\n\nEpoch 00025: val_loss did not improve from 0.96785\nEpoch 26/100\n - 53s - loss: 1.4311 - acc: 0.5181 - val_loss: 1.3308 - val_acc: 0.5356\n\nEpoch 00026: val_loss did not improve from 0.96785\nEpoch 27/100\n - 53s - loss: 1.4460 - acc: 0.5124 - val_loss: 1.2807 - val_acc: 0.5570\n\nEpoch 00027: val_loss did not improve from 0.96785\nEpoch 28/100\n - 60s - loss: 1.4613 - acc: 0.5112 - val_loss: 1.2505 - val_acc: 0.5740\n\nEpoch 00028: val_loss did not improve from 0.96785\nEpoch 29/100\n - 80s - loss: 1.4706 - acc: 0.5032 - val_loss: 1.5598 - val_acc: 0.4462\n\nEpoch 00029: val_loss did not improve from 0.96785\nEpoch 30/100\n - 79s - loss: 1.5003 - acc: 0.4970 - val_loss: 1.1695 - val_acc: 0.5842\n\nEpoch 00030: val_loss did not improve from 0.96785\nEpoch 31/100\n - 60s - loss: 1.5121 - acc: 0.4939 - val_loss: 1.2706 - val_acc: 0.5850\n\nEpoch 00031: val_loss did not improve from 0.96785\nEpoch 32/100\n - 71s - loss: 1.5207 - acc: 0.4872 - val_loss: 1.1488 - val_acc: 0.6032\n\nEpoch 00032: val_loss did not improve from 0.96785\nEpoch 33/100\n - 85s - loss: 1.5382 - acc: 0.4826 - val_loss: 1.3100 - val_acc: 0.5440\n\nEpoch 00033: val_loss did not improve from 0.96785\nEpoch 34/100\n - 78s - loss: 1.5507 - acc: 0.4763 - val_loss: 1.1904 - val_acc: 0.5924\n\nEpoch 00034: val_loss did not improve from 0.96785\nEpoch 35/100\n - 74s - loss: 1.5715 - acc: 0.4695 - val_loss: 1.4230 - val_acc: 0.5040\n\nEpoch 00035: val_loss did not improve from 0.96785\nEpoch 36/100\n - 71s - loss: 1.5849 - acc: 0.4636 - val_loss: 1.3997 - val_acc: 0.5286\n\nEpoch 00036: val_loss did not improve from 0.96785\nEpoch 37/100\n - 71s - loss: 1.6072 - acc: 0.4556 - val_loss: 1.2331 - val_acc: 0.5720\n\nEpoch 00037: val_loss did not improve from 0.96785\nEpoch 38/100\n - 76s - loss: 1.6077 - acc: 0.4545 - val_loss: 1.3933 - val_acc: 0.5222\n\nEpoch 00038: val_loss did not improve from 0.96785\nEpoch 39/100\n - 66s - loss: 1.6159 - acc: 0.4519 - val_loss: 1.4958 - val_acc: 0.4560\n\nEpoch 00039: val_loss did not improve from 0.96785\nEpoch 40/100\n - 80s - loss: 1.6509 - acc: 0.4409 - val_loss: 1.4325 - val_acc: 0.4758\n\nEpoch 00040: val_loss did not improve from 0.96785\nEpoch 41/100\n - 77s - loss: 1.6628 - acc: 0.4331 - val_loss: 1.3907 - val_acc: 0.5086\n\nEpoch 00041: val_loss did not improve from 0.96785\nEpoch 42/100\n - 91s - loss: 1.6651 - acc: 0.4336 - val_loss: 1.3285 - val_acc: 0.5428\n\nEpoch 00042: val_loss did not improve from 0.96785\nEpoch 43/100\n - 81s - loss: 1.6686 - acc: 0.4311 - val_loss: 1.3000 - val_acc: 0.5452\n\nEpoch 00043: val_loss did not improve from 0.96785\nEpoch 44/100\n - 51s - loss: 1.6724 - acc: 0.4278 - val_loss: 1.3552 - val_acc: 0.5390\n\nEpoch 00044: val_loss did not improve from 0.96785\nEpoch 45/100\n - 40s - loss: 1.6865 - acc: 0.4245 - val_loss: 1.3496 - val_acc: 0.5116\n\nEpoch 00045: val_loss did not improve from 0.96785\nEpoch 46/100\n - 40s - loss: 1.6878 - acc: 0.4194 - val_loss: 1.3678 - val_acc: 0.5272\n\nEpoch 00046: val_loss did not improve from 0.96785\nEpoch 47/100\n - 40s - loss: 1.6947 - acc: 0.4211 - val_loss: 1.3246 - val_acc: 0.5384\n\nEpoch 00047: val_loss did not improve from 0.96785\nEpoch 48/100\n - 41s - loss: 1.6874 - acc: 0.4209 - val_loss: 1.3495 - val_acc: 0.5438\n\nEpoch 00048: val_loss did not improve from 0.96785\nEpoch 49/100\n - 40s - loss: 1.6892 - acc: 0.4225 - val_loss: 1.3779 - val_acc: 0.5306\n\nEpoch 00049: val_loss did not improve from 0.96785\nEpoch 50/100\n - 41s - loss: 1.6878 - acc: 0.4168 - val_loss: 1.3686 - val_acc: 0.5306\n\nEpoch 00050: val_loss did not improve from 0.96785\nEpoch 51/100\n - 43s - loss: 1.6930 - acc: 0.4172 - val_loss: 1.2627 - val_acc: 0.5682\n\nEpoch 00051: val_loss did not improve from 0.96785\nEpoch 52/100\n - 43s - loss: 1.6996 - acc: 0.4125 - val_loss: 1.7034 - val_acc: 0.5202\n\nEpoch 00052: val_loss did not improve from 0.96785\nEpoch 53/100\n - 41s - loss: 1.6946 - acc: 0.4156 - val_loss: 1.3737 - val_acc: 0.5146\n\nEpoch 00053: val_loss did not improve from 0.96785\nEpoch 54/100\n - 41s - loss: 1.6955 - acc: 0.4132 - val_loss: 1.3678 - val_acc: 0.5176\n\nEpoch 00054: val_loss did not improve from 0.96785\nEpoch 55/100\n - 46s - loss: 1.7002 - acc: 0.4104 - val_loss: 1.3815 - val_acc: 0.5266\n\nEpoch 00055: val_loss did not improve from 0.96785\nEpoch 56/100\n - 44s - loss: 1.7032 - acc: 0.4108 - val_loss: 1.5053 - val_acc: 0.4550\n\nEpoch 00056: val_loss did not improve from 0.96785\nEpoch 57/100\n - 41s - loss: 1.7119 - acc: 0.4040 - val_loss: 1.4515 - val_acc: 0.4832\n"
]
],
[
[
"### 10. Load the Model with the Best Validation Accuracy",
"_____no_output_____"
]
],
[
[
"# load the weights that yielded the best validation accuracy\nmodel.load_weights('aug_model.weights.best.mine.hdf5')",
"_____no_output_____"
]
],
[
[
"### 11. Calculate Classification Accuracy on Test Set",
"_____no_output_____"
]
],
[
[
"# evaluate and print test accuracy\nscore = model.evaluate(x_test, y_test, verbose=0)\nprint('\\n', 'Test accuracy:', score[1])",
"\n Test accuracy: 0.6665\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0cabfa21d0f9e5c567386ed3a05200f8224df46 | 192,025 | ipynb | Jupyter Notebook | experiments/cnn_1/oracle.run1.framed/trials/8/trial.ipynb | stevester94/csc500-notebooks | 4c1b04c537fe233a75bed82913d9d84985a89177 | [
"MIT"
] | null | null | null | experiments/cnn_1/oracle.run1.framed/trials/8/trial.ipynb | stevester94/csc500-notebooks | 4c1b04c537fe233a75bed82913d9d84985a89177 | [
"MIT"
] | null | null | null | experiments/cnn_1/oracle.run1.framed/trials/8/trial.ipynb | stevester94/csc500-notebooks | 4c1b04c537fe233a75bed82913d9d84985a89177 | [
"MIT"
] | null | null | null | 111.448056 | 73,244 | 0.822783 | [
[
[
"import os, json, sys, time, random\nimport numpy as np\nimport torch\nfrom easydict import EasyDict\nfrom math import floor\nfrom easydict import EasyDict\n\nfrom steves_utils.vanilla_train_eval_test_jig import Vanilla_Train_Eval_Test_Jig\n\nfrom steves_utils.torch_utils import get_dataset_metrics, independent_accuracy_assesment\nfrom steves_models.configurable_vanilla import Configurable_Vanilla\nfrom steves_utils.torch_sequential_builder import build_sequential\nfrom steves_utils.lazy_map import Lazy_Map\nfrom steves_utils.sequence_aggregator import Sequence_Aggregator\n\nfrom steves_utils.stratified_dataset.traditional_accessor import Traditional_Accessor_Factory\n\nfrom steves_utils.cnn_do_report import (\n get_loss_curve,\n get_results_table,\n get_parameters_table,\n get_domain_accuracies,\n)\n\nfrom steves_utils.torch_utils import (\n confusion_by_domain_over_dataloader,\n independent_accuracy_assesment\n)\n\nfrom steves_utils.utils_v2 import (\n per_domain_accuracy_from_confusion,\n get_datasets_base_path\n)\n\n# from steves_utils.ptn_do_report import TBD",
"_____no_output_____"
],
[
"required_parameters = {\n \"experiment_name\",\n \"lr\",\n \"device\",\n \"dataset_seed\",\n \"seed\",\n \"labels\",\n \"domains_target\",\n \"domains_source\",\n \"num_examples_per_domain_per_label_source\",\n \"num_examples_per_domain_per_label_target\",\n \"batch_size\",\n \"n_epoch\",\n \"patience\",\n \"criteria_for_best\",\n \"normalize_source\",\n \"normalize_target\",\n \"x_net\",\n \"NUM_LOGS_PER_EPOCH\",\n \"BEST_MODEL_PATH\",\n \"pickle_name_source\",\n \"pickle_name_target\",\n \"torch_default_dtype\",\n}",
"_____no_output_____"
],
[
"from steves_utils.ORACLE.utils_v2 import (\n ALL_SERIAL_NUMBERS,\n ALL_DISTANCES_FEET_NARROWED,\n)\n\nstandalone_parameters = {}\nstandalone_parameters[\"experiment_name\"] = \"MANUAL CORES CNN\"\nstandalone_parameters[\"lr\"] = 0.0001\nstandalone_parameters[\"device\"] = \"cuda\"\n\nstandalone_parameters[\"dataset_seed\"] = 1337\nstandalone_parameters[\"seed\"] = 1337\nstandalone_parameters[\"labels\"] = ALL_SERIAL_NUMBERS\n\nstandalone_parameters[\"domains_source\"] = [8,32,50]\nstandalone_parameters[\"domains_target\"] = [14,20,26,38,44,]\n\nstandalone_parameters[\"num_examples_per_domain_per_label_source\"]=-1\nstandalone_parameters[\"num_examples_per_domain_per_label_target\"]=-1\n\nstandalone_parameters[\"pickle_name_source\"] = \"oracle.Run1_framed_2000Examples_stratified_ds.2022A.pkl\"\nstandalone_parameters[\"pickle_name_target\"] = \"oracle.Run2_framed_2000Examples_stratified_ds.2022A.pkl\"\n\nstandalone_parameters[\"torch_default_dtype\"] = \"torch.float32\" \n\nstandalone_parameters[\"batch_size\"]=128\n\nstandalone_parameters[\"n_epoch\"] = 3\n\nstandalone_parameters[\"patience\"] = 10\n\nstandalone_parameters[\"criteria_for_best\"] = \"target_accuracy\"\nstandalone_parameters[\"normalize_source\"] = False\nstandalone_parameters[\"normalize_target\"] = False\n\nstandalone_parameters[\"x_net\"] = [\n {\"class\": \"nnReshape\", \"kargs\": {\"shape\":[-1, 1, 2, 256]}},\n {\"class\": \"Conv2d\", \"kargs\": { \"in_channels\":1, \"out_channels\":256, \"kernel_size\":(1,7), \"bias\":False, \"padding\":(0,3), },},\n {\"class\": \"ReLU\", \"kargs\": {\"inplace\": True}},\n {\"class\": \"BatchNorm2d\", \"kargs\": {\"num_features\":256}},\n\n {\"class\": \"Conv2d\", \"kargs\": { \"in_channels\":256, \"out_channels\":80, \"kernel_size\":(2,7), \"bias\":True, \"padding\":(0,3), },},\n {\"class\": \"ReLU\", \"kargs\": {\"inplace\": True}},\n {\"class\": \"BatchNorm2d\", \"kargs\": {\"num_features\":80}},\n {\"class\": \"Flatten\", \"kargs\": {}},\n\n {\"class\": \"Linear\", \"kargs\": {\"in_features\": 80*256, \"out_features\": 256}}, # 80 units per IQ pair\n {\"class\": \"ReLU\", \"kargs\": {\"inplace\": True}},\n {\"class\": \"BatchNorm1d\", \"kargs\": {\"num_features\":256}},\n\n {\"class\": \"Linear\", \"kargs\": {\"in_features\": 256, \"out_features\": len(standalone_parameters[\"labels\"])}},\n]\n\nstandalone_parameters[\"NUM_LOGS_PER_EPOCH\"] = 10\nstandalone_parameters[\"BEST_MODEL_PATH\"] = \"./best_model.pth\"",
"_____no_output_____"
],
[
"# Parameters\nparameters = {\n \"experiment_name\": \"cnn_1:oracle.run1.framed\",\n \"labels\": [\n \"3123D52\",\n \"3123D65\",\n \"3123D79\",\n \"3123D80\",\n \"3123D54\",\n \"3123D70\",\n \"3123D7B\",\n \"3123D89\",\n \"3123D58\",\n \"3123D76\",\n \"3123D7D\",\n \"3123EFE\",\n \"3123D64\",\n \"3123D78\",\n \"3123D7E\",\n \"3124E4A\",\n ],\n \"domains_source\": [8, 32, 50],\n \"domains_target\": [14, 20, 26, 38, 44],\n \"pickle_name_source\": \"oracle.Run1_framed_2000Examples_stratified_ds.2022A.pkl\",\n \"pickle_name_target\": \"oracle.Run1_framed_2000Examples_stratified_ds.2022A.pkl\",\n \"device\": \"cuda\",\n \"lr\": 0.0001,\n \"batch_size\": 128,\n \"normalize_source\": False,\n \"normalize_target\": False,\n \"num_examples_per_domain_per_label_source\": -1,\n \"num_examples_per_domain_per_label_target\": -1,\n \"torch_default_dtype\": \"torch.float32\",\n \"n_epoch\": 50,\n \"patience\": 3,\n \"criteria_for_best\": \"target_accuracy\",\n \"x_net\": [\n {\"class\": \"nnReshape\", \"kargs\": {\"shape\": [-1, 1, 2, 256]}},\n {\n \"class\": \"Conv2d\",\n \"kargs\": {\n \"in_channels\": 1,\n \"out_channels\": 256,\n \"kernel_size\": [1, 7],\n \"bias\": False,\n \"padding\": [0, 3],\n },\n },\n {\"class\": \"ReLU\", \"kargs\": {\"inplace\": True}},\n {\"class\": \"BatchNorm2d\", \"kargs\": {\"num_features\": 256}},\n {\n \"class\": \"Conv2d\",\n \"kargs\": {\n \"in_channels\": 256,\n \"out_channels\": 80,\n \"kernel_size\": [2, 7],\n \"bias\": True,\n \"padding\": [0, 3],\n },\n },\n {\"class\": \"ReLU\", \"kargs\": {\"inplace\": True}},\n {\"class\": \"BatchNorm2d\", \"kargs\": {\"num_features\": 80}},\n {\"class\": \"Flatten\", \"kargs\": {}},\n {\"class\": \"Linear\", \"kargs\": {\"in_features\": 20480, \"out_features\": 256}},\n {\"class\": \"ReLU\", \"kargs\": {\"inplace\": True}},\n {\"class\": \"BatchNorm1d\", \"kargs\": {\"num_features\": 256}},\n {\"class\": \"Linear\", \"kargs\": {\"in_features\": 256, \"out_features\": 16}},\n ],\n \"NUM_LOGS_PER_EPOCH\": 10,\n \"BEST_MODEL_PATH\": \"./best_model.pth\",\n \"dataset_seed\": 1337,\n \"seed\": 1337,\n}\n",
"_____no_output_____"
],
[
"# Set this to True if you want to run this template directly\nSTANDALONE = False\nif STANDALONE:\n print(\"parameters not injected, running with standalone_parameters\")\n parameters = standalone_parameters\n\nif not 'parameters' in locals() and not 'parameters' in globals():\n raise Exception(\"Parameter injection failed\")\n\n#Use an easy dict for all the parameters\np = EasyDict(parameters)\n\nsupplied_keys = set(p.keys())\n\nif supplied_keys != required_parameters:\n print(\"Parameters are incorrect\")\n if len(supplied_keys - required_parameters)>0: print(\"Shouldn't have:\", str(supplied_keys - required_parameters))\n if len(required_parameters - supplied_keys)>0: print(\"Need to have:\", str(required_parameters - supplied_keys))\n raise RuntimeError(\"Parameters are incorrect\")\n\n",
"_____no_output_____"
],
[
"###################################\n# Set the RNGs and make it all deterministic\n###################################\nnp.random.seed(p.seed)\nrandom.seed(p.seed)\ntorch.manual_seed(p.seed)\n\ntorch.use_deterministic_algorithms(True) ",
"_____no_output_____"
],
[
"torch.set_default_dtype(eval(p.torch_default_dtype))",
"_____no_output_____"
],
[
"###################################\n# Build the network(s)\n# Note: It's critical to do this AFTER setting the RNG\n###################################\nx_net = build_sequential(p.x_net)",
"_____no_output_____"
],
[
"start_time_secs = time.time()",
"_____no_output_____"
],
[
"def wrap_in_dataloader(p, ds):\n return torch.utils.data.DataLoader(\n ds,\n batch_size=p.batch_size,\n shuffle=True,\n num_workers=1,\n persistent_workers=True,\n prefetch_factor=50,\n pin_memory=True\n )\n\ntaf_source = Traditional_Accessor_Factory(\n labels=p.labels,\n domains=p.domains_source,\n num_examples_per_domain_per_label=p.num_examples_per_domain_per_label_source,\n pickle_path=os.path.join(get_datasets_base_path(), p.pickle_name_source),\n seed=p.dataset_seed\n)\ntrain_original_source, val_original_source, test_original_source = \\\n taf_source.get_train(), taf_source.get_val(), taf_source.get_test()\n\n\ntaf_target = Traditional_Accessor_Factory(\n labels=p.labels,\n domains=p.domains_target,\n num_examples_per_domain_per_label=p.num_examples_per_domain_per_label_source,\n pickle_path=os.path.join(get_datasets_base_path(), p.pickle_name_target),\n seed=p.dataset_seed\n)\ntrain_original_target, val_original_target, test_original_target = \\\n taf_target.get_train(), taf_target.get_val(), taf_target.get_test()\n\n\n# For CNN We only use X and Y. And we only train on the source.\n# Properly form the data using a transform lambda and Lazy_Map. Finally wrap them in a dataloader\n\ntransform_lambda = lambda ex: ex[:2] # Strip the tuple to just (x,y)\n\n\ntrain_processed_source = wrap_in_dataloader(\n p,\n Lazy_Map(train_original_source, transform_lambda)\n)\nval_processed_source = wrap_in_dataloader(\n p,\n Lazy_Map(val_original_source, transform_lambda)\n)\ntest_processed_source = wrap_in_dataloader(\n p,\n Lazy_Map(test_original_source, transform_lambda)\n)\n\ntrain_processed_target = wrap_in_dataloader(\n p,\n Lazy_Map(train_original_target, transform_lambda)\n)\nval_processed_target = wrap_in_dataloader(\n p,\n Lazy_Map(val_original_target, transform_lambda)\n)\ntest_processed_target = wrap_in_dataloader(\n p,\n Lazy_Map(test_original_target, transform_lambda)\n)\n\n\n\ndatasets = EasyDict({\n \"source\": {\n \"original\": {\"train\":train_original_source, \"val\":val_original_source, \"test\":test_original_source},\n \"processed\": {\"train\":train_processed_source, \"val\":val_processed_source, \"test\":test_processed_source}\n },\n \"target\": {\n \"original\": {\"train\":train_original_target, \"val\":val_original_target, \"test\":test_original_target},\n \"processed\": {\"train\":train_processed_target, \"val\":val_processed_target, \"test\":test_processed_target}\n },\n})",
"_____no_output_____"
],
[
"ep = next(iter(test_processed_target))\nep[0].dtype",
"_____no_output_____"
],
[
"model = Configurable_Vanilla(\n x_net=x_net,\n label_loss_object=torch.nn.NLLLoss(),\n learning_rate=p.lr\n)",
"_____no_output_____"
],
[
"jig = Vanilla_Train_Eval_Test_Jig(\n model=model,\n path_to_best_model=p.BEST_MODEL_PATH,\n device=p.device,\n label_loss_object=torch.nn.NLLLoss(),\n)\n\njig.train(\n train_iterable=datasets.source.processed.train,\n source_val_iterable=datasets.source.processed.val,\n target_val_iterable=datasets.target.processed.val,\n patience=p.patience,\n num_epochs=p.n_epoch,\n num_logs_per_epoch=p.NUM_LOGS_PER_EPOCH,\n criteria_for_best=p.criteria_for_best\n)",
"epoch: 1, [batch: 1 / 525], examples_per_second: 814.0396, train_label_loss: 2.7947, \n"
],
[
"total_experiment_time_secs = time.time() - start_time_secs",
"_____no_output_____"
],
[
"source_test_label_accuracy, source_test_label_loss = jig.test(datasets.source.processed.test)\ntarget_test_label_accuracy, target_test_label_loss = jig.test(datasets.target.processed.test)\n\nsource_val_label_accuracy, source_val_label_loss = jig.test(datasets.source.processed.val)\ntarget_val_label_accuracy, target_val_label_loss = jig.test(datasets.target.processed.val)\n\nhistory = jig.get_history()\n\ntotal_epochs_trained = len(history[\"epoch_indices\"])\n\nval_dl = wrap_in_dataloader(p, Sequence_Aggregator((datasets.source.original.val, datasets.target.original.val)))\n\nconfusion = confusion_by_domain_over_dataloader(model, p.device, val_dl, forward_uses_domain=False)\nper_domain_accuracy = per_domain_accuracy_from_confusion(confusion)\n\n# Add a key to per_domain_accuracy for if it was a source domain\nfor domain, accuracy in per_domain_accuracy.items():\n per_domain_accuracy[domain] = {\n \"accuracy\": accuracy,\n \"source?\": domain in p.domains_source\n }\n\n# Do an independent accuracy assesment JUST TO BE SURE!\n# _source_test_label_accuracy = independent_accuracy_assesment(model, datasets.source.processed.test, p.device)\n# _target_test_label_accuracy = independent_accuracy_assesment(model, datasets.target.processed.test, p.device)\n# _source_val_label_accuracy = independent_accuracy_assesment(model, datasets.source.processed.val, p.device)\n# _target_val_label_accuracy = independent_accuracy_assesment(model, datasets.target.processed.val, p.device)\n\n# assert(_source_test_label_accuracy == source_test_label_accuracy)\n# assert(_target_test_label_accuracy == target_test_label_accuracy)\n# assert(_source_val_label_accuracy == source_val_label_accuracy)\n# assert(_target_val_label_accuracy == target_val_label_accuracy)\n\n###################################\n# Write out the results\n###################################\n\nexperiment = {\n \"experiment_name\": p.experiment_name,\n \"parameters\": p,\n \"results\": {\n \"source_test_label_accuracy\": source_test_label_accuracy,\n \"source_test_label_loss\": source_test_label_loss,\n \"target_test_label_accuracy\": target_test_label_accuracy,\n \"target_test_label_loss\": target_test_label_loss,\n \"source_val_label_accuracy\": source_val_label_accuracy,\n \"source_val_label_loss\": source_val_label_loss,\n \"target_val_label_accuracy\": target_val_label_accuracy,\n \"target_val_label_loss\": target_val_label_loss,\n \"total_epochs_trained\": total_epochs_trained,\n \"total_experiment_time_secs\": total_experiment_time_secs,\n \"confusion\": confusion,\n \"per_domain_accuracy\": per_domain_accuracy,\n },\n \"history\": history,\n \"dataset_metrics\": get_dataset_metrics(datasets, \"cnn\"),\n}",
"_____no_output_____"
],
[
"get_loss_curve(experiment)",
"_____no_output_____"
],
[
"get_results_table(experiment)",
"_____no_output_____"
],
[
"get_domain_accuracies(experiment)",
"_____no_output_____"
],
[
"print(\"Source Test Label Accuracy:\", experiment[\"results\"][\"source_test_label_accuracy\"], \"Target Test Label Accuracy:\", experiment[\"results\"][\"target_test_label_accuracy\"])\nprint(\"Source Val Label Accuracy:\", experiment[\"results\"][\"source_val_label_accuracy\"], \"Target Val Label Accuracy:\", experiment[\"results\"][\"target_val_label_accuracy\"])",
"Source Test Label Accuracy: 0.9120833333333334 Target Test Label Accuracy: 0.083875\nSource Val Label Accuracy: 0.9145138888888888 Target Val Label Accuracy: 0.08370833333333333\n"
],
[
"json.dumps(experiment)",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cb0d3d2c7016ed677ff7cdfa320e1147256a18 | 18,266 | ipynb | Jupyter Notebook | NYC_CitiBike_Challenge.ipynb | rmchartman/Bike_Sharing | 2e77083d3a90cf7bd6c43b93c710994798558bd3 | [
"MIT"
] | null | null | null | NYC_CitiBike_Challenge.ipynb | rmchartman/Bike_Sharing | 2e77083d3a90cf7bd6c43b93c710994798558bd3 | [
"MIT"
] | null | null | null | NYC_CitiBike_Challenge.ipynb | rmchartman/Bike_Sharing | 2e77083d3a90cf7bd6c43b93c710994798558bd3 | [
"MIT"
] | null | null | null | 36.242063 | 91 | 0.391438 | [
[
[
"import pandas as pd",
"_____no_output_____"
],
[
"# 1. Create a DataFrame for the 201908-citibike-tripdata data. \ncitibike = pd.DataFrame(pd.read_csv('201908-citibike-tripdata.csv'))\ncitibike.head()",
"_____no_output_____"
],
[
"# 2. Check the datatypes of your columns. \ncitibike.dtypes",
"_____no_output_____"
],
[
"# 3. Convert the 'tripduration' column to datetime datatype.\ncitibike['tripduration'] = pd.to_datetime(citibike['tripduration'], unit='m')",
"_____no_output_____"
],
[
"# 4. Check the datatypes of your columns. \ncitibike.dtypes",
"_____no_output_____"
],
[
"citibike.head()",
"_____no_output_____"
],
[
"# 5. Export the Dataframe as a new CSV file without the index.\ncitibike.to_csv('citibike_modified.csv', index = False)",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cb2ad8b8b841e6cefca032e9bbfd8bd665bd37 | 263,793 | ipynb | Jupyter Notebook | 16-Introducing-Scikit-Learn.ipynb | Jeff0603/Deep-Learning-in-Computer-Vision | 222320cb06907c91e05d40daed7552bfb9b6d2dd | [
"MIT"
] | 2 | 2020-07-24T03:07:06.000Z | 2020-07-24T03:07:35.000Z | 16-Introducing-Scikit-Learn.ipynb | Jeff0603/Deep-Learning-in-Computer-Vision | 222320cb06907c91e05d40daed7552bfb9b6d2dd | [
"MIT"
] | null | null | null | 16-Introducing-Scikit-Learn.ipynb | Jeff0603/Deep-Learning-in-Computer-Vision | 222320cb06907c91e05d40daed7552bfb9b6d2dd | [
"MIT"
] | null | null | null | 101.186421 | 155,362 | 0.803353 | [
[
[
"# Introducing Scikit-Learn",
"_____no_output_____"
],
[
"There are several Python libraries which provide solid implementations of a range of machine learning algorithms.\nOne of the best known is [Scikit-Learn](http://scikit-learn.org), a package that provides efficient versions of a large number of common algorithms.\nScikit-Learn is characterized by a clean, uniform, and streamlined API, as well as by very useful and complete [online documentation](https://scikit-learn.org/stable/documentation.html).\nA benefit of this uniformity is that once you understand the basic use and syntax of Scikit-Learn for one type of model, switching to a new model or algorithm is very straightforward.\n\nThis section provides an overview of the Scikit-Learn API.\n\nWe will start by covering *data representation* in Scikit-Learn, followed by covering the *Estimator* API, and finally go through a couple examples.",
"_____no_output_____"
],
[
"## Data Representation in Scikit-Learn",
"_____no_output_____"
],
[
"Machine learning is about creating models from data: for that reason, we'll start by discussing how data can be represented in order to be understood by the computer.\nThe best way to think about data within Scikit-Learn is in terms of tables of data.",
"_____no_output_____"
],
[
"### Data as table\n\nA basic table is a two-dimensional grid of data, in which the rows represent individual elements of the dataset, and the columns represent quantities related to each of these elements.\nFor example, consider the [Iris dataset](https://en.wikipedia.org/wiki/Iris_flower_data_set), famously analyzed by Ronald Fisher in 1936.\nWe can download this dataset in the form of a Pandas ``DataFrame`` using the [seaborn](http://seaborn.pydata.org/) library:",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport numpy as np\nfrom IPython.display import Pretty as disp\nhint = 'https://raw.githubusercontent.com/soltaniehha/Business-Analytics/master/docs/hints/' # path to hints on GitHub\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n%matplotlib inline\nsns.set(rc={'figure.figsize':(10,8)}) # Figure size",
"/usr/local/lib/python3.6/dist-packages/statsmodels/tools/_testing.py:19: FutureWarning: pandas.util.testing is deprecated. Use the functions in the public API at pandas.testing instead.\n import pandas.util.testing as tm\n"
],
[
"iris = sns.load_dataset('iris')\niris.head()",
"_____no_output_____"
]
],
[
[
"<img src=\"https://github.com/soltaniehha/Business-Analytics/blob/master/figs/11-01-Petal-sepal.jpg?raw=true\" width=\"300\" align=\"center\"/>",
"_____no_output_____"
]
],
[
[
"iris.species.unique()",
"_____no_output_____"
]
],
[
[
"Here each row of the data refers to a single observed flower, and the number of rows is the total number of flowers in the dataset.\nIn general, we will refer to the rows of the matrix as *samples*, and the number of rows as ``n_samples``.\n\nLikewise, each column of the data refers to a particular quantitative piece of information that describes each sample.\nIn general, we will refer to the columns of the matrix as *features*, and the number of columns as ``n_features``.",
"_____no_output_____"
],
[
"#### Features matrix\n\nThis table layout makes clear that the information can be thought of as a two-dimensional numerical array or matrix, which we will call the *features matrix*.\nBy convention, this features matrix is often stored in a variable named ``X``.\nThe features matrix is assumed to be two-dimensional, with shape ``[n_samples, n_features]``, and is most often contained in a NumPy array or a Pandas ``DataFrame``.\n\nThe samples (i.e., rows) always refer to the individual objects described by the dataset.\nFor example, the sample might be a flower, a person, a document, an image, a sound file, a video, an astronomical object, or anything else you can describe with a set of quantitative measurements.\n\nThe features (i.e., columns) always refer to the distinct observations that describe each sample in a quantitative manner.\nFeatures are generally real-valued, but may be Boolean or discrete-valued in some cases.",
"_____no_output_____"
],
[
"#### Target array\n\nIn addition to the feature matrix ``X``, we also generally work with a *label* or *target* array, which by convention we will usually call ``y``.\nThe target array is usually one dimensional, with length ``n_samples``, and is generally contained in a NumPy array or Pandas ``Series``.\nThe target array may have continuous numerical values, or discrete classes/labels.\n\nOften one point of confusion is how the target array differs from the other features columns. The distinguishing feature of the target array is that it is usually the quantity we want to *predict from the data*: in statistical terms, it is the dependent variable.\nFor example, in the preceding data we may wish to construct a model that can predict the species of flower based on the other measurements; in this case, the ``species`` column would be considered the target array.\n\nWith this target array in mind, we can use Seaborn to conveniently visualize the data:",
"_____no_output_____"
]
],
[
[
"sns.pairplot(iris, hue='species', height=2.5);",
"_____no_output_____"
]
],
[
[
"For use in Scikit-Learn, we will extract the features matrix and target array from the ``DataFrame``, which we can do using some of the Pandas ``DataFrame`` operations we've learned:",
"_____no_output_____"
]
],
[
[
"X_iris = iris.drop('species', axis=1)\nX_iris.shape",
"_____no_output_____"
],
[
"y_iris = iris['species']\ny_iris.shape",
"_____no_output_____"
]
],
[
[
"To summarize, the expected layout of features and target values is visualized in the following diagram:",
"_____no_output_____"
],
[
"<img src=\"https://github.com/soltaniehha/Business-Analytics/blob/master/figs/11-01-samples-features.png?raw=true\" width=\"700\" align=\"center\"/>",
"_____no_output_____"
],
[
"With this data properly formatted, we can move on to consider the *estimator* API of Scikit-Learn:",
"_____no_output_____"
],
[
"## Scikit-Learn's Estimator API",
"_____no_output_____"
],
[
"The Scikit-Learn API is designed with the following guiding principles in mind, as outlined in the [Scikit-Learn API paper(2013)](http://arxiv.org/abs/1309.0238):\n\n- *Consistency*: All objects share a common interface drawn from a limited set of methods, with consistent documentation.\n\n- *Inspection*: All specified parameter values are exposed as public attributes.\n\n- *Limited object hierarchy*: Only algorithms are represented by Python classes; datasets are represented\n in standard formats (NumPy arrays, Pandas ``DataFrame``s) and parameter\n names use standard Python strings.\n\n- *Composition*: Many machine learning tasks can be expressed as sequences of more fundamental algorithms,\n and Scikit-Learn makes use of this wherever possible.\n\n- *Sensible defaults*: When models require user-specified parameters, the library defines an appropriate default value.\n\nIn practice, these principles make Scikit-Learn very easy to use, once the basic principles are understood.\nEvery machine learning algorithm in Scikit-Learn is implemented via the Estimator API, which provides a consistent interface for a wide range of machine learning applications.",
"_____no_output_____"
],
[
"### Basics of the API\n\nMost commonly, the steps in using the Scikit-Learn estimator API are as follows\n(we will step through a couple of detailed examples in the sections that follow).\n\n1. Choose a class of model by importing the appropriate estimator class from Scikit-Learn.\n2. Choose model hyperparameters by instantiating this class with desired values.\n3. Arrange data into a features matrix and target vector following the discussion above.\n4. Fit the model to your data by calling the ``fit()`` method of the model instance.\n5. Apply the Model to new data:\n - For supervised learning, often we predict labels for unknown data using the ``predict()`` method.\n - For unsupervised learning, we often transform or infer properties of the data using the ``transform()`` or ``predict()`` method.\n\nWe will now step through simple examples of applying supervised learning methods.",
"_____no_output_____"
],
[
"### Supervised learning example: Simple linear regression\n\nAs an example of this process, let's consider a simple linear regression—that is, the common case of fitting a line to $(x, y)$ data.\nWe will use the following columns from `iris` for our regression example: `petal_width` & `petal_length`",
"_____no_output_____"
]
],
[
[
"X = iris[['petal_width']]\ny = iris[['petal_length']]\nplt.scatter(X, y);",
"_____no_output_____"
]
],
[
[
"With this data in place, we can use the recipe outlined earlier. Let's walk through the process: ",
"_____no_output_____"
],
[
"#### 1. Choose a class of model\n\nIn Scikit-Learn, every class of model is represented by a Python class.\nSo, for example, if we would like to compute a simple linear regression model, we can import the linear regression class:",
"_____no_output_____"
]
],
[
[
"from sklearn.linear_model import LinearRegression",
"_____no_output_____"
]
],
[
[
"Note that other more general linear regression models exist as well; you can read more about them in the [``sklearn.linear_model`` module documentation](http://Scikit-Learn.org/stable/modules/linear_model.html).",
"_____no_output_____"
],
[
"#### 2. Choose model hyperparameters\n\nAn important point is that *a class of model is not the same as an instance of a model*.\n\nOnce we have decided on our model class, there are still some options open to us.\nDepending on the model class we are working with, we might need to answer one or more questions like the following:\n\n- Would we like to fit for the offset (i.e., *y*-intercept)?\n- Would we like the model to be normalized?\n- Would we like to preprocess our features to add model flexibility?\n- What degree of regularization would we like to use in our model?\n- How many model components would we like to use?\n\nThese are examples of the important choices that must be made *once the model class is selected*.\nThese choices are often represented as *hyperparameters*, or parameters that must be set before the model is fit to data.\nIn Scikit-Learn, hyperparameters are chosen by passing values at model instantiation.\n\nFor our linear regression example, we can instantiate the ``LinearRegression`` class and specify that we would like to fit the intercept using the ``fit_intercept`` hyperparameter:",
"_____no_output_____"
]
],
[
[
"model = LinearRegression(fit_intercept=True)\nmodel",
"_____no_output_____"
]
],
[
[
"Keep in mind that when the model is instantiated, the only action is the storing of these hyperparameter values.\nIn particular, we have not yet applied the model to any data: the Scikit-Learn API makes very clear the distinction between *choice of model* and *application of model to data*.",
"_____no_output_____"
],
[
"#### 3. Arrange data into a features matrix and target vector\n\nPreviously we detailed the Scikit-Learn data representation, which requires a two-dimensional features matrix and a one-dimensional target array.\nHere our target variable ``y`` is already in the correct form (a length-``n_samples`` array). Our features matrix is also in the right shape since we only have 1 feature it is a matrix of size ``[n_samples, n_features]``.\nLet's check the shapes:",
"_____no_output_____"
]
],
[
[
"print(X.shape)\nprint(y.shape)",
"(150, 1)\n(150, 1)\n"
]
],
[
[
"#### 4. Fit the model to your data\n\nNow it is time to apply our model to data.\nThis can be done with the ``fit()`` method of the model:",
"_____no_output_____"
]
],
[
[
"model.fit(X, y)",
"_____no_output_____"
]
],
[
[
"This ``fit()`` command causes a number of model-dependent internal computations to take place, and the results of these computations are stored in model-specific attributes that the user can explore.\nIn Scikit-Learn, by convention all model parameters that were learned during the ``fit()`` process have trailing underscores; for example in this linear model, we have the following:",
"_____no_output_____"
]
],
[
[
"model.coef_",
"_____no_output_____"
],
[
"model.intercept_",
"_____no_output_____"
]
],
[
[
"These two parameters represent the slope and intercept of the simple linear fit to the data.\nComparing to the data definition, we see that they are very close to the input slope of 2.2 and intercept of 1.\n\nOne question that frequently comes up regards the uncertainty in such internal model parameters.\nIn general, Scikit-Learn does not provide tools to draw conclusions from internal model parameters themselves: interpreting model parameters is much more a *statistical modeling* question than a *machine learning* question.\nMachine learning rather focuses on what the model *predicts*.\nIf you would like to dive into the meaning of fit parameters within the model, other tools are available, including the [Statsmodels Python package](http://statsmodels.sourceforge.net/).",
"_____no_output_____"
],
[
"#### 5. Predict labels for unknown data\n\nOnce the model is trained, the main task of supervised machine learning is to evaluate it based on what it says about new data that was not part of the training set.\nIn Scikit-Learn, this can be done using the ``predict()`` method.\nFor the sake of this example, our \"new data\" will be a grid of `x` values, and we will ask what `y` values the model predicts:",
"_____no_output_____"
]
],
[
[
"xfit = np.linspace(0, 2.5)\nxfit = pd.DataFrame(xfit)\nxfit.shape",
"_____no_output_____"
]
],
[
[
"We have coerced these *x* values into a ``[n_samples, n_features]`` features matrix, after which we can feed it to the model:",
"_____no_output_____"
]
],
[
[
"yfit = model.predict(xfit)",
"_____no_output_____"
]
],
[
[
"Finally, let's visualize the results by plotting first the raw data, and then this model fit:",
"_____no_output_____"
]
],
[
[
"plt.scatter(X, y)\nplt.plot(xfit, yfit, c='gray')\nplt.xlabel('petal_width')\nplt.ylabel('petal_length');",
"_____no_output_____"
]
],
[
[
"Typically the efficacy of the model is evaluated by comparing its results to some known baseline, as we will see in the next example",
"_____no_output_____"
],
[
"### Supervised learning example: Iris classification\n\nLet's take a look at another example of this process, using the Iris dataset we discussed earlier.\nOur question will be this: given a model trained on a portion of the Iris data, how well can we predict the remaining labels?\n\nFor this task, we will use an extremely simple generative model known as Gaussian naive Bayes, which proceeds by assuming each class is drawn from an axis-aligned Gaussian distribution.\nBecause it is so fast and has no hyperparameters to choose, Gaussian naive Bayes is often a good model to use as a baseline classification, before exploring whether improvements can be found through more sophisticated models.\n\nWe would like to evaluate the model on data it has not seen before, and so we will split the data into a *training set* and a *testing set*.\nThis could be done by hand, but it is more convenient to use the ``train_test_split`` utility function:",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import train_test_split\n\nXtrain, Xtest, ytrain, ytest = train_test_split(X_iris, y_iris, test_size=0.3, random_state=833)",
"_____no_output_____"
]
],
[
[
"With the data arranged, we can follow our recipe to predict the labels:",
"_____no_output_____"
]
],
[
[
"from sklearn.naive_bayes import GaussianNB # 1. choose model class\nmodel = GaussianNB() # 2. instantiate model\nmodel.fit(Xtrain, ytrain) # 3. fit model to data\ny_model = model.predict(Xtest) # 4. predict on new data",
"_____no_output_____"
]
],
[
[
"Finally, we can use the ``accuracy_score`` utility to see the fraction of predicted labels that match their true value:",
"_____no_output_____"
]
],
[
[
"from sklearn.metrics import accuracy_score\naccuracy_score(ytest, y_model)",
"_____no_output_____"
]
],
[
[
"With an accuracy topping 93%, we see that even this very naive classification algorithm is effective for this particular dataset!\n\nTo learn more about Gaussian naive Bayes check out [this YouTube video](https://www.youtube.com/watch?v=r1in0YNetG8).",
"_____no_output_____"
],
[
"# Your Turn\nFor this exercise we are going to make some predictions using Telco customer churn data. Our goal is to make a simple model that can predict whether a customer will churn or not based on the historical data. We will follow the steps above.\n\nBut first, let's load the data:",
"_____no_output_____"
]
],
[
[
"df = pd.read_csv('https://raw.githubusercontent.com/soltaniehha/Business-Analytics/master/data/Telco-Customer-Churn.csv')\ndf.head(3)",
"_____no_output_____"
]
],
[
[
"Column `TotalCharges` has 11 rows with an empty string (\" \"). Replace these values by `0` as they represent new customers that haven't received a bill yet. Once you replaced the values, convert that column to a `float32` data type.",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-TotalCharges')",
"_____no_output_____"
]
],
[
[
"If we check the `df.info()` now we should see that `TotalCharges` is now a `float32`:",
"_____no_output_____"
]
],
[
[
"df.info()",
"<class 'pandas.core.frame.DataFrame'>\nRangeIndex: 7043 entries, 0 to 7042\nData columns (total 21 columns):\n # Column Non-Null Count Dtype \n--- ------ -------------- ----- \n 0 customerID 7043 non-null object \n 1 gender 7043 non-null object \n 2 SeniorCitizen 7043 non-null int64 \n 3 Partner 7043 non-null object \n 4 Dependents 7043 non-null object \n 5 tenure 7043 non-null int64 \n 6 PhoneService 7043 non-null object \n 7 MultipleLines 7043 non-null object \n 8 InternetService 7043 non-null object \n 9 OnlineSecurity 7043 non-null object \n 10 OnlineBackup 7043 non-null object \n 11 DeviceProtection 7043 non-null object \n 12 TechSupport 7043 non-null object \n 13 StreamingTV 7043 non-null object \n 14 StreamingMovies 7043 non-null object \n 15 Contract 7043 non-null object \n 16 PaperlessBilling 7043 non-null object \n 17 PaymentMethod 7043 non-null object \n 18 MonthlyCharges 7043 non-null float64\n 19 TotalCharges 7043 non-null float32\n 20 Churn 7043 non-null object \ndtypes: float32(1), float64(1), int64(2), object(17)\nmemory usage: 1.1+ MB\n"
]
],
[
[
"Before we get to splitting our dataset into train/test we would have to make sure all of our values are numerical as most of ML algorithms work with numerical values only. \n\n### How to Convert Categorical Data to Numerical Data?\nIn order to do this we have to convert all of the categorical variables to numerical values. This can be done with a process called one-hot encoding. Take the \"Churn\" column as an example. We have two unique values: \"Yes\"/\"No\". One-hot encoding will create two variables, one called `Churn_Yes` and the other one `Churn_No`. We will go from\n\n| Churn |\n|--|\n|Yes|\n|No|\n|Yes|\n|...|\n\nto\n\n|Churn_Yes | Churn_No |\n|--|--|\n|1|0|\n|0|1|\n|1|0|\n|...|...|\n\nAs you can see, having two variables is redundant since they mirror each other. So, in any one-hot encoding scenario, we need `n-1` variables for a categorical variable that had `n` categories.\n\nBelow, we will use a *pandas* function called `get_dummies()`. If we want *pandas* to automcatically drop one of the extra variables for us we use the `drop_first=True` argument. ",
"_____no_output_____"
]
],
[
[
"churn_df = df.drop('customerID', axis=1) # dropping customerID as it doesn't have any predictive power\ndf_dummified = pd.get_dummies(churn_df, drop_first=True) # One-hot encoding\ndf_dummified.rename(columns={'Churn_Yes': 'Churn'}, inplace=True) # renaming Churn_Yes to Churn\ndf_dummified.head()",
"_____no_output_____"
]
],
[
[
"Using `df_dummified` dataframe, create two dataframes for features matrix and target vector and call them `X_df` and `y_df` respectively:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n# X_df\n",
"_____no_output_____"
],
[
"# Your answer goes here\n# y_df\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-X_df-y_df')",
"_____no_output_____"
]
],
[
[
"Check their shape:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"X_df: (7043, 30)\ny_df: (7043,)\n"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-shape')",
"_____no_output_____"
]
],
[
[
"From `X_df` and `y_df` create the train/test splits. \n* Set 30% of the data to test and the remainder to train. \n* Use `random_state=833`, so you get the same result as in the notebook. \n* Name the resulting objects: `Xtrain`, `Xtest`, `ytrain`, `ytest`.",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-split')",
"_____no_output_____"
]
],
[
[
"From `sklearn.naive_bayes` import `GaussianNB`:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-import')",
"_____no_output_____"
]
],
[
[
"Instantiate a `GaussianNB` model and call it `model`:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-model')",
"_____no_output_____"
]
],
[
[
"Fit model to data:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-fit')",
"_____no_output_____"
]
],
[
[
"Now let's make some predictions. Use the `Xtest` feature dataframe to predict whether these customers are churning or not. Call the outcome (predictions) `y_model`:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-predict')",
"_____no_output_____"
]
],
[
[
"Accuracy is not the most reliable metric when it comes to evaluating classification algorithms, but it's one of the most simple ones. Let's calculate it below:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"Our model is 0.65 accurate!\n"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-accuracy')",
"_____no_output_____"
]
],
[
[
"### Is this model any good? \n\nIf we had said no one will churn, what the accuracy would have been?\n\nWe would have identified all the ones who didn't churn correctly, but missed all the ones who did actually churn. Let's calculate the accuracy for this simplistic model below:\n\nhint: all you need to work with is `ytest`",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-accuracy-base')",
"_____no_output_____"
]
],
[
[
"So, after all our ML model is not that great. But the scope of this exercise is not to fine-tune this model, but understand the pipeline and how to read the outcome. Let's continue with some simple questions.",
"_____no_output_____"
],
[
"How many people did we have in the test dataset? \n\nSave it to a variable called `n_test`:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-test-size')",
"_____no_output_____"
]
],
[
[
"How many of these customers churned? \n\nSave it to a variable and call it `P`:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-churned')",
"_____no_output_____"
]
],
[
[
"How many true positives did the model generate? (True positive = correctly identified in the \"positive\" class. Take \"Yes\" as the positive class).\n\nSave it to a variable and call it `TP`:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-TP')",
"_____no_output_____"
]
],
[
[
"What is the true positive rate (or sensitivity)?\n\n**Sensitivity** (also called the **true positive rate (TPR)**, the recall, or probability of detection in some fields) measures the proportion of actual positives that are correctly identified as such (e.g., the percentage of sick people who are correctly identified as having the condition). ~Wikipedia\n\n$TPR=\\frac{TP}{P}$, where $TP$ is ture positives and $P$ is count of all positives.",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-sensitivity')",
"_____no_output_____"
]
],
[
[
"How many of the customers in the test set didn't churn?\n\nSave it to `N`:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-N')",
"_____no_output_____"
]
],
[
[
"How many true negatives did the model generate? (True negative = correctly rejected). \nSave a to a variable and call it `TN`:",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-TN')",
"_____no_output_____"
]
],
[
[
"What is the true negative rate (or specificity)?\n\n**Specificity** (also called the **true negative rate**) measures the proportion of actual negatives that are correctly identified as such (e.g., the percentage of healthy people who are correctly identified as not having the condition). ~Wikipedia\n\n$TNR=\\frac{TN}{N}$, where $TN$ is ture negatives and $N$ is count of all negatives.",
"_____no_output_____"
]
],
[
[
"# Your answer goes here\n",
"_____no_output_____"
],
[
"# SOLUTION: Uncomment and execute the cell below to get help\n#disp(hint + '09-02-specificity')",
"_____no_output_____"
]
],
[
[
"You may check out [this Wikipedia page](https://en.wikipedia.org/wiki/Sensitivity_and_specificity) for more info on sensitivity and specificity.",
"_____no_output_____"
],
[
"<img src=\"https://github.com/soltaniehha/Business-Analytics/blob/master/figs/09-02-sensitivity.png?raw=true\" width=\"400\" align=\"center\"/>",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
]
] |
d0cb3cb3ecda3c65921fa2da2e4e16d6231d36ef | 76,494 | ipynb | Jupyter Notebook | credit risk evaluator.ipynb | jorgeaserrano/Supervised-Machine-Learning | 408a8a1fa788caa55fb110bd28160592a3112e9a | [
"ADSL"
] | null | null | null | credit risk evaluator.ipynb | jorgeaserrano/Supervised-Machine-Learning | 408a8a1fa788caa55fb110bd28160592a3112e9a | [
"ADSL"
] | null | null | null | credit risk evaluator.ipynb | jorgeaserrano/Supervised-Machine-Learning | 408a8a1fa788caa55fb110bd28160592a3112e9a | [
"ADSL"
] | null | null | null | 38.613831 | 216 | 0.326548 | [
[
[
"# Import Dependencies\nimport numpy as np\nimport pandas as pd\nfrom pathlib import Path\n\n# Processing Libraries\nfrom sklearn.preprocessing import StandardScaler, LabelEncoder\n\n# Models\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.ensemble import RandomForestClassifier",
"_____no_output_____"
]
],
[
[
"### Predictions\nI believe the Logistic Regression model will perform better than the Random Forest Classifier as the data is not randomized.\n\nHow about after scaling the data?\nI expect the Logistic Regression to perform better on the scaled data. In this particular case, the Logistic Regression is the appropriate regression analysis to conduct as the dependent variable are binary.\n\nConclusion\nAs expected, the Logistic Regression performed better than the Random Forest Classifier. ",
"_____no_output_____"
]
],
[
[
"# Retrieving the datasets\ntrain_df = pd.read_csv(\"Resources/2019loans.csv\")\ntest_df = pd.read_csv(\"Resources/2020Q1loans.csv\")",
"_____no_output_____"
],
[
"# Processing the Data\nX_train_dummies = pd.get_dummies(train_df)\nprint(X_train_dummies.columns)\nX_train_dummies",
"Index(['Unnamed: 0', 'index', 'loan_amnt', 'int_rate', 'installment',\n 'annual_inc', 'dti', 'delinq_2yrs', 'inq_last_6mths', 'open_acc',\n 'pub_rec', 'revol_bal', 'total_acc', 'out_prncp', 'out_prncp_inv',\n 'total_pymnt', 'total_pymnt_inv', 'total_rec_prncp', 'total_rec_int',\n 'total_rec_late_fee', 'recoveries', 'collection_recovery_fee',\n 'last_pymnt_amnt', 'collections_12_mths_ex_med', 'policy_code',\n 'acc_now_delinq', 'tot_coll_amt', 'tot_cur_bal', 'open_acc_6m',\n 'open_act_il', 'open_il_12m', 'open_il_24m', 'mths_since_rcnt_il',\n 'total_bal_il', 'il_util', 'open_rv_12m', 'open_rv_24m', 'max_bal_bc',\n 'all_util', 'total_rev_hi_lim', 'inq_fi', 'total_cu_tl', 'inq_last_12m',\n 'acc_open_past_24mths', 'avg_cur_bal', 'bc_open_to_buy', 'bc_util',\n 'chargeoff_within_12_mths', 'delinq_amnt', 'mo_sin_old_il_acct',\n 'mo_sin_old_rev_tl_op', 'mo_sin_rcnt_rev_tl_op', 'mo_sin_rcnt_tl',\n 'mort_acc', 'mths_since_recent_bc', 'mths_since_recent_inq',\n 'num_accts_ever_120_pd', 'num_actv_bc_tl', 'num_actv_rev_tl',\n 'num_bc_sats', 'num_bc_tl', 'num_il_tl', 'num_op_rev_tl',\n 'num_rev_accts', 'num_rev_tl_bal_gt_0', 'num_sats', 'num_tl_120dpd_2m',\n 'num_tl_30dpd', 'num_tl_90g_dpd_24m', 'num_tl_op_past_12m',\n 'pct_tl_nvr_dlq', 'percent_bc_gt_75', 'pub_rec_bankruptcies',\n 'tax_liens', 'tot_hi_cred_lim', 'total_bal_ex_mort', 'total_bc_limit',\n 'total_il_high_credit_limit', 'home_ownership_ANY',\n 'home_ownership_MORTGAGE', 'home_ownership_OWN', 'home_ownership_RENT',\n 'verification_status_Not Verified',\n 'verification_status_Source Verified', 'verification_status_Verified',\n 'loan_status_high_risk', 'loan_status_low_risk', 'pymnt_plan_n',\n 'initial_list_status_f', 'initial_list_status_w',\n 'application_type_Individual', 'application_type_Joint App',\n 'hardship_flag_N', 'hardship_flag_Y', 'debt_settlement_flag_N',\n 'debt_settlement_flag_Y'],\n dtype='object')\n"
],
[
"train_df",
"_____no_output_____"
],
[
"test_df",
"_____no_output_____"
],
[
"# Convert categorical data to numeric and separate target feature for training data\nX_train = train_df.drop([\"loan_status\"], axis=1)\nX_train = pd.get_dummies(X_train)\ny_train = LabelEncoder().fit_transform(train_df[\"loan_status\"])\nprint(X_train.columns)\ny_train",
"Index(['Unnamed: 0', 'index', 'loan_amnt', 'int_rate', 'installment',\n 'annual_inc', 'dti', 'delinq_2yrs', 'inq_last_6mths', 'open_acc',\n 'pub_rec', 'revol_bal', 'total_acc', 'out_prncp', 'out_prncp_inv',\n 'total_pymnt', 'total_pymnt_inv', 'total_rec_prncp', 'total_rec_int',\n 'total_rec_late_fee', 'recoveries', 'collection_recovery_fee',\n 'last_pymnt_amnt', 'collections_12_mths_ex_med', 'policy_code',\n 'acc_now_delinq', 'tot_coll_amt', 'tot_cur_bal', 'open_acc_6m',\n 'open_act_il', 'open_il_12m', 'open_il_24m', 'mths_since_rcnt_il',\n 'total_bal_il', 'il_util', 'open_rv_12m', 'open_rv_24m', 'max_bal_bc',\n 'all_util', 'total_rev_hi_lim', 'inq_fi', 'total_cu_tl', 'inq_last_12m',\n 'acc_open_past_24mths', 'avg_cur_bal', 'bc_open_to_buy', 'bc_util',\n 'chargeoff_within_12_mths', 'delinq_amnt', 'mo_sin_old_il_acct',\n 'mo_sin_old_rev_tl_op', 'mo_sin_rcnt_rev_tl_op', 'mo_sin_rcnt_tl',\n 'mort_acc', 'mths_since_recent_bc', 'mths_since_recent_inq',\n 'num_accts_ever_120_pd', 'num_actv_bc_tl', 'num_actv_rev_tl',\n 'num_bc_sats', 'num_bc_tl', 'num_il_tl', 'num_op_rev_tl',\n 'num_rev_accts', 'num_rev_tl_bal_gt_0', 'num_sats', 'num_tl_120dpd_2m',\n 'num_tl_30dpd', 'num_tl_90g_dpd_24m', 'num_tl_op_past_12m',\n 'pct_tl_nvr_dlq', 'percent_bc_gt_75', 'pub_rec_bankruptcies',\n 'tax_liens', 'tot_hi_cred_lim', 'total_bal_ex_mort', 'total_bc_limit',\n 'total_il_high_credit_limit', 'home_ownership_ANY',\n 'home_ownership_MORTGAGE', 'home_ownership_OWN', 'home_ownership_RENT',\n 'verification_status_Not Verified',\n 'verification_status_Source Verified', 'verification_status_Verified',\n 'pymnt_plan_n', 'initial_list_status_f', 'initial_list_status_w',\n 'application_type_Individual', 'application_type_Joint App',\n 'hardship_flag_N', 'hardship_flag_Y', 'debt_settlement_flag_N',\n 'debt_settlement_flag_Y'],\n dtype='object')\n"
],
[
"# Convert categorical data to numeric and separate target feature for testing data\nX_test = test_df.drop([\"loan_status\"], axis=1)\nX_test = pd.get_dummies(X_test)\ny_test = LabelEncoder().fit_transform(test_df[\"loan_status\"])\nprint(X_test.columns)\ny_test",
"Index(['Unnamed: 0', 'index', 'loan_amnt', 'int_rate', 'installment',\n 'annual_inc', 'dti', 'delinq_2yrs', 'inq_last_6mths', 'open_acc',\n 'pub_rec', 'revol_bal', 'total_acc', 'out_prncp', 'out_prncp_inv',\n 'total_pymnt', 'total_pymnt_inv', 'total_rec_prncp', 'total_rec_int',\n 'total_rec_late_fee', 'recoveries', 'collection_recovery_fee',\n 'last_pymnt_amnt', 'collections_12_mths_ex_med', 'policy_code',\n 'acc_now_delinq', 'tot_coll_amt', 'tot_cur_bal', 'open_acc_6m',\n 'open_act_il', 'open_il_12m', 'open_il_24m', 'mths_since_rcnt_il',\n 'total_bal_il', 'il_util', 'open_rv_12m', 'open_rv_24m', 'max_bal_bc',\n 'all_util', 'total_rev_hi_lim', 'inq_fi', 'total_cu_tl', 'inq_last_12m',\n 'acc_open_past_24mths', 'avg_cur_bal', 'bc_open_to_buy', 'bc_util',\n 'chargeoff_within_12_mths', 'delinq_amnt', 'mo_sin_old_il_acct',\n 'mo_sin_old_rev_tl_op', 'mo_sin_rcnt_rev_tl_op', 'mo_sin_rcnt_tl',\n 'mort_acc', 'mths_since_recent_bc', 'mths_since_recent_inq',\n 'num_accts_ever_120_pd', 'num_actv_bc_tl', 'num_actv_rev_tl',\n 'num_bc_sats', 'num_bc_tl', 'num_il_tl', 'num_op_rev_tl',\n 'num_rev_accts', 'num_rev_tl_bal_gt_0', 'num_sats', 'num_tl_120dpd_2m',\n 'num_tl_30dpd', 'num_tl_90g_dpd_24m', 'num_tl_op_past_12m',\n 'pct_tl_nvr_dlq', 'percent_bc_gt_75', 'pub_rec_bankruptcies',\n 'tax_liens', 'tot_hi_cred_lim', 'total_bal_ex_mort', 'total_bc_limit',\n 'total_il_high_credit_limit', 'home_ownership_ANY',\n 'home_ownership_MORTGAGE', 'home_ownership_OWN', 'home_ownership_RENT',\n 'verification_status_Not Verified',\n 'verification_status_Source Verified', 'verification_status_Verified',\n 'pymnt_plan_n', 'initial_list_status_f', 'initial_list_status_w',\n 'application_type_Individual', 'application_type_Joint App',\n 'hardship_flag_N', 'hardship_flag_Y', 'debt_settlement_flag_N'],\n dtype='object')\n"
],
[
"# add missing dummy variables to testing set\nX_test[\"debt_settlement_flag_Y\"] = X_test.apply(lambda row: round(abs(row[\"debt_settlement_flag_N\"] - 1),0), axis=1)\nX_test = X_test.convert_dtypes()\nX_test",
"_____no_output_____"
],
[
"# Train the Logistic Regression model on the unscaled data and print the model score\nclassifier = LogisticRegression(max_iter=10000)\nclassifier.fit(X_train, y_train)\ntrain_score = classifier.score(X_train, y_train)\ntest_score = classifier.score(X_test, y_test)\nprint(f\"Train Score: {train_score:.3f}\")\nprint(f\"Test Score: {test_score:.3f}\")",
"Train Score: 0.703\nTest Score: 0.565\n"
],
[
"# Train a Random Forest Classifier model and print the model score\nrfc = RandomForestClassifier(random_state=42)\nrfc.fit(X_train, y_train)\ntrain_score = rfc.score(X_train, y_train)\ntest_score = rfc.score(X_test, y_test)\nprint(f\"Train Score: {train_score:.3f}\")\nprint(f\"Test Score: {test_score:.3f}\")",
"Train Score: 1.000\nTest Score: 0.631\n"
],
[
"# Scale the data\nscaler = StandardScaler().fit(X_train)\nX_train_scaled = scaler.transform(X_train)\nX_test_scaled = scaler.transform(X_test)",
"_____no_output_____"
],
[
"# Train the Logistic Regression model on the scaled data and print the model score\nclassifier = LogisticRegression(max_iter=10000)\nclassifier.fit(X_train_scaled, y_train)\ntrain_score = classifier.score(X_train_scaled, y_train)\ntest_score = classifier.score(X_test_scaled, y_test)\nprint(f\"Train Score: {train_score:.3f}\")\nprint(f\"Test Score: {test_score:.3f}\")",
"Train Score: 0.713\nTest Score: 0.720\n"
],
[
"# Train a Random Forest Classifier model on the scaled data and print the model score\nrfc = RandomForestClassifier(random_state=42)\nrfc.fit(X_train_scaled, y_train)\ntrain_score = rfc.score(X_train_scaled, y_train)\ntest_score = rfc.score(X_test_scaled, y_test)\nprint(f\"Train Score: {train_score:.3f}\")\nprint(f\"Test Score: {test_score:.3f}\")",
"Train Score: 1.000\nTest Score: 0.630\n"
]
]
] | [
"code",
"markdown",
"code"
] | [
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cb484964bdd88a351e2c1564179775cdb651f1 | 142,503 | ipynb | Jupyter Notebook | src/puzzle/examples/mitmh/year2019/the_missing_piece_meets_the_big_o.ipynb | PhilHarnish/forge | 663f19d759b94d84935c14915922070635a4af65 | [
"MIT"
] | 2 | 2020-08-18T18:43:09.000Z | 2020-08-18T20:05:59.000Z | src/puzzle/examples/mitmh/year2019/the_missing_piece_meets_the_big_o.ipynb | PhilHarnish/forge | 663f19d759b94d84935c14915922070635a4af65 | [
"MIT"
] | null | null | null | src/puzzle/examples/mitmh/year2019/the_missing_piece_meets_the_big_o.ipynb | PhilHarnish/forge | 663f19d759b94d84935c14915922070635a4af65 | [
"MIT"
] | null | null | null | 38.266112 | 124 | 0.600766 | [
[
[
"given = \"\"\"\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nGrey\tLEFT\tLEFT\t2\nBLACK\tRIGHT\tRIGHT\t2\nGrey\tLEFT\tLEFT\t2\nBLACK\tRIGHT\tRIGHT\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tRIGHT\tRIGHT\t5\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tTOP\tTOP\t5\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t3\nGrey\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t3\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t3\nGrey\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t5\nGrey\tLEFT\tLEFT\t5\nGrey\tLEFT\tLEFT\t2\nBLACK\tRIGHT\tRIGHT\t5\nGrey\tRIGHT\tRIGHT\t5\nBLACK\tRIGHT\tRIGHT\t5\nGrey\tRIGHT\tRIGHT\t5\nGrey\tLEFT\tLEFT\t4\nBLACK\tTOP\tTOP\t2\nBLACK\tRIGHT\tRIGHT\t5\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tLEFT\tLEFT\t3\nGrey\tTOP\tTOP\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tLEFT\tLEFT\t3\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nMAP CIRCLE\t\t\t\nGrey\tLEFT\tLEFT\t3\nGrey\tEMPTY\tEMPTY\t5\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tLEFT\tLEFT\t3\nBLACK\tEMPTY\tEMPTY\t1\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t3\nGrey\tRIGHT\tRIGHT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t3\nBLACK\tRIGHT\tRIGHT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t3\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tTOP\tTOP\t5\nGrey\tLEFT\tLEFT\t5\nBLACK\tTOP\tTOP\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t5\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tTOP\tTOP\t4\nGrey\tTOP\tTOP\t2\nBLACK\tTOP\tTOP\t5\nBLACK\tTOP\tTOP\t4\nGrey\tLEFT\tLEFT\t2\nGrey\tBOTTOM\tBOTTOM\t3\nGrey\tRIGHT\tRIGHT\t2\nGrey\tTOP\tTOP\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t4\nGrey\tLEFT\tLEFT\t2\nGrey\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t5\nBLACK\tRIGHT\tRIGHT\t4\nGrey\tLEFT\tLEFT\t2\nGrey\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t5\nBLACK\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t5\nGrey\tTOP\tTOP\t5\nGrey\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t5\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tLEFT\tLEFT\t2\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nMAP CIRCLE\t\t\t\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tRIGHT\tRIGHT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tTOP\tTOP\t4\nGrey\tTOP\tTOP\t2\nBLACK\tTOP\tTOP\t5\nGrey\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t5\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tEMPTY\tEMPTY\t5\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nMAP CIRCLE\t\t\t\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t1\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tTOP\tTOP\t3\nGrey\tLEFT\tLEFT\t2\nBLACK\tLEFT\tLEFT\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tRIGHT\tRIGHT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tLEFT\tLEFT\t4\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tLEFT\tLEFT\t2\nBLACK\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tRIGHT\tRIGHT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tTOP\tTOP\t4\nGrey\tEMPTY\tEMPTY\t3\nGrey\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tLEFT\tLEFT\t5\nGrey\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tLEFT\tLEFT\t5\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tTOP\tTOP\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tEMPTY\tEMPTY\t5\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tEMPTY\tEMPTY\t1\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t1\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tLEFT\tLEFT\t2\nBLACK\tLEFT\tLEFT\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tEMPTY\tEMPTY\t5\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t5\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tLEFT\tLEFT\t2\nBLACK\tLEFT\tLEFT\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tEMPTY\tEMPTY\t5\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t3\nGrey\tEMPTY\tEMPTY\t5\nBLACK\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tTOP\tTOP\t5\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nMAP CIRCLE\t\t\t\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tRIGHT\tRIGHT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tTOP\tTOP\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tTOP\tTOP\t4\nGrey\tTOP\tTOP\t2\nBLACK\tTOP\tTOP\t5\nGrey\tRIGHT\tRIGHT\t2\nGrey\tTOP\tTOP\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t5\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tTOP\tTOP\t3\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tLEFT\tLEFT\t4\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nGrey\tEMPTY\tEMPTY\t1\nGrey\tEMPTY\tEMPTY\t2\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tRIGHT\tRIGHT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tTOP\tTOP\t4\nGrey\tTOP\tTOP\t2\nBLACK\tTOP\tTOP\t5\nGrey\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t5\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tLEFT\tLEFT\t5\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nBLACK\tRIGHT\tRIGHT\t4\nGrey\tLEFT\tLEFT\t2\nGrey\tLEFT\tLEFT\t5\nBLACK\tTOP\tTOP\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nBLACK\tRIGHT\tRIGHT\t4\nGrey\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nMAP CIRCLE\t\t\t\nBLACK\tTOP\tTOP\t2\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tTOP\tTOP\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tLEFT\tLEFT\t2\nBLACK\tLEFT\tLEFT\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tRIGHT\tRIGHT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nBLACK\tLEFT\tLEFT\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tRIGHT\tRIGHT\t4\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tRIGHT\tRIGHT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tEMPTY\tEMPTY\t4\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nMAP CIRCLE\t\t\t\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nBLACK\tBOTTOM\tBOTTOM\t1\nGrey\tEMPTY\tEMPTY\t2\nBLACK\tBOTTOM\tBOTTOM\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t5\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tEMPTY\tEMPTY\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tRIGHT\tRIGHT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nBLACK\tBOTTOM\tBOTTOM\t4\nBLACK\tBOTTOM\tBOTTOM\t2\nBLACK\tRIGHT\tRIGHT\t3\nGrey\tRIGHT\tRIGHT\t3\nBLACK\tLEFT\tLEFT\t3\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tLEFT\tLEFT\t2\nBLACK\tBOTTOM\tBOTTOM\t4\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tLEFT\tLEFT\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tEMPTY\tEMPTY\t4\nGrey\tLEFT\tLEFT\t3\nBLACK\tTOP\tTOP\t1\nBLACK\tEMPTY\tEMPTY\t5\nGrey\tTOP\tTOP\t3\nGrey\tLEFT\tLEFT\t2\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tBOTTOM\tBOTTOM\t2\nGrey\tTOP\tTOP\t3\nGrey\tEMPTY\tEMPTY\t3\nGrey\tBOTTOM\tBOTTOM\t5\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nBLACK\tBOTTOM\tBOTTOM\t2\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\nGrey\tRIGHT\tRIGHT\t2\nGrey\tRIGHT\tRIGHT\t2\nGrey\tBOTTOM\tBOTTOM\t4\nGrey\tBOTTOM\tBOTTOM\t2\n\"\"\"\n\ntranscript = \"\"\"\nI AM SAM. I AM SAM. SAM I AM.\n\nTHAT SAM-I-AM! THAT SAM-I-AM! I DO NOT LIKE THAT SAM-I-AM!\n\nDO WOULD YOU LIKE GREEN EGGS AND HAM?\n\nI DO NOT LIKE THEM,SAM-I-AM.\nI DO NOT LIKE GREEN EGGS AND HAM.\n\nWOULD YOU LIKE THEM HERE OR THERE?\n\nI WOULD NOT LIKE THEM HERE OR THERE.\nI WOULD NOT LIKE THEM ANYWHERE.\nI DO NOT LIKE GREEN EGGS AND HAM.\nI DO NOT LIKE THEM, SAM-I-AM.\n\nWOULD YOU LIKE THEM IN A HOUSE?\nWOULD YOU LIKE THEN WITH A MOUSE?\n\nI DO NOT LIKE THEM IN A HOUSE.\nI DO NOT LIKE THEM WITH A MOUSE.\nI DO NOT LIKE THEM HERE OR THERE.\nI DO NOT LIKE THEM ANYWHERE.\nI DO NOT LIKE GREEN EGGS AND HAM.\nI DO NOT LIKE THEM, SAM-I-AM.\n\nWOULD YOU EAT THEM IN A BOX?\nWOULD YOU EAT THEM WITH A FOX?\n\nNOT IN A BOX. NOT WITH A FOX.\nNOT IN A HOUSE. NOT WITH A MOUSE.\nI WOULD NOT EAT THEM HERE OR THERE.\nI WOULD NOT EAT THEM ANYWHERE.\nI WOULD NOT EAT GREEN EGGS AND HAM.\nI DO NOT LIKE THEM, SAM-I-AM.\n\nWOULD YOU? COULD YOU? IN A CAR?\nEAT THEM! EAT THEM! HERE THEY ARE.\n\nI WOULD NOT, COULD NOT, IN A CAR.\n\nYOU MAY LIKE THEM. YOU WILL SEE.\nYOU MAY LIKE THEM IN A TREE!\n\nI WOULD NOT, COULD NOT IN A TREE.\nNOT IN A CAR! YOU LET ME BE.\nI DO NOT LIKE THEM IN A BOX.\nI DO NOT LIKE THEM WITH A FOX.\nI DO NOT LIKE THEM IN A HOUSE.\nI DO NOT LIKE THEM WITH A MOUSE.\nI DO NOT LIKE THEM HERE OR THERE.\nI DO NOT LIKE THEM ANYWHERE.\nI DO NOT LIKE GREEN EGGS AND HAM.\nI DO NOT LIKE THEM, SAM-I-AM.\n\nA TRAIN! A TRAIN! A TRAIN! A TRAIN!\nCOULD YOU, WOULD YOU ON A TRAIN?\n\nNOT ON TRAIN! NOT IN A TREE!\nNOT IN A CAR! SAM! LET ME BE!\nI WOULD NOT, COULD NOT, IN A BOX.\nI WOULD NOT, COULD NOT, WITH A FOX.\nI WILL NOT EAT THEM IN A HOUSE.\nI WILL NOT EAT THEM HERE OR THERE.\nI WILL NOT EAT THEM ANYWHERE.\nI DO NOT EAT GREEM EGGS AND HAM.\nI DO NOT LIKE THEM, SAM-I-AM.\n\nSAY! IN THE DARK? HERE IN THE DARK!\nWOULD YOU, COULD YOU, IN THE DARK?\n\nI WOULD NOT, COULD NOT, IN THE DARK.\n\nWOULD YOU COULD YOU IN THE RAIN?\n\nI WOULD NOT, COULD NOT IN THE RAIN.\nNOT IN THE DARK. NOT ON A TRAIN.\nNOT IN A CAR. NOT IN A TREE.\nI DO NOT LIKE THEM, SAM, YOU SEE.\nNOT IN A HOUSE. NOT IN A BOX.\nNOT WITH A MOUSE. NOT WITH A FOX.\nI WILL NOT EAT THEM HERE OR THERE.\nI DO NOT LIKE THEM ANYWHERE!\n\nYOU DO NOT LIKE GREEN EGGS AND HAM?\n\nI DO NOT LIKE THEM, SAM-I-AM.\n\nCOULD YOU, WOULD YOU, WITH A GOAT?\n\nI WOULD NOT, COULD NOT WITH A GOAT!\n\nWOULD YOU, COULD YOU, ON A BOAT?\n\nI COULD NOT, WOULD NOT, ON A BOAT.\nI WILL NOT, WILL NOT, WITH A GOAT.\nI WILL NOT EAT THEM IN THE RAIN.\nNOT IN THE DARK! NOT IN A TREE!\nNOT IN A CAR! YOU LET ME BE!\nI DO NOT LIKE THEM IN A BOX.\nI DO NOT LIKE THEM WITH A FOX.\nI WILL NOT EAT THEM IN A HOUSE.\nI DO NOT LIKE THEM WITH A MOUSE.\nI DO NOT LIKE THEM HERE OR THERE.\nI DO NOT LIKE THEM ANYWHERE!\nI DO NOT LIKE GREEN EGGS AND HAM!\nI DO NOT LIKE THEM, SAM-I-AM.\n\nYOU DO NOT LIKE THEM. SO YOU SAY.\nTRY THEM! TRY THEM! AND YOU MAY.\nTRY THEM AND YOU MAY, I SAY.\n\nsAM! IF YOU LET ME BE,\nI WILL TRY THEM. YOU WILL SEE.\n\n(... and he tries them ...)\n\nSAY! I LIKE GREEN EGGS AND HAM!\nI DO! I LIKE THEM, SAM-I-AM!\nAND I WOULD EAT THEM IN A BOAT.\nAND I WOULD EAT THEM WITH A GOAT...\nAND I WILL EAT THEM, IN THE RAIN.\nAND IN THE DARK. AND ON A TRAIN.\nAND IN A CAR. AND IN A TREE.\nTHEY ARE SO GOOD, SO GOOD, YOU SEE!\nSO I WILL EAT THEM IN A BOX.\nAND I WILL EAT THEM WITH A FOX.\nAND I WILL EAT THEM IN A HOUSE.\nAND I WILL EAT THEM WITH A MOUSE.\nAND I WILL EAT THEM HERE AND THERE.\nSAY! I WILL EAT THEM ANYWHERE!\nI DO SO LIKE GREEN EGGS AND HAM!\nTHANK YOU! THANK YOU, SAM I AM.\n\"\"\"\n\nVALUES = {\n 'GREY': 0,\n 'BLACK': 0,\n \n 'EMPTY': 0,\n 'TOP': 1,\n 'RIGHT': 2,\n 'BOTTOM': 3,\n 'LEFT': 4,\n \n '1': 0,\n '2': 1,\n '3': 2,\n '4': 3,\n '5': 4,\n}\n",
"_____no_output_____"
],
[
"def parse(txt):\n chunk = []\n result = [chunk]\n for line in txt.strip('\\n').split('\\n'):\n if 'MAP CIRCLE' in line:\n print('chunk length', len(chunk))\n chunk = []\n result.append(chunk)\n continue\n color, _, position, fill = line.upper().split('\\t')\n chunk.append((color, position, fill))\n #chunk.append((VALUES[color], VALUES[position], VALUES[fill]))\n return result",
"_____no_output_____"
],
[
"import collections\n\nparsed = parse(given)\n",
"chunk length 79\nchunk length 90\nchunk length 69\nchunk length 161\nchunk length 190\nchunk length 121\n"
],
[
"ngram_qs = [\n collections.deque([], maxlen=i) for i in range(1, 10)\n]\n\ncounter = collections.Counter()\n\nfor chunk in parsed:\n for ngram_q in ngram_qs:\n ngram_q.clear()\n for piece in chunk:\n for ngram_q in ngram_qs:\n ngram_q.append(''.join(map(str, piece)))\n if len(ngram_q) == ngram_q.maxlen:\n # print(ngram_q.maxlen, '\\n', ngram_q)\n counter[','.join(ngram_q)] += 1\n\nfor s, freq in sorted(counter.items(), key=lambda x: x[1], reverse=True):\n print(str(freq).rjust(8), s)\n if freq == 1:\n break",
" 84 GREYEMPTY3\n 83 GREYBOTTOM2\n 60 BLACKLEFT2\n 59 GREYEMPTY2\n 44 GREYTOP3\n 41 BLACKBOTTOM3\n 37 GREYBOTTOM5\n 35 GREYLEFT2\n 35 GREYTOP3,GREYEMPTY3\n 34 GREYBOTTOM5,GREYBOTTOM2\n 34 GREYEMPTY3,GREYBOTTOM5\n 33 BLACKLEFT2,GREYTOP3\n 33 GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 32 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 31 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 30 GREYEMPTY2,BLACKBOTTOM3\n 27 BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 26 BLACKBOTTOM4\n 25 GREYLEFT3\n 25 GREYRIGHT4\n 25 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 24 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 23 BLACKLEFT2,GREYRIGHT4\n 22 BLACKTOP4\n 19 BLACKBOTTOM3,GREYEMPTY3\n 17 GREYRIGHT2\n 17 BLACKTOP4,GREYBOTTOM2\n 17 BLACKEMPTY4\n 17 GREYEMPTY2,BLACKEMPTY4\n 15 GREYBOTTOM4\n 15 GREYBOTTOM4,GREYBOTTOM2\n 15 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 14 BLACKBOTTOM3,BLACKLEFT2\n 14 BLACKLEFT4\n 13 GREYBOTTOM2,GREYRIGHT2\n 13 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 13 GREYEMPTY3,BLACKBOTTOM4\n 12 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 12 BLACKBOTTOM4,GREYBOTTOM2\n 12 GREYRIGHT4,GREYEMPTY3\n 11 BLACKEMPTY5\n 11 BLACKLEFT3\n 11 BLACKEMPTY2\n 11 BLACKEMPTY2,BLACKBOTTOM3\n 11 GREYLEFT2,BLACKBOTTOM4\n 10 GREYEMPTY4\n 10 GREYEMPTY4,GREYLEFT3\n 10 BLACKTOP1\n 10 GREYLEFT3,BLACKTOP1\n 10 BLACKTOP1,BLACKEMPTY5\n 10 GREYLEFT3,BLACKTOP1,BLACKEMPTY5\n 10 BLACKLEFT3,BLACKLEFT2\n 10 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 10 GREYEMPTY3,BLACKTOP4\n 10 GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2\n 9 GREYEMPTY4,GREYLEFT3,BLACKTOP1\n 9 GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5\n 9 BLACKEMPTY5,GREYTOP3\n 9 BLACKRIGHT3\n 9 BLACKEMPTY4,BLACKLEFT2\n 9 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 9 BLACKBOTTOM1\n 9 BLACKBOTTOM1,GREYEMPTY2\n 9 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3\n 9 GREYEMPTY1\n 9 GREYEMPTY1,GREYEMPTY2\n 9 GREYRIGHT2,BLACKLEFT2\n 9 GREYRIGHT2,BLACKLEFT2,GREYTOP3\n 9 GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 8 BLACKTOP1,BLACKEMPTY5,GREYTOP3\n 8 GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3\n 8 BLACKEMPTY3\n 8 BLACKEMPTY3,BLACKLEFT2\n 8 GREYBOTTOM1\n 8 GREYBOTTOM1,GREYEMPTY2\n 8 BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4\n 8 GREYLEFT1\n 8 GREYLEFT1,GREYEMPTY2\n 8 GREYEMPTY5\n 8 GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2\n 8 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2\n 8 GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3\n 8 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3\n 8 GREYBOTTOM2,GREYEMPTY4\n 8 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4\n 8 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3\n 8 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3\n 8 GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 8 GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 8 GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 8 GREYRIGHT3\n 8 BLACKRIGHT3,GREYRIGHT3\n 8 GREYRIGHT3,BLACKLEFT3\n 8 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 8 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 8 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 8 GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 8 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 8 GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 8 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 8 GREYEMPTY3,BLACKLEFT4\n 7 GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3\n 7 GREYBOTTOM2,BLACKEMPTY3\n 7 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2\n 7 GREYRIGHT4,BLACKTOP4\n 7 BLACKLEFT2,GREYRIGHT4,BLACKTOP4\n 7 GREYRIGHT4,BLACKTOP4,GREYBOTTOM2\n 7 BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2\n 7 GREYBOTTOM2,GREYLEFT3\n 7 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 7 GREYTOP1\n 7 GREYTOP1,GREYEMPTY2\n 7 GREYTOP1,GREYEMPTY2,BLACKBOTTOM3\n 7 GREYEMPTY5,BLACKEMPTY2\n 7 GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3\n 7 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1\n 7 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1\n 7 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5\n 7 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5\n 7 GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 7 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 7 GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 7 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 7 GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 7 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 7 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4\n 7 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4\n 7 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4\n 7 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3\n 7 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3\n 7 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3\n 7 GREYBOTTOM2,BLACKRIGHT3\n 7 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 7 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 7 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 6 GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3\n 6 GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2\n 6 GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4\n 6 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 6 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4\n 6 GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4\n 6 GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4\n 6 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4\n 6 GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3\n 6 GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3\n 6 BLACKEMPTY5,GREYTOP3,GREYEMPTY3\n 6 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 6 GREYBOTTOM2,GREYBOTTOM1\n 6 GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2\n 6 BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 6 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 6 BLACKEMPTY4,GREYEMPTY3\n 6 GREYEMPTY2,BLACKEMPTY4,GREYEMPTY3\n 6 GREYLEFT2,BLACKLEFT4\n 6 BLACKLEFT4,GREYEMPTY3\n 6 GREYEMPTY3,BLACKLEFT4,GREYEMPTY3\n 6 BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4\n 6 GREYEMPTY3,BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4\n 6 BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2\n 6 GREYEMPTY3,BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2\n 6 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1\n 6 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1\n 6 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1\n 6 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5\n 6 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5\n 6 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5\n 5 GREYRIGHT5\n 5 GREYTOP5\n 5 BLACKLEFT3,BLACKLEFT2,GREYRIGHT4\n 5 BLACKTOP4,GREYBOTTOM2,GREYLEFT3\n 5 GREYRIGHT4,BLACKTOP4,GREYBOTTOM2,GREYLEFT3\n 5 BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2,GREYLEFT3\n 5 BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4\n 5 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4\n 5 BLACKLEFT1\n 5 BLACKLEFT1,GREYEMPTY2\n 5 BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3\n 5 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3\n 5 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3\n 5 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 5 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3\n 5 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2\n 5 BLACKEMPTY3,BLACKLEFT2,GREYTOP3\n 5 BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 5 BLACKLEFT3,BLACKLEFT2,GREYTOP3\n 5 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3\n 5 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3\n 5 GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4\n 5 GREYBOTTOM2,BLACKBOTTOM1\n 5 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2\n 5 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3\n 5 GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 5 BLACKLEFT5\n 5 BLACKLEFT5,GREYEMPTY2\n 5 BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3\n 5 GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1\n 5 BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3\n 5 GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3\n 5 BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 5 GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 5 BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4\n 5 BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3\n 5 BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4\n 5 BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2\n 4 GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 4 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 4 BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 4 GREYLEFT5\n 4 BLACKEMPTY1\n 4 BLACKEMPTY1,BLACKEMPTY2\n 4 BLACKEMPTY1,BLACKEMPTY2,BLACKBOTTOM3\n 4 GREYRIGHT1\n 4 GREYRIGHT1,GREYEMPTY2\n 4 GREYRIGHT1,GREYEMPTY2,BLACKEMPTY4\n 4 BLACKBOTTOM5\n 4 BLACKLEFT2,BLACKBOTTOM5\n 4 GREYTOP4\n 4 GREYBOTTOM2,GREYTOP4\n 4 GREYTOP2\n 4 GREYTOP4,GREYTOP2\n 4 GREYBOTTOM2,GREYTOP4,GREYTOP2\n 4 BLACKTOP5\n 4 GREYTOP2,BLACKTOP5\n 4 GREYTOP4,GREYTOP2,BLACKTOP5\n 4 GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5\n 4 BLACKRIGHT4\n 4 BLACKRIGHT4,GREYLEFT2\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3\n 4 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2\n 4 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2\n 4 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3\n 4 GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3\n 4 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3\n 4 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 4 BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 4 GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3\n 4 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3\n 4 BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3\n 4 GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 4 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 4 BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 4 GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 4 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 4 BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 4 GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 4 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 4 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3\n 4 BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1\n 4 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1\n 4 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2\n 4 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2\n 4 BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 4 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 4 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 4 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 4 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 4 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 4 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 4 GREYBOTTOM2,GREYLEFT1\n 4 GREYBOTTOM2,GREYLEFT1,GREYEMPTY2\n 4 GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 4 BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 4 BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 4 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 4 BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 4 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 4 BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 4 BLACKEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 4 GREYEMPTY3,GREYEMPTY1\n 4 BLACKBOTTOM3,GREYEMPTY3,GREYEMPTY1\n 4 GREYEMPTY3,GREYEMPTY1,GREYEMPTY2\n 4 BLACKBOTTOM3,GREYEMPTY3,GREYEMPTY1,GREYEMPTY2\n 4 BLACKTOP3\n 4 GREYEMPTY2,BLACKTOP3\n 4 BLACKLEFT4,GREYLEFT2\n 4 GREYLEFT2,BLACKLEFT4,GREYLEFT2\n 4 BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4\n 4 GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4\n 4 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3\n 4 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3\n 4 GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3\n 4 GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 4 BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 4 GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 4 GREYTOP3,GREYLEFT2\n 4 BLACKBOTTOM2\n 3 BLACKEMPTY3,BLACKLEFT2,GREYRIGHT4\n 3 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYRIGHT4\n 3 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4\n 3 BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,BLACKTOP4\n 3 BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2\n 3 BLACKRIGHT5\n 3 BLACKBOTTOM3,GREYLEFT3\n 3 BLACKRIGHT1\n 3 BLACKRIGHT1,GREYEMPTY2\n 3 BLACKTOP4,GREYLEFT2\n 3 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3\n 3 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3\n 3 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 3 BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1\n 3 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1\n 3 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1\n 3 BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2\n 3 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2\n 3 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4\n 3 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4\n 3 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4\n 3 BLACKLEFT3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4\n 3 GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1\n 3 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2\n 3 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3\n 3 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3\n 3 GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 3 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 3 BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 3 BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 3 BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 3 BLACKTOP4,GREYBOTTOM2,GREYLEFT1\n 3 GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1\n 3 GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1\n 3 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1\n 3 BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2\n 3 GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2\n 3 GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2\n 3 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2\n 3 BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 3 GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 3 GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 3 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 3 GREYLEFT2,GREYTOP1\n 3 GREYLEFT2,GREYTOP1,GREYEMPTY2\n 3 GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3\n 3 GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 3 GREYEMPTY3,BLACKLEFT5\n 3 BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5\n 3 GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5\n 3 GREYEMPTY3,BLACKLEFT5,GREYEMPTY2\n 3 BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2\n 3 GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2\n 3 GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3\n 3 BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3\n 3 GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3\n 3 GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 3 BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 3 GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 3 GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 3 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3\n 3 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3\n 3 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3\n 3 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4\n 3 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4\n 3 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4\n 3 BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 3 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 3 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 3 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 3 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,GREYEMPTY3\n 3 GREYEMPTY3,GREYLEFT1\n 3 GREYEMPTY3,GREYLEFT1,GREYEMPTY2\n 3 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,GREYEMPTY1\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,GREYEMPTY1,GREYEMPTY2\n 3 BLACKBOTTOM3,GREYLEFT2\n 3 BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4\n 3 BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2\n 3 BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4\n 3 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2\n 3 GREYEMPTY2,GREYEMPTY1\n 3 GREYEMPTY1,GREYEMPTY2,GREYEMPTY1\n 3 GREYEMPTY2,GREYEMPTY1,GREYEMPTY2\n 3 GREYEMPTY1,GREYEMPTY2,GREYEMPTY1,GREYEMPTY2\n 3 GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3\n 3 GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3\n 3 BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2\n 3 GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2\n 3 BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYTOP3\n 3 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 3 BLACKBOTTOM4,GREYBOTTOM4\n 3 GREYLEFT2,BLACKBOTTOM4,GREYBOTTOM4\n 3 BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2\n 3 GREYLEFT2,BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2\n 3 BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 3 GREYLEFT2,BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 3 BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2\n 3 GREYLEFT2,BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2\n 3 BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3\n 3 GREYLEFT2,BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3\n 3 BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 3 GREYLEFT2,BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 3 BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 GREYLEFT2,BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 3 BLACKBOTTOM4,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 3 GREYRIGHT4,GREYEMPTY3,BLACKBOTTOM4\n 3 GREYRIGHT4,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2\n 3 BLACKLEFT2,GREYTOP3,GREYLEFT2\n 3 GREYTOP3,GREYLEFT2,BLACKBOTTOM4\n 3 BLACKLEFT2,GREYTOP3,GREYLEFT2,BLACKBOTTOM4\n 3 GREYRIGHT2,BLACKBOTTOM2\n 3 GREYBOTTOM2,GREYRIGHT2,BLACKBOTTOM2\n 3 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKBOTTOM2\n 2 BLACKRIGHT2\n 2 GREYLEFT2,BLACKRIGHT2\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYRIGHT4\n 2 GREYBOTTOM2,GREYTOP5\n 2 GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4\n 2 BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4,BLACKTOP4\n 2 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4,BLACKTOP4\n 2 BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2\n 2 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2\n 2 BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2,GREYLEFT3\n 2 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2,GREYLEFT3\n 2 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,BLACKTOP4\n 2 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2\n 2 BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,BLACKTOP4,GREYBOTTOM2,GREYLEFT3\n 2 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYRIGHT4\n 2 BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4\n 2 GREYLEFT5,GREYLEFT2\n 2 BLACKRIGHT5,GREYRIGHT5\n 2 BLACKTOP2\n 2 GREYEMPTY2,BLACKBOTTOM3,GREYLEFT3\n 2 BLACKEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 2 BLACKEMPTY1,BLACKEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 2 BLACKEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4\n 2 BLACKEMPTY1,BLACKEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4\n 2 GREYRIGHT4,BLACKBOTTOM4\n 2 BLACKLEFT2,GREYRIGHT4,BLACKBOTTOM4\n 2 GREYRIGHT4,BLACKBOTTOM4,GREYBOTTOM2\n 2 BLACKLEFT2,GREYRIGHT4,BLACKBOTTOM4,GREYBOTTOM2\n 2 BLACKBOTTOM4,GREYBOTTOM2,GREYLEFT3\n 2 GREYRIGHT4,BLACKBOTTOM4,GREYBOTTOM2,GREYLEFT3\n 2 BLACKLEFT2,GREYRIGHT4,BLACKBOTTOM4,GREYBOTTOM2,GREYLEFT3\n 2 GREYTOP3,GREYBOTTOM2\n 2 GREYLEFT5,BLACKTOP4\n 2 GREYLEFT5,BLACKTOP4,GREYLEFT2\n 2 GREYLEFT2,BLACKLEFT2\n 2 BLACKTOP4,GREYLEFT2,BLACKLEFT2\n 2 GREYLEFT5,BLACKTOP4,GREYLEFT2,BLACKLEFT2\n 2 GREYLEFT2,GREYLEFT3\n 2 BLACKRIGHT4,GREYLEFT2,GREYLEFT3\n 2 GREYLEFT3,BLACKLEFT2\n 2 GREYLEFT2,GREYLEFT3,BLACKLEFT2\n 2 BLACKRIGHT4,GREYLEFT2,GREYLEFT3,BLACKLEFT2\n 2 GREYLEFT3,BLACKLEFT2,BLACKBOTTOM5\n 2 GREYLEFT2,GREYLEFT3,BLACKLEFT2,BLACKBOTTOM5\n 2 BLACKRIGHT4,GREYLEFT2,GREYLEFT3,BLACKLEFT2,BLACKBOTTOM5\n 2 GREYBOTTOM5,GREYLEFT2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYLEFT2\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYLEFT2\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 2 GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 2 GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 2 GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 GREYBOTTOM2,GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1\n 2 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1\n 2 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1\n 2 GREYBOTTOM1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2\n 2 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2\n 2 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3\n 2 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 2 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4\n 2 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 2 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 2 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 2 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 2 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 2 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 2 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 2 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 2 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 2 GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2\n 2 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 2 GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3\n 2 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 GREYBOTTOM2,BLACKLEFT1\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1\n 2 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1\n 2 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1\n 2 GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1\n 2 GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2\n 2 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2\n 2 GREYEMPTY2,BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2\n 2 GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3\n 2 BLACKEMPTY4,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2\n 2 BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 GREYBOTTOM2,BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYTOP4\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4\n 2 BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4\n 2 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4\n 2 BLACKLEFT1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2\n 2 BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2\n 2 GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5\n 2 BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5\n 2 BLACKTOP5,GREYLEFT2\n 2 GREYTOP2,BLACKTOP5,GREYLEFT2\n 2 GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2\n 2 GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2\n 2 BLACKTOP5,GREYLEFT2,GREYTOP1\n 2 GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1\n 2 GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1\n 2 GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1\n 2 BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2\n 2 GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2\n 2 GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2\n 2 GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2\n 2 BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3\n 2 BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 2 GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 2 GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 2 GREYBOTTOM2,GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 2 GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5\n 2 BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5\n 2 GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5\n 2 GREYTOP4,GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5\n 2 GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2\n 2 BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2\n 2 GREYTOP2,BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2\n 2 GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3\n 2 BLACKTOP5,GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYLEFT2,GREYTOP1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 2 GREYEMPTY3,GREYEMPTY5\n 2 GREYEMPTY3,GREYEMPTY5,BLACKEMPTY2\n 2 GREYEMPTY3,GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3\n 2 GREYEMPTY3,GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 2 GREYBOTTOM2,BLACKEMPTY1\n 2 GREYBOTTOM2,BLACKEMPTY1,BLACKEMPTY2\n 2 GREYBOTTOM2,BLACKEMPTY1,BLACKEMPTY2,BLACKBOTTOM3\n 2 GREYBOTTOM2,GREYRIGHT1\n 2 GREYBOTTOM2,GREYRIGHT1,GREYEMPTY2\n 2 GREYBOTTOM2,GREYRIGHT1,GREYEMPTY2,BLACKEMPTY4\n 2 GREYRIGHT1,GREYEMPTY2,BLACKEMPTY4,GREYEMPTY3\n 2 BLACKTOP4,GREYEMPTY3\n 2 GREYBOTTOM2,BLACKRIGHT1\n 2 GREYBOTTOM2,BLACKRIGHT1,GREYEMPTY2\n 2 BLACKRIGHT1,GREYEMPTY2,BLACKTOP3\n 2 GREYBOTTOM2,BLACKRIGHT1,GREYEMPTY2,BLACKTOP3\n 2 BLACKTOP3,GREYEMPTY3\n 2 GREYEMPTY2,BLACKTOP3,GREYEMPTY3\n 2 BLACKBOTTOM4,GREYEMPTY3\n 2 GREYEMPTY3,BLACKBOTTOM4,GREYEMPTY3\n 2 BLACKBOTTOM4,GREYEMPTY3,BLACKLEFT4\n 2 GREYEMPTY3,BLACKBOTTOM4,GREYEMPTY3,BLACKLEFT4\n 2 BLACKLEFT4,GREYBOTTOM2\n 2 GREYEMPTY3,BLACKLEFT4,GREYBOTTOM2\n 2 BLACKBOTTOM4,GREYEMPTY3,BLACKLEFT4,GREYBOTTOM2\n 2 GREYEMPTY3,BLACKBOTTOM4,GREYEMPTY3,BLACKLEFT4,GREYBOTTOM2\n 2 BLACKTOP3,GREYLEFT2\n 2 GREYEMPTY2,BLACKTOP3,GREYLEFT2\n 2 BLACKEMPTY4,GREYLEFT2\n 2 GREYEMPTY2,BLACKEMPTY4,GREYLEFT2\n 2 BLACKBOTTOM4,GREYLEFT2\n 2 GREYLEFT2,BLACKBOTTOM4,GREYLEFT2\n 2 BLACKBOTTOM4,GREYLEFT2,BLACKLEFT4\n 2 GREYLEFT2,BLACKBOTTOM4,GREYLEFT2,BLACKLEFT4\n 2 BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 2 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 2 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 2 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4\n 2 BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 2 GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 2 BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 2 GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2\n 2 GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,GREYEMPTY3\n 2 BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,GREYEMPTY3\n 2 GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,GREYEMPTY3\n 2 GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,GREYEMPTY3\n 2 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKTOP4,GREYBOTTOM2,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4,GREYEMPTY3\n 2 GREYEMPTY3,BLACKBOTTOM1\n 2 GREYEMPTY3,BLACKBOTTOM1,GREYEMPTY2\n 2 GREYEMPTY3,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYEMPTY3,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3\n 2 GREYBOTTOM2,BLACKLEFT5\n 2 GREYBOTTOM2,BLACKLEFT5,GREYEMPTY2\n 2 GREYBOTTOM2,BLACKLEFT5,GREYEMPTY2,BLACKBOTTOM3\n 2 GREYEMPTY1,GREYEMPTY2,BLACKTOP3\n 2 GREYEMPTY3,GREYEMPTY1,GREYEMPTY2,BLACKTOP3\n 2 BLACKBOTTOM3,GREYEMPTY3,GREYEMPTY1,GREYEMPTY2,BLACKTOP3\n 2 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,GREYEMPTY1,GREYEMPTY2,BLACKTOP3\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYEMPTY3,BLACKLEFT4,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYLEFT2\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4\n 2 BLACKBOTTOM4,GREYEMPTY5\n 2 GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5\n 2 BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5\n 2 GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5\n 2 BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5\n 2 BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2\n 2 GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2\n 2 BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2\n 2 GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2\n 2 BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2\n 2 BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3\n 2 GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3\n 2 BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3\n 2 GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3\n 2 BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3\n 2 BLACKEMPTY2,BLACKBOTTOM3,GREYLEFT2,BLACKLEFT4,GREYLEFT2,BLACKBOTTOM4,GREYEMPTY5,BLACKEMPTY2,BLACKBOTTOM3\n 2 GREYBOTTOM2,GREYEMPTY5\n 2 BLACKEMPTY5,GREYRIGHT4\n 2 BLACKTOP1,BLACKEMPTY5,GREYRIGHT4\n 2 GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4\n 2 GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4\n 2 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4\n 2 BLACKEMPTY5,GREYRIGHT4,GREYEMPTY3\n 2 BLACKTOP1,BLACKEMPTY5,GREYRIGHT4,GREYEMPTY3\n 2 GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4,GREYEMPTY3\n 2 GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4,GREYEMPTY3\n 2 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4,GREYEMPTY3\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4,GREYEMPTY3\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYRIGHT4,GREYEMPTY3\n 2 BLACKEMPTY3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 2 GREYBOTTOM2,BLACKEMPTY3,BLACKLEFT2,GREYRIGHT4,GREYEMPTY3\n 2 GREYEMPTY2,GREYEMPTY1,GREYEMPTY2,GREYEMPTY1\n 2 GREYEMPTY1,GREYEMPTY2,GREYEMPTY1,GREYEMPTY2,GREYEMPTY1\n 2 GREYEMPTY2,GREYEMPTY1,GREYEMPTY2,GREYEMPTY1,GREYEMPTY2\n 2 GREYEMPTY1,GREYEMPTY2,GREYEMPTY1,GREYEMPTY2,GREYEMPTY1,GREYEMPTY2\n 2 GREYBOTTOM2,GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 GREYEMPTY4,GREYLEFT3,BLACKTOP1,BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKEMPTY3\n 2 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3\n 2 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3\n 2 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 GREYBOTTOM5,GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5\n 2 BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 GREYBOTTOM2,BLACKBOTTOM1,GREYEMPTY2,BLACKBOTTOM3,BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2\n 2 GREYTOP3,BLACKRIGHT4\n 2 BLACKLEFT2,GREYTOP3,BLACKRIGHT4\n 2 GREYTOP3,BLACKRIGHT4,GREYLEFT2\n 2 BLACKLEFT2,GREYTOP3,BLACKRIGHT4,GREYLEFT2\n 2 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKBOTTOM4\n 2 BLACKLEFT2,GREYRIGHT4,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2\n 2 BLACKBOTTOM4,GREYBOTTOM2,BLACKRIGHT3\n 2 GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2,BLACKRIGHT3\n 2 BLACKBOTTOM4,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 2 GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3\n 2 BLACKBOTTOM4,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 2 GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3\n 2 BLACKBOTTOM4,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 2 GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2,BLACKRIGHT3,GREYRIGHT3,BLACKLEFT3,BLACKLEFT2\n 2 BLACKBOTTOM3,GREYEMPTY3,GREYLEFT1\n 2 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,GREYLEFT1\n 2 BLACKBOTTOM3,GREYEMPTY3,GREYLEFT1,GREYEMPTY2\n 2 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,GREYLEFT1,GREYEMPTY2\n 2 GREYEMPTY3,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 2 BLACKBOTTOM3,GREYEMPTY3,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 2 GREYEMPTY2,BLACKBOTTOM3,GREYEMPTY3,GREYLEFT1,GREYEMPTY2,BLACKEMPTY4\n 2 GREYRIGHT4,GREYLEFT2\n 2 BLACKLEFT2,GREYRIGHT4,GREYLEFT2\n 2 GREYRIGHT4,GREYLEFT2,BLACKBOTTOM4\n 2 BLACKLEFT2,GREYRIGHT4,GREYLEFT2,BLACKBOTTOM4\n 2 GREYTOP3,GREYEMPTY3,BLACKBOTTOM4\n 2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,BLACKBOTTOM4\n 2 GREYBOTTOM2,GREYBOTTOM4\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4\n 2 GREYBOTTOM2,GREYBOTTOM4,GREYBOTTOM2\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4,GREYBOTTOM2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4,GREYBOTTOM2\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4,GREYBOTTOM2\n 2 GREYBOTTOM2,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 2 GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 2 GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 2 GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 2 BLACKBOTTOM2,GREYBOTTOM4\n 2 GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4\n 2 GREYBOTTOM2,GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4\n 2 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4\n 2 BLACKBOTTOM2,GREYBOTTOM4,GREYBOTTOM2\n 2 GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4,GREYBOTTOM2\n 2 GREYBOTTOM2,GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4,GREYBOTTOM2\n 2 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4,GREYBOTTOM2\n 2 BLACKBOTTOM2,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 2 GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 2 GREYBOTTOM2,GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 2 GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2,BLACKBOTTOM2,GREYBOTTOM4,GREYBOTTOM2,GREYRIGHT2\n 1 GREYRIGHT2,GREYLEFT2\n"
],
[
"N = 8\n\n# ⇦ ⇨ ⇧ ⇩\n# ⬅ ➡ ⬆ ⬇\n\nVIZ = {\n 'BLACKTOP': '\\t⬆',\n 'BLACKRIGHT': '\\t➡',\n 'BLACKBOTTOM': '\\t⬇',\n 'BLACKLEFT': '\\t⬅',\n 'BLACKEMPTY': '\\t⬤',\n 'GREYTOP': '\\t⇧',\n 'GREYRIGHT': '\\t⇨',\n 'GREYBOTTOM': '\\t⇩',\n 'GREYLEFT': '\\t⇦',\n 'GREYEMPTY': '\\t◯',\n \n # '1': '▕',\n # '2': '▕▎',\n # '3': '▕▍',\n # '4': '▕▋',\n # '5': '▕▉',\n}\n\ndef print_lines(n_start, lines):\n for offset, line in enumerate(lines):\n n = n_start + offset\n if n % N == 0:\n nth = '*'\n else:\n nth = ' '\n #if len(line) > 2:\n # for k, v in VIZ.items():\n # line = line.replace(k, v)\n print(str(n).ljust(3), nth, line)\n",
"_____no_output_____"
],
[
"for chunk in parsed:\n buffer.clear()\n print('-' * 20)\n for i, piece in enumerate(chunk):\n if len(buffer) == buffer.maxlen:\n word = ','.join(buffer)\n if word in SEQUENCES:\n print_lines(i - buffer.maxlen, ['%s = %s' % (word, SEQUENCES[word])] * 5)\n buffer.clear()\n buffer.append(''.join(map(str, piece))) # Don't lose this piece.\n continue\n print_lines(i - buffer.maxlen, [buffer[0]])\n buffer.append(''.join(map(str, piece)))\n",
"--------------------\n0 * GREYBOTTOM4\n1 GREYBOTTOM2\n2 GREYRIGHT2\n3 GREYLEFT2\n4 BLACKRIGHT2\n5 GREYLEFT2\n6 BLACKRIGHT2\n7 GREYEMPTY4\n8 * GREYLEFT3\n9 BLACKTOP1\n10 BLACKEMPTY5\n11 GREYTOP3\n12 GREYRIGHT5\n13 GREYBOTTOM5\n14 GREYBOTTOM2\n15 BLACKEMPTY3\n16 * BLACKLEFT2\n17 GREYRIGHT4\n18 BLACKTOP4\n19 GREYBOTTOM2\n20 GREYTOP5\n21 BLACKRIGHT3\n22 GREYLEFT3\n23 BLACKLEFT3\n24 * BLACKLEFT2\n25 GREYRIGHT4\n26 BLACKTOP4\n27 GREYBOTTOM2\n28 GREYLEFT3\n29 GREYBOTTOM1\n30 GREYEMPTY2\n31 BLACKEMPTY4\n32 * BLACKLEFT2\n33 GREYRIGHT4\n34 BLACKTOP4\n35 GREYBOTTOM2\n36 GREYLEFT3\n37 BLACKBOTTOM1\n38 GREYEMPTY2\n39 BLACKBOTTOM3\n40 * BLACKLEFT2\n41 GREYRIGHT4\n42 BLACKTOP4\n43 GREYBOTTOM2\n44 GREYLEFT3\n45 GREYLEFT1\n46 GREYEMPTY2\n47 BLACKEMPTY4\n48 * BLACKLEFT2\n49 GREYRIGHT4\n50 BLACKTOP4\n51 GREYBOTTOM2\n52 GREYLEFT3\n53 BLACKLEFT1\n54 GREYEMPTY2\n55 BLACKBOTTOM3\n56 * BLACKLEFT2\n57 GREYRIGHT4\n58 BLACKTOP4\n59 GREYBOTTOM2\n60 GREYRIGHT5\n61 GREYLEFT5\n62 GREYLEFT2\n63 BLACKRIGHT5\n64 * GREYRIGHT5\n65 BLACKRIGHT5\n66 GREYRIGHT5\n67 GREYLEFT4\n68 BLACKTOP2\n69 BLACKRIGHT5\n70 GREYEMPTY2\n71 BLACKBOTTOM3\n72 * GREYLEFT3\n73 GREYTOP1\n--------------------\n0 * GREYLEFT3\n1 GREYEMPTY5\n2 BLACKEMPTY2\n3 BLACKBOTTOM3\n4 GREYLEFT3\n5 BLACKEMPTY1\n6 BLACKEMPTY2\n7 BLACKBOTTOM3\n8 * BLACKLEFT2\n9 GREYRIGHT4\n10 BLACKTOP4\n11 GREYBOTTOM2\n12 GREYLEFT3\n13 GREYRIGHT1\n14 GREYEMPTY2\n15 BLACKEMPTY4\n16 * BLACKLEFT2\n17 GREYRIGHT4\n18 BLACKBOTTOM4\n19 GREYBOTTOM2\n20 GREYLEFT3\n21 BLACKRIGHT1\n22 GREYEMPTY2\n23 BLACKBOTTOM3\n24 * BLACKLEFT2\n25 GREYRIGHT4\n26 BLACKBOTTOM4\n27 GREYBOTTOM2\n28 GREYLEFT3\n29 GREYBOTTOM4\n30 GREYBOTTOM2\n31 GREYRIGHT2\n32 * BLACKLEFT2\n33 GREYTOP3\n34 GREYBOTTOM2\n35 GREYBOTTOM5\n36 GREYBOTTOM2\n37 GREYEMPTY4\n38 GREYLEFT3\n39 BLACKTOP1\n40 * BLACKEMPTY5\n41 GREYTOP3\n42 GREYBOTTOM2\n43 GREYTOP5\n44 GREYLEFT5\n45 BLACKTOP4\n46 GREYLEFT2\n47 BLACKLEFT2\n48 * BLACKBOTTOM5\n49 BLACKTOP4\n50 GREYBOTTOM2\n51 GREYTOP4\n52 GREYTOP2\n53 BLACKTOP5\n54 BLACKTOP4\n55 GREYLEFT2\n56 * GREYBOTTOM3\n57 GREYRIGHT2\n58 GREYTOP5\n59 GREYBOTTOM2\n60 BLACKRIGHT4\n61 GREYLEFT2\n62 GREYLEFT3\n63 BLACKLEFT2\n64 * BLACKBOTTOM5\n65 BLACKRIGHT4\n66 GREYLEFT2\n67 GREYLEFT3\n68 BLACKLEFT2\n69 BLACKBOTTOM5\n70 BLACKLEFT2\n71 BLACKBOTTOM5\n72 * GREYTOP5\n73 GREYLEFT2\n74 GREYRIGHT5\n75 BLACKLEFT2\n76 GREYTOP3\n77 GREYEMPTY3\n78 GREYBOTTOM5\n79 GREYLEFT2\n80 * GREYBOTTOM4\n81 GREYBOTTOM2\n82 GREYRIGHT2\n83 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n84 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n85 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n86 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n87 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n--------------------\n0 * BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n1 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n2 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n3 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n4 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n5 BLACKEMPTY3\n6 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n7 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n8 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n9 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n10 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n11 BLACKRIGHT3\n12 GREYRIGHT3\n13 BLACKLEFT3\n14 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n15 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n16 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n17 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n18 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n19 GREYBOTTOM1\n20 GREYEMPTY2\n21 BLACKEMPTY4\n22 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n23 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n24 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n25 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n26 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n27 BLACKBOTTOM1\n28 GREYEMPTY2\n29 BLACKBOTTOM3\n30 BLACKLEFT2\n31 GREYRIGHT4\n32 * GREYEMPTY3\n33 BLACKTOP4\n34 GREYBOTTOM2\n35 GREYLEFT1\n36 GREYEMPTY2\n37 BLACKEMPTY4\n38 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n39 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n40 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n41 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n42 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n43 BLACKLEFT1\n44 GREYEMPTY2\n45 BLACKBOTTOM3\n46 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n47 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n48 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n49 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n50 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n51 GREYTOP4\n52 GREYTOP2\n53 BLACKTOP5\n54 GREYLEFT2\n55 GREYTOP1\n56 * GREYEMPTY2\n57 BLACKBOTTOM3\n58 GREYEMPTY3\n59 BLACKLEFT5\n60 GREYEMPTY2\n61 BLACKBOTTOM3\n62 GREYEMPTY3\n63 GREYEMPTY5\n--------------------\n0 * BLACKLEFT2\n1 GREYRIGHT4\n2 GREYEMPTY3\n3 BLACKTOP4\n4 GREYBOTTOM2\n5 BLACKEMPTY1\n6 BLACKEMPTY2\n7 BLACKBOTTOM3\n8 * BLACKLEFT2\n9 GREYRIGHT4\n10 GREYEMPTY3\n11 BLACKTOP4\n12 GREYBOTTOM2\n13 GREYRIGHT1\n14 GREYEMPTY2\n15 BLACKEMPTY4\n16 * GREYEMPTY3\n17 BLACKTOP4\n18 GREYEMPTY3\n19 BLACKTOP4\n20 GREYBOTTOM2\n21 BLACKRIGHT1\n22 GREYEMPTY2\n23 BLACKTOP3\n24 * GREYEMPTY3\n25 BLACKBOTTOM4\n26 GREYEMPTY3\n27 BLACKLEFT4\n28 GREYBOTTOM2\n29 BLACKRIGHT1\n30 GREYEMPTY2\n31 BLACKTOP3\n32 * GREYLEFT2\n33 BLACKLEFT4\n34 GREYLEFT2\n35 BLACKBOTTOM4\n36 GREYRIGHT1\n37 GREYEMPTY2\n38 BLACKEMPTY4\n39 GREYEMPTY3\n40 * BLACKLEFT4\n41 GREYEMPTY3\n42 BLACKBOTTOM4\n43 GREYBOTTOM2\n44 GREYRIGHT1\n45 GREYEMPTY2\n46 BLACKEMPTY4\n47 GREYLEFT2\n48 * BLACKBOTTOM4\n49 GREYLEFT2\n50 BLACKLEFT4\n51 GREYBOTTOM4\n52 GREYBOTTOM2\n53 GREYRIGHT2\n54 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n55 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n56 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n57 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n58 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n59 GREYEMPTY4\n60 GREYLEFT3\n61 BLACKTOP1\n62 BLACKEMPTY5\n63 GREYTOP3\n64 * GREYEMPTY3\n65 GREYBOTTOM5\n66 GREYLEFT2\n67 BLACKEMPTY3\n68 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n69 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n70 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n71 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n72 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n73 BLACKRIGHT3\n74 GREYRIGHT3\n75 BLACKLEFT3\n76 BLACKLEFT2\n77 GREYRIGHT4\n78 GREYEMPTY3\n79 BLACKTOP4\n80 * GREYBOTTOM2\n81 GREYLEFT1\n82 GREYEMPTY2\n83 BLACKEMPTY4\n84 GREYEMPTY3\n85 GREYBOTTOM1\n86 GREYEMPTY2\n87 BLACKTOP4\n88 * GREYEMPTY3\n89 GREYLEFT1\n90 GREYEMPTY2\n91 BLACKBOTTOM3\n92 GREYEMPTY3\n93 BLACKBOTTOM1\n94 GREYEMPTY2\n95 BLACKBOTTOM3\n96 * GREYEMPTY3\n97 GREYLEFT5\n98 GREYLEFT2\n99 GREYRIGHT2\n100 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n101 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n102 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n103 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n104 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n105 BLACKLEFT5\n106 GREYEMPTY2\n107 BLACKBOTTOM3\n108 GREYEMPTY3\n109 GREYTOP1\n110 GREYEMPTY2\n111 BLACKBOTTOM3\n112 * GREYEMPTY3\n113 GREYEMPTY1\n114 GREYEMPTY2\n115 BLACKTOP3\n116 GREYEMPTY3\n117 GREYEMPTY5\n118 BLACKEMPTY2\n119 BLACKBOTTOM3\n120 * GREYEMPTY3\n121 BLACKEMPTY1\n122 BLACKEMPTY2\n123 BLACKBOTTOM3\n124 GREYEMPTY3\n125 BLACKLEFT4\n126 GREYEMPTY3\n127 BLACKBOTTOM4\n128 * GREYBOTTOM2\n129 BLACKEMPTY1\n130 BLACKEMPTY2\n131 BLACKBOTTOM3\n132 GREYLEFT2\n133 BLACKLEFT4\n134 GREYLEFT2\n135 BLACKBOTTOM4\n136 * GREYEMPTY5\n137 BLACKEMPTY2\n138 BLACKBOTTOM3\n139 GREYEMPTY3\n140 BLACKLEFT4\n141 GREYEMPTY3\n142 BLACKBOTTOM4\n143 GREYBOTTOM2\n144 * GREYEMPTY5\n145 BLACKEMPTY2\n146 BLACKBOTTOM3\n147 GREYLEFT2\n148 BLACKLEFT4\n149 GREYLEFT2\n150 BLACKBOTTOM4\n151 GREYEMPTY5\n152 * BLACKEMPTY2\n153 BLACKBOTTOM3\n154 BLACKLEFT3\n155 GREYEMPTY5\n--------------------\n0 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n1 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n2 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n3 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n4 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n5 GREYEMPTY4\n6 GREYLEFT3\n7 BLACKTOP1\n8 * BLACKEMPTY5\n9 GREYRIGHT4\n10 GREYEMPTY3\n11 GREYBOTTOM5\n12 GREYBOTTOM2\n13 BLACKEMPTY3\n14 BLACKLEFT2\n15 GREYRIGHT4\n16 * GREYEMPTY3\n17 BLACKTOP4\n18 GREYBOTTOM2\n19 BLACKRIGHT3\n20 GREYRIGHT3\n21 BLACKLEFT3\n22 BLACKLEFT2\n23 GREYRIGHT4\n24 * GREYEMPTY3\n25 BLACKTOP4\n26 GREYBOTTOM2\n27 BLACKBOTTOM1\n28 GREYEMPTY2\n29 BLACKBOTTOM3\n30 BLACKLEFT2\n31 GREYRIGHT4\n32 * GREYEMPTY3\n33 BLACKTOP4\n34 GREYBOTTOM2\n35 GREYBOTTOM1\n36 GREYEMPTY2\n37 BLACKEMPTY4\n38 BLACKLEFT2\n39 GREYRIGHT4\n40 * GREYEMPTY3\n41 BLACKTOP4\n42 GREYBOTTOM2\n43 GREYLEFT1\n44 GREYEMPTY2\n45 BLACKEMPTY4\n46 GREYEMPTY3\n47 BLACKBOTTOM4\n48 * GREYEMPTY3\n49 BLACKLEFT4\n50 GREYBOTTOM2\n51 BLACKBOTTOM1\n52 GREYEMPTY2\n53 BLACKBOTTOM3\n54 GREYEMPTY3\n55 BLACKLEFT4\n56 * GREYEMPTY3\n57 BLACKBOTTOM4\n58 GREYBOTTOM2\n59 GREYTOP4\n60 GREYTOP2\n61 BLACKTOP5\n62 GREYRIGHT2\n63 GREYTOP1\n64 * GREYEMPTY2\n65 BLACKBOTTOM3\n66 GREYEMPTY3\n67 BLACKLEFT5\n68 GREYEMPTY2\n69 BLACKBOTTOM3\n70 GREYEMPTY3\n71 GREYEMPTY1\n72 * GREYEMPTY2\n73 BLACKBOTTOM3\n74 GREYEMPTY3\n75 GREYEMPTY1\n76 GREYEMPTY2\n77 BLACKTOP3\n78 GREYLEFT2\n79 BLACKBOTTOM4\n80 * GREYLEFT2\n81 BLACKLEFT4\n82 GREYEMPTY1\n83 GREYEMPTY2\n84 GREYEMPTY1\n85 GREYEMPTY2\n86 GREYEMPTY1\n87 GREYEMPTY2\n88 * GREYEMPTY1\n89 GREYEMPTY2\n90 GREYBOTTOM4\n91 GREYBOTTOM2\n92 GREYRIGHT2\n93 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n94 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n95 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n96 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n97 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n98 GREYEMPTY4\n99 GREYLEFT3\n100 BLACKTOP1\n101 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n102 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n103 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n104 * BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n105 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n106 BLACKEMPTY3\n107 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n108 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n109 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n110 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n111 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n112 * BLACKRIGHT3\n113 GREYRIGHT3\n114 BLACKLEFT3\n115 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n116 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n117 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n118 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n119 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n120 * GREYBOTTOM1\n121 GREYEMPTY2\n122 BLACKEMPTY4\n123 GREYLEFT2\n124 GREYTOP3\n125 GREYEMPTY3\n126 GREYBOTTOM5\n127 GREYBOTTOM2\n128 * BLACKBOTTOM1\n129 GREYEMPTY2\n130 BLACKBOTTOM3\n131 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n132 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n133 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n134 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n135 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n136 * GREYLEFT1\n137 GREYEMPTY2\n138 BLACKEMPTY4\n139 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n140 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n141 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n142 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n143 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n144 * BLACKLEFT1\n145 GREYEMPTY2\n146 BLACKBOTTOM3\n147 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n148 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n149 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n150 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n151 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n152 * GREYTOP4\n153 GREYTOP2\n154 BLACKTOP5\n155 GREYLEFT2\n156 GREYTOP1\n157 GREYEMPTY2\n158 BLACKBOTTOM3\n159 GREYEMPTY3\n160 * BLACKLEFT5\n161 GREYEMPTY2\n162 BLACKBOTTOM3\n163 GREYEMPTY3\n164 BLACKLEFT4\n165 GREYEMPTY3\n166 BLACKBOTTOM4\n167 GREYBOTTOM2\n168 * BLACKLEFT5\n169 GREYEMPTY2\n170 BLACKBOTTOM3\n171 BLACKLEFT2\n172 GREYTOP3\n173 BLACKRIGHT4\n174 GREYLEFT2\n175 GREYLEFT5\n176 * BLACKTOP4\n177 GREYLEFT2\n178 BLACKLEFT2\n179 GREYTOP3\n180 BLACKRIGHT4\n181 GREYLEFT2\n182 GREYTOP1\n183 GREYEMPTY2\n184 * BLACKBOTTOM3\n--------------------\n0 * BLACKTOP2\n1 BLACKLEFT3\n2 BLACKLEFT2\n3 GREYRIGHT4\n4 BLACKLEFT2\n5 GREYRIGHT4\n6 GREYTOP1\n7 GREYEMPTY2\n8 * BLACKBOTTOM3\n9 GREYLEFT2\n10 BLACKLEFT4\n11 GREYLEFT2\n12 BLACKBOTTOM4\n13 GREYBOTTOM4\n14 GREYBOTTOM2\n15 GREYRIGHT2\n16 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n17 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n18 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n19 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n20 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n21 GREYEMPTY4\n22 GREYLEFT3\n23 BLACKTOP1\n24 * BLACKEMPTY5\n25 GREYRIGHT4\n26 GREYEMPTY3\n27 BLACKBOTTOM4\n28 GREYBOTTOM2\n29 BLACKEMPTY3\n30 BLACKLEFT2\n31 GREYRIGHT4\n32 * GREYEMPTY3\n33 BLACKBOTTOM4\n34 GREYBOTTOM2\n35 BLACKRIGHT3\n36 GREYRIGHT3\n37 BLACKLEFT3\n38 BLACKLEFT2\n39 GREYRIGHT4\n40 * GREYEMPTY3\n41 BLACKBOTTOM4\n42 GREYBOTTOM2\n43 GREYBOTTOM1\n44 GREYEMPTY2\n45 BLACKEMPTY4\n46 GREYEMPTY3\n47 BLACKBOTTOM1\n48 * GREYEMPTY2\n49 BLACKBOTTOM3\n50 GREYEMPTY3\n51 GREYLEFT1\n52 GREYEMPTY2\n53 BLACKEMPTY4\n54 GREYEMPTY3\n55 BLACKLEFT1\n56 * GREYEMPTY2\n57 BLACKBOTTOM3\n58 GREYEMPTY3\n59 GREYLEFT1\n60 GREYEMPTY2\n61 BLACKEMPTY4\n62 BLACKLEFT2\n63 GREYRIGHT4\n64 * GREYLEFT2\n65 BLACKBOTTOM4\n66 BLACKLEFT1\n67 GREYEMPTY2\n68 BLACKBOTTOM3\n69 BLACKLEFT2\n70 GREYRIGHT4\n71 GREYLEFT2\n72 * BLACKBOTTOM4\n73 GREYBOTTOM4\n74 GREYBOTTOM2\n75 GREYRIGHT2\n76 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n77 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n78 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n79 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n80 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n81 GREYEMPTY4\n82 GREYLEFT3\n83 BLACKTOP1\n84 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n85 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n86 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n87 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n88 * BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n89 BLACKEMPTY3\n90 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n91 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n92 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n93 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n94 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n95 BLACKRIGHT3\n96 * GREYRIGHT3\n97 BLACKLEFT3\n98 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n99 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n100 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n101 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n102 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n103 GREYBOTTOM1\n104 * GREYEMPTY2\n105 BLACKEMPTY4\n106 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n107 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n108 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n109 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n110 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n111 BLACKBOTTOM1\n112 * GREYEMPTY2\n113 BLACKBOTTOM3\n114 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n115 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n116 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n117 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n118 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n--------------------\n0 * BLACKLEFT2\n1 GREYTOP3\n2 GREYLEFT2\n3 BLACKBOTTOM4\n4 BLACKBOTTOM1\n5 GREYEMPTY2\n6 BLACKBOTTOM3\n7 BLACKLEFT2\n8 * GREYTOP3\n9 GREYLEFT2\n10 BLACKBOTTOM4\n11 GREYBOTTOM4\n12 GREYBOTTOM2\n13 GREYRIGHT2\n14 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n15 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n16 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n17 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n18 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n19 GREYEMPTY5\n20 GREYLEFT3\n21 BLACKTOP1\n22 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n23 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n24 * BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n25 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n26 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n27 BLACKEMPTY3\n28 BLACKLEFT2,GREYTOP3,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2 = B\n29 BLACKLEFT2,GREYTOP3,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2 = B\n30 BLACKLEFT2,GREYTOP3,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2 = B\n31 BLACKLEFT2,GREYTOP3,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2 = B\n32 * BLACKLEFT2,GREYTOP3,GREYEMPTY3,BLACKBOTTOM4,GREYBOTTOM2 = B\n33 BLACKRIGHT3\n34 GREYRIGHT3\n35 BLACKLEFT3\n36 BLACKLEFT2\n37 GREYTOP3\n38 GREYEMPTY3\n39 BLACKBOTTOM4\n40 * BLACKBOTTOM2\n41 BLACKRIGHT3\n42 GREYRIGHT3\n43 BLACKLEFT3\n44 BLACKLEFT2\n45 GREYTOP3\n46 GREYLEFT2\n47 BLACKBOTTOM4\n48 * GREYEMPTY4\n49 GREYLEFT3\n50 BLACKTOP1\n51 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n52 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n53 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n54 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n55 BLACKEMPTY5,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = C\n56 * GREYBOTTOM4\n57 GREYBOTTOM2\n58 GREYRIGHT2\n59 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n60 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n61 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n62 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n63 BLACKLEFT2,GREYTOP3,GREYEMPTY3,GREYBOTTOM5,GREYBOTTOM2 = PIECE\n64 * GREYEMPTY4\n65 GREYLEFT3\n66 BLACKTOP1\n67 BLACKEMPTY5\n68 GREYTOP3\n69 GREYLEFT2\n70 GREYBOTTOM5\n71 GREYBOTTOM4\n72 * GREYBOTTOM2\n73 GREYRIGHT2\n74 BLACKBOTTOM2\n75 GREYTOP3\n76 GREYEMPTY3\n77 GREYBOTTOM5\n78 GREYBOTTOM2\n79 GREYBOTTOM4\n80 * GREYBOTTOM2\n81 GREYRIGHT2\n82 BLACKBOTTOM2\n83 GREYBOTTOM4\n84 GREYBOTTOM2\n85 GREYRIGHT2\n86 BLACKBOTTOM2\n87 GREYBOTTOM4\n"
],
[
"\"\"\"\n1BOTTOMBLACK\t\n1BOTTOMGrey\t\n1EMPTYBLACK\t\n1EMPTYGrey\t\n1LEFTBLACK\t\n1LEFTGrey\t\n1RIGHTBLACK\t\n1RIGHTGrey\t\n1TOPBLACK\tEGGS\n1TOPGrey\t\n2BOTTOMBLACK\tTHAT\n2BOTTOMGrey\tI\n2EMPTYBLACK\t\n2EMPTYGrey\t\n2LEFTBLACK\t\n2LEFTGrey\tYOU\n2RIGHTBLACK\tTHANK\n2RIGHTGrey\tSAM\n2TOPBLACK\t\n2TOPGrey\t\n3BOTTOMBLACK\t\n3BOTTOMGrey\t\n3EMPTYBLACK\t\n3EMPTYGrey\t\n3LEFTBLACK\t\n3LEFTGrey\tAND\n3RIGHTBLACK\t\n3RIGHTGrey\t\n3TOPBLACK\t\n3TOPGrey\t\n4BOTTOMBLACK\t\n4BOTTOMGrey\tAM\n4EMPTYBLACK\t\n4EMPTYGrey\tHAM\n4LEFTBLACK\t\n4LEFTGrey\t\n4RIGHTBLACK\t\n4RIGHTGrey\t\n4TOPBLACK\t\n4TOPGrey\t\n5BOTTOMBLACK\t\n5BOTTOMGrey\t\n5EMPTYBLACK\t\n5EMPTYGrey\t\n5LEFTBLACK\t\n5LEFTGrey\t\n5RIGHTBLACK\t\n5RIGHTGrey\t\n5TOPBLACK\t\n5TOPGrey\t\n\"\"\"\n\nWORDS = {\n 'BLACKTOP1': 'EGGS',\n 'GREYLEFT3': 'AND',\n 'GREYEMPTY4': 'HAM',\n 'GREYEMPTY2': 'A',\n 'GREYEMPTY1': 'TRAIN',\n 'BLACKLEFT4': 'COULD',\n 'GREYLEFT2': 'YOU',\n 'BLACKBOTTOM4': 'WOULD',\n 'BLACKTOP3': 'ON',\n 'GREYEMPTY3': 'NOT',\n 'BLACKBOTTOM3': 'IN',\n 'BLACKLEFT5': 'TREE',\n 'GREYTOP1': 'CAR',\n 'GREYRIGHT2': 'SAM',\n 'BLACKTOP5': 'LET',\n 'GREYTOP2': 'ME',\n 'GREYTOP4': 'BE',\n 'GREYBOTTOM2': 'I',\n 'BLACKBOTTOM1': 'BOX',\n 'BLACKEMPTY4': 'IN',\n 'GREYLEFT1': 'FOX',\n 'BLACKTOP4': 'WILL',\n 'GREYRIGHT4': 'EAT',\n 'BLACKLEFT2': 'THEM',\n 'GREYBOTTOM1': 'HOUSE',\n 'BLACKLEFT3': 'HERE',\n 'GREYRIGHT3': 'OR',\n 'BLACKRIGHT3': 'THERE',\n 'BLACKEMPTY3': ''\n}",
"_____no_output_____"
],
[
"for chunk in reversed(parsed):\n for i, piece in enumerate(reversed(chunk)):\n word = ''.join(map(str, piece))\n if word in WORDS:\n print(WORDS[word])\n else:\n print(word)\n",
"I\nGREYBOTTOM4\nSAM\nSAM\nI\nGREYBOTTOM4\nBLACKBOTTOM2\nSAM\nI\nGREYBOTTOM4\nBLACKBOTTOM2\nSAM\nI\nGREYBOTTOM4\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nBLACKBOTTOM2\nSAM\nI\nGREYBOTTOM4\nGREYBOTTOM5\nYOU\nGREYTOP3\nBLACKEMPTY5\nEGGS\nAND\nHAM\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nSAM\nI\nGREYBOTTOM4\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nBLACKEMPTY5\nEGGS\nAND\nHAM\nWOULD\nYOU\nGREYTOP3\nTHEM\nHERE\nOR\nTHERE\nBLACKBOTTOM2\nWOULD\nNOT\nGREYTOP3\nTHEM\nHERE\nOR\nTHERE\nI\nWOULD\nNOT\nGREYTOP3\nTHEM\nBLACKEMPTY3\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nBLACKEMPTY5\nEGGS\nAND\nGREYEMPTY5\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nSAM\nI\nGREYBOTTOM4\nWOULD\nYOU\nGREYTOP3\nTHEM\nIN\nA\nBOX\nWOULD\nYOU\nGREYTOP3\nTHEM\nA\nHOUSE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nIN\nA\nBOX\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nIN\nA\nHOUSE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nHERE\nOR\nTHERE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nBLACKEMPTY3\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nBLACKEMPTY5\nEGGS\nAND\nHAM\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nSAM\nI\nGREYBOTTOM4\nWOULD\nYOU\nEAT\nTHEM\nIN\nA\nBLACKLEFT1\nWOULD\nYOU\nEAT\nTHEM\nIN\nA\nFOX\nNOT\nIN\nA\nBLACKLEFT1\nNOT\nIN\nA\nFOX\nNOT\nIN\nA\nBOX\nNOT\nIN\nA\nHOUSE\nI\nWOULD\nNOT\nEAT\nTHEM\nHERE\nOR\nTHERE\nI\nWOULD\nNOT\nEAT\nTHEM\nBLACKEMPTY3\nI\nWOULD\nNOT\nEAT\nBLACKEMPTY5\nEGGS\nAND\nHAM\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nSAM\nI\nGREYBOTTOM4\nWOULD\nYOU\nCOULD\nYOU\nIN\nA\nCAR\nEAT\nTHEM\nEAT\nTHEM\nHERE\nBLACKTOP2\nI\nWOULD\nNOT\nCOULD\nNOT\nIN\nA\nCAR\nYOU\nBLACKRIGHT4\nGREYTOP3\nTHEM\nYOU\nWILL\nGREYLEFT5\nYOU\nBLACKRIGHT4\nGREYTOP3\nTHEM\nIN\nA\nTREE\nI\nWOULD\nNOT\nCOULD\nNOT\nIN\nA\nTREE\nNOT\nIN\nA\nCAR\nYOU\nLET\nME\nBE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nIN\nA\nBLACKLEFT1\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nIN\nA\nFOX\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nIN\nA\nBOX\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nYOU\nIN\nA\nHOUSE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nHERE\nOR\nTHERE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nBLACKEMPTY3\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nBLACKEMPTY5\nEGGS\nAND\nHAM\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nSAM\nI\nGREYBOTTOM4\nA\nTRAIN\nA\nTRAIN\nA\nTRAIN\nA\nTRAIN\nCOULD\nYOU\nWOULD\nYOU\nON\nA\nTRAIN\nNOT\nIN\nA\nTRAIN\nNOT\nIN\nA\nTREE\nNOT\nIN\nA\nCAR\nSAM\nLET\nME\nBE\nI\nWOULD\nNOT\nCOULD\nNOT\nIN\nA\nBOX\nI\nCOULD\nNOT\nWOULD\nNOT\nIN\nA\nFOX\nI\nWILL\nNOT\nEAT\nTHEM\nIN\nA\nHOUSE\nI\nWILL\nNOT\nEAT\nTHEM\nIN\nA\nBOX\nI\nWILL\nNOT\nEAT\nTHEM\nHERE\nOR\nTHERE\nI\nWILL\nNOT\nEAT\nTHEM\nBLACKEMPTY3\nI\nGREYBOTTOM5\nNOT\nEAT\nBLACKEMPTY5\nEGGS\nAND\nHAM\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nI\nGREYBOTTOM4\nGREYTOP5\nIN\nBLACKEMPTY2\nGREYEMPTY5\nHERE\nIN\nBLACKEMPTY2\nGREYEMPTY5\nWOULD\nYOU\nCOULD\nYOU\nIN\nBLACKEMPTY2\nGREYEMPTY5\nI\nWOULD\nNOT\nCOULD\nNOT\nIN\nBLACKEMPTY2\nGREYEMPTY5\nWOULD\nYOU\nCOULD\nYOU\nIN\nBLACKEMPTY2\nBLACKEMPTY1\nI\nWOULD\nNOT\nCOULD\nNOT\nIN\nBLACKEMPTY2\nBLACKEMPTY1\nNOT\nIN\nBLACKEMPTY2\nGREYEMPTY5\nNOT\nON\nA\nTRAIN\nNOT\nIN\nA\nCAR\nNOT\nIN\nA\nTREE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nSAM\nYOU\nGREYLEFT5\nNOT\nIN\nA\nBOX\nNOT\nIN\nA\nFOX\nNOT\nWILL\nA\nHOUSE\nNOT\nIN\nA\nFOX\nI\nWILL\nNOT\nEAT\nTHEM\nHERE\nOR\nTHERE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nBLACKEMPTY3\nYOU\nGREYBOTTOM5\nNOT\nGREYTOP3\nBLACKEMPTY5\nEGGS\nAND\nHAM\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nSAM\nI\nGREYBOTTOM4\nCOULD\nYOU\nWOULD\nYOU\nIN\nA\nGREYRIGHT1\nI\nWOULD\nNOT\nCOULD\nNOT\nIN\nA\nGREYRIGHT1\nWOULD\nYOU\nCOULD\nYOU\nON\nA\nBLACKRIGHT1\nI\nCOULD\nNOT\nWOULD\nNOT\nON\nA\nBLACKRIGHT1\nI\nWILL\nNOT\nWILL\nNOT\nIN\nA\nGREYRIGHT1\nI\nWILL\nNOT\nEAT\nTHEM\nIN\nBLACKEMPTY2\nBLACKEMPTY1\nI\nWILL\nNOT\nEAT\nTHEM\nA\nTRAIN\nNOT\nIN\nBLACKEMPTY2\nGREYEMPTY5\nNOT\nIN\nA\nTREE\nNOT\nIN\nA\nCAR\nYOU\nLET\nME\nBE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nIN\nA\nBLACKLEFT1\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nIN\nA\nFOX\nI\nWILL\nNOT\nEAT\nTHEM\nIN\nA\nBOX\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nIN\nA\nHOUSE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nHERE\nOR\nTHERE\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nBLACKEMPTY3\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nBLACKEMPTY5\nAND\nHAM\nI\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nSAM\nI\nGREYBOTTOM4\nYOU\nGREYBOTTOM5\nNOT\nGREYTOP3\nTHEM\nGREYRIGHT5\nYOU\nGREYTOP5\nBLACKBOTTOM5\nTHEM\nBLACKBOTTOM5\nTHEM\nAND\nYOU\nBLACKRIGHT4\nBLACKBOTTOM5\nTHEM\nAND\nYOU\nBLACKRIGHT4\nI\nGREYTOP5\nSAM\nGREYBOTTOM3\nYOU\nWILL\nLET\nME\nBE\nI\nWILL\nBLACKBOTTOM5\nTHEM\nYOU\nWILL\nGREYLEFT5\nGREYTOP5\nI\nGREYTOP3\nBLACKEMPTY5\nEGGS\nAND\nHAM\nI\nGREYBOTTOM5\nI\nGREYTOP3\nTHEM\nSAM\nI\nGREYBOTTOM4\nAND\nI\nWOULD\nEAT\nTHEM\nIN\nA\nBLACKRIGHT1\nAND\nI\nWOULD\nEAT\nTHEM\nIN\nA\nGREYRIGHT1\nAND\nI\nWILL\nEAT\nTHEM\nIN\nBLACKEMPTY2\nBLACKEMPTY1\nAND\nIN\nBLACKEMPTY2\nGREYEMPTY5\nAND\nA\nTRAIN\nAND\nIN\nA\nCAR\nAND\nIN\nA\nBLACKRIGHT5\nBLACKTOP2\nGREYLEFT4\nGREYRIGHT5\nBLACKRIGHT5\nGREYRIGHT5\nBLACKRIGHT5\nYOU\nGREYLEFT5\nGREYRIGHT5\nI\nWILL\nEAT\nTHEM\nIN\nA\nBLACKLEFT1\nAND\nI\nWILL\nEAT\nTHEM\nIN\nA\nFOX\nAND\nI\nWILL\nEAT\nTHEM\nIN\nA\nBOX\nAND\nI\nWILL\nEAT\nTHEM\nIN\nA\nHOUSE\nAND\nI\nWILL\nEAT\nTHEM\nHERE\nAND\nTHERE\nGREYTOP5\nI\nWILL\nEAT\nTHEM\nBLACKEMPTY3\nI\nGREYBOTTOM5\nGREYRIGHT5\nGREYTOP3\nBLACKEMPTY5\nEGGS\nAND\nHAM\nBLACKRIGHT2\nYOU\nBLACKRIGHT2\nYOU\nSAM\nI\nGREYBOTTOM4\n"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cb54b55002e8d01ab5e4e68e416e6d489b8654 | 281,497 | ipynb | Jupyter Notebook | demo_connect_poi.ipynb | ywnch/toolbox | e5c0b19b1beb558c8cc281e69ff9b2267fff3548 | [
"MIT"
] | 19 | 2019-06-14T17:46:58.000Z | 2022-01-28T01:38:15.000Z | demo_connect_poi.ipynb | ywnch/toolbox | e5c0b19b1beb558c8cc281e69ff9b2267fff3548 | [
"MIT"
] | 5 | 2019-08-14T19:10:11.000Z | 2021-05-20T07:18:50.000Z | demo_connect_poi.ipynb | ywnch/toolbox | e5c0b19b1beb558c8cc281e69ff9b2267fff3548 | [
"MIT"
] | 6 | 2019-07-20T16:42:30.000Z | 2021-05-02T00:47:47.000Z | 528.136961 | 262,812 | 0.935292 | [
[
[
"# Demonstration of integrating POI Points to OSM road network\n1. Use anyway you like to get the sample [POI data](https://assets.onemap.sg/shp/supermarkets.zip) consisting of supermarkets from [OneMap SG](https://www.onemap.sg/).\n2. Use [OSMnx](https://osmnx.readthedocs.io/en/stable/index.html) to download the pedestrian network from [OpenStreetMap](https://openstreetmap.org), we use a bounding box of Toa Payoh for the demo.\n3. Save the network as `.shp` and read in as two `GeoDataFrame`s: junction as `nodes` and road segment as `edges`.\n4. Integrate POIs into the network using the `connect_poi` function.",
"_____no_output_____"
]
],
[
[
"import os\nimport wget\nimport osmnx as ox\nimport geopandas as gpd\nfrom toolbox import connect_poi",
"_____no_output_____"
]
],
[
[
"## 1. Prepare POIs",
"_____no_output_____"
]
],
[
[
"# get POI data\nurl = \"https://assets.onemap.sg/shp/supermarkets.zip\"\nPATH = 'data/supermarkets.zip'\n\nif os.path.exists(PATH):\n print('File existed.')\nelse:\n PATH = wget.download(url, PATH)\n print('File downloaded.')",
"File downloaded.\n"
],
[
"# load and subset the POI based on a bounding box\nbbox = (103.8427, 1.3308, 103.8601, 1.3416) # set bbox of Toa Payoh\npois = gpd.read_file('supermarkets', vfs='zip://{}'.format(PATH), crs='epsg:3857')\npois = pois.to_crs(epsg=4326)\npois['lon'] = pois['geometry'].apply(lambda p: p.x)\npois['lat'] = pois['geometry'].apply(lambda p: p.y)\npois = pois[(pois['lon'] >= bbox[0]) & (pois['lon'] <= bbox[2]) &\n (pois['lat'] >= bbox[1]) & (pois['lat'] <= bbox[3])]\npois['key'] = pois.index # set a primary key column\npois.head(3)",
"/Users/Yuwen/anaconda/lib/python3.6/site-packages/fiona/env.py:398: FionaDeprecationWarning: The vfs keyword argument is deprecated. Instead, pass a URL that uses a zip or tar (for example) scheme.\n return f(*args, **kwargs)\n"
]
],
[
[
"[NOTE] For use in pandana, you may want to ensure the key column for the input is numeric-only to avoid processing errors. Preferably use unique integers (int or str) only, and be aware not to intersect with the node key, which is 'osmid' if you use OSM data, in the nodes gdf.",
"_____no_output_____"
],
[
"## 2. Prepare network",
"_____no_output_____"
]
],
[
[
"# get road network and save as .shp\nG = ox.graph_from_bbox(bbox[3], bbox[1], bbox[2], bbox[0], network_type='walk')\nox.save_graph_shapefile(G, filepath='data/sample/', encoding='utf-8')",
"_____no_output_____"
],
[
"# load as GeoDataFrame\nnodes = gpd.read_file('data/sample/nodes.shp')\nedges = gpd.read_file('data/sample/edges.shp')",
"_____no_output_____"
]
],
[
[
"## 3. Integrate POIs and network",
"_____no_output_____"
]
],
[
[
"connect_poi?",
"_____no_output_____"
],
[
"# it's a one-liner, but is still at beta at the moment\nnew_nodes, new_edges = connect_poi(pois, nodes, edges, key_col='key', path=None)",
"Building rtree...\nUpdating external nodes...\nProjecting POIs to the network...\nUpdating internal nodes...\nUpdating internal edges...\nUpdating external links...\nRemove faulty projections: 0/7 (0.00%)\nNOTE: duplication in node coordinates keys\nNodes count: 845\nNode coordinates key count: 843\nMissing 'from' nodes: 0\nMissing 'to' nodes: 0\n"
]
],
[
[
"## 4. Check output\n1. First is an example of how edges will be broken into segments when there is a POI to be linked onto it. This process accommodates for multiple POIs. E.g., for 2 POIs projecting onto a same edge (but not overlapping nor on either vertices of the edge), the edge will be replaced with 3 segments.\n2. Then a figure illustrating how the new network looks like after the update.\n\n[NOTE] Be noted that the aggregated length of segments will not equal exactly to the length of the original edge for some reasons that are not handled at the moment.",
"_____no_output_____"
]
],
[
[
"# original edge\nedges[edges['from'] == 3370311549][['from', 'to', 'length']]",
"_____no_output_____"
],
[
"# new edges replacing the original (953, 954) and connecting the poi (964)\nnew_edges[(new_edges['from'] == 3370311549) |\n (new_edges['from'] == 9990000005) |\n (new_edges['to'] == 9990000005) ][['from', 'to', 'length']]",
"_____no_output_____"
],
[
"# output\npoi_links = new_edges[new_edges['highway'] == 'projected_footway']\nax = edges.plot(linewidth=0.8, figsize=(18,10), label='Original Road Edges')\npoi_links.plot(color='indianred', linewidth=2, ax=ax, label='New Connection Edges')\npois.plot(color='indianred', marker='.', markersize=200, ax=ax, label='POI')\nax.legend(loc=2, fontsize=18)\nax.set_title('The integrated network of supermarkets and road network at Toa Payoh', fontsize=22);",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
] |
d0cb6f7ba275ca8b5cb786a7dbffe6a398a268c0 | 14,286 | ipynb | Jupyter Notebook | lectures/Lecture_19.ipynb | KiranArun/CSMM.102x-Machine_Learning | a2d5cda6e380ebdd0546d3f8ed07cb0881b685fc | [
"MIT"
] | 6 | 2019-09-27T13:50:16.000Z | 2021-01-14T10:13:25.000Z | lectures/Lecture_19.ipynb | semihkumluk/CSMM.102x-Machine_Learning | a2d5cda6e380ebdd0546d3f8ed07cb0881b685fc | [
"MIT"
] | null | null | null | lectures/Lecture_19.ipynb | semihkumluk/CSMM.102x-Machine_Learning | a2d5cda6e380ebdd0546d3f8ed07cb0881b685fc | [
"MIT"
] | 4 | 2018-12-05T18:03:42.000Z | 2020-02-22T15:42:09.000Z | 109.053435 | 11,480 | 0.866233 | [
[
[
"# Pincipal component analysis",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt",
"_____no_output_____"
]
],
[
[
"this is reducing data to a lower dimensional space\n\n$q^tq = 1$\n\n$q^Tx_i =$ distance of datapoint after projecting it on line of vector q\n\n$(q^Tx_i)q =$ stretches vector to the datapoint\n- this is the prediction of the data\n- using the vector q which is constant for all data points\n- and the value which stretches the vector to as close as possible to the real data point \n\nWe optimize q using minimize squared error\n\n$q = \\arg \\min_q \\sum_{i=1}^n||x_i - qq^Tx_i||^2$\n\n$= \\arg \\min_q \\sum_{i=1}^n x_i^Tx_i - q^T\\underbrace{(\\sum_{i=1}^nx_ix_i^T)}_{XX^T}q$\n\n$q =\\arg \\max_q q^T(XX^T)q$\n\nq = 1st eigenvector of $XX^T$\n\n$\\lambda = q^T(XX^T)q$ 1st eigenvalue",
"_____no_output_____"
]
],
[
[
"x = np.linspace(0, 5, 201)\n\ndef f(x):\n return np.exp(-x)*\n\ny = f(x)\n\nfig, ax = plt.subplots(1, figsize=(8,4))\n\nax.plot(x,y)\n\nax.grid(True)\nplt.show()\n",
"/usr/local/lib/python2.7/dist-packages/ipykernel_launcher.py:4: RuntimeWarning: divide by zero encountered in log\n after removing the cwd from sys.path.\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0cb77303ce27220e8f7bfe423335ba658ebadc3 | 150,058 | ipynb | Jupyter Notebook | format_and_add_errors.ipynb | chummels/cgm_modeling_challenge | e20dd49771557a1a9e3de14b2f557c428bb9072a | [
"BSD-2-Clause"
] | null | null | null | format_and_add_errors.ipynb | chummels/cgm_modeling_challenge | e20dd49771557a1a9e3de14b2f557c428bb9072a | [
"BSD-2-Clause"
] | null | null | null | format_and_add_errors.ipynb | chummels/cgm_modeling_challenge | e20dd49771557a1a9e3de14b2f557c428bb9072a | [
"BSD-2-Clause"
] | null | null | null | 312.620833 | 10,516 | 0.93064 | [
[
[
"import numpy as np\nimport pandas as pd\nimport scipy\nimport scipy.stats\nimport verdict",
"_____no_output_____"
],
[
"import matplotlib.pyplot as plt",
"_____no_output_____"
]
],
[
[
"# Parameters",
"_____no_output_____"
]
],
[
[
"sample_number = 0",
"_____no_output_____"
]
],
[
[
"# Load Mock Data",
"_____no_output_____"
]
],
[
[
"# Load using my preferred wrapper for hdf5 files.\ndata = verdict.Dict.from_hdf5( './data/synthetic_data/sample{}/observers_file.h5'.format( sample_number ) )",
"_____no_output_____"
]
],
[
[
"# Assign Errors\n\nOur goal is to create semi-realistic errors.\nWe won't put too much effort into this, so we'll roughly fit a gamma function to the distribution of errors from COS-Halos data, and sample from the distribution.\nWe do provide a bound on 1.5 the maximum observed error, however, to prevent getting anything too crazy.",
"_____no_output_____"
],
[
"## Derive Errors from Data",
"_____no_output_____"
]
],
[
[
"df = pd.read_fwf(\n './data/cos_halos_data.txt',\n skiprows = 31,\n names = [ 'ID', 'z', 'Ion', 'Vel', 'e_Vel', 'b', 'e_b', 'logN', 'elogN', 'l_logNA', ',logNA', 'e_logNA' ],\n)",
"_____no_output_____"
],
[
"# Find ions used\nions = list( set( df['Ion'] ) )\nions.remove( np.nan )\nions.append( 'H I' )",
"_____no_output_____"
],
[
"# Get out errors from data, mildly processed\nelogNs = {}\nfor ion in ions:\n \n if ion != 'H I':\n # Locate\n ion_df = df[df['Ion'] == ion]\n elogN = []\n for e in ion_df['elogN'].values:\n try:\n elogN.append( float( e ) )\n except ValueError:\n continue\n else:\n # Manual H I input from COS-Halos hydrogen paper\n elogN = [ 0.03, 0.05, 0.05, 0.03, 0.09, 0.03, 0.15, 0.15, 0.08, 0.06, 0.03, 0.06, 0.03, 0.04, 0.03, 0.13, 0.06, 0.04, 0.05, 0.06, 0.02, 0.04, 0.06, 0.04, 0.04, 0.03, 0.07, 0.06, 0.10, 0.12, 0.06, 0.02, 0.03, 0.09, 0.04, 0.03, 0.04, ]\n\n elogNs[ion] = np.array( elogN )",
"_____no_output_____"
],
[
"# Stats of the errors\n\nerrs = {}\nfor ion in ions:\n \n elogN = elogNs[ion]\n\n # Extract\n errs[ion] = {\n 'mean': np.mean( elogN ),\n 'std': np.std( elogN ),\n }\n \n \n # Create a gamma fn, *very* roughly fitted\n beta = errs[ion]['mean'] / errs[ion]['std']\n alpha = errs[ion]['mean'] * beta\n dist = scipy.stats.gamma( a=alpha, scale=1/beta )\n \n # Plot and store\n fig = plt.figure()\n ax = plt.gca()\n ax.hist(\n elogN,\n bins = np.linspace( 0, elogN.max(), 32 )\n )\n ax.plot(\n np.linspace( 0, elogN.max(), 128 ),\n dist.pdf( np.linspace( 0, elogN.max(), 128 ) ),\n )\n ax.annotate(\n s = ion,\n xy = ( 1, 1 ),\n xytext = ( -5, -5 ),\n va = 'top',\n ha = 'right',\n xycoords = 'axes fraction',\n textcoords = 'offset points',\n fontsize = 20,\n )\n errs[ion]['dist'] = dist",
"_____no_output_____"
]
],
[
[
"## Apply to Data",
"_____no_output_____"
]
],
[
[
"data_out = {}\nfor ion in data.keys():\n \n dist = errs[ion]['dist']\n \n ion_errs = []\n modified_columns = []\n for i, column in enumerate( data[ion] ):\n \n ion_err = np.inf\n while ( ion_err > elogNs[ion].max()*1.5 ) or ( ion_err < elogNs[ion].min() / 1.5 ):\n ion_err = dist.rvs()\n \n # Assume error is conservative, apply\n modified_column = column * 10.**np.random.uniform( -ion_err, ion_err )\n \n # Round and store\n ion_errs.append( np.round( ion_err, decimals=3 ) )\n modified_columns.append( np.round( np.log10( modified_column ), decimals=3 ) )\n \n data_out[ion] = {\n 'logN': np.array( modified_columns ),\n 'elogN': np.array( ion_errs ),\n }\ndata_out = verdict.Dict( data_out )",
"<ipython-input-21-1a3bbd98ad63>:19: RuntimeWarning: divide by zero encountered in log10\n modified_columns.append( np.round( np.log10( modified_column ), decimals=3 ) )\n"
]
],
[
[
"# Save Output",
"_____no_output_____"
]
],
[
[
"data_out.to_hdf5( './data/sample{}.h5'.format( sample_number ) )",
"_____no_output_____"
]
],
[
[
"# Reload for Checking",
"_____no_output_____"
]
],
[
[
"data_out = verdict.Dict.from_hdf5( './data/synthetic_data_samples/sample{}.h5'.format( sample_number ) )",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0cb7ad726ccd04fc4fe385e67f9c73de086f435 | 309,539 | ipynb | Jupyter Notebook | AAAI/Interpretability/attention_sparsity_comparison/cifar_entropy/sixth_layer/old codes/sixth_layer_entropy_seed_0_k_001.ipynb | lnpandey/DL_explore_synth_data | 0a5d8b417091897f4c7f358377d5198a155f3f24 | [
"MIT"
] | 2 | 2019-08-24T07:20:35.000Z | 2020-03-27T08:16:59.000Z | AAAI/Interpretability/attention_sparsity_comparison/cifar_entropy/sixth_layer/old codes/sixth_layer_entropy_seed_0_k_001.ipynb | lnpandey/DL_explore_synth_data | 0a5d8b417091897f4c7f358377d5198a155f3f24 | [
"MIT"
] | null | null | null | AAAI/Interpretability/attention_sparsity_comparison/cifar_entropy/sixth_layer/old codes/sixth_layer_entropy_seed_0_k_001.ipynb | lnpandey/DL_explore_synth_data | 0a5d8b417091897f4c7f358377d5198a155f3f24 | [
"MIT"
] | 3 | 2019-06-21T09:34:32.000Z | 2019-09-19T10:43:07.000Z | 91.688092 | 38,390 | 0.736831 | [
[
[
"from google.colab import drive\ndrive.mount('/content/drive')",
"Mounted at /content/drive\n"
],
[
"# from google.colab import drive\n# drive.mount('/content/drive')\n!pwd",
"/content\n"
],
[
"\npath = '/content/drive/MyDrive/Research/AAAI/cifar_new/k_001/sixth_run1_'",
"_____no_output_____"
],
[
"import torch.nn as nn\nimport torch.nn.functional as F\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport torch\nimport torchvision\nimport torchvision.transforms as transforms\nfrom torch.utils.data import Dataset, DataLoader\nfrom torchvision import transforms, utils\nfrom matplotlib import pyplot as plt\nimport copy\n\n# Ignore warnings\nimport warnings\nwarnings.filterwarnings(\"ignore\")\nn_seed = 0\nk = 0.001",
"_____no_output_____"
],
[
"torch.backends.cudnn.deterministic = True\ntorch.backends.cudnn.benchmark= False",
"_____no_output_____"
],
[
"transform = transforms.Compose(\n [transforms.ToTensor(),\n transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])\n\ntrainset = torchvision.datasets.CIFAR10(root='./data', train=True, download=True, transform=transform)\n\n\ntestset = torchvision.datasets.CIFAR10(root='./data', train=False, download=True, transform=transform)\n",
"Downloading https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz to ./data/cifar-10-python.tar.gz\n"
],
[
"trainloader = torch.utils.data.DataLoader(trainset, batch_size=10, shuffle=False)\ntestloader = torch.utils.data.DataLoader(testset, batch_size=10, shuffle=False)\n\n\nclasses = ('plane', 'car', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck')\n\nforeground_classes = {'plane', 'car', 'bird'}\n#foreground_classes = {'bird', 'cat', 'deer'}\nbackground_classes = {'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck'}\n#background_classes = {'plane', 'car', 'dog', 'frog', 'horse','ship', 'truck'}\n\nfg1,fg2,fg3 = 0,1,2",
"_____no_output_____"
],
[
"dataiter = iter(trainloader)\nbackground_data=[]\nbackground_label=[]\nforeground_data=[]\nforeground_label=[]\nbatch_size=10\n\nfor i in range(5000):\n images, labels = dataiter.next()\n for j in range(batch_size):\n if(classes[labels[j]] in background_classes):\n img = images[j].tolist()\n background_data.append(img)\n background_label.append(labels[j])\n else:\n img = images[j].tolist()\n foreground_data.append(img)\n foreground_label.append(labels[j])\n \nforeground_data = torch.tensor(foreground_data)\nforeground_label = torch.tensor(foreground_label)\nbackground_data = torch.tensor(background_data)\nbackground_label = torch.tensor(background_label)",
"_____no_output_____"
],
[
"def create_mosaic_img(bg_idx,fg_idx,fg): \n \"\"\"\n bg_idx : list of indexes of background_data[] to be used as background images in mosaic\n fg_idx : index of image to be used as foreground image from foreground data\n fg : at what position/index foreground image has to be stored out of 0-8\n \"\"\"\n image_list=[]\n j=0\n for i in range(9):\n if i != fg:\n image_list.append(background_data[bg_idx[j]])#.type(\"torch.DoubleTensor\"))\n j+=1\n else: \n image_list.append(foreground_data[fg_idx])#.type(\"torch.DoubleTensor\"))\n label = foreground_label[fg_idx]- fg1 # minus fg1 because our fore ground classes are fg1,fg2,fg3 but we have to store it as 0,1,2\n #image_list = np.concatenate(image_list ,axis=0)\n image_list = torch.stack(image_list) \n return image_list,label",
"_____no_output_____"
],
[
"desired_num = 30000\nmosaic_list_of_images =[] # list of mosaic images, each mosaic image is saved as list of 9 images\nfore_idx =[] # list of indexes at which foreground image is present in a mosaic image i.e from 0 to 9 \nmosaic_label=[] # label of mosaic image = foreground class present in that mosaic\nfor i in range(desired_num):\n np.random.seed(i)\n bg_idx = np.random.randint(0,35000,8)\n fg_idx = np.random.randint(0,15000)\n fg = np.random.randint(0,9)\n fore_idx.append(fg)\n image_list,label = create_mosaic_img(bg_idx,fg_idx,fg)\n mosaic_list_of_images.append(image_list)\n mosaic_label.append(label)",
"_____no_output_____"
],
[
"plt.imshow(torch.transpose(mosaic_list_of_images[0][1],dim0= 0,dim1 = 2))",
"Clipping input data to the valid range for imshow with RGB data ([0..1] for floats or [0..255] for integers).\n"
],
[
"class MosaicDataset(Dataset):\n \"\"\"MosaicDataset dataset.\"\"\"\n\n def __init__(self, mosaic_list_of_images, mosaic_label, fore_idx):\n \"\"\"\n Args:\n csv_file (string): Path to the csv file with annotations.\n root_dir (string): Directory with all the images.\n transform (callable, optional): Optional transform to be applied\n on a sample.\n \"\"\"\n self.mosaic = mosaic_list_of_images\n self.label = mosaic_label\n self.fore_idx = fore_idx\n\n def __len__(self):\n return len(self.label)\n\n def __getitem__(self, idx):\n return self.mosaic[idx] , self.label[idx], self.fore_idx[idx]\n\nbatch = 250\nmsd = MosaicDataset(mosaic_list_of_images, mosaic_label , fore_idx)\ntrain_loader = DataLoader( msd,batch_size= batch ,shuffle=True)",
"_____no_output_____"
],
[
"class Focus(nn.Module):\n def __init__(self):\n super(Focus, self).__init__()\n self.conv1 = nn.Conv2d(in_channels=3, out_channels=32, kernel_size=3, padding=0,bias=False)\n self.conv2 = nn.Conv2d(in_channels=32, out_channels=64, kernel_size=3, padding=0,bias=False)\n self.conv3 = nn.Conv2d(in_channels=64, out_channels=64, kernel_size=3, padding=0,bias=False)\n self.conv4 = nn.Conv2d(in_channels=64, out_channels=128, kernel_size=3, padding=0,bias=False)\n self.conv5 = nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=0,bias=False)\n self.conv6 = nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, padding=1,bias=False)\n self.pool = nn.MaxPool2d(kernel_size=2, stride=2)\n self.batch_norm1 = nn.BatchNorm2d(32,track_running_stats=False)\n self.batch_norm2 = nn.BatchNorm2d(64,track_running_stats=False)\n self.batch_norm3 = nn.BatchNorm2d(256,track_running_stats=False)\n self.dropout1 = nn.Dropout2d(p=0.05)\n self.dropout2 = nn.Dropout2d(p=0.1)\n self.fc1 = nn.Linear(256,64,bias=False)\n self.fc2 = nn.Linear(64, 32,bias=False)\n self.fc3 = nn.Linear(32, 10,bias=False)\n self.fc4 = nn.Linear(10, 1,bias=False)\n\n torch.nn.init.xavier_normal_(self.conv1.weight)\n torch.nn.init.xavier_normal_(self.conv2.weight)\n torch.nn.init.xavier_normal_(self.conv3.weight)\n torch.nn.init.xavier_normal_(self.conv4.weight)\n torch.nn.init.xavier_normal_(self.conv5.weight)\n torch.nn.init.xavier_normal_(self.conv6.weight)\n\n torch.nn.init.xavier_normal_(self.fc1.weight)\n torch.nn.init.xavier_normal_(self.fc2.weight)\n torch.nn.init.xavier_normal_(self.fc3.weight)\n torch.nn.init.xavier_normal_(self.fc4.weight)\n\n def forward(self,z): #y is avg image #z batch of list of 9 images\n y = torch.zeros([batch,256, 3,3], dtype=torch.float64)\n x = torch.zeros([batch,9],dtype=torch.float64)\n ftr = torch.zeros([batch,9,256,3,3])\n y = y.to(\"cuda\")\n x = x.to(\"cuda\")\n ftr = ftr.to(\"cuda\")\n \n for i in range(9):\n out,ftrs = self.helper(z[:,i])\n #print(out.shape)\n x[:,i] = out\n ftr[:,i] = ftrs\n log_x = F.log_softmax(x,dim=1) # log_alpha\n x = F.softmax(x,dim=1) \n\n for i in range(9): \n x1 = x[:,i] \n y = y + torch.mul(x1[:,None,None,None],ftr[:,i])\n\n return x, y, log_x, #alpha, log_alpha, avg_data\n \n def helper(self, x):\n #x1 = x\n #x1 =x\n x = self.conv1(x)\n x = F.relu(self.batch_norm1(x))\n\n x = (F.relu(self.conv2(x)))\n x = self.pool(x)\n \n x = self.conv3(x)\n x = F.relu(self.batch_norm2(x))\n\n x = (F.relu(self.conv4(x)))\n x = self.pool(x)\n x = self.dropout1(x)\n\n x = self.conv5(x)\n \n x = F.relu(self.batch_norm3(x))\n\n x = self.conv6(x)\n x1 = F.tanh(x)\n x = F.relu(x)\n x = self.pool(x)\n\n x = x.view(x.size(0), -1)\n\n x = self.dropout2(x)\n x = F.relu(self.fc1(x))\n x = F.relu(self.fc2(x))\n x = self.dropout2(x)\n x = F.relu(self.fc3(x))\n x = self.fc4(x)\n x = x[:,0] \n # print(x.shape)\n return x,x1",
"_____no_output_____"
],
[
"torch.manual_seed(n_seed)\nfocus_net = Focus().double()\nfocus_net = focus_net.to(\"cuda\")",
"_____no_output_____"
],
[
"class Classification(nn.Module):\n def __init__(self):\n super(Classification, self).__init__()\n self.conv1 = nn.Conv2d(in_channels=256, out_channels=128, kernel_size=3, padding=1)\n self.conv2 = nn.Conv2d(in_channels=128, out_channels=128, kernel_size=3, padding=1)\n self.conv3 = nn.Conv2d(in_channels=128, out_channels=256, kernel_size=3, padding=1)\n self.conv4 = nn.Conv2d(in_channels=256, out_channels=256, kernel_size=3, padding=1)\n self.conv5 = nn.Conv2d(in_channels=256, out_channels=512, kernel_size=3, padding=1)\n self.conv6 = nn.Conv2d(in_channels=512, out_channels=512, kernel_size=3, padding=1)\n self.pool = nn.MaxPool2d(kernel_size=2, stride=2,padding=1)\n self.batch_norm1 = nn.BatchNorm2d(128,track_running_stats=False)\n self.batch_norm2 = nn.BatchNorm2d(256,track_running_stats=False)\n self.batch_norm3 = nn.BatchNorm2d(512,track_running_stats=False)\n self.dropout1 = nn.Dropout2d(p=0.05)\n self.dropout2 = nn.Dropout2d(p=0.1)\n self.global_average_pooling = nn.AvgPool2d(kernel_size=2)\n self.fc1 = nn.Linear(512,128)\n # self.fc2 = nn.Linear(128, 64)\n # self.fc3 = nn.Linear(64, 10)\n self.fc2 = nn.Linear(128, 3)\n\n torch.nn.init.xavier_normal_(self.conv1.weight)\n torch.nn.init.xavier_normal_(self.conv2.weight)\n torch.nn.init.xavier_normal_(self.conv3.weight)\n torch.nn.init.xavier_normal_(self.conv4.weight)\n torch.nn.init.xavier_normal_(self.conv5.weight)\n torch.nn.init.xavier_normal_(self.conv6.weight)\n\n torch.nn.init.zeros_(self.conv1.bias)\n torch.nn.init.zeros_(self.conv2.bias)\n torch.nn.init.zeros_(self.conv3.bias)\n torch.nn.init.zeros_(self.conv4.bias)\n torch.nn.init.zeros_(self.conv5.bias)\n torch.nn.init.zeros_(self.conv6.bias)\n\n\n torch.nn.init.xavier_normal_(self.fc1.weight)\n torch.nn.init.xavier_normal_(self.fc2.weight)\n torch.nn.init.zeros_(self.fc1.bias)\n torch.nn.init.zeros_(self.fc2.bias)\n\n\n def forward(self, x):\n x = self.conv1(x)\n x = F.relu(self.batch_norm1(x))\n\n x = (F.relu(self.conv2(x)))\n x = self.pool(x)\n \n x = self.conv3(x)\n x = F.relu(self.batch_norm2(x))\n\n x = (F.relu(self.conv4(x)))\n x = self.pool(x)\n x = self.dropout1(x)\n\n x = self.conv5(x)\n x = F.relu(self.batch_norm3(x))\n\n x = (F.relu(self.conv6(x)))\n x = self.pool(x)\n #print(x.shape)\n x = self.global_average_pooling(x)\n x = x.squeeze()\n #x = x.view(x.size(0), -1)\n #print(x.shape)\n x = self.dropout2(x)\n x = F.relu(self.fc1(x))\n #x = F.relu(self.fc2(x))\n #x = self.dropout2(x)\n #x = F.relu(self.fc3(x))\n x = self.fc2(x)\n return x",
"_____no_output_____"
],
[
"torch.manual_seed(n_seed)\nclassify = Classification().double()\nclassify = classify.to(\"cuda\")",
"_____no_output_____"
],
[
"test_images =[] #list of mosaic images, each mosaic image is saved as laist of 9 images\nfore_idx_test =[] #list of indexes at which foreground image is present in a mosaic image \ntest_label=[] # label of mosaic image = foreground class present in that mosaic\nfor i in range(10000):\n np.random.seed(i+30000)\n bg_idx = np.random.randint(0,35000,8)\n fg_idx = np.random.randint(0,15000)\n fg = np.random.randint(0,9)\n fore_idx_test.append(fg)\n image_list,label = create_mosaic_img(bg_idx,fg_idx,fg)\n test_images.append(image_list)\n test_label.append(label)",
"_____no_output_____"
],
[
"test_data = MosaicDataset(test_images,test_label,fore_idx_test)\ntest_loader = DataLoader( test_data,batch_size= batch ,shuffle=False)",
"_____no_output_____"
],
[
"criterion = nn.CrossEntropyLoss()\ndef my_cross_entropy(x, y,alpha,log_alpha,k):\n # log_prob = -1.0 * F.log_softmax(x, 1)\n # loss = log_prob.gather(1, y.unsqueeze(1))\n # loss = loss.mean()\n loss = criterion(x,y)\n \n #alpha = torch.clamp(alpha,min=1e-10) \n \n b = -1.0* alpha * log_alpha\n b = torch.mean(torch.sum(b,dim=1))\n closs = loss\n entropy = b \n loss = (1-k)*loss + ((k)*b)\n return loss,closs,entropy",
"_____no_output_____"
],
[
"import torch.optim as optim\n# criterion_classify = nn.CrossEntropyLoss()\noptimizer_focus = optim.Adam(focus_net.parameters(), lr=0.001)#, momentum=0.9)\noptimizer_classify = optim.Adam(classify.parameters(), lr=0.001)#, momentum=0.9)",
"_____no_output_____"
],
[
"col1=[]\ncol2=[]\ncol3=[]\ncol4=[]\ncol5=[]\ncol6=[]\ncol7=[]\ncol8=[]\ncol9=[]\ncol10=[]\ncol11=[]\ncol12=[]\ncol13=[]\ncol14 = [] # train average sparsity\ncol15 = [] # test average sparsity\n\n",
"_____no_output_____"
],
[
"correct = 0\ntotal = 0\ncount = 0\nflag = 1\nfocus_true_pred_true =0\nfocus_false_pred_true =0\nfocus_true_pred_false =0\nfocus_false_pred_false =0\n\nargmax_more_than_half = 0\nargmax_less_than_half =0\nsparse_val = 0 \nfocus_net.eval()\nclassify.eval()\nwith torch.no_grad():\n for data in train_loader:\n inputs, labels , fore_idx = data\n inputs = inputs.double()\n inputs, labels , fore_idx = inputs.to(\"cuda\"),labels.to(\"cuda\"), fore_idx.to(\"cuda\")\n alphas, avg_images,_ = focus_net(inputs)\n # print(inputs.shape, alphas.shape, avg_images.shape)\n outputs = classify(avg_images)\n\n _, predicted = torch.max(outputs.data, 1)\n \n sparse_val += torch.sum(torch.sum(alphas>0.01,dim=1)).item()\n\n\n for j in range(labels.size(0)):\n count += 1\n focus = torch.argmax(alphas[j])\n if alphas[j][focus] >= 0.5 :\n argmax_more_than_half += 1\n else:\n argmax_less_than_half += 1\n\n if(focus == fore_idx[j] and predicted[j] == labels[j]):\n focus_true_pred_true += 1\n elif(focus != fore_idx[j] and predicted[j] == labels[j]):\n focus_false_pred_true += 1\n elif(focus == fore_idx[j] and predicted[j] != labels[j]):\n focus_true_pred_false += 1\n elif(focus != fore_idx[j] and predicted[j] != labels[j]):\n focus_false_pred_false += 1\n\n total += labels.size(0)\n correct += (predicted == labels).sum().item()\n\nprint('Accuracy of the network on the 30000 train images: %f %%' % ( 100 * correct / total))\nprint(\"total correct\", correct)\nprint(\"total train set images\", total)\n\nprint(\"focus_true_pred_true %d =============> FTPT : %f %%\" % (focus_true_pred_true , (100 * focus_true_pred_true / total) ) )\nprint(\"focus_false_pred_true %d =============> FFPT : %f %%\" % (focus_false_pred_true, (100 * focus_false_pred_true / total) ) )\nprint(\"focus_true_pred_false %d =============> FTPF : %f %%\" %( focus_true_pred_false , ( 100 * focus_true_pred_false / total) ) )\nprint(\"focus_false_pred_false %d =============> FFPF : %f %%\" % (focus_false_pred_false, ( 100 * focus_false_pred_false / total) ) )\nprint(\"Sparsity_Value %d =============> AVG Sparsity : %f \" % (sparse_val,(sparse_val)/total))\nprint(\"argmax_more_than_half ==================> \",argmax_more_than_half)\nprint(\"argmax_less_than_half ==================> \",argmax_less_than_half)\nprint(count)\n\nprint(\"=\"*100)\n\ncol1.append(0)\ncol2.append(argmax_more_than_half)\ncol3.append(argmax_less_than_half)\ncol4.append(focus_true_pred_true)\ncol5.append(focus_false_pred_true)\ncol6.append(focus_true_pred_false)\ncol7.append(focus_false_pred_false)\ncol14.append(sparse_val)",
"Accuracy of the network on the 30000 train images: 33.813333 %\ntotal correct 10144\ntotal train set images 30000\nfocus_true_pred_true 405 =============> FTPT : 1.350000 %\nfocus_false_pred_true 9739 =============> FFPT : 32.463333 %\nfocus_true_pred_false 1624 =============> FTPF : 5.413333 %\nfocus_false_pred_false 18232 =============> FFPF : 60.773333 %\nSparsity_Value 270000 =============> AVG Sparsity : 9.000000 \nargmax_more_than_half ==================> 0\nargmax_less_than_half ==================> 30000\n30000\n====================================================================================================\n"
],
[
"correct = 0\ntotal = 0\ncount = 0\nflag = 1\nfocus_true_pred_true =0\nfocus_false_pred_true =0\nfocus_true_pred_false =0\nfocus_false_pred_false =0\n\nargmax_more_than_half = 0\nargmax_less_than_half =0\nsparse_val = 0\nfocus_net.eval()\nclassify.eval()\nwith torch.no_grad():\n for data in test_loader:\n inputs, labels , fore_idx = data\n inputs = inputs.double()\n inputs, labels , fore_idx = inputs.to(\"cuda\"),labels.to(\"cuda\"), fore_idx.to(\"cuda\")\n alphas, avg_images,_ = focus_net(inputs)\n outputs = classify(avg_images)\n\n _, predicted = torch.max(outputs.data, 1)\n \n sparse_val += torch.sum(torch.sum(alphas>0.01,dim=1)).item()\n\n for j in range(labels.size(0)):\n focus = torch.argmax(alphas[j])\n if alphas[j][focus] >= 0.5 :\n argmax_more_than_half += 1\n else:\n argmax_less_than_half += 1\n\n if(focus == fore_idx[j] and predicted[j] == labels[j]):\n focus_true_pred_true += 1\n elif(focus != fore_idx[j] and predicted[j] == labels[j]):\n focus_false_pred_true += 1\n elif(focus == fore_idx[j] and predicted[j] != labels[j]):\n focus_true_pred_false += 1\n elif(focus != fore_idx[j] and predicted[j] != labels[j]):\n focus_false_pred_false += 1\n\n total += labels.size(0)\n correct += (predicted == labels).sum().item()\n\nprint('Accuracy of the network on the 10000 test images: %f %%' % (100 * correct / total))\nprint(\"total correct\", correct)\nprint(\"total test set images\", total)\n\nprint(\"focus_true_pred_true %d =============> FTPT : %f %%\" % (focus_true_pred_true , (100 * focus_true_pred_true / total) ) )\nprint(\"focus_false_pred_true %d =============> FFPT : %f %%\" % (focus_false_pred_true, (100 * focus_false_pred_true / total) ) )\nprint(\"focus_true_pred_false %d =============> FTPF : %f %%\" %( focus_true_pred_false , ( 100 * focus_true_pred_false / total) ) )\nprint(\"focus_false_pred_false %d =============> FFPF : %f %%\" % (focus_false_pred_false, ( 100 * focus_false_pred_false / total) ) )\nprint(\"Sparsity_Value %d =============> AVG Sparsity : %f \" % (sparse_val,(sparse_val)/total))\nprint(\"argmax_more_than_half ==================> \",argmax_more_than_half)\nprint(\"argmax_less_than_half ==================> \",argmax_less_than_half)\ncol8.append(argmax_more_than_half)\ncol9.append(argmax_less_than_half)\ncol10.append(focus_true_pred_true)\ncol11.append(focus_false_pred_true)\ncol12.append(focus_true_pred_false)\ncol13.append(focus_false_pred_false)\ncol15.append(sparse_val)",
"Accuracy of the network on the 10000 test images: 33.550000 %\ntotal correct 3355\ntotal test set images 10000\nfocus_true_pred_true 138 =============> FTPT : 1.380000 %\nfocus_false_pred_true 3217 =============> FFPT : 32.170000 %\nfocus_true_pred_false 514 =============> FTPF : 5.140000 %\nfocus_false_pred_false 6131 =============> FFPF : 61.310000 %\nSparsity_Value 90000 =============> AVG Sparsity : 9.000000 \nargmax_more_than_half ==================> 0\nargmax_less_than_half ==================> 10000\n"
],
[
"nos_epochs = 100\nfocus_true_pred_true =0\nfocus_false_pred_true =0\nfocus_true_pred_false =0\nfocus_false_pred_false =0\n\nargmax_more_than_half = 0\nargmax_less_than_half =0\nfocus_net.train()\nclassify.train()\ntr_loss = []\n\n\nfor epoch in range(nos_epochs): # loop over the dataset multiple times\n focus_net.train()\n classify.train()\n focus_true_pred_true =0\n focus_false_pred_true =0\n focus_true_pred_false =0\n focus_false_pred_false =0\n \n argmax_more_than_half = 0\n argmax_less_than_half =0\n sparse_val = 0 \n \n running_loss = 0.0\n epoch_loss = []\n cnt=0\n\n iteration = desired_num // batch\n \n #training data set\n \n for i, data in enumerate(train_loader):\n inputs , labels , fore_idx = data\n inputs = inputs.double()\n inputs, labels = inputs.to(\"cuda\"), labels.to(\"cuda\")\n # zero the parameter gradients\n optimizer_focus.zero_grad()\n optimizer_classify.zero_grad()\n alphas, avg_images,log_alphas = focus_net(inputs)\n outputs = classify(avg_images)\n \n # outputs, alphas, avg_images = classify(inputs)\n\n _, predicted = torch.max(outputs.data, 1)\n# print(outputs)\n# print(outputs.shape,labels.shape , torch.argmax(outputs, dim=1))\n\n loss,_,_ = my_cross_entropy(outputs, labels,alphas,log_alphas,k) \n loss.backward()\n optimizer_focus.step()\n optimizer_classify.step()\n\n running_loss += loss.item()\n mini = 60\n if cnt % mini == mini-1: # print every 40 mini-batches\n print('[%d, %5d] loss: %.3f' %(epoch + 1, cnt + 1, running_loss / mini))\n epoch_loss.append(running_loss/mini)\n running_loss = 0.0\n cnt=cnt+1\n \n \n if epoch % 1 == 0:\n sparse_val += torch.sum(torch.sum(alphas>0.01,dim=1)).item()\n for j in range (batch):\n focus = torch.argmax(alphas[j])\n\n if(alphas[j][focus] >= 0.5):\n argmax_more_than_half +=1\n else:\n argmax_less_than_half +=1\n\n if(focus == fore_idx[j] and predicted[j] == labels[j]):\n focus_true_pred_true += 1\n\n elif(focus != fore_idx[j] and predicted[j] == labels[j]):\n focus_false_pred_true +=1\n\n elif(focus == fore_idx[j] and predicted[j] != labels[j]):\n focus_true_pred_false +=1\n\n elif(focus != fore_idx[j] and predicted[j] != labels[j]):\n focus_false_pred_false +=1\n\n\n tr_loss.append(np.mean(epoch_loss))\n if epoch % 1 == 0:\n col1.append(epoch+1)\n col2.append(argmax_more_than_half)\n col3.append(argmax_less_than_half)\n col4.append(focus_true_pred_true)\n col5.append(focus_false_pred_true)\n col6.append(focus_true_pred_false)\n col7.append(focus_false_pred_false)\n col14.append(sparse_val)\n \n #************************************************************************\n #testing data set \n focus_net.eval()\n classify.eval() \n with torch.no_grad():\n focus_true_pred_true =0\n focus_false_pred_true =0\n focus_true_pred_false =0\n focus_false_pred_false =0\n\n argmax_more_than_half = 0\n argmax_less_than_half =0\n sparse_val = 0\n for data in test_loader:\n inputs, labels , fore_idx = data\n inputs = inputs.double()\n inputs, labels = inputs.to(\"cuda\"), labels.to(\"cuda\")\n alphas, avg_images,log_alphas = focus_net(inputs)\n outputs = classify(avg_images)\n #outputs, alphas, avg_images = classify(inputs)\n _, predicted = torch.max(outputs.data, 1)\n sparse_val += torch.sum(torch.sum(alphas>0.01,dim=1)).item()\n for j in range (batch):\n focus = torch.argmax(alphas[j])\n\n if(alphas[j][focus] >= 0.5):\n argmax_more_than_half +=1\n else:\n argmax_less_than_half +=1\n\n if(focus == fore_idx[j] and predicted[j] == labels[j]):\n focus_true_pred_true += 1\n\n elif(focus != fore_idx[j] and predicted[j] == labels[j]):\n focus_false_pred_true +=1\n\n elif(focus == fore_idx[j] and predicted[j] != labels[j]):\n focus_true_pred_false +=1\n\n elif(focus != fore_idx[j] and predicted[j] != labels[j]):\n focus_false_pred_false +=1\n \n col8.append(argmax_more_than_half)\n col9.append(argmax_less_than_half)\n col10.append(focus_true_pred_true)\n col11.append(focus_false_pred_true)\n col12.append(focus_true_pred_false)\n col13.append(focus_false_pred_false)\n col15.append(sparse_val)\n if(np.mean(epoch_loss) <= 0.05):\n break;\nprint('Finished Training') ",
"[1, 60] loss: 1.221\n[1, 120] loss: 1.097\n[2, 60] loss: 1.030\n[2, 120] loss: 0.953\n[3, 60] loss: 0.857\n[3, 120] loss: 0.782\n[4, 60] loss: 0.725\n[4, 120] loss: 0.689\n[5, 60] loss: 0.663\n[5, 120] loss: 0.640\n[6, 60] loss: 0.607\n[6, 120] loss: 0.591\n[7, 60] loss: 0.591\n[7, 120] loss: 0.587\n[8, 60] loss: 0.566\n[8, 120] loss: 0.549\n[9, 60] loss: 0.539\n[9, 120] loss: 0.565\n[10, 60] loss: 0.546\n[10, 120] loss: 0.572\n[11, 60] loss: 0.551\n[11, 120] loss: 0.555\n[12, 60] loss: 0.599\n[12, 120] loss: 0.547\n[13, 60] loss: 0.491\n[13, 120] loss: 0.480\n[14, 60] loss: 0.462\n[14, 120] loss: 0.465\n[15, 60] loss: 0.424\n[15, 120] loss: 0.407\n[16, 60] loss: 0.352\n[16, 120] loss: 0.338\n[17, 60] loss: 0.282\n[17, 120] loss: 0.289\n[18, 60] loss: 0.325\n[18, 120] loss: 0.257\n[19, 60] loss: 0.225\n[19, 120] loss: 0.220\n[20, 60] loss: 0.172\n[20, 120] loss: 0.166\n[21, 60] loss: 0.133\n[21, 120] loss: 0.152\n[22, 60] loss: 0.110\n[22, 120] loss: 0.122\n[23, 60] loss: 0.085\n[23, 120] loss: 0.101\n[24, 60] loss: 0.081\n[24, 120] loss: 0.083\n[25, 60] loss: 0.073\n[25, 120] loss: 0.072\n[26, 60] loss: 0.054\n[26, 120] loss: 0.076\n[27, 60] loss: 0.047\n[27, 120] loss: 0.057\n[28, 60] loss: 0.045\n[28, 120] loss: 0.056\n[29, 60] loss: 0.042\n[29, 120] loss: 0.048\nFinished Training\n"
],
[
"torch.save(focus_net.state_dict(),path+\"weights_focus_0.pt\") \ntorch.save(classify.state_dict(),path+\"weights_classify_0.pt\")",
"_____no_output_____"
],
[
"columns = [\"epochs\", \"argmax > 0.5\" ,\"argmax < 0.5\", \"focus_true_pred_true\", \"focus_false_pred_true\", \"focus_true_pred_false\", \"focus_false_pred_false\" ,\"sparse_val\"]",
"_____no_output_____"
],
[
"df_train = pd.DataFrame()\ndf_test = pd.DataFrame()",
"_____no_output_____"
],
[
"len(col1),col9",
"_____no_output_____"
],
[
"plt.plot(np.arange(1,epoch+2),tr_loss)\nplt.xlabel(\"epochs\", fontsize=14, fontweight = 'bold')\nplt.ylabel(\"Loss\", fontsize=14, fontweight = 'bold')\nplt.title(\"Train Loss\")\nplt.grid()\nplt.show()",
"_____no_output_____"
],
[
"np.save(\"train_loss.npy\",{\"training_loss\":tr_loss})",
"_____no_output_____"
],
[
"df_train[columns[0]] = col1\ndf_train[columns[1]] = col2\ndf_train[columns[2]] = col3\ndf_train[columns[3]] = col4\ndf_train[columns[4]] = col5\ndf_train[columns[5]] = col6\ndf_train[columns[6]] = col7\ndf_train[columns[7]] = col14\n\ndf_test[columns[0]] = col1\ndf_test[columns[1]] = col8\ndf_test[columns[2]] = col9\ndf_test[columns[3]] = col10\ndf_test[columns[4]] = col11\ndf_test[columns[5]] = col12\ndf_test[columns[6]] = col13\ndf_test[columns[7]] = col15",
"_____no_output_____"
],
[
"df_train",
"_____no_output_____"
],
[
"df_train.to_csv(path+\"_train.csv\",index=False)",
"_____no_output_____"
],
[
"# plt.figure(12,12)\nplt.plot(col1,col2, label='argmax > 0.5')\nplt.plot(col1,col3, label='argmax < 0.5')\n\nplt.legend(loc='center left', bbox_to_anchor=(1, 0.5))\nplt.xlabel(\"epochs\")\nplt.ylabel(\"training data\")\nplt.title(\"On Training set\")\nplt.show()\n\n",
"_____no_output_____"
],
[
"plt.figure(figsize=(6,5))\nplt.plot(col1,np.array(col4)/300, label =\"FTPT \")\nplt.plot(col1,np.array(col5)/300, label =\"FFPT \")\nplt.plot(col1,np.array(col6)/300, label =\"FTPF \")\nplt.plot(col1,np.array(col7)/300, label =\"FFPF \")\nplt.title(\"On Training set\")\n#plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))\nplt.xlabel(\"epochs\", fontsize=14, fontweight = 'bold')\nplt.ylabel(\"percentage train data\", fontsize=14, fontweight = 'bold')\n# plt.xlabel(\"epochs\")\n# plt.ylabel(\"training data\")\nplt.legend()\n\nplt.savefig(path + \"_train.png\",bbox_inches=\"tight\")\nplt.savefig(path + \"_train.pdf\",bbox_inches=\"tight\")\nplt.grid()\nplt.show()",
"_____no_output_____"
],
[
"plt.figure(figsize=(6,5))\nplt.plot(col1,np.array(col14)/30000, label =\"sparsity_val\")\n\nplt.title(\"On Training set\")\n#plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))\nplt.xlabel(\"epochs\", fontsize=14, fontweight = 'bold')\nplt.ylabel(\"average sparsity value\", fontsize=14, fontweight = 'bold')\n# plt.xlabel(\"epochs\")\n# plt.ylabel(\"sparsity_value\")\n\nplt.savefig(path + \"sparsity_train.png\",bbox_inches=\"tight\")\nplt.savefig(path + \"sparsity_train.pdf\",bbox_inches=\"tight\")\nplt.grid()\nplt.show()",
"_____no_output_____"
],
[
"df_test",
"_____no_output_____"
],
[
"df_test.to_csv(path+\"_test.csv\")",
"_____no_output_____"
],
[
"# plt.figure(12,12)\nplt.plot(col1,col8, label='argmax > 0.5')\nplt.plot(col1,col9, label='argmax < 0.5')\n\nplt.legend(loc='center left', bbox_to_anchor=(1, 0.5))\nplt.xlabel(\"epochs\")\nplt.ylabel(\"Testing data\")\nplt.title(\"On Testing set\")\nplt.show()\n\n",
"_____no_output_____"
],
[
"plt.figure(figsize=(6,5))\nplt.plot(col1,np.array(col10)/100, label =\"FTPT \")\nplt.plot(col1,np.array(col11)/100, label =\"FFPT \")\nplt.plot(col1,np.array(col12)/100, label =\"FTPF \")\nplt.plot(col1,np.array(col13)/100, label =\"FFPF \")\nplt.title(\"On Testing set\")\n\n#plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))\nplt.xlabel(\"epochs\", fontsize=14, fontweight = 'bold')\nplt.ylabel(\"percentage test data\", fontsize=14, fontweight = 'bold')\n# plt.xlabel(\"epochs\")\n# plt.ylabel(\"training data\")\nplt.legend()\n\n#plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))\nplt.xlabel(\"epochs\")\n# plt.ylabel(\"Testing data\")\nplt.savefig(path + \"_test.png\",bbox_inches=\"tight\")\nplt.savefig(path + \"_test.pdf\",bbox_inches=\"tight\")\nplt.grid()\nplt.show()",
"_____no_output_____"
],
[
"plt.figure(figsize=(6,5))\nplt.plot(col1,np.array(col15)/10000, label =\"sparsity_val\")\n\nplt.title(\"On Testing set\")\n#plt.legend(loc='center left', bbox_to_anchor=(1, 0.5))\nplt.xlabel(\"epochs\", fontsize=14, fontweight = 'bold')\nplt.ylabel(\"average sparsity value\", fontsize=14, fontweight = 'bold')\nplt.grid()\n\nplt.savefig(path + \"sparsity_test.png\",bbox_inches=\"tight\")\nplt.savefig(path + \"sparsity_test.pdf\",bbox_inches=\"tight\")\nplt.show()",
"_____no_output_____"
],
[
"correct = 0\ntotal = 0\ncount = 0\nflag = 1\nfocus_true_pred_true =0\nfocus_false_pred_true =0\nfocus_true_pred_false =0\nfocus_false_pred_false =0\n\nargmax_more_than_half = 0\nargmax_less_than_half =0\nsparse_val = 0\nfocus_net.eval()\nclassify.eval()\nwith torch.no_grad():\n for data in train_loader:\n inputs, labels , fore_idx = data\n inputs = inputs.double()\n inputs, labels , fore_idx = inputs.to(\"cuda\"),labels.to(\"cuda\"), fore_idx.to(\"cuda\")\n alphas, avg_images,_ = focus_net(inputs)\n outputs = classify(avg_images)\n\n _, predicted = torch.max(outputs.data, 1)\n sparse_val += torch.sum(torch.sum(alphas>0.01,dim=1)).item()\n for j in range(labels.size(0)):\n count += 1\n focus = torch.argmax(alphas[j])\n if alphas[j][focus] >= 0.5 :\n argmax_more_than_half += 1\n else:\n argmax_less_than_half += 1\n\n if(focus == fore_idx[j] and predicted[j] == labels[j]):\n focus_true_pred_true += 1\n elif(focus != fore_idx[j] and predicted[j] == labels[j]):\n focus_false_pred_true += 1\n elif(focus == fore_idx[j] and predicted[j] != labels[j]):\n focus_true_pred_false += 1\n elif(focus != fore_idx[j] and predicted[j] != labels[j]):\n focus_false_pred_false += 1\n\n total += labels.size(0)\n correct += (predicted == labels).sum().item()\n\nprint('Accuracy of the network on the 30000 train images: %f %%' % ( 100 * correct / total))\nprint(\"total correct\", correct)\nprint(\"total train set images\", total)\n\nprint(\"focus_true_pred_true %d =============> FTPT : %f %%\" % (focus_true_pred_true , (100 * focus_true_pred_true / total) ) )\nprint(\"focus_false_pred_true %d =============> FFPT : %f %%\" % (focus_false_pred_true, (100 * focus_false_pred_true / total) ) )\nprint(\"focus_true_pred_false %d =============> FTPF : %f %%\" %( focus_true_pred_false , ( 100 * focus_true_pred_false / total) ) )\nprint(\"focus_false_pred_false %d =============> FFPF : %f %%\" % (focus_false_pred_false, ( 100 * focus_false_pred_false / total) ) )\nprint(\"Sparsity_Value %d =============> AVG Sparsity : %f \" % (sparse_val,(sparse_val)/total))\nprint(\"argmax_more_than_half ==================> \",argmax_more_than_half)\nprint(\"argmax_less_than_half ==================> \",argmax_less_than_half)\nprint(count)\n\nprint(\"=\"*100)",
"Accuracy of the network on the 30000 train images: 99.466667 %\ntotal correct 29840\ntotal train set images 30000\nfocus_true_pred_true 23409 =============> FTPT : 78.030000 %\nfocus_false_pred_true 6431 =============> FFPT : 21.436667 %\nfocus_true_pred_false 51 =============> FTPF : 0.170000 %\nfocus_false_pred_false 109 =============> FFPF : 0.363333 %\nSparsity_Value 118107 =============> AVG Sparsity : 3.936900 \nargmax_more_than_half ==================> 21426\nargmax_less_than_half ==================> 8574\n30000\n====================================================================================================\n"
],
[
"correct = 0\ntotal = 0\ncount = 0\nflag = 1\nfocus_true_pred_true =0\nfocus_false_pred_true =0\nfocus_true_pred_false =0\nfocus_false_pred_false =0\n\nargmax_more_than_half = 0\nargmax_less_than_half =0\nsparse_val = 0 \nfocus_net.eval()\nclassify.eval()\nwith torch.no_grad():\n for data in test_loader:\n inputs, labels , fore_idx = data\n inputs = inputs.double()\n inputs, labels , fore_idx = inputs.to(\"cuda\"),labels.to(\"cuda\"), fore_idx.to(\"cuda\")\n alphas, avg_images , _ = focus_net(inputs)\n outputs = classify(avg_images)\n\n _, predicted = torch.max(outputs.data, 1)\n sparse_val += torch.sum(torch.sum(alphas>0.01,dim=1)).item()\n for j in range(labels.size(0)):\n focus = torch.argmax(alphas[j])\n if alphas[j][focus] >= 0.5 :\n argmax_more_than_half += 1\n else:\n argmax_less_than_half += 1\n\n if(focus == fore_idx[j] and predicted[j] == labels[j]):\n focus_true_pred_true += 1\n elif(focus != fore_idx[j] and predicted[j] == labels[j]):\n focus_false_pred_true += 1\n elif(focus == fore_idx[j] and predicted[j] != labels[j]):\n focus_true_pred_false += 1\n elif(focus != fore_idx[j] and predicted[j] != labels[j]):\n focus_false_pred_false += 1\n\n total += labels.size(0)\n correct += (predicted == labels).sum().item()\n\nprint('Accuracy of the network on the 10000 test images: %f %%' % (\n 100 * correct / total))\nprint(\"total correct\", correct)\nprint(\"total test set images\", total)\n\nprint(\"focus_true_pred_true %d =============> FTPT : %f %%\" % (focus_true_pred_true , (100 * focus_true_pred_true / total) ) )\nprint(\"focus_false_pred_true %d =============> FFPT : %f %%\" % (focus_false_pred_true, (100 * focus_false_pred_true / total) ) )\nprint(\"focus_true_pred_false %d =============> FTPF : %f %%\" %( focus_true_pred_false , ( 100 * focus_true_pred_false / total) ) )\nprint(\"focus_false_pred_false %d =============> FFPF : %f %%\" % (focus_false_pred_false, ( 100 * focus_false_pred_false / total) ) )\nprint(\"Sparsity_Value %d =============> AVG Sparsity : %f \" % (sparse_val,(sparse_val)/total))\n\nprint(\"argmax_more_than_half ==================> \",argmax_more_than_half)\nprint(\"argmax_less_than_half ==================> \",argmax_less_than_half)",
"Accuracy of the network on the 10000 test images: 94.650000 %\ntotal correct 9465\ntotal test set images 10000\nfocus_true_pred_true 7454 =============> FTPT : 74.540000 %\nfocus_false_pred_true 2011 =============> FFPT : 20.110000 %\nfocus_true_pred_false 215 =============> FTPF : 2.150000 %\nfocus_false_pred_false 320 =============> FFPF : 3.200000 %\nSparsity_Value 40924 =============> AVG Sparsity : 4.092400 \nargmax_more_than_half ==================> 7072\nargmax_less_than_half ==================> 2928\n"
],
[
"correct = 0\ntotal = 0\nfocus_net.eval()\nclassify.eval()\nwith torch.no_grad():\n for data in train_loader:\n inputs, labels , fore_idx = data\n inputs = inputs.double()\n inputs, labels = inputs.to(\"cuda\"), labels.to(\"cuda\")\n alphas, avg_images,_ = focus_net(inputs)\n outputs = classify(avg_images)\n\n _, predicted = torch.max(outputs.data, 1)\n\n total += labels.size(0)\n correct += (predicted == labels).sum().item()\n\nprint('Accuracy of the network on the 30000 train images: %f %%' % ( 100 * correct / total))\nprint(\"total correct\", correct)\nprint(\"total train set images\", total)",
"Accuracy of the network on the 30000 train images: 99.490000 %\ntotal correct 29847\ntotal train set images 30000\n"
],
[
"correct = 0\ntotal = 0\nfocus_net.eval()\nclassify.eval()\nwith torch.no_grad():\n for data in test_loader:\n inputs, labels , fore_idx = data\n inputs = inputs.double()\n inputs, labels = inputs.to(\"cuda\"), labels.to(\"cuda\")\n alphas, avg_images,_ = focus_net(inputs)\n outputs = classify(avg_images)\n\n _, predicted = torch.max(outputs.data, 1)\n\n total += labels.size(0)\n correct += (predicted == labels).sum().item()\n\nprint('Accuracy of the network on the 10000 test images: %f %%' % ( 100 * correct / total))\nprint(\"total correct\", correct)\nprint(\"total test set images\", total)",
"Accuracy of the network on the 10000 test images: 94.650000 %\ntotal correct 9465\ntotal test set images 10000\n"
],
[
"",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cb7bac9a76a8286871a1951217fe6c44fecd1a | 25,560 | ipynb | Jupyter Notebook | src/jupiter/2_fullyconnected_tensorflow.ipynb | Evegen55/math_with_python | 9534510312c0bfcf2225921bb0d7a20c70dd8e0e | [
"MIT"
] | 1 | 2018-02-05T17:14:53.000Z | 2018-02-05T17:14:53.000Z | src/jupiter/2_fullyconnected_tensorflow.ipynb | Evegen55/math_with_python | 9534510312c0bfcf2225921bb0d7a20c70dd8e0e | [
"MIT"
] | 5 | 2018-02-03T10:39:33.000Z | 2018-02-14T16:27:14.000Z | src/jupiter/2_fullyconnected_tensorflow.ipynb | Evegen55/math_with_python | 9534510312c0bfcf2225921bb0d7a20c70dd8e0e | [
"MIT"
] | null | null | null | 37.643594 | 132 | 0.582355 | [
[
[
"# These are all the modules we'll be using later. Make sure you can import them\n# before proceeding further.\nfrom __future__ import print_function\nimport numpy as np\nimport tensorflow as tf\nfrom six.moves import cPickle as pickle\nfrom six.moves import range",
"_____no_output_____"
],
[
"# The folder when dumped big 3D array has been stored from previous excercise\ndata_root = 'D:\\\\1_Workspaces\\\\UNDER_VCS\\\\github\\\\1_ML_NN\\\\python_with_math\\\\data'\n#a big 3D array to a big file. \npickle_file = 'notMNIST.pickle'\n\nwith open(data_root + '\\\\' + pickle_file, 'rb') as f:\n save = pickle.load(f)\n train_dataset = save['train_dataset']\n train_labels = save['train_labels']\n valid_dataset = save['valid_dataset']\n valid_labels = save['valid_labels']\n test_dataset = save['test_dataset']\n test_labels = save['test_labels']\n del save # hint to help gc free up memory\n print('Training set', train_dataset.shape, train_labels.shape)\n print('Validation set', valid_dataset.shape, valid_labels.shape)\n print('Test set', test_dataset.shape, test_labels.shape)",
"Training set (200000, 28, 28) (200000,)\nValidation set (10000, 28, 28) (10000,)\nTest set (10000, 28, 28) (10000,)\n"
],
[
"image_size = 28\nnum_labels = 10\n\ndef reformat(dataset, labels):\n dataset = dataset.reshape((-1, image_size * image_size)).astype(np.float32)\n # Map 0 to [1.0, 0.0, 0.0 ...], 1 to [0.0, 1.0, 0.0 ...]\n labels = (np.arange(num_labels) == labels[:,None]).astype(np.float32)\n return dataset, labels\ntrain_dataset, train_labels = reformat(train_dataset, train_labels)\nvalid_dataset, valid_labels = reformat(valid_dataset, valid_labels)\ntest_dataset, test_labels = reformat(test_dataset, test_labels)\nprint('Training set', train_dataset.shape, train_labels.shape)\nprint('Validation set', valid_dataset.shape, valid_labels.shape)\nprint('Test set', test_dataset.shape, test_labels.shape)",
"Training set (200000, 784) (200000, 10)\nValidation set (10000, 784) (10000, 10)\nTest set (10000, 784) (10000, 10)\n"
],
[
"# It loads all the data into TensorFlow and build the computation graph corresponding to our training:\n\n# With gradient descent training, even this much data is prohibitive.\n# Subset the training data for faster turnaround.\ntrain_subset = 10000\n\ngraph = tf.Graph()\nwith graph.as_default():\n\n # Input data.\n # Load the training, validation and test data into constants that are\n # attached to the graph.\n tf_train_dataset = tf.constant(train_dataset[:train_subset, :])\n tf_train_labels = tf.constant(train_labels[:train_subset])\n tf_valid_dataset = tf.constant(valid_dataset)\n tf_test_dataset = tf.constant(test_dataset)\n \n # Variables.\n # These are the parameters that we are going to be training. The weight\n # matrix will be initialized using random values following a (truncated)\n # normal distribution. The biases get initialized to zero.\n weights = tf.Variable(\n tf.truncated_normal([image_size * image_size, num_labels]))\n biases = tf.Variable(tf.zeros([num_labels]))\n \n # Training computation.\n # We multiply the inputs with the weight matrix, and add biases. We compute\n # the softmax and cross-entropy (it's one operation in TensorFlow, because\n # it's very common, and it can be optimized). We take the average of this\n # cross-entropy across all training examples: that's our loss.\n logits = tf.matmul(tf_train_dataset, weights) + biases\n loss = tf.reduce_mean(\n tf.nn.softmax_cross_entropy_with_logits(labels=tf_train_labels, logits=logits))\n \n # Optimizer.\n # We are going to find the minimum of this loss using gradient descent.\n optimizer = tf.train.GradientDescentOptimizer(0.5).minimize(loss)\n \n # Predictions for the training, validation, and test data.\n # These are not part of training, but merely here so that we can report\n # accuracy figures as we train.\n train_prediction = tf.nn.softmax(logits)\n valid_prediction = tf.nn.softmax(\n tf.matmul(tf_valid_dataset, weights) + biases)\n test_prediction = tf.nn.softmax(tf.matmul(tf_test_dataset, weights) + biases)",
"_____no_output_____"
],
[
"num_steps = 10000 #why 801?\n\ndef accuracy(predictions, labels):\n return (100.0 * np.sum(np.argmax(predictions, 1) == np.argmax(labels, 1))\n / predictions.shape[0])\n\n#it performs the train\nwith tf.Session(graph=graph) as session:\n # This is a one-time operation which ensures the parameters get initialized as\n # we described in the graph: random weights for the matrix, zeros for the\n # biases. \n tf.global_variables_initializer().run()\n print('Tensorflow graph initialized')\n for step in range(num_steps):\n # Run the computations. We tell .run() that we want to run the optimizer,\n # and get the loss value and the training predictions returned as numpy\n # arrays.\n _, l, predictions = session.run([optimizer, loss, train_prediction])\n if (step % 100 == 0):\n print('Loss at step %d: %f' % (step, l))\n print('Training accuracy: %.1f%%' % accuracy(\n predictions, train_labels[:train_subset, :]))\n # Calling .eval() on valid_prediction is basically like calling run(), but\n # just to get that one numpy array. Note that it recomputes all its graph\n # dependencies.\n print('Validation accuracy: %.1f%%' % accuracy(\n valid_prediction.eval(), valid_labels))\n print('Test accuracy: %.1f%%' % accuracy(test_prediction.eval(), test_labels))\n#TODO plot graph from accuracy data",
"Tensorflow graph initialized\nLoss at step 0: 19.005764\nTraining accuracy: 8.6%\nValidation accuracy: 9.5%\nLoss at step 100: 2.306310\nTraining accuracy: 71.9%\nValidation accuracy: 70.7%\nLoss at step 200: 1.862624\nTraining accuracy: 75.1%\nValidation accuracy: 72.8%\nLoss at step 300: 1.619365\nTraining accuracy: 76.3%\nValidation accuracy: 73.7%\nLoss at step 400: 1.452627\nTraining accuracy: 77.3%\nValidation accuracy: 74.1%\nLoss at step 500: 1.328036\nTraining accuracy: 77.8%\nValidation accuracy: 74.4%\nLoss at step 600: 1.230201\nTraining accuracy: 78.4%\nValidation accuracy: 74.8%\nLoss at step 700: 1.151069\nTraining accuracy: 79.0%\nValidation accuracy: 74.9%\nLoss at step 800: 1.085528\nTraining accuracy: 79.5%\nValidation accuracy: 75.0%\nLoss at step 900: 1.030110\nTraining accuracy: 79.9%\nValidation accuracy: 75.1%\nLoss at step 1000: 0.982457\nTraining accuracy: 80.3%\nValidation accuracy: 75.3%\nLoss at step 1100: 0.940917\nTraining accuracy: 80.7%\nValidation accuracy: 75.3%\nLoss at step 1200: 0.904299\nTraining accuracy: 81.0%\nValidation accuracy: 75.5%\nLoss at step 1300: 0.871726\nTraining accuracy: 81.6%\nValidation accuracy: 75.5%\nLoss at step 1400: 0.842531\nTraining accuracy: 81.8%\nValidation accuracy: 75.6%\nLoss at step 1500: 0.816180\nTraining accuracy: 82.2%\nValidation accuracy: 75.7%\nLoss at step 1600: 0.792249\nTraining accuracy: 82.4%\nValidation accuracy: 75.9%\nLoss at step 1700: 0.770396\nTraining accuracy: 82.6%\nValidation accuracy: 76.0%\nLoss at step 1800: 0.750347\nTraining accuracy: 82.8%\nValidation accuracy: 76.2%\nLoss at step 1900: 0.731872\nTraining accuracy: 83.0%\nValidation accuracy: 76.2%\nLoss at step 2000: 0.714789\nTraining accuracy: 83.3%\nValidation accuracy: 76.2%\nLoss at step 2100: 0.698939\nTraining accuracy: 83.5%\nValidation accuracy: 76.3%\nLoss at step 2200: 0.684192\nTraining accuracy: 83.7%\nValidation accuracy: 76.4%\nLoss at step 2300: 0.670434\nTraining accuracy: 84.0%\nValidation accuracy: 76.5%\nLoss at step 2400: 0.657569\nTraining accuracy: 84.1%\nValidation accuracy: 76.4%\nLoss at step 2500: 0.645511\nTraining accuracy: 84.3%\nValidation accuracy: 76.4%\nLoss at step 2600: 0.634187\nTraining accuracy: 84.5%\nValidation accuracy: 76.5%\nLoss at step 2700: 0.623530\nTraining accuracy: 84.7%\nValidation accuracy: 76.4%\nLoss at step 2800: 0.613483\nTraining accuracy: 84.9%\nValidation accuracy: 76.4%\nLoss at step 2900: 0.603993\nTraining accuracy: 85.0%\nValidation accuracy: 76.5%\nLoss at step 3000: 0.595014\nTraining accuracy: 85.2%\nValidation accuracy: 76.5%\nLoss at step 3100: 0.586504\nTraining accuracy: 85.4%\nValidation accuracy: 76.5%\nLoss at step 3200: 0.578426\nTraining accuracy: 85.6%\nValidation accuracy: 76.6%\nLoss at step 3300: 0.570746\nTraining accuracy: 85.8%\nValidation accuracy: 76.6%\nLoss at step 3400: 0.563433\nTraining accuracy: 85.8%\nValidation accuracy: 76.6%\nLoss at step 3500: 0.556461\nTraining accuracy: 86.0%\nValidation accuracy: 76.7%\nLoss at step 3600: 0.549805\nTraining accuracy: 86.1%\nValidation accuracy: 76.7%\nLoss at step 3700: 0.543443\nTraining accuracy: 86.2%\nValidation accuracy: 76.6%\nLoss at step 3800: 0.537355\nTraining accuracy: 86.4%\nValidation accuracy: 76.7%\nLoss at step 3900: 0.531522\nTraining accuracy: 86.5%\nValidation accuracy: 76.7%\nLoss at step 4000: 0.525927\nTraining accuracy: 86.5%\nValidation accuracy: 76.7%\nLoss at step 4100: 0.520556\nTraining accuracy: 86.7%\nValidation accuracy: 76.8%\nLoss at step 4200: 0.515394\nTraining accuracy: 86.8%\nValidation accuracy: 76.8%\nLoss at step 4300: 0.510427\nTraining accuracy: 86.9%\nValidation accuracy: 76.8%\nLoss at step 4400: 0.505645\nTraining accuracy: 87.0%\nValidation accuracy: 76.9%\nLoss at step 4500: 0.501034\nTraining accuracy: 87.1%\nValidation accuracy: 76.9%\nLoss at step 4600: 0.496588\nTraining accuracy: 87.3%\nValidation accuracy: 77.0%\nLoss at step 4700: 0.492295\nTraining accuracy: 87.5%\nValidation accuracy: 77.0%\nLoss at step 4800: 0.488147\nTraining accuracy: 87.6%\nValidation accuracy: 77.0%\nLoss at step 4900: 0.484136\nTraining accuracy: 87.7%\nValidation accuracy: 77.0%\nLoss at step 5000: 0.480255\nTraining accuracy: 87.8%\nValidation accuracy: 77.0%\nLoss at step 5100: 0.476498\nTraining accuracy: 87.9%\nValidation accuracy: 76.9%\nLoss at step 5200: 0.472857\nTraining accuracy: 88.0%\nValidation accuracy: 77.0%\nLoss at step 5300: 0.469328\nTraining accuracy: 88.0%\nValidation accuracy: 76.9%\nLoss at step 5400: 0.465905\nTraining accuracy: 88.1%\nValidation accuracy: 77.0%\nLoss at step 5500: 0.462581\nTraining accuracy: 88.2%\nValidation accuracy: 77.0%\nLoss at step 5600: 0.459354\nTraining accuracy: 88.2%\nValidation accuracy: 77.0%\nLoss at step 5700: 0.456219\nTraining accuracy: 88.2%\nValidation accuracy: 77.0%\nLoss at step 5800: 0.453170\nTraining accuracy: 88.3%\nValidation accuracy: 77.0%\nLoss at step 5900: 0.450206\nTraining accuracy: 88.3%\nValidation accuracy: 77.1%\nLoss at step 6000: 0.447320\nTraining accuracy: 88.4%\nValidation accuracy: 77.1%\nLoss at step 6100: 0.444511\nTraining accuracy: 88.4%\nValidation accuracy: 77.2%\nLoss at step 6200: 0.441775\nTraining accuracy: 88.5%\nValidation accuracy: 77.2%\nLoss at step 6300: 0.439109\nTraining accuracy: 88.5%\nValidation accuracy: 77.2%\nLoss at step 6400: 0.436509\nTraining accuracy: 88.6%\nValidation accuracy: 77.2%\nLoss at step 6500: 0.433974\nTraining accuracy: 88.6%\nValidation accuracy: 77.2%\nLoss at step 6600: 0.431500\nTraining accuracy: 88.7%\nValidation accuracy: 77.2%\nLoss at step 6700: 0.429086\nTraining accuracy: 88.8%\nValidation accuracy: 77.2%\nLoss at step 6800: 0.426728\nTraining accuracy: 88.8%\nValidation accuracy: 77.2%\nLoss at step 6900: 0.424425\nTraining accuracy: 88.9%\nValidation accuracy: 77.2%\nLoss at step 7000: 0.422174\nTraining accuracy: 89.0%\nValidation accuracy: 77.2%\nLoss at step 7100: 0.419974\nTraining accuracy: 89.1%\nValidation accuracy: 77.1%\nLoss at step 7200: 0.417823\nTraining accuracy: 89.1%\nValidation accuracy: 77.2%\nLoss at step 7300: 0.415718\nTraining accuracy: 89.2%\nValidation accuracy: 77.2%\nLoss at step 7400: 0.413659\nTraining accuracy: 89.3%\nValidation accuracy: 77.2%\nLoss at step 7500: 0.411643\nTraining accuracy: 89.3%\nValidation accuracy: 77.2%\nLoss at step 7600: 0.409670\nTraining accuracy: 89.4%\nValidation accuracy: 77.2%\nLoss at step 7700: 0.407737\nTraining accuracy: 89.5%\nValidation accuracy: 77.2%\nLoss at step 7800: 0.405843\nTraining accuracy: 89.5%\nValidation accuracy: 77.2%\nLoss at step 7900: 0.403987\nTraining accuracy: 89.6%\nValidation accuracy: 77.2%\nLoss at step 8000: 0.402168\nTraining accuracy: 89.7%\nValidation accuracy: 77.2%\nLoss at step 8100: 0.400384\nTraining accuracy: 89.7%\nValidation accuracy: 77.2%\nLoss at step 8200: 0.398635\nTraining accuracy: 89.8%\nValidation accuracy: 77.2%\nLoss at step 8300: 0.396918\nTraining accuracy: 89.8%\nValidation accuracy: 77.1%\nLoss at step 8400: 0.395234\nTraining accuracy: 89.8%\nValidation accuracy: 77.1%\nLoss at step 8500: 0.393582\nTraining accuracy: 89.8%\nValidation accuracy: 77.2%\nLoss at step 8600: 0.391959\nTraining accuracy: 89.9%\nValidation accuracy: 77.2%\nLoss at step 8700: 0.390365\nTraining accuracy: 89.9%\nValidation accuracy: 77.2%\nLoss at step 8800: 0.388800\nTraining accuracy: 90.0%\nValidation accuracy: 77.2%\nLoss at step 8900: 0.387263\nTraining accuracy: 90.0%\nValidation accuracy: 77.2%\nLoss at step 9000: 0.385752\nTraining accuracy: 90.1%\nValidation accuracy: 77.3%\nLoss at step 9100: 0.384267\nTraining accuracy: 90.1%\nValidation accuracy: 77.2%\nLoss at step 9200: 0.382808\nTraining accuracy: 90.2%\nValidation accuracy: 77.2%\nLoss at step 9300: 0.381373\nTraining accuracy: 90.2%\nValidation accuracy: 77.2%\nLoss at step 9400: 0.379962\nTraining accuracy: 90.3%\nValidation accuracy: 77.2%\nLoss at step 9500: 0.378574\nTraining accuracy: 90.3%\nValidation accuracy: 77.2%\nLoss at step 9600: 0.377209\nTraining accuracy: 90.3%\nValidation accuracy: 77.2%\nLoss at step 9700: 0.375866\nTraining accuracy: 90.3%\nValidation accuracy: 77.2%\nLoss at step 9800: 0.374544\nTraining accuracy: 90.4%\nValidation accuracy: 77.2%\nLoss at step 9900: 0.373243\nTraining accuracy: 90.4%\nValidation accuracy: 77.2%\nTest accuracy: 84.2%\n"
],
[
"# Let's now switch to stochastic gradient descent training instead, which is much faster.\n\nbatch_size = 128\n\ngraph = tf.Graph()\nwith graph.as_default():\n\n # Input data. For the training data, we use a placeholder that will be fed\n # at run time with a training minibatch.\n tf_train_dataset = tf.placeholder(tf.float32,\n shape=(batch_size, image_size * image_size))\n tf_train_labels = tf.placeholder(tf.float32, shape=(batch_size, num_labels))\n tf_valid_dataset = tf.constant(valid_dataset)\n tf_test_dataset = tf.constant(test_dataset)\n \n # Variables.\n weights = tf.Variable(\n tf.truncated_normal([image_size * image_size, num_labels]))\n biases = tf.Variable(tf.zeros([num_labels]))\n \n # Training computation.\n logits = tf.matmul(tf_train_dataset, weights) + biases\n loss = tf.reduce_mean(\n tf.nn.softmax_cross_entropy_with_logits(labels=tf_train_labels, logits=logits))\n \n # Optimizer.\n optimizer = tf.train.GradientDescentOptimizer(0.5).minimize(loss)\n \n # Predictions for the training, validation, and test data.\n train_prediction = tf.nn.softmax(logits)\n valid_prediction = tf.nn.softmax(\n tf.matmul(tf_valid_dataset, weights) + biases)\n test_prediction = tf.nn.softmax(tf.matmul(tf_test_dataset, weights) + biases)",
"_____no_output_____"
],
[
"num_steps = 10000\n\nwith tf.Session(graph=graph) as session:\n tf.global_variables_initializer().run()\n print(\"Initialized\")\n for step in range(num_steps):\n # Pick an offset within the training data, which has been randomized.\n # Note: we could use better randomization across epochs.\n offset = (step * batch_size) % (train_labels.shape[0] - batch_size)\n # Generate a minibatch.\n batch_data = train_dataset[offset:(offset + batch_size), :]\n batch_labels = train_labels[offset:(offset + batch_size), :]\n # Prepare a dictionary telling the session where to feed the minibatch.\n # The key of the dictionary is the placeholder node of the graph to be fed,\n # and the value is the numpy array to feed to it.\n feed_dict = {tf_train_dataset : batch_data, tf_train_labels : batch_labels}\n _, l, predictions = session.run(\n [optimizer, loss, train_prediction], feed_dict=feed_dict)\n if (step % 500 == 0):\n print(\"Minibatch loss at step %d: %f\" % (step, l))\n print(\"Minibatch accuracy: %.1f%%\" % accuracy(predictions, batch_labels))\n print(\"Validation accuracy: %.1f%%\" % accuracy(\n valid_prediction.eval(), valid_labels))\n print(\"Test accuracy: %.1f%%\" % accuracy(test_prediction.eval(), test_labels))\n\n#TODO measure time",
"Initialized\nMinibatch loss at step 0: 17.899033\nMinibatch accuracy: 7.8%\nValidation accuracy: 10.0%\nMinibatch loss at step 500: 1.193777\nMinibatch accuracy: 79.7%\nValidation accuracy: 75.0%\nMinibatch loss at step 1000: 1.287950\nMinibatch accuracy: 82.0%\nValidation accuracy: 76.5%\nMinibatch loss at step 1500: 0.656950\nMinibatch accuracy: 81.2%\nValidation accuracy: 77.4%\nMinibatch loss at step 2000: 0.924349\nMinibatch accuracy: 78.9%\nValidation accuracy: 77.3%\nMinibatch loss at step 2500: 1.161976\nMinibatch accuracy: 74.2%\nValidation accuracy: 78.2%\nMinibatch loss at step 3000: 0.851813\nMinibatch accuracy: 80.5%\nValidation accuracy: 78.8%\nMinibatch loss at step 3500: 0.921817\nMinibatch accuracy: 81.2%\nValidation accuracy: 78.6%\nMinibatch loss at step 4000: 0.835667\nMinibatch accuracy: 80.5%\nValidation accuracy: 79.0%\nMinibatch loss at step 4500: 0.808454\nMinibatch accuracy: 79.7%\nValidation accuracy: 79.4%\nMinibatch loss at step 5000: 0.658319\nMinibatch accuracy: 81.2%\nValidation accuracy: 79.5%\nMinibatch loss at step 5500: 0.857714\nMinibatch accuracy: 74.2%\nValidation accuracy: 79.5%\nMinibatch loss at step 6000: 0.938224\nMinibatch accuracy: 76.6%\nValidation accuracy: 79.7%\nMinibatch loss at step 6500: 0.562490\nMinibatch accuracy: 81.2%\nValidation accuracy: 80.0%\nMinibatch loss at step 7000: 0.773726\nMinibatch accuracy: 76.6%\nValidation accuracy: 80.2%\nMinibatch loss at step 7500: 0.964890\nMinibatch accuracy: 78.9%\nValidation accuracy: 80.0%\nMinibatch loss at step 8000: 1.113154\nMinibatch accuracy: 72.7%\nValidation accuracy: 80.1%\nMinibatch loss at step 8500: 0.644020\nMinibatch accuracy: 83.6%\nValidation accuracy: 80.6%\nMinibatch loss at step 9000: 0.761561\nMinibatch accuracy: 82.0%\nValidation accuracy: 80.0%\nMinibatch loss at step 9500: 0.601618\nMinibatch accuracy: 85.2%\nValidation accuracy: 80.9%\nTest accuracy: 86.6%\n"
],
[
"# Turn the logistic regression example with SGD into a 1-hidden layer neural network with rectified linear units nn.relu() \n# and 1024 hidden nodes. This model should improve your validation / test accuracy.\n\n#Do TODOs\n",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cb7fdf08524cc318a191a757c7ecf874d3f4b7 | 42,885 | ipynb | Jupyter Notebook | 4-ml-clustering-and-retrieval/Week_4-assignment-2.ipynb | anilk991/Coursera-Machine-Learning-Specialization-UW | 9b43e0282b38f39c769f344ee42a30b2b4405a77 | [
"MIT"
] | 1 | 2020-10-21T12:57:23.000Z | 2020-10-21T12:57:23.000Z | 4-ml-clustering-and-retrieval/Week_4-assignment-2.ipynb | anilk991/Coursera-Machine-Learning-Specialization-UW | 9b43e0282b38f39c769f344ee42a30b2b4405a77 | [
"MIT"
] | null | null | null | 4-ml-clustering-and-retrieval/Week_4-assignment-2.ipynb | anilk991/Coursera-Machine-Learning-Specialization-UW | 9b43e0282b38f39c769f344ee42a30b2b4405a77 | [
"MIT"
] | null | null | null | 36.312447 | 519 | 0.47196 | [
[
[
"## Fitting a diagonal covariance Gaussian mixture model to text data\n\nIn a previous assignment, we explored k-means clustering for a high-dimensional Wikipedia dataset. We can also model this data with a mixture of Gaussians, though with increasing dimension we run into two important issues associated with using a full covariance matrix for each component.\n * Computational cost becomes prohibitive in high dimensions: score calculations have complexity cubic in the number of dimensions M if the Gaussian has a full covariance matrix.\n * A model with many parameters require more data: observe that a full covariance matrix for an M-dimensional Gaussian will have M(M+1)/2 parameters to fit. With the number of parameters growing roughly as the square of the dimension, it may quickly become impossible to find a sufficient amount of data to make good inferences.\n\nBoth of these issues are avoided if we require the covariance matrix of each component to be diagonal, as then it has only M parameters to fit and the score computation decomposes into M univariate score calculations. Recall from the lecture that the M-step for the full covariance is:\n\n\\begin{align*}\n\\hat{\\Sigma}_k &= \\frac{1}{N_k^{soft}} \\sum_{i=1}^N r_{ik} (x_i-\\hat{\\mu}_k)(x_i - \\hat{\\mu}_k)^T\n\\end{align*}\n\nNote that this is a square matrix with M rows and M columns, and the above equation implies that the (v, w) element is computed by\n\n\\begin{align*}\n\\hat{\\Sigma}_{k, v, w} &= \\frac{1}{N_k^{soft}} \\sum_{i=1}^N r_{ik} (x_{iv}-\\hat{\\mu}_{kv})(x_{iw} - \\hat{\\mu}_{kw})\n\\end{align*}\n\nWhen we assume that this is a diagonal matrix, then non-diagonal elements are assumed to be zero and we only need to compute each of the M elements along the diagonal independently using the following equation. \n\n\\begin{align*}\n\\hat{\\sigma}^2_{k, v} &= \\hat{\\Sigma}_{k, v, v} \\\\\n&= \\frac{1}{N_k^{soft}} \\sum_{i=1}^N r_{ik} (x_{iv}-\\hat{\\mu}_{kv})^2\n\\end{align*}\n\nIn this section, we will use an EM implementation to fit a Gaussian mixture model with **diagonal** covariances to a subset of the Wikipedia dataset. The implementation uses the above equation to compute each variance term. \n\nWe'll begin by importing the dataset and coming up with a useful representation for each article. After running our algorithm on the data, we will explore the output to see whether we can give a meaningful interpretation to the fitted parameters in our model.",
"_____no_output_____"
],
[
"**Note to Amazon EC2 users**: To conserve memory, make sure to stop all the other notebooks before running this notebook.",
"_____no_output_____"
],
[
"## Import necessary packages",
"_____no_output_____"
]
],
[
[
"from __future__ import print_function # to conform python 2.x print to python 3.x\nimport turicreate",
"_____no_output_____"
]
],
[
[
"We also have a Python file containing implementations for several functions that will be used during the course of this assignment.",
"_____no_output_____"
]
],
[
[
"from em_utilities import *",
"_____no_output_____"
]
],
[
[
"## Load Wikipedia data and extract TF-IDF features",
"_____no_output_____"
],
[
"Load Wikipedia data and transform each of the first 5000 document into a TF-IDF representation.",
"_____no_output_____"
]
],
[
[
"wiki = turicreate.SFrame('people_wiki.sframe/').head(5000)\nwiki['tf_idf'] = turicreate.text_analytics.tf_idf(wiki['text'])",
"_____no_output_____"
]
],
[
[
"Using a utility we provide, we will create a sparse matrix representation of the documents. This is the same utility function you used during the previous assignment on k-means with text data.",
"_____no_output_____"
]
],
[
[
"wiki = wiki.add_row_number()\ntf_idf, map_word_to_index = sframe_to_scipy(wiki, 'tf_idf')\nmap_index_to_word = dict([[map_word_to_index[i], i] for i in map_word_to_index.keys()])",
"_____no_output_____"
]
],
[
[
"As in the previous assignment, we will normalize each document's TF-IDF vector to be a unit vector. ",
"_____no_output_____"
]
],
[
[
"%%time\ntf_idf = normalize(tf_idf)",
"CPU times: user 4.56 ms, sys: 733 µs, total: 5.29 ms\nWall time: 5.8 ms\n"
]
],
[
[
"We can check that the length (Euclidean norm) of each row is now 1.0, as expected.",
"_____no_output_____"
]
],
[
[
"for i in range(5):\n doc = tf_idf[i]\n print(np.linalg.norm(doc.todense()))",
"1.0\n1.0\n0.9999999999999997\n1.0000000000000007\n1.0\n"
]
],
[
[
"## EM in high dimensions\n\nEM for high-dimensional data requires some special treatment:\n * E step and M step must be vectorized as much as possible, as explicit loops are dreadfully slow in Python.\n * All operations must be cast in terms of sparse matrix operations, to take advantage of computational savings enabled by sparsity of data.\n * Initially, some words may be entirely absent from a cluster, causing the M step to produce zero mean and variance for those words. This means any data point with one of those words will have 0 probability of being assigned to that cluster since the cluster allows for no variability (0 variance) around that count being 0 (0 mean). Since there is a small chance for those words to later appear in the cluster, we instead assign a small positive variance (~1e-10). Doing so also prevents numerical overflow.\n \nWe provide the complete implementation for you in the file `em_utilities.py`. For those who are interested, you can read through the code to see how the sparse matrix implementation differs from the previous assignment. \n\nYou are expected to answer some quiz questions using the results of clustering.",
"_____no_output_____"
],
[
"**Initializing mean parameters using k-means**\n\nRecall from the lectures that EM for Gaussian mixtures is very sensitive to the choice of initial means. With a bad initial set of means, EM may produce clusters that span a large area and are mostly overlapping. To eliminate such bad outcomes, we first produce a suitable set of initial means by using the cluster centers from running k-means. That is, we first run k-means and then take the final set of means from the converged solution as the initial means in our EM algorithm.",
"_____no_output_____"
]
],
[
[
"%%time \n\nfrom sklearn.cluster import KMeans\n\nnp.random.seed(5)\nnum_clusters = 25\n\n# Use scikit-learn's k-means to simplify workflow\n#kmeans_model = KMeans(n_clusters=num_clusters, n_init=5, max_iter=400, random_state=1, n_jobs=-1) # uncomment to use parallelism -- may break on your installation\nkmeans_model = KMeans(n_clusters=num_clusters, n_init=5, max_iter=400, random_state=1, n_jobs=1)\nkmeans_model.fit(tf_idf)\ncentroids, cluster_assignment = kmeans_model.cluster_centers_, kmeans_model.labels_\n\nmeans = [centroid for centroid in centroids]",
"/home/offbeat/Environments/turicreate/lib/python3.7/site-packages/sklearn/cluster/_kmeans.py:974: FutureWarning: 'n_jobs' was deprecated in version 0.23 and will be removed in 0.25.\n \" removed in 0.25.\", FutureWarning)\n"
]
],
[
[
"**Initializing cluster weights**\n\nWe will initialize each cluster weight to be the proportion of documents assigned to that cluster by k-means above.",
"_____no_output_____"
]
],
[
[
"%%time \n\nnum_docs = tf_idf.shape[0]\nweights = []\nfor i in range(num_clusters):\n # Compute the number of data points assigned to cluster i:\n num_assigned = np.sum(cluster_assignment == i) # YOUR CODE HERE\n w = float(num_assigned) / num_docs\n weights.append(w)",
"CPU times: user 1.51 ms, sys: 345 µs, total: 1.86 ms\nWall time: 1.22 ms\n"
],
[
"np.sum(cluster_assignment == 1)",
"_____no_output_____"
]
],
[
[
"**Initializing covariances**\n\nTo initialize our covariance parameters, we compute $\\hat{\\sigma}_{k, j}^2 = \\sum_{i=1}^{N}(x_{i,j} - \\hat{\\mu}_{k, j})^2$ for each feature $j$. For features with really tiny variances, we assign 1e-8 instead to prevent numerical instability. We do this computation in a vectorized fashion in the following code block.",
"_____no_output_____"
]
],
[
[
"covs = []\nfor i in range(num_clusters):\n member_rows = tf_idf[cluster_assignment==i]\n cov = (member_rows.multiply(member_rows) - 2*member_rows.dot(diag(means[i]))).sum(axis=0).A1 / member_rows.shape[0] \\\n + means[i]**2\n cov[cov < 1e-8] = 1e-8\n covs.append(cov)",
"_____no_output_____"
]
],
[
[
"**Running EM**\n\nNow that we have initialized all of our parameters, run EM.",
"_____no_output_____"
]
],
[
[
"out = EM_for_high_dimension(tf_idf, means, covs, weights, cov_smoothing=1e-10)",
"_____no_output_____"
],
[
"out['loglik']",
"_____no_output_____"
]
],
[
[
"## Interpret clustering results",
"_____no_output_____"
],
[
"In contrast to k-means, EM is able to explicitly model clusters of varying sizes and proportions. The relative magnitude of variances in the word dimensions tell us much about the nature of the clusters.\n\nWrite yourself a cluster visualizer as follows. Examining each cluster's mean vector, list the 5 words with the largest mean values (5 most common words in the cluster). For each word, also include the associated variance parameter (diagonal element of the covariance matrix). \n\nA sample output may be:\n```\n==========================================================\nCluster 0: Largest mean parameters in cluster \n\nWord Mean Variance \nfootball 1.08e-01 8.64e-03\nseason 5.80e-02 2.93e-03\nclub 4.48e-02 1.99e-03\nleague 3.94e-02 1.08e-03\nplayed 3.83e-02 8.45e-04\n...\n```",
"_____no_output_____"
]
],
[
[
"# Fill in the blanks\ndef visualize_EM_clusters(tf_idf, means, covs, map_index_to_word):\n print('')\n print('==========================================================')\n \n num_clusters = len(means)\n for c in range(num_clusters):\n print('Cluster {0:d}: Largest mean parameters in cluster '.format(c))\n print('\\n{0: <12}{1: <12}{2: <12}'.format('Word', 'Mean', 'Variance'))\n \n # The k'th element of sorted_word_ids should be the index of the word \n # that has the k'th-largest value in the cluster mean. Hint: Use np.argsort().\n sorted_word_ids = np.argsort(means[c])[::-1] # YOUR CODE HERE\n\n for i in sorted_word_ids[:5]:\n print('{0: <12}{1:<10.2e}{2:10.2e}'.format(map_index_to_word[i], \n means[c][i],\n covs[c][i]))\n print('\\n==========================================================')",
"_____no_output_____"
],
[
"'''By EM'''\nvisualize_EM_clusters(tf_idf, out['means'], out['covs'], map_index_to_word)",
"\n==========================================================\nCluster 0: Largest mean parameters in cluster \n\nWord Mean Variance \nminister 7.57e-02 7.42e-03\nelection 5.89e-02 3.21e-03\nparty 5.89e-02 2.61e-03\nliberal 2.93e-02 4.55e-03\nelected 2.91e-02 8.95e-04\n\n==========================================================\nCluster 1: Largest mean parameters in cluster \n\nWord Mean Variance \nfilm 1.76e-01 6.07e-03\nfilms 5.50e-02 2.97e-03\nfestival 4.66e-02 3.60e-03\nfeature 3.69e-02 1.81e-03\ndirected 3.39e-02 2.22e-03\n\n==========================================================\nCluster 2: Largest mean parameters in cluster \n\nWord Mean Variance \nart 1.26e-01 6.83e-03\nmuseum 5.62e-02 7.27e-03\ngallery 3.65e-02 3.40e-03\nartist 3.61e-02 1.44e-03\ndesign 3.20e-02 4.59e-03\n\n==========================================================\nCluster 3: Largest mean parameters in cluster \n\nWord Mean Variance \nbasketball 1.86e-01 7.78e-03\nnba 1.01e-01 1.22e-02\npoints 6.25e-02 5.92e-03\ncoach 5.57e-02 5.91e-03\nteam 4.68e-02 1.30e-03\n\n==========================================================\nCluster 4: Largest mean parameters in cluster \n\nWord Mean Variance \nhockey 2.45e-01 1.64e-02\nnhl 1.56e-01 1.64e-02\nice 6.40e-02 2.97e-03\nseason 5.05e-02 2.52e-03\nleague 4.31e-02 1.53e-03\n\n==========================================================\nCluster 5: Largest mean parameters in cluster \n\nWord Mean Variance \nrepublican 7.93e-02 5.20e-03\nsenate 5.41e-02 6.28e-03\nhouse 4.64e-02 2.41e-03\ndistrict 4.60e-02 2.37e-03\ndemocratic 4.46e-02 3.02e-03\n\n==========================================================\nCluster 6: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 1.60e-01 4.65e-03\nher 1.00e-01 3.14e-03\nmiss 2.22e-02 7.76e-03\nwomen 1.43e-02 1.36e-03\nwomens 1.21e-02 1.46e-03\n\n==========================================================\nCluster 7: Largest mean parameters in cluster \n\nWord Mean Variance \nchampionships7.78e-02 5.17e-03\nm 4.70e-02 7.58e-03\nolympics 4.69e-02 2.59e-03\nmedal 4.28e-02 2.44e-03\nshe 4.18e-02 5.99e-03\n\n==========================================================\nCluster 8: Largest mean parameters in cluster \n\nWord Mean Variance \nbook 1.45e-02 9.38e-04\npublished 1.23e-02 6.16e-04\nthat 1.10e-02 1.73e-04\nnovel 1.07e-02 1.43e-03\nhe 1.04e-02 6.05e-05\n\n==========================================================\nCluster 9: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 1.37e-01 4.25e-03\nher 8.99e-02 2.74e-03\nactress 7.65e-02 4.29e-03\nfilm 5.98e-02 3.44e-03\ndrama 5.03e-02 6.40e-03\n\n==========================================================\nCluster 10: Largest mean parameters in cluster \n\nWord Mean Variance \nsoccer 1.15e-01 2.86e-02\nchess 4.52e-02 1.66e-02\nteam 4.13e-02 2.15e-03\ncoach 3.09e-02 4.45e-03\nleague 3.07e-02 2.01e-03\n\n==========================================================\nCluster 11: Largest mean parameters in cluster \n\nWord Mean Variance \npresident 2.52e-02 1.29e-03\nchairman 2.44e-02 1.97e-03\ncommittee 2.34e-02 2.38e-03\nserved 2.24e-02 6.99e-04\nexecutive 2.15e-02 1.23e-03\n\n==========================================================\nCluster 12: Largest mean parameters in cluster \n\nWord Mean Variance \nmusic 7.26e-02 3.48e-03\njazz 6.07e-02 1.14e-02\nhong 3.78e-02 9.92e-03\nkong 3.50e-02 8.64e-03\nchinese 3.12e-02 5.33e-03\n\n==========================================================\nCluster 13: Largest mean parameters in cluster \n\nWord Mean Variance \nuniversity 3.47e-02 8.89e-04\nhistory 3.38e-02 2.81e-03\nphilosophy 2.86e-02 5.35e-03\nprofessor 2.74e-02 1.08e-03\nstudies 2.41e-02 1.95e-03\n\n==========================================================\nCluster 14: Largest mean parameters in cluster \n\nWord Mean Variance \ntheatre 4.93e-02 6.17e-03\nactor 3.56e-02 2.91e-03\ntelevision 3.21e-02 1.67e-03\nfilm 2.93e-02 1.16e-03\ncomedy 2.86e-02 3.91e-03\n\n==========================================================\nCluster 15: Largest mean parameters in cluster \n\nWord Mean Variance \nalbum 6.76e-02 4.78e-03\nband 5.35e-02 4.21e-03\nmusic 4.18e-02 1.96e-03\nreleased 3.13e-02 1.11e-03\nsong 2.50e-02 1.81e-03\n\n==========================================================\nCluster 16: Largest mean parameters in cluster \n\nWord Mean Variance \ntour 1.14e-01 1.92e-02\npga 1.08e-01 2.65e-02\nracing 8.45e-02 8.26e-03\nchampionship6.27e-02 4.54e-03\nformula 6.06e-02 1.31e-02\n\n==========================================================\nCluster 17: Largest mean parameters in cluster \n\nWord Mean Variance \nnews 5.76e-02 8.06e-03\nradio 5.18e-02 4.62e-03\nshow 3.75e-02 2.56e-03\nbbc 3.63e-02 7.41e-03\nchef 3.27e-02 1.18e-02\n\n==========================================================\nCluster 18: Largest mean parameters in cluster \n\nWord Mean Variance \nfootball 1.11e-01 5.60e-03\nyards 7.37e-02 1.72e-02\nnfl 6.98e-02 9.15e-03\ncoach 6.74e-02 7.85e-03\nquarterback 4.02e-02 7.16e-03\n\n==========================================================\nCluster 19: Largest mean parameters in cluster \n\nWord Mean Variance \nleague 5.21e-02 3.13e-03\nclub 5.04e-02 2.64e-03\nseason 4.77e-02 2.30e-03\nrugby 4.35e-02 8.18e-03\ncup 4.22e-02 2.46e-03\n\n==========================================================\nCluster 20: Largest mean parameters in cluster \n\nWord Mean Variance \norchestra 1.31e-01 1.06e-02\nmusic 1.23e-01 6.15e-03\nsymphony 8.70e-02 1.08e-02\nconductor 8.16e-02 1.01e-02\nphilharmonic4.96e-02 3.27e-03\n\n==========================================================\nCluster 21: Largest mean parameters in cluster \n\nWord Mean Variance \nlaw 9.52e-02 8.35e-03\ncourt 6.84e-02 5.24e-03\njudge 4.59e-02 4.44e-03\nattorney 3.74e-02 4.30e-03\ndistrict 3.72e-02 4.20e-03\n\n==========================================================\nCluster 22: Largest mean parameters in cluster \n\nWord Mean Variance \nfootball 1.21e-01 6.14e-03\nafl 9.58e-02 1.31e-02\naustralian 7.91e-02 1.58e-03\nclub 5.93e-02 1.76e-03\nseason 5.58e-02 1.83e-03\n\n==========================================================\nCluster 23: Largest mean parameters in cluster \n\nWord Mean Variance \nresearch 5.70e-02 2.68e-03\nscience 3.50e-02 2.95e-03\nuniversity 3.34e-02 7.14e-04\nprofessor 3.20e-02 1.26e-03\nphysics 2.61e-02 5.43e-03\n\n==========================================================\nCluster 24: Largest mean parameters in cluster \n\nWord Mean Variance \nbaseball 1.16e-01 5.57e-03\nleague 1.03e-01 3.63e-03\nmajor 5.09e-02 1.19e-03\ngames 4.66e-02 1.93e-03\nsox 4.55e-02 6.28e-03\n\n==========================================================\n"
]
],
[
[
"**Quiz Question**. Select all the topics that have a cluster in the model created above. [multiple choice]\n\n- Baseball\n- Basketball\n- Soccer/Football\n- Music\n- Politics\n- Law\n- Finance",
"_____no_output_____"
],
[
"## Comparing to random initialization",
"_____no_output_____"
],
[
"Create variables for randomly initializing the EM algorithm. Complete the following code block.",
"_____no_output_____"
]
],
[
[
"np.random.seed(5) # See the note below to see why we set seed=5.\nnum_clusters = len(means)\nnum_docs, num_words = tf_idf.shape\n\nrandom_means = []\nrandom_covs = []\nrandom_weights = []\n\nfor k in range(num_clusters):\n \n # Create a numpy array of length num_words with random normally distributed values.\n # Use the standard univariate normal distribution (mean 0, variance 1).\n # YOUR CODE HERE\n mean = np.random.normal(0, 1, size=num_words)\n \n # Create a numpy array of length num_words with random values uniformly distributed between 1 and 5.\n # YOUR CODE HERE\n cov = np.random.uniform(1, 5, size=(num_words))\n\n # Initially give each cluster equal weight.\n # YOUR CODE HERE\n weight = 1\n \n random_means.append(mean)\n random_covs.append(cov)\n random_weights.append(weight)",
"_____no_output_____"
]
],
[
[
"**Quiz Question**: Try fitting EM with the random initial parameters you created above. (Use `cov_smoothing=1e-5`.) Store the result to `out_random_init`. What is the final loglikelihood that the algorithm converges to?",
"_____no_output_____"
]
],
[
[
"out_random_init = EM_for_high_dimension(tf_idf, random_means, random_covs, random_weights, cov_smoothing=1e-5)",
"_____no_output_____"
],
[
"print(\"{:e}\".format(out_random_init['loglik'][-1]))",
"2.362457e+09\n"
]
],
[
[
"**Quiz Question:** Is the final loglikelihood larger or smaller than the final loglikelihood we obtained above when initializing EM with the results from running k-means?",
"_____no_output_____"
]
],
[
[
"out['loglik']",
"_____no_output_____"
]
],
[
[
"**Quiz Question**: For the above model, `out_random_init`, use the `visualize_EM_clusters` method you created above. Are the clusters more or less interpretable than the ones found after initializing using k-means?",
"_____no_output_____"
]
],
[
[
"# YOUR CODE HERE. Use visualize_EM_clusters, which will require you to pass in tf_idf and map_index_to_word.\nvisualize_EM_clusters(tf_idf, out_random_init['means'], out_random_init['covs'], map_index_to_word)",
"\n==========================================================\nCluster 0: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.24e-02 3.54e-03\naward 1.53e-02 1.18e-03\nmusic 1.45e-02 1.29e-03\nuniversity 1.43e-02 6.32e-04\nlaw 1.27e-02 2.59e-03\n\n==========================================================\nCluster 1: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 1.99e-02 2.80e-03\nleague 1.91e-02 2.14e-03\nseason 1.59e-02 1.17e-03\nfootball 1.53e-02 2.15e-03\nhe 1.36e-02 1.13e-04\n\n==========================================================\nCluster 2: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 5.65e-02 6.39e-03\nher 5.21e-02 5.62e-03\nmusic 1.13e-02 9.50e-04\nde 1.08e-02 1.92e-03\nopera 1.03e-02 3.26e-03\n\n==========================================================\nCluster 3: Largest mean parameters in cluster \n\nWord Mean Variance \nfilm 2.98e-02 5.79e-03\nhe 1.38e-02 1.07e-04\nhockey 1.33e-02 5.33e-03\nshe 1.31e-02 1.69e-03\nher 1.24e-02 1.20e-03\n\n==========================================================\nCluster 4: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 1.96e-02 3.21e-03\nfilm 1.38e-02 1.72e-03\nhe 1.36e-02 1.14e-04\nher 1.35e-02 1.09e-03\nuniversity 1.31e-02 5.36e-04\n\n==========================================================\nCluster 5: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.03e-02 2.65e-03\nher 1.37e-02 1.09e-03\nhe 1.31e-02 1.21e-04\nlaw 9.93e-03 1.96e-03\ncourt 9.54e-03 1.47e-03\n\n==========================================================\nCluster 6: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.70e-02 3.62e-03\nher 1.44e-02 1.18e-03\nhe 1.18e-02 1.06e-04\nserved 1.11e-02 3.79e-04\nstate 1.03e-02 5.08e-04\n\n==========================================================\nCluster 7: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 3.41e-02 4.33e-03\nher 2.17e-02 1.89e-03\nmusic 1.73e-02 2.16e-03\nalbum 1.52e-02 2.38e-03\nmarathon 1.25e-02 5.52e-03\n\n==========================================================\nCluster 8: Largest mean parameters in cluster \n\nWord Mean Variance \nleague 1.87e-02 2.01e-03\nshe 1.73e-02 2.67e-03\nhe 1.46e-02 1.17e-04\nseason 1.38e-02 8.80e-04\nplayed 1.35e-02 6.32e-04\n\n==========================================================\nCluster 9: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 3.38e-02 4.81e-03\nher 1.52e-02 1.23e-03\nteam 1.46e-02 8.86e-04\nplayed 1.45e-02 7.99e-04\ncup 1.39e-02 1.44e-03\n\n==========================================================\nCluster 10: Largest mean parameters in cluster \n\nWord Mean Variance \nmusic 1.54e-02 1.51e-03\nyork 1.49e-02 8.13e-04\nhe 1.31e-02 1.01e-04\nuniversity 1.23e-02 5.72e-04\nshe 1.22e-02 2.06e-03\n\n==========================================================\nCluster 11: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.07e-02 2.65e-03\nher 1.61e-02 1.67e-03\nfilm 1.55e-02 2.19e-03\nmusic 1.36e-02 1.71e-03\nuniversity 1.36e-02 3.43e-04\n\n==========================================================\nCluster 12: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.06e-02 2.98e-03\ntour 1.46e-02 3.64e-03\nhe 1.42e-02 1.22e-04\nher 1.26e-02 1.11e-03\nmusic 1.25e-02 1.40e-03\n\n==========================================================\nCluster 13: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.12e-02 2.25e-03\nher 1.65e-02 1.35e-03\nart 1.60e-02 2.76e-03\nnixon 1.50e-02 9.78e-03\nmusic 1.44e-02 1.41e-03\n\n==========================================================\nCluster 14: Largest mean parameters in cluster \n\nWord Mean Variance \nmusic 1.85e-02 2.31e-03\nfilm 1.69e-02 2.75e-03\nhe 1.31e-02 9.45e-05\nresearch 1.08e-02 1.06e-03\nuniversity 1.04e-02 2.96e-04\n\n==========================================================\nCluster 15: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.14e-02 3.05e-03\nhe 1.35e-02 1.11e-04\nleague 1.32e-02 1.34e-03\nher 1.30e-02 1.32e-03\nseason 1.22e-02 1.01e-03\n\n==========================================================\nCluster 16: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.12e-02 2.73e-03\nher 1.65e-02 1.29e-03\nfilm 1.36e-02 1.26e-03\nhe 1.17e-02 1.01e-04\nshow 1.14e-02 9.72e-04\n\n==========================================================\nCluster 17: Largest mean parameters in cluster \n\nWord Mean Variance \nfilm 1.66e-02 3.18e-03\nmusic 1.28e-02 1.23e-03\nhe 1.18e-02 9.96e-05\nshe 1.11e-02 1.28e-03\nher 1.05e-02 1.17e-03\n\n==========================================================\nCluster 18: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 4.03e-02 5.17e-03\nher 2.28e-02 1.75e-03\nband 1.64e-02 2.43e-03\nmusic 1.24e-02 9.29e-04\nuniversity 1.19e-02 3.84e-04\n\n==========================================================\nCluster 19: Largest mean parameters in cluster \n\nWord Mean Variance \nleague 1.51e-02 1.26e-03\nseason 1.43e-02 1.04e-03\nhe 1.33e-02 9.20e-05\nshe 1.33e-02 1.71e-03\nclub 1.11e-02 8.05e-04\n\n==========================================================\nCluster 20: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.63e-02 3.91e-03\nfilm 1.82e-02 1.93e-03\nher 1.45e-02 1.43e-03\nhe 1.26e-02 1.05e-04\nlaw 1.24e-02 2.35e-03\n\n==========================================================\nCluster 21: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 1.86e-02 2.57e-03\nhe 1.39e-02 1.30e-04\nleague 1.37e-02 1.27e-03\nseason 1.22e-02 1.09e-03\nher 1.21e-02 1.09e-03\n\n==========================================================\nCluster 22: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 1.50e-02 2.21e-03\nmusic 1.49e-02 1.63e-03\nhe 1.29e-02 1.08e-04\nparty 1.12e-02 8.99e-04\nher 1.00e-02 1.08e-03\n\n==========================================================\nCluster 23: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.27e-02 2.67e-03\nher 1.79e-02 1.67e-03\nmusic 1.62e-02 1.32e-03\nband 1.20e-02 1.10e-03\nyork 1.18e-02 6.68e-04\n\n==========================================================\nCluster 24: Largest mean parameters in cluster \n\nWord Mean Variance \nshe 2.62e-02 3.89e-03\nher 1.77e-02 1.67e-03\nalbum 1.50e-02 2.47e-03\nhe 1.28e-02 1.26e-04\nsoccer 1.16e-02 4.19e-03\n\n==========================================================\n"
]
],
[
[
"**Note**: Random initialization may sometimes produce a superior fit than k-means initialization. We do not claim that random initialization is always worse. However, this section does illustrate that random initialization often produces much worse clustering than k-means counterpart. This is the reason why we provide the particular random seed (`np.random.seed(5)`).",
"_____no_output_____"
],
[
"## Takeaway\n\nIn this assignment we were able to apply the EM algorithm to a mixture of Gaussians model of text data. This was made possible by modifying the model to assume a diagonal covariance for each cluster, and by modifying the implementation to use a sparse matrix representation. In the second part you explored the role of k-means initialization on the convergence of the model as well as the interpretability of the clusters.",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
]
] |
d0cb94d4682810e68bd2020e02682ebcedb01007 | 36,480 | ipynb | Jupyter Notebook | examples/file_readwrite.ipynb | acossard/crystal_functions | e220d31e226490f7f5c963d519eeaaddceb44d04 | [
"MIT"
] | null | null | null | examples/file_readwrite.ipynb | acossard/crystal_functions | e220d31e226490f7f5c963d519eeaaddceb44d04 | [
"MIT"
] | null | null | null | examples/file_readwrite.ipynb | acossard/crystal_functions | e220d31e226490f7f5c963d519eeaaddceb44d04 | [
"MIT"
] | 1 | 2022-03-30T09:37:53.000Z | 2022-03-30T09:37:53.000Z | 27.847328 | 204 | 0.465159 | [
[
[
"# Example notebook for the functions contained in cry_file_readwrite.py",
"_____no_output_____"
],
[
"### Crystal_input class",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import Crystal_input",
"_____no_output_____"
]
],
[
[
"#### Create a crystal input object from blocks",
"_____no_output_____"
]
],
[
[
"geom_block = ['MGO BULK - GEOMETRY TEST\\n',\n 'CRYSTAL\\n',\n '0 0 0\\n',\n '225\\n',\n '4.217\\n',\n '2\\n',\n '12 0. 0. 0.\\n',\n '8 0.5 0.5 0.5\\n',\n 'END\\n']\nbs_block = ['BASISSET\\n','POB-DZVP\\n']\nfunc_block = ['DFT\\n', 'B3LYP\\n', 'XXLGRID\\n', 'ENDDFT\\n']\nscf_block = [['TOLINTEG\\n', '7 7 7 7 14\\n'],\n ['SHRINK\\n', '12 24\\n'],\n ['MAXCYCLE\\n', '200\\n'],\n ['FMIXING\\n', '70\\n'],\n 'DIIS\\n',\n 'ENDSCF\\n']",
"_____no_output_____"
],
[
"mgo_input = Crystal_input().from_blocks(geom_block,bs_block,func_block,scf_block)\nmgo_input.geom_block",
"_____no_output_____"
]
],
[
[
"#### Create a crystal input object from an existing input file",
"_____no_output_____"
]
],
[
[
"mgo_input = Crystal_input().from_file('data/mgo.d12')\nmgo_input.geom_block",
"_____no_output_____"
]
],
[
[
"### Crystal_output class",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import Crystal_output",
"_____no_output_____"
]
],
[
[
"#### 3D system",
"_____no_output_____"
]
],
[
[
"mgo_output = Crystal_output().read_cry_output('data/mgo_optgeom.out')\nmgo_output",
"_____no_output_____"
]
],
[
[
"#### Functions and properties",
"_____no_output_____"
]
],
[
[
"#Final energy\nprint(\"Final energy = %s eV \\n\" % mgo_output.get_final_energy())\n\n#Fermi energy\nprint(\"Fermi energy = %s eV \\n\" % mgo_output.get_fermi_energy())\n\n#Primitive lattice\nprint(\"Primitive lattice \\n %s \\n\" % mgo_output.get_primitive_lattice())\n\n#Reciprocal lattice\nprint(\"Reciprocal lattice \\n %s \\n\" % mgo_output.get_reciprocal_lattice())\n\n#Band gap\nprint(\"Band gap = %s eV \\n\" % mgo_output.get_band_gap())\n\n#Last geometry\nprint(\"Last geometry = \\n %s \\n\" % mgo_output.get_last_geom())\n\n#Symmetry operators\nprint(\"Symmetry operators = \\n %s \\n\" % mgo_output.get_symm_ops())\n\n#Forces\nprint(\"Forces on cell = \\n %s \\n Forces on atoms = \\n %s \\n Gradient = \\n %s \\n\" % (mgo_output.get_forces(grad=True)[0],\n mgo_output.get_forces(grad=True)[1],\n mgo_output.grad))\n#Scf convergence\nprint(\"Total energy = \\n %s \\n Delta energy = \\n %s \\n\" % (mgo_output.get_scf_convergence()[0],\n mgo_output.get_scf_convergence()[1]))",
"Final energy = -7495.341792877063 eV \n\nFermi energy = -4.13671240282 eV \n\nPrimitive lattice \n [[0. 2.1085 2.1085]\n [2.1085 0. 2.1085]\n [2.1085 2.1085 0. ]] \n\nReciprocal lattice \n [[-1.48996571 1.48996571 1.48996571]\n [ 1.48996571 -1.48996571 1.48996571]\n [ 1.48996571 1.48996571 -1.48996571]] \n\nBand gap = 7.1237 eV \n\n"
]
],
[
[
"#### 0D system",
"_____no_output_____"
]
],
[
[
"co_output = Crystal_output().read_cry_output('data/co.out')",
"_____no_output_____"
],
[
"#Final energy\nprint(\"Final energy = %s eV \\n\" % co_output.get_final_energy())\n\n#Fermi energy\nprint(\"Fermi energy = %s eV \\n\" % co_output.get_fermi_energy())\n\n#Primitive lattice\nprint(\"Primitive lattice \\n %s \\n\" % co_output.get_primitive_lattice())\n\n#Reciprocal lattice\nprint(\"Reciprocal lattice \\n %s \\n\" % co_output.get_reciprocal_lattice())\n\n#Band gap\nprint(\"Band gap = %s eV \\n\" % co_output.get_band_gap())\n\n#Last geometry\nprint(\"Last geometry = \\n %s \\n\" % co_output.get_last_geom())\n\n#Symmetry operators\nprint(\"Symmetry operators = \\n %s \\n\" % co_output.get_symm_ops())\n\n#Forces\nprint(\"Forces on cell = \\n %s \\n Forces on atoms = \\n %s \\n Gradient = \\n %s \\n\" % (co_output.get_forces(grad=True)[0],\n co_output.get_forces(grad=True)[1],\n co_output.grad))\n#Scf convergence\nprint(\"Total energy = \\n %s \\n Delta energy = \\n %s \\n\" % (co_output.get_scf_convergence()[0],\n co_output.get_scf_convergence()[1]))",
"Final energy = -3037.8807073392627 eV \n\nFermi energy = -7.247937617924001 eV \n\nWARNING: no lattice vectors found in the output file. lattice = []\nPrimitive lattice \n None \n\nReciprocal lattice \n None \n\nBand gap = 10.9012 eV \n\nLast geometry = \n [[[12.0, 0.0, 0.0], [0.0, 12.0, 0.0], [0.0, 0.0, 12.0]], [6, 8], [[-0.06372620712817, -0.03982887945511, -0.03186310356409], [0.8637262071282, 0.5398288794551, 0.4318631035641]]] \n\nSymmetry operators = \n None \n\nForces on cell = \n [] \n Forces on atoms = \n [[-0.48652346 -0.30407721 -0.24326191]\n [ 0.48652346 0.30407721 0.24326191]] \n Gradient = \n ['0.881299', '0.033031', '0.014444', '0.005748', '0.000292', '0.000266'] \n\nTotal energy = \n [-3050.4186324 -3037.81431056 -3037.86470591 -3037.87933672\n -3037.88070722 -3037.88070734 -3037.88070734] \n Delta energy = \n [-3.04767680e+03 1.25988782e+01 -5.03410900e-02 -1.46397332e-02\n -1.37145456e-03 -1.17281134e-07 -7.48313500e-10] \n\n"
]
],
[
[
"### Properties_output class",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import Properties_output",
"_____no_output_____"
]
],
[
[
"#### Bands",
"_____no_output_____"
]
],
[
[
"mgo_bands = Properties_output()\nmgo_bands.read_cry_bands('../examples/data/mgo_BAND_dat.BAND')\nmgo_bands",
"_____no_output_____"
]
],
[
[
"#### Doss",
"_____no_output_____"
]
],
[
[
"mgo_doss = Properties_output()\nmgo_doss = mgo_doss.read_cry_doss('data/mgo_DOSS_dat.DOSS')\nmgo_doss",
"_____no_output_____"
]
],
[
[
"### write_cry_input function",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import Crystal_input\nfrom crystal_functions.file_readwrite import write_crystal_input",
"_____no_output_____"
]
],
[
[
"#### Use existing input file",
"_____no_output_____"
]
],
[
[
"#Read the original input\nmgo_original_input = Crystal_input().from_file('data/mgo.d12')\n\n#Write the input\nnew_input_name = 'data/mgo_from_file.d12'\nwrite_crystal_input(new_input_name,crystal_input=mgo_original_input)",
"_____no_output_____"
]
],
[
[
"#### Build from blocks",
"_____no_output_____"
]
],
[
[
"#Define the blocks\ngeom_block = ['MGO BULK - GEOMETRY TEST\\n',\n 'CRYSTAL\\n',\n '0 0 0\\n',\n '225\\n',\n '4.217\\n',\n '2\\n',\n '12 0. 0. 0.\\n',\n '8 0.5 0.5 0.5\\n',\n 'END\\n']\nbs_block = ['12 4\\n',\n '0 0 8 2.0 1.0\\n',\n ' 68370.0 0.0002226\\n',\n ' 9661.0 0.001901\\n',\n ' 2041.0 0.011042\\n',\n ' 529.6 0.05005\\n',\n ' 159.17 0.1690\\n',\n ' 54.71 0.36695\\n',\n ' 21.236 0.4008\\n',\n ' 8.791 0.1487\\n',\n '0 1 5 8.0 1.0\\n',\n ' 143.7 -0.00671 0.00807\\n',\n ' 31.27 -0.07927 0.06401\\n',\n ' 9.661 -0.08088 0.2092\\n',\n ' 3.726 0.2947 0.3460\\n',\n ' 1.598 0.5714 0.3731\\n',\n '0 1 1 2.0 1.0\\n',\n ' 0.688 1.0 1.0\\n',\n '0 1 1 0.0 1.0\\n',\n ' 0.28 1.0 1.0\\n',\n '8 4\\n',\n '0 0 8 2.0 1.0\\n',\n ' 8020.0 0.00108\\n',\n ' 1338.0 0.00804\\n',\n ' 255.4 0.05324\\n',\n ' 69.22 0.1681\\n',\n ' 23.90 0.3581\\n',\n ' 9.264 0.3855\\n',\n ' 3.851 0.1468\\n',\n ' 1.212 0.0728\\n',\n '0 1 4 6.0 1.0\\n',\n ' 49.43 -0.00883 0.00958\\n',\n ' 10.47 -0.0915 0.0696\\n',\n ' 3.235 -0.0402 0.2065\\n',\n ' 1.217 0.379 0.347\\n',\n '0 1 1 0.0 1.0\\n',\n ' 0.4764 1.0 1.0\\n',\n '0 1 1 0.0 1.0\\n',\n ' 0.1802 1.0 1.0\\n',\n '99 0\\n',\n 'ENDBS\\n']\nfunc_block = ['DFT\\n', 'B3LYP\\n', 'XXLGRID\\n', 'ENDDFT\\n']\nscf_block = [['TOLINTEG\\n', '7 7 7 7 14\\n'],\n ['SHRINK\\n', '12 24\\n'],\n ['MAXCYCLE\\n', '200\\n'],\n ['FMIXING\\n', '70\\n'],\n 'DIIS\\n',\n 'ENDSCF\\n']\n\n#Write the input object\nmgo_from_blocks = Crystal_input().from_blocks(geom_block,bs_block,func_block,scf_block)\nnew_input_name = 'data/mgo_from_blocks.d12'\nwrite_crystal_input(new_input_name,mgo_from_blocks)",
"_____no_output_____"
],
[
"#Write input for external object (ASE or pymatgen)\n#Start from original inout \nmgo_original_input = Crystal_input().from_file('data/mgo.d12')\n\n#Generate the external object\nfrom pymatgen.core import Structure, Lattice \nfrom pymatgen.symmetry.analyzer import SpacegroupAnalyzer\n\nsubstrate = Structure.from_spacegroup(\"Fm-3m\", Lattice.cubic(4.217), [\"Mg\",\"O\"], [[0, 0, 0],[0.5,0.5,0.5]])\nsubstrate_primitive = SpacegroupAnalyzer(substrate).get_primitive_standard_structure() \n\n#Write the input\nnew_input_name = 'data/mgo_external_obj.d12'\nwrite_crystal_input(new_input_name,crystal_input=mgo_original_input,external_obj=substrate_primitive)",
"_____no_output_____"
]
],
[
[
"### write_cry_properties function",
"_____no_output_____"
],
[
"#### bands from k points coordinates",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import Properties_input\nfrom crystal_functions.file_readwrite import write_properties_input\n\n#Create the bands input object\nbands_input = Properties_input()\n#Add the newk block to the input object\nbands_input.make_newk_block(12,24)\n\n#Prepare the band_block\nk_path = [[0,0,0],[0.5,0,0],[0.5,0.5,0.5],[0.25,0,0.5]]\nn_kpoints = 200\nfirst_band = 1\nlast_band = 26\nbands_input.make_bands_block(k_path,n_kpoints,first_band,last_band)\n\n#Write the input\nwrite_properties_input('data/bands_input_1.d3',bands_input)",
"_____no_output_____"
],
[
"bands_input.property_block",
"_____no_output_____"
]
],
[
[
"#### bands from pymatgen HighSymmKpath object",
"_____no_output_____"
]
],
[
[
"from pymatgen.symmetry.bandstructure import HighSymmKpath\nfrom pymatgen.symmetry.analyzer import SpacegroupAnalyzer\n\nfrom crystal_functions.file_readwrite import write_properties_input\nfrom crystal_functions.file_readwrite import Crystal_output\nfrom crystal_functions.file_readwrite import Properties_input\nfrom crystal_functions.convert import cry_out2pmg\n\n\n#Create the bands input object\nbands_input = Properties_input()\n#Add the newk block to the input object\nbands_input.make_newk_block(12,24)\n\n#Read the structure\nmgo = Crystal_output().read_cry_output('data/mgo.out')\nmgo = cry_out2pmg(mgo)\nmgo_prim = SpacegroupAnalyzer(mgo).get_primitive_standard_structure(international_monoclinic=False)\n\n#Obtain the k path object\nk_path = HighSymmKpath(mgo_prim)\n\nn_kpoints = 200\nfirst_band = 1\nlast_band = 26\nbands_input.make_bands_block(k_path,n_kpoints,first_band,last_band)\n\n#Write the input\nwrite_properties_input('data/bands_input_2.d3',bands_input)",
"_____no_output_____"
],
[
"bands_input.property_block",
"_____no_output_____"
]
],
[
[
"#### doss",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import write_properties_input\nfrom crystal_functions.file_readwrite import Properties_input\n\n#Create the doss input object\ndoss_input = Properties_input()\n#Add the newk block to the input object\ndoss_input.make_newk_block(12,24)\n\n#Prepare the doss_block\n\ndoss_input.make_doss_block(n_points=200,e_range=[-5,15],plotting_option=2,poly=12,print_option=1)\n\n#Write the input\nwrite_properties_input('data/doss_input.d3',doss_input)",
"_____no_output_____"
],
[
"!cat data/doss_input.d3",
"NEWK\r\n12 24\r\n1 0\r\nDOSS\r\n0 200 -1 -1 2 12 1\r\n-0.18374651800348382 0.5512395540104514\r\nEND\r\n"
]
],
[
[
"#### pdoss (atoms)",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import write_properties_input\nfrom crystal_functions.file_readwrite import Properties_input\n\n#Create the doss input object\npdoss_input = Properties_input()\n#Add the newk block to the input object\npdoss_input.make_newk_block(12,24)\n\n#Prepare the pdoss_block\nprojections = [[1],[2]]\npdoss_input.make_pdoss_block(projections,proj_type='atom',n_points=200,band_range=[1,26],\n plotting_option=2,poly=12,print_option=1)\n\n#Write the input\nwrite_properties_input('data/pdoss_input.d3',pdoss_input)",
"_____no_output_____"
],
[
"!cat data/pdoss_input.d3",
"NEWK\r\n12 24\r\n1 0\r\nPDOS\r\n2 200 1 26 2 12 1\r\n-1 1\r\n-1 2\r\nEND\r\n"
]
],
[
[
"#### pdoss (ao)",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import write_properties_input\nfrom crystal_functions.file_readwrite import Properties_input\n\n#Create the doss input object\npdoss_input = Properties_input()\n#Add the newk block to the input object\npdoss_input.make_newk_block(12,24)\n\n#Prepare the pdoss_block\nprojections = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],\n [14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26]]\npdoss_input.make_pdoss_block(projections,proj_type='ao',n_points=200,band_range=[1,26],\n plotting_option=2,poly=12,print_option=1)\n\n#Write the input\nwrite_properties_input('data/pdoss_input_ao.d3',pdoss_input)",
"_____no_output_____"
],
[
"!cat data/pdoss_input_ao.d3",
"NEWK\r\n12 24\r\n1 0\r\nPDOS\r\n2 200 1 26 2 12 1\r\n13 1 2 3 4 5 6 7 8 9 10 11 12 13\r\n13 14 15 16 17 18 19 20 21 22 23 24 25 26\r\nEND\r\n"
]
],
[
[
"### write_cry_gui function",
"_____no_output_____"
],
[
"#### from pymatgen structure",
"_____no_output_____"
],
[
"#### bulk (3D)",
"_____no_output_____"
]
],
[
[
"from crystal_functions.file_readwrite import Crystal_gui, write_crystal_gui\nfrom crystal_functions.convert import cry_pmg2gui\n\nfrom pymatgen.core import Structure, Lattice\n\n#Generate bulk structure\nsubstrate = Structure.from_spacegroup(\"Fm-3m\", Lattice.cubic(4.217), [\"Mg\",'O'], [[0, 0, 0],[0.5,0.5,0.5]])\n\n#The dimensionality parameter is optional. The function will recognise it is a pymatgen bulk object\n#Create the gui object by converting the pymatgen structure\nmgo_gui = cry_pmg2gui(substrate,dimensionality=2)\n\nwrite_crystal_gui('data/mgo_write_gui.gui',mgo_gui)",
"_____no_output_____"
],
[
"! cat data/mgo_write_gui.gui",
"2 1 1\r\n4.217 0.0 0.0\r\n0.0 4.217 0.0\r\n0.0 0.0 500.0\r\n32\r\n1.0 0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n0.0 1.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n0.0 1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 0.0 -1.0\r\n0.0 2.1085 0.0\r\n0.0 1.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 0.0 -1.0\r\n0.0 2.1085 0.0\r\n1.0 0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 -1.0\r\n0.0 2.1085 0.0\r\n0.0 -1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 -1.0\r\n0.0 2.1085 0.0\r\n1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 0.0 -1.0\r\n0.0 2.1085 0.0\r\n0.0 -1.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 0.0 -1.0\r\n0.0 2.1085 0.0\r\n-1.0 0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 -1.0\r\n0.0 2.1085 0.0\r\n0.0 1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 -1.0\r\n0.0 2.1085 0.0\r\n-1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 0.0 -1.0\r\n2.1085 0.0 0.0\r\n0.0 1.0 0.0\r\n-1.0 0.0 0.0\r\r\n0.0 0.0 -1.0\r\n2.1085 0.0 0.0\r\n1.0 0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 -1.0\r\n2.1085 0.0 0.0\r\n0.0 -1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 -1.0\r\n2.1085 0.0 0.0\r\n1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 0.0 -1.0\r\n2.1085 0.0 0.0\r\n0.0 -1.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 0.0 -1.0\r\n2.1085 0.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 -1.0\r\n2.1085 0.0 0.0\r\n0.0 1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 -1.0\r\n2.1085 0.0 0.0\r\n1.0 0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 1.0\r\n2.1085 2.1085 0.0\r\n0.0 -1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n2.1085 2.1085 0.0\r\n-1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 0.0 1.0\r\n2.1085 2.1085 0.0\r\n0.0 1.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n2.1085 2.1085 0.0\r\n-1.0 0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 1.0\r\n2.1085 2.1085 0.0\r\n0.0 1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n2.1085 2.1085 0.0\r\n1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 0.0 1.0\r\n2.1085 2.1085 0.0\r\n0.0 -1.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n2.1085 2.1085 0.0\r\n8\r\n12 0.0 0.0 -1.05425\r\n12 2.1085 2.1085 -1.05425\r\n12 2.1085 0.0 1.05425\r\n12 0.0 2.1085 1.05425\r\n8 2.1085 2.1085 1.05425\r\n8 0.0 0.0 1.05425\r\n8 0.0 2.1085 -1.05425\r\n8 2.1085 0.0 -1.05425\r\n225 32"
]
],
[
[
"#### slab (2D)",
"_____no_output_____"
]
],
[
[
"import sys\nsys.path.insert(1,'../crystal_functions/')\nfrom file_readwrite import *\nfrom convert import *",
"_____no_output_____"
],
[
"#from crystal_functions.file_readwrite import write_crystal_gui\n\nfrom pymatgen.core import Structure, Lattice\nfrom pymatgen.core.surface import SlabGenerator\n\n#Generate bulk structure\nsubstrate = Structure.from_spacegroup(\"Fm-3m\", Lattice.cubic(4.217), [\"Mg\",'O'], [[0, 0, 0],[0.5,0.5,0.5]])\n#Generate slab\nsubstrate = SlabGenerator(substrate, (1,0,0), 5., 10., center_slab=True).get_slab()\n\n#The dimensionality parameter is optional. \nmgo_slab_gui = cry_pmg2gui(substrate, dimensionality=2)\n\nwrite_crystal_gui('data/mgo_100_write_gui.gui',mgo_slab_gui)",
"_____no_output_____"
],
[
"! cat data/mgo_100_write_gui.gui",
"2 1 1\r\n2.9818692962636706 0.0 1.8258683445725374e-16\r\n-1.8258683445725374e-16 2.9818692962636706 1.8258683445725374e-16\r\n0.0 0.0 500.0\r\n8\r\n1.0 -0.0 0.0\r\n0.0 1.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n-0.0 -1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 -0.0 1.0\r\n0.0 0.0 0.0\r\n-1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n-0.0 -0.0 1.0\r\n0.0 0.0 0.0\r\n0.0 1.0 0.0\r\n-1.0 -0.0 0.0\r\n-0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n-1.0 -0.0 0.0\r\n0.0 1.0 0.0\r\n-0.0 -0.0 1.0\r\n0.0 0.0 0.0\r\n-0.0 1.0 0.0\r\n1.0 0.0 0.0\r\n0.0 0.0 1.0\r\n0.0 0.0 0.0\r\n1.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n0.0 -0.0 1.0\r\n0.0 0.0 0.0\r\n0.0 -1.0 0.0\r\n-1.0 -0.0 0.0\r\n-0.0 -0.0 1.0\r\n0.0 0.0 0.0\r\n8\r\n12 0.0 0.0 3.16275\r\n12 1.4909346481318353 1.4909346481318353 1.054250000000001\r\n12 0.0 0.0 -1.0542500000000008\r\n12 1.4909346481318353 1.4909346481318353 -3.16275\r\n8 0.0 0.0 1.0542500000000008\r\n8 1.4909346481318353 1.4909346481318353 3.1627500000000004\r\n8 0.0 0.0 -3.16275\r\n8 1.4909346481318353 1.4909346481318353 -1.0542500000000006\r\n129 8"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
] |
d0cba2343ad9715653e4da231bb244ab6d5cebc4 | 47,696 | ipynb | Jupyter Notebook | notebooks/benchmark/text/Text Emotion Multiclass Classification Benchmark Demo.ipynb | afzalmushtaque/shap | 46b3800b31df04745416da27c71b216f91d61775 | [
"MIT"
] | 16,097 | 2016-12-01T20:01:26.000Z | 2022-03-31T20:27:40.000Z | notebooks/benchmark/text/Text Emotion Multiclass Classification Benchmark Demo.ipynb | afzalmushtaque/shap | 46b3800b31df04745416da27c71b216f91d61775 | [
"MIT"
] | 2,217 | 2017-09-18T20:06:45.000Z | 2022-03-31T21:00:25.000Z | notebooks/benchmark/text/Text Emotion Multiclass Classification Benchmark Demo.ipynb | afzalmushtaque/shap | 46b3800b31df04745416da27c71b216f91d61775 | [
"MIT"
] | 2,634 | 2017-06-29T21:30:46.000Z | 2022-03-30T07:30:36.000Z | 64.980926 | 15,344 | 0.7895 | [
[
[
"# Text Data Explanation Benchmarking: Emotion Multiclass Classification",
"_____no_output_____"
],
[
"This notebook demonstrates how to use the benchmark utility to benchmark the performance of an explainer for text data. In this demo, we showcase explanation performance for partition explainer on an Emotion Multiclass Classification model. The metrics used to evaluate are \"keep positive\" and \"keep negative\". The masker used is Text Masker.\n\nThe new benchmark utility uses the new API with MaskedModel as wrapper around user-imported model and evaluates masked values of inputs.",
"_____no_output_____"
]
],
[
[
"import copy\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom transformers import AutoTokenizer, AutoModelForSequenceClassification\nimport shap.benchmark as benchmark\nimport shap\nimport scipy as sp\nimport nlp\nimport torch\n\npd.set_option('display.max_columns', None)\npd.set_option('display.max_rows', None)\npd.set_option('max_colwidth', None)",
"_____no_output_____"
]
],
[
[
"### Load Data and Model",
"_____no_output_____"
]
],
[
[
"train, test = nlp.load_dataset(\"emotion\", split = [\"train\", \"test\"])\n\ndata={'text':train['text'],\n 'emotion':train['label']}\n \ndata = pd.DataFrame(data)",
"Using custom data configuration default\n"
],
[
"tokenizer = AutoTokenizer.from_pretrained(\"nateraw/bert-base-uncased-emotion\",use_fast=True)\nmodel = AutoModelForSequenceClassification.from_pretrained(\"nateraw/bert-base-uncased-emotion\")",
"_____no_output_____"
]
],
[
[
"### Class Label Mapping",
"_____no_output_____"
]
],
[
[
"# set mapping between label and id\nid2label = model.config.id2label\nlabel2id = model.config.label2id\nlabels = sorted(label2id, key=label2id.get)",
"_____no_output_____"
]
],
[
[
"### Define Score Function",
"_____no_output_____"
]
],
[
[
"def f(x):\n tv = torch.tensor([tokenizer.encode(v, padding='max_length', max_length=128,truncation=True) for v in x])\n attention_mask = (tv!=0).type(torch.int64)\n outputs = model(tv,attention_mask=attention_mask)[0].detach().numpy()\n scores = (np.exp(outputs).T / np.exp(outputs).sum(-1)).T\n val = sp.special.logit(scores) \n return val",
"_____no_output_____"
]
],
[
[
"### Create Explainer Object",
"_____no_output_____"
]
],
[
[
"explainer = shap.Explainer(f,tokenizer,output_names=labels)",
"explainers.Partition is still in an alpha state, so use with caution...\n"
]
],
[
[
"### Run SHAP Explanation",
"_____no_output_____"
]
],
[
[
"shap_values = explainer(data['text'][0:20])",
"_____no_output_____"
]
],
[
[
"### Define Metrics (Sort Order & Perturbation Method)",
"_____no_output_____"
]
],
[
[
"sort_order = 'positive'\nperturbation = 'keep'",
"_____no_output_____"
]
],
[
[
"### Benchmark Explainer",
"_____no_output_____"
]
],
[
[
"sequential_perturbation = benchmark.perturbation.SequentialPerturbation(explainer.model, explainer.masker, sort_order, perturbation)\nxs, ys, auc = sequential_perturbation.model_score(shap_values, data['text'][0:20])\nsequential_perturbation.plot(xs, ys, auc)",
"_____no_output_____"
],
[
"sort_order = 'negative'\nperturbation = 'keep'",
"_____no_output_____"
],
[
"sequential_perturbation = benchmark.perturbation.SequentialPerturbation(explainer.model, explainer.masker, sort_order, perturbation)\nxs, ys, auc = sequential_perturbation.model_score(shap_values, data['text'][0:20])\nsequential_perturbation.plot(xs, ys, auc)",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
] |
d0cbacb76804b72d3f29e2b4e4e8fa3e2536ab93 | 8,539 | ipynb | Jupyter Notebook | datasets/Part_4_Self_Organizing_Maps_SOM/som_theory.ipynb | dasafo/deeplearning-az | 853999082a63c965c4ea63970ee9bd787cb19c75 | [
"CC0-1.0"
] | null | null | null | datasets/Part_4_Self_Organizing_Maps_SOM/som_theory.ipynb | dasafo/deeplearning-az | 853999082a63c965c4ea63970ee9bd787cb19c75 | [
"CC0-1.0"
] | null | null | null | datasets/Part_4_Self_Organizing_Maps_SOM/som_theory.ipynb | dasafo/deeplearning-az | 853999082a63c965c4ea63970ee9bd787cb19c75 | [
"CC0-1.0"
] | null | null | null | 37.951111 | 574 | 0.635437 | [
[
[
"# Mapas Autorganizados (SOM)",
"_____no_output_____"
],
[
"<img src=\"../img/som_1.jpg\" width=\"500\">",
"_____no_output_____"
],
[
"Se toma un conjunto de datos multidimensional los cuales se pueden mostrar como un mapa bidimensional. El objetivo del **SOM** es reducir las columnas y quedarnos solo con las que nos aporten más info. O lo que es lo mismo, reducir lo máximo la dimensión de la entrada de datos.",
"_____no_output_____"
],
[
"## Ejemplo",
"_____no_output_____"
],
[
"<img src=\"../img/som_2.jpg\" heigh=\"700\">",
"_____no_output_____"
],
[
"En el mapa **SOM** central nos indica la prosperidad o pobreza de los paises agrupados en colores, usando como inputs varios datos de éstos.",
"_____no_output_____"
],
[
"## Cómo aprenden los SOM:",
"_____no_output_____"
],
[
"Abajo podemos ver 3 columnas de datos de entrada ($X_{1},X_{2},X_{3}$) convertido en un **SOM** en 2-D.",
"_____no_output_____"
],
[
"<img src=\"../img/som_3.jpg\" width=\"400\">",
"_____no_output_____"
],
[
"Abajo tenemos la misma red neuronal pero puesto los nodos de salida en una sola columna. Cada Nodo le llegan 3 sinapsis-enlace de los nodos de entrada, cada nodo tiene un peso asociado para cada enlace $W_{i,j}$.\n\nEn las redes neurnales artificiales los pesos se usaban para multiplicar la entrada del peso de ese nodo para luego sumarlo, agruparlo o lo que fuese en la neurona final y aplicarle una función de activación, en cambio en los mapas autorganizados **SOM** no hay función de activación, los pesos son una característica del propio nodo y por lo tanto dichos pesos no se colocan en las sinápsis sino en el propio nodo (ahora los nodos tienen una serie de coordenadas dados por los pesos).",
"_____no_output_____"
],
[
"<img src=\"../img/som_4.jpg\" width=\"700\">",
"_____no_output_____"
],
[
"El objetivo es descubrir el nodo que más cercano está a cada uno de los nodos de entrada, para ello calculamos su distancia (por ejmplo la Euclidea). En el caso de arriba observamos que el nodo3 es el más cercano.",
"_____no_output_____"
],
[
"<img src=\"../img/som_6.jpg\" width=\"500\">",
"_____no_output_____"
],
[
"<img src=\"../img/som_5.jpg\" width=\"500\">",
"_____no_output_____"
],
[
"Si pasamos los nodos a un plano bidimensional y si nos imaginamos que el nodo verde (figura **1**) es el nodo más cercano a las variables input $X_j$, lo que pasará después es que el **SOM** actualizará los pesos para que cada uno de ellos distribuya a las observaciones.\n\nSi nos fijamos en el dibujo inferior, lo que vemos en términos visuales descrito arriba es que el punto más cercano \"estirará\" del mapa hasta él para que se acerque todavía más en las siguientes iteraciones. En definitiva, para cada uno de los nodos, va a intentar cambiar las coordenadas(pesos) de dicho nodos para que cada vez se parezcan más a las observaciones.\n\nA continuación lo que se hará será tomar del punto en cuestión(nodo verde en **1**) un radio que hará que los nodos que se encuentren dentro de esta zona amarilla se actualizarán sus coordenadas-pesos, siendo los nodos más cercanos al verde los que más se actualicen y viceversa.\n\nLuego se procederá igual, por ejemplo con el nodo azúl que se parezca más a las variables de entrada (ver **2**), con su propio radio de actuación y hará lo mismo. En el momento que un nodo entra en conflicto con el azúl o el verde, obviamente será atraído más por el nodo más cercano (nos fijamos en la figura **3**). Si nos fijamos en la figura **4** vemos que para un nodo intermedio entre el azúl y verde, al estar en medio tenría un color intermedio, el turquesa. Y para los que están cerca del verde tendrían un colo casi verde del todo, con muy poco de azúl.\n\nObteniendo así finalmente un mapa de colores.",
"_____no_output_____"
],
[
"<img src=\"../img/som_7.jpg\" width=\"400\">",
"_____no_output_____"
],
[
"<img src=\"../img/som_8.jpg\" width=\"400\">",
"_____no_output_____"
],
[
"Si tenemos más unidades de mayor coincidencia con las variables de entrada pasará lo mismo obteniendo el mapa de color.\n\nEn cada iteración (epoch) los radios de acción amarillos se irán haciendo más pequeños. EL proceso se vuelve más y más preciso.",
"_____no_output_____"
],
[
"## Importante recordar:\n- Los SOMs retienen la topología del conjunto de entrada.\n- Los SOMs revelan correlaciones que no se identifican fácilmente.\n- Los SOMs clasifican datos sin supervisión alguna.\n- No hay vector de variable target -> no hay propagación hacia atrás.\n- No hay conexiones laterales entre los nodos.",
"_____no_output_____"
],
[
"[Ejemplo de SOM](http://ai-junkie.com/ann/som/som1.html) con programa descargable *.exe*",
"_____no_output_____"
],
[
"## Cómo leer un mapa autorganizado SOM avanzado:\n\nEjemplo de SOM de patrones en el voto de 535 senadores nortaméricanos\n<img src=\"../img/som_9.jpg\" width=\"600\">",
"_____no_output_____"
],
[
"# Pasos para entrenar un SOM:\n\n- <span style='color:#288c17'> <b>PASO 1:</span> Empezamos con un dataset compuesto de *n_features* variables independientes.\n\n- <span style='color:#288c17'> <b>PASO 2:</span> Preparamos una parrilla compuesta de nodos, cada uno con un vector de pesos de *n_features* elementos.\n\n- <span style='color:#288c17'> <b>PASO 3:</span> Aleatoriamente inicializamos valores del vector de pesos a números pequeños cercanos a $0$ (pero no $0$).\n\n- <span style='color:#288c17'> <b>PASO 4:</span> Seleccionar una observación aleatoria del dataser.\n\n- <span style='color:#288c17'> <b>PASO 5:</span> Calcular la distancia Euclídea desde dicho puntos a las diferentes neuronas de la red.\n\n- <span style='color:#288c17'> <b>PASO 6:</span> Seleccionar la neurona con la menor distancia al punto. Dicha neurona es el nodo ganador.\n\n- <span style='color:#288c17'> <b>PASO 7:</span> Actualizar lso epsos del nodo ganador para moverlo más cerca dle punto.\n\n- <span style='color:#288c17'> <b>PASO 8:</span> Utilizar una función Gaussiana al vecindario del punto de medie el nodo ganador y actualizar los pesos de los vecinos para moverlos más cerca del punto. El radio de los vecinos afectados es la desviación típica de la Gaussiana.\n\n- <span style='color:#288c17'> <b>PASO 9:</span> Repetir los pasos <span style='color:#288c17'> <b>1</span> a <span style='color:#288c17'> <b>5</span> y actualizar los pesos después de cada observación (*Reinforcement Learning*) o después de un conjunto de observaciones (*Batch Learning*), hasta que la red neuronal converja en un punto donde los vecindarios no cambien.",
"_____no_output_____"
]
]
] | [
"markdown"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
]
] |
d0cbae1ba077218f2cd3f174336e3bbcbb38b310 | 2,580 | ipynb | Jupyter Notebook | 8-Labs/Lab30/Lab30.ipynb | dustykat/engr-1330-psuedo-course | 3e7e31a32a1896fcb1fd82b573daa5248e465a36 | [
"CC0-1.0"
] | null | null | null | 8-Labs/Lab30/Lab30.ipynb | dustykat/engr-1330-psuedo-course | 3e7e31a32a1896fcb1fd82b573daa5248e465a36 | [
"CC0-1.0"
] | null | null | null | 8-Labs/Lab30/Lab30.ipynb | dustykat/engr-1330-psuedo-course | 3e7e31a32a1896fcb1fd82b573daa5248e465a36 | [
"CC0-1.0"
] | null | null | null | 24.339623 | 163 | 0.542248 | [
[
[
"**Download** (right-click, save target as ...) this page as a jupyterlab notebook [Lab 30](http://54.243.252.9/engr-1330-webroot/8-Labs/Lab30/Lab30.ipynb)\n\n___",
"_____no_output_____"
],
[
"# <font color=darkblue>Laboratory 30: Logarithmic and Power-Law Models </font>\n\nLAST NAME, FIRST NAME\n\nR00000000\n\nENGR 1330 Laboratory 30 - In Lab\n\n___\n",
"_____no_output_____"
],
[
"## Background\n\nThe last couple lessons contain the needed logic, so just apply to the problem below\n\n## Exercise 1\n\nUsing methods in the lesson, fit an appropriate data model to the voltage versus time data below. Use the data model to determine\n\n1. What voltage do you expect after 1.5 seconds?\n2. What voltage do you expect after 15.0 seconds?\n3. How long will it take for the voltage to decline to 1.5 volts?\n4. How long will it take for the voltage to decline to 0.17 volts?\n\n|Time(sec)|Voltage(V)|\n|---:|---:|\n|0|9.8|\n|1|5.9|\n|2|3.9|\n|3|2.1|\n|4|1.0|\n|5|0.8|\n|6|0.6|\n|7|0.4|\n|8|0.3|\n|9|0.2|\n|10|0.1|\n",
"_____no_output_____"
]
],
[
[
"# Load the necessary packages\n# build the data lists\n# build a dataframe\n# Initialise and fit regression model using `statsmodels`\n# Predict values\n# Plot regression against actual data\n# Is the model \"good\" if not try a different data model (linear,exponential,power law,logarithmic,polynomial)\n\n# with your \"good\" model answer the questions",
"_____no_output_____"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown",
"markdown",
"markdown"
],
[
"code"
]
] |
d0cbb0bab853c7e6af04685aa5d7497c2f2265ce | 704,755 | ipynb | Jupyter Notebook | notebooks/trial/MNIST.ipynb | vafaei-ar/pymce | c01197b74fb515a0d6e400310c4d5c0ffad0f3c9 | [
"BSD-3-Clause"
] | 16 | 2019-09-11T12:53:15.000Z | 2021-12-09T12:07:51.000Z | notebooks/trial/MNIST.ipynb | vafaei-ar/pymce | c01197b74fb515a0d6e400310c4d5c0ffad0f3c9 | [
"BSD-3-Clause"
] | null | null | null | notebooks/trial/MNIST.ipynb | vafaei-ar/pymce | c01197b74fb515a0d6e400310c4d5c0ffad0f3c9 | [
"BSD-3-Clause"
] | 3 | 2019-12-12T08:55:44.000Z | 2021-08-23T04:37:53.000Z | 781.324834 | 82,568 | 0.946536 | [
[
[
"# Unsupervised outliers detection (event detection)",
"_____no_output_____"
]
],
[
[
"import drama as drm\nimport numpy as np\nimport matplotlib.pylab as plt\nfrom matplotlib import gridspec\n\nfrom drama.outlier_finder import grid_run_drama\n\nfrom keras.datasets import mnist\n\n%matplotlib inline\n\nn_try = 5",
"Using TensorFlow backend.\n"
],
[
"# MNIST dataset\n(x_train, y_train), (x_test, y_test) = mnist.load_data()\n\nimage_size = x_train.shape[1]\nx_train = x_train.astype('float32') / 255\nx_test = x_test.astype('float32') / 255\nprint(x_train.shape, y_train.shape, x_test.shape, y_test.shape)",
"(60000, 28, 28) (60000,) (10000, 28, 28) (10000,)\n"
],
[
"inlier_labels = [2,3,4,6,8]\noutlier_labels = [5,0]\nn_inliers = 500\nn_outliers = 10\n\nX = []\ny = []\nfor i in inlier_labels:\n filt = y_train==i\n ns = np.sum(filt)\n X.extend(x_train[filt][:n_inliers])\n y.extend(n_inliers*[0])\n \nfor i in outlier_labels:\n filt = y_train==i\n ns = np.sum(filt)\n X.extend(x_train[filt][:n_outliers])\n y.extend(n_outliers*[1])\n \nX = np.array(X)\ny = np.array(y)",
"_____no_output_____"
],
[
"X.shape,y.shape",
"_____no_output_____"
],
[
"X = np.reshape(X, [-1, image_size*image_size])",
"_____no_output_____"
],
[
"lof_all = np.zeros((n_try,3))\nifr_all = np.zeros((n_try,3))\ndf = drm.sk_check(X.reshape(-1,784),X.reshape(-1,784),y,[1])\nfor i in range(n_try):\n for j,scr in enumerate(['AUC','MCC','RWS']):\n lof_all[i,j] = df[scr][0]\n ifr_all[i,j] = df[scr][1]",
"/home/gf/packages/anaconda3/lib/python3.6/site-packages/sklearn/ensemble/iforest.py:223: FutureWarning: behaviour=\"old\" is deprecated and will be removed in version 0.22. Please use behaviour=\"new\", which makes the decision_function change to match other anomaly detection algorithm API.\n FutureWarning)\n"
],
[
"df",
"_____no_output_____"
]
],
[
[
"# Outlier detection",
"_____no_output_____"
]
],
[
[
"metrics = ['cityblock', 'L2', 'L4', 'braycurtis', 'canberra', 'chebyshev',\n 'correlation', 'mahalanobis', 'wL2', 'wL4']\ndrt_list = ['DAE1D', 'DVAE1D']\n\nresult = []\nfor i in range(n_try):\n# auc,mcc,rws,conf = grid_run_drama(X,y)\n auc,mcc,rws,conf = grid_run_drama(X,y,\n drt_list=drt_list,\n metrics=metrics,\n n_split=2)\n \n arr = np.stack([auc,mcc,rws],axis=-1)\n result.append(arr)\nresult = np.array(result)\n\ndrts = np.unique(conf[:,1])\nmetrs = np.unique(conf[:,2])\n\nres = result.reshape(n_try,len(drt_list),len(metrics),-1)\n\ndrm.plot_table(np.mean(res,axis=0),drts,metrs)\n\nauc = np.sum((res[:, :, :, 0].T>lof_all[:, 0]) & (res[:, :, :, 0].T>ifr_all[:, 0]),axis=-1).T\nmcc = np.sum((res[:, :, :, 1].T>lof_all[:, 1]) & (res[:, :, :, 1].T>ifr_all[:, 1]),axis=-1).T\nrws = np.sum((res[:, :, :, 2].T>lof_all[:, 2]) & (res[:, :, :, 2].T>ifr_all[:, 2]),axis=-1).T\n\nfig = plt.figure(figsize=(20,10))\nplt.clf()\nax = fig.add_subplot(111)\nax.set_aspect('auto')\nax.imshow(auc, cmap=plt.cm.jet,interpolation='nearest')\n\nwidth, height = auc.shape\n\nfor x in range(width):\n for y in range(height):\n ax.annotate('AUC: {:d}\\n MCC: {:d}\\n RWS: {:d}'.format(auc[x][y],mcc[x][y],rws[x][y]), xy=(y, x), \n horizontalalignment='center',\n verticalalignment='center',fontsize=18);\n\nplt.xticks(range(len(metrs)),metrs,fontsize=15)\nplt.yticks(range(len(drts)), drts,fontsize=15)\n\nplt.title('Number of successes (LOF and i-forest) out of 20 data set',fontsize=25)\nplt.annotate('** Colors depend on AUC.', (0,0), (0, -30), xycoords='axes fraction',\n textcoords='offset points', va='top',fontsize=15)\n\n# plt.savefig('AND_success.jpg',dpi=150,bbox_inches='tight')",
"Unsupervised outlier detection mode.\n"
],
[
"inlier_labels = [1,2,3,4]\noutlier_labels = [5]\nn_inliers = 1000\nn_outliers = 30\n\nX = []\ny = []\nfor i in inlier_labels:\n filt = y_train==i\n ns = np.sum(filt)\n X.extend(x_train[filt][:n_inliers])\n y.extend(n_inliers*[0])\n \nfor i in outlier_labels:\n filt = y_train==i\n ns = np.sum(filt)\n X.extend(x_train[filt][:n_outliers])\n y.extend(n_outliers*[1])\n \nX = np.array(X)\ny = np.array(y)\nX = np.reshape(X, [-1, image_size*image_size, 1])",
"_____no_output_____"
],
[
"metrics = ['cityblock', 'L2', 'L4', 'braycurtis', 'canberra', 'chebyshev',\n 'correlation', 'mahalanobis', 'wL2', 'wL4']\ndrt_list = ['CAE1D', 'CVAE1D']\n\nresult = []\nfor i in range(n_try):\n# auc,mcc,rws,conf = grid_run_drama(X,y)\n auc,mcc,rws,conf = grid_run_drama(X,y,\n drt_list=drt_list,\n metrics=metrics,\n n_split=2)\n \n arr = np.stack([auc,mcc,rws],axis=-1)\n result.append(arr)\nresult = np.array(result)\n\ndrts = np.unique(conf[:,1])\nmetrs = np.unique(conf[:,2])\n\nres = result.reshape(n_try,len(drt_list),len(metrics),-1)\n\ndrm.plot_table(np.mean(res,axis=0),drts,metrs)\n\nauc = np.sum((res[:, :, :, 0].T>lof_all[:, 0]) & (res[:, :, :, 0].T>ifr_all[:, 0]),axis=-1).T\nmcc = np.sum((res[:, :, :, 1].T>lof_all[:, 1]) & (res[:, :, :, 1].T>ifr_all[:, 1]),axis=-1).T\nrws = np.sum((res[:, :, :, 2].T>lof_all[:, 2]) & (res[:, :, :, 2].T>ifr_all[:, 2]),axis=-1).T\n\nfig = plt.figure(figsize=(20,10))\nplt.clf()\nax = fig.add_subplot(111)\nax.set_aspect('auto')\nax.imshow(auc, cmap=plt.cm.jet,interpolation='nearest')\n\nwidth, height = auc.shape\n\nfor x in range(width):\n for y in range(height):\n ax.annotate('AUC: {:d}\\n MCC: {:d}\\n RWS: {:d}'.format(auc[x][y],mcc[x][y],rws[x][y]), xy=(y, x), \n horizontalalignment='center',\n verticalalignment='center',fontsize=18);\n\nplt.xticks(range(len(metrs)),metrs,fontsize=15)\nplt.yticks(range(len(drts)), drts,fontsize=15)\n\nplt.title('Number of successes (LOF and i-forest) out of 20 data set',fontsize=25)\nplt.annotate('** Colors depend on AUC.', (0,0), (0, -30), xycoords='axes fraction',\n textcoords='offset points', va='top',fontsize=15)\n\n# plt.savefig('AND_success.jpg',dpi=150,bbox_inches='tight')",
"Unsupervised outlier detection mode.\n"
],
[
"inlier_labels = [1,2,3,4]\noutlier_labels = [5]\nn_inliers = 1000\nn_outliers = 30\n\nX = []\ny = []\nfor i in inlier_labels:\n filt = y_train==i\n ns = np.sum(filt)\n X.extend(x_train[filt][:n_inliers])\n y.extend(n_inliers*[0])\n \nfor i in outlier_labels:\n filt = y_train==i\n ns = np.sum(filt)\n X.extend(x_train[filt][:n_outliers])\n y.extend(n_outliers*[1])\n \nX = np.array(X)\ny = np.array(y)\nX = np.reshape(X, [-1, image_size, image_size, 1])",
"_____no_output_____"
],
[
"metrics = ['cityblock', 'L2', 'L4', 'braycurtis', 'canberra', 'chebyshev',\n 'correlation', 'mahalanobis', 'wL2', 'wL4']\ndrt_list = ['CAE2D', 'CVAE2D']\n\nresult = []\nfor i in range(n_try):\n# auc,mcc,rws,conf = grid_run_drama(X,y)\n auc,mcc,rws,conf = grid_run_drama(X,y,\n drt_list=drt_list,\n metrics=metrics,\n n_split=2)\n \n arr = np.stack([auc,mcc,rws],axis=-1)\n result.append(arr)\nresult = np.array(result)\n\ndrts = np.unique(conf[:,1])\nmetrs = np.unique(conf[:,2])\n\nres = result.reshape(n_try,len(drt_list),len(metrics),-1)\n\ndrm.plot_table(np.mean(res,axis=0),drts,metrs)\n\nauc = np.sum((res[:, :, :, 0].T>lof_all[:, 0]) & (res[:, :, :, 0].T>ifr_all[:, 0]),axis=-1).T\nmcc = np.sum((res[:, :, :, 1].T>lof_all[:, 1]) & (res[:, :, :, 1].T>ifr_all[:, 1]),axis=-1).T\nrws = np.sum((res[:, :, :, 2].T>lof_all[:, 2]) & (res[:, :, :, 2].T>ifr_all[:, 2]),axis=-1).T\n\nfig = plt.figure(figsize=(20,10))\nplt.clf()\nax = fig.add_subplot(111)\nax.set_aspect('auto')\nax.imshow(auc, cmap=plt.cm.jet,interpolation='nearest')\n\nwidth, height = auc.shape\n\nfor x in range(width):\n for y in range(height):\n ax.annotate('AUC: {:d}\\n MCC: {:d}\\n RWS: {:d}'.format(auc[x][y],mcc[x][y],rws[x][y]), xy=(y, x), \n horizontalalignment='center',\n verticalalignment='center',fontsize=18);\n\nplt.xticks(range(len(metrs)),metrs,fontsize=15)\nplt.yticks(range(len(drts)), drts,fontsize=15)\n\nplt.title('Number of successes (LOF and i-forest) out of 20 data set',fontsize=25)\nplt.annotate('** Colors depend on AUC.', (0,0), (0, -30), xycoords='axes fraction',\n textcoords='offset points', va='top',fontsize=15)\n\n# plt.savefig('AND_success.jpg',dpi=150,bbox_inches='tight')",
"Unsupervised outlier detection mode.\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
]
] |
d0cbb79fa62eeecc506b08d83c53bb404e2ededa | 10,984 | ipynb | Jupyter Notebook | datacamp_ml/ml_trees/ensemble_learning.ipynb | issagaliyeva/machine_learning | 63f4d39a95147cdac4ef760cb47dffc318793a99 | [
"MIT"
] | null | null | null | datacamp_ml/ml_trees/ensemble_learning.ipynb | issagaliyeva/machine_learning | 63f4d39a95147cdac4ef760cb47dffc318793a99 | [
"MIT"
] | null | null | null | datacamp_ml/ml_trees/ensemble_learning.ipynb | issagaliyeva/machine_learning | 63f4d39a95147cdac4ef760cb47dffc318793a99 | [
"MIT"
] | null | null | null | 32.984985 | 99 | 0.452658 | [
[
[
"# Ensemble Learning\n### Advantages of CARTs\n- simple to understand, interpret, and use\n- flexibility: ability to describe non-linear dependencies\n- preprocessing: no need to standardize or normalize features\n\n### Limitations of CARTS\n- classification: can only produce orthogonal decision boundaries\n- sensitive to small variations in the training set\n- high variance: unconstrained CARTs may overfit the training set\n\n### Solution: Ensemble learning\n<b>STEPS:</b>\n- train different models on the same dataset\n- let each model make its predictions\n- meta-model: aggregates predictions of individual models\n- final prediction: more robust and less prone to errors\n\n<img src='images/ensemble_learning.png'>\n<img src='images/hard_voting.png'>",
"_____no_output_____"
]
],
[
[
"# import the packages\nimport numpy as np\nimport pandas as pd\nimport seaborn as sns\nimport matplotlib.pyplot as plt\n\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn.neighbors import KNeighborsClassifier\nfrom sklearn.ensemble import VotingClassifier\n\nfrom sklearn.model_selection import train_test_split, cross_val_score\nfrom sklearn.metrics import accuracy_score\nfrom sklearn.datasets import load_breast_cancer\n\nsns.set()\n%matplotlib inline",
"_____no_output_____"
],
[
"# voting classifier\ndata = load_breast_cancer()\nbreast_cancer = pd.DataFrame(data.data, columns=data.feature_names)\nbreast_cancer.head(3)",
"_____no_output_____"
],
[
"X, y = breast_cancer, data.target\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, stratify=y)",
"_____no_output_____"
],
[
"# instantiate individual classifiers\nlogreg = LogisticRegression()\nknn = KNeighborsClassifier()\ndt = DecisionTreeClassifier()\n\nclassifiers = [\n ('Logistic Regression', logreg),\n ('K Nearest Neighbors', knn),\n ('Classification Tree', dt)\n]\n\n# iterate over the defined list of tuples containing the classifiers\nfor clf_name, clf in classifiers:\n # fit the model \n clf.fit(X_train, y_train)\n \n # predict the labels of the test set\n y_pred = clf.predict(X_test)\n \n # print the accuracy score \n print(f'Accuracy score of {clf_name}: {round(accuracy_score(y_test, y_pred), 3)}')\n",
"Accuracy score of Logistic Regression: 0.942\nAccuracy score of K Nearest Neighbors: 0.918\nAccuracy score of Classification Tree: 0.93\n"
],
[
"# instantiate a voting classifier\nvoting_clf = VotingClassifier(estimators=classifiers)\n\n# fit the training set and predict the test set\nvoting_clf.fit(X_train, y_train)\ny_pred = voting_clf.predict(X_test)\n\n# show the results\nprint(f'Accuracy score of the Voting Classifier: {round(accuracy_score(y_test, y_pred), 3)}')",
"Accuracy score of the Voting Classifier: 0.942\n"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
]
] |
d0cbc3aa65f6b9119f338760c7500d6d48ae625a | 7,489 | ipynb | Jupyter Notebook | book/tools-for-mathematics/07-sequences/why/.main.md.bcp.ipynb | daffidwilde/pfm | dcf38faccee3c212c8394c36f4c093a2916d283e | [
"MIT"
] | null | null | null | book/tools-for-mathematics/07-sequences/why/.main.md.bcp.ipynb | daffidwilde/pfm | dcf38faccee3c212c8394c36f4c093a2916d283e | [
"MIT"
] | null | null | null | book/tools-for-mathematics/07-sequences/why/.main.md.bcp.ipynb | daffidwilde/pfm | dcf38faccee3c212c8394c36f4c093a2916d283e | [
"MIT"
] | null | null | null | 22.832317 | 89 | 0.500601 | [
[
[
"# Further information\n\n## What are the differences between recursion and iteration?\n\nWhen giving instructions to a computer it is possible to use recursion to\ndirectly implement a common mathematical definition. For example consider the\nfollowing sequence:\n\n$$\n \\left\\{\\begin{array}{l}\n a_1 = 1\\\\\n a_{n + 1}= 3a_n, n > 1\n \\end{array}\\right.\n$$\n\nWe can define this in Python as follows:",
"_____no_output_____"
]
],
[
[
"def generate_sequence(n):\n \"\"\"\n Generate the sequence defined by:\n\n a_1 = 1\n a_n = 3 a_{n - 1}\n\n This is done using recursion.\n \"\"\"\n if n == 1:\n return 1\n return 3 * generate_sequence(n - 1)",
"_____no_output_____"
]
],
[
[
"The first 6 terms:",
"_____no_output_____"
]
],
[
[
"[generate_sequence(n) for n in range(1, 7)]",
"_____no_output_____"
]
],
[
[
"We note that in this case this corresponds to powers of $3$, and indeed we can\nprove that: $a_n = 3 ^ {n - 1}$. We will not carry out the proof here but one\napproach to doing it would be to use proof by induction which is closely related\nto recursive functions.\n\nWe can write a different python function that uses this formulae. This is called\n**iteration**:",
"_____no_output_____"
]
],
[
[
"def calculate_sequence(n):\n \"\"\"\n Calculate the nth term of the sequence defined by:\n\n a_1 = 1\n a_n = 3 a_{n - 1}\n\n This is done using iteration using the direct formula:\n\n a_n = 3 ^ n\n \"\"\"\n return 3 ** (n - 1)",
"_____no_output_____"
],
[
"[calculate_sequence(n) for n in range(1, 7)]",
"_____no_output_____"
]
],
[
[
"We can in fact use a Jupyter [magic\ncommand](https://ipython.readthedocs.io/en/stable/interactive/magics.html) to\ntime the run time of a command. It is clear that recursion is slower.",
"_____no_output_____"
]
],
[
[
"%timeit [generate_sequence(n) for n in range(1, 25)]",
"28.7 µs ± 831 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n"
],
[
"%timeit [calculate_sequence(n) for n in range(1, 25)]",
"7.63 µs ± 89.5 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)\n"
]
],
[
[
"In practice:\n\n- Using recursion is powerful as it can be used to directly implement recursive\n definitions.\n- Using iteration is more computationally efficient but it is not always\n straightforward to obtain an iterative formula.\n\n\n(what_is_caching)=\n## What is caching\n\nOne of the reasons that recursion is computationally inefficient is that it\nalways has to recalculate previously calculated values.\n\nFor example:\n\n\n$$\n \\left\\{\\begin{array}{l}\n a_1 = 1\\\\\n a_{n + 1}= 3a_n, n > 1\n \\end{array}\\right.\n$$\n\nOne way to overcome this is to use caching which means that when a function is\ncalled for a value it has already computed it remembers the value.\n\nPython has a caching tool available in the functools library:",
"_____no_output_____"
]
],
[
[
"import functools\n\n\ndef generate_sequence(n):\n \"\"\"\n Generate the sequence defined by:\n\n a_1 = 1\n a_n = 3 a_{n - 1}\n\n This is done using recursion.\n \"\"\"\n if n == 1:\n return 1\n return 3 * generate_sequence(n - 1)\n\n\[email protected]_cache()\ndef cached_generate_sequence(n):\n \"\"\"\n Generate the sequence defined by:\n\n a_1 = 1\n a_n = 3 a_{n - 1}\n\n This is done using recursion but also includes a cache.\n \"\"\"\n if n == 1:\n return 1\n return 3 * cached_generate_sequence(n - 1)",
"_____no_output_____"
]
],
[
[
"Timing both these approaches confirms a substantial increase in time for the\ncached version.",
"_____no_output_____"
]
],
[
[
"%timeit [generate_sequence(n) for n in range(1, 25)]",
"27.6 µs ± 372 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)\n"
],
[
"%timeit [cached_generate_sequence(n) for n in range(1, 25)]",
"1.53 µs ± 7.47 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
] |
d0cbe63782f5e6668050ac8cdc3c093c0d0de356 | 19,155 | ipynb | Jupyter Notebook | anatomy-of-matplotlib-scipyconf-2018/04-limits-legends-and-layouts.ipynb | dlimpid/np-mpl-pd-nims-moderator-2019-04 | 7b48116d9e4449e05b46b5f7abb651eb67a9215d | [
"CC-BY-4.0"
] | 1 | 2019-12-07T02:21:40.000Z | 2019-12-07T02:21:40.000Z | anatomy-of-matplotlib-scipyconf-2018/04-limits-legends-and-layouts.ipynb | dlimpid/np-mpl-pd-nims-moderator-2019-04 | 7b48116d9e4449e05b46b5f7abb651eb67a9215d | [
"CC-BY-4.0"
] | null | null | null | anatomy-of-matplotlib-scipyconf-2018/04-limits-legends-and-layouts.ipynb | dlimpid/np-mpl-pd-nims-moderator-2019-04 | 7b48116d9e4449e05b46b5f7abb651eb67a9215d | [
"CC-BY-4.0"
] | 1 | 2019-12-07T02:21:43.000Z | 2019-12-07T02:21:43.000Z | 34.023091 | 489 | 0.580057 | [
[
[
"# Import conventions we'll be using here. See Part 1\nimport matplotlib\n# matplotlib.use('nbagg')\nimport matplotlib.pyplot as plt\nimport numpy as np",
"_____no_output_____"
]
],
[
[
"# Limits, Legends, and Layouts\n\nIn this section, we'll focus on what happens around the edges of the axes: Ticks, ticklabels, limits, layouts, and legends.",
"_____no_output_____"
],
[
"# Limits and autoscaling\n\nBy default, Matplotlib will attempt to determine limits for you that encompasses all the data you have plotted. This is the \"autoscale\" feature. For image plots, the limits are not padded while plots such as scatter plots and bar plots are given some padding.",
"_____no_output_____"
]
],
[
[
"fig, (ax1, ax2) = plt.subplots(nrows=1, ncols=2, figsize=plt.figaspect(0.5))\n\nax1.plot([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\nax2.scatter([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\n\nplt.show()",
"_____no_output_____"
]
],
[
[
"### `ax.margins(...)`\n\nIf you'd like to add a bit of \"padding\" to a plot, `ax.margins(<some_small_fraction>)` is a very handy way to do so. Instead of choosing \"even-ish\" numbers as min/max ranges for each axis, `margins` will make Matplotlib calculate the min/max of each axis by taking the range of the data and adding on a fractional amount of padding.\n\nAs an example:",
"_____no_output_____"
]
],
[
[
"fig, (ax1, ax2) = plt.subplots(1, 2, figsize=plt.figaspect(0.5))\n\nax1.plot([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\nax2.scatter([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\n\nax1.margins(x=0.0, y=0.1) # 10% padding in the y-direction only\nax2.margins(0.05) # 5% padding in all directions\n\nplt.show()",
"_____no_output_____"
]
],
[
[
"### `ax.axis(...)`\n\nThe `ax.axis(...)` method is a convienent way of controlling the axes limits and enabling/disabling autoscaling.\n\nIf you ever need to get all of the current plot limits, calling `ax.axis()` with no arguments will return the xmin/max/etc:\n\n xmin, xmax, ymin, ymax = ax.axis()\n \nIf you'd like to manually set all of the x/y limits at once, you can use `ax.axis` for this, as well (note that we're calling it with a single argument that's a sequence, not 4 individual arguments):\n\n ax.axis([xmin, xmax, ymin, ymax])\n \nHowever, you'll probably use `axis` mostly with either the `\"tight\"` or `\"equal\"` options. There are other options as well; see the documentation for full details. In a nutshell, though:\n\n * *tight*: Set axes limits to the exact range of the data\n * *equal*: Set axes scales such that one cm/inch in the y-direction is the same as one cm/inch in the x-direction. In Matplotlib terms, this sets the aspect ratio of the plot to 1. That _doesn't_ mean that the axes \"box\" will be square.\n \nAnd as an example:",
"_____no_output_____"
]
],
[
[
"fig, axes = plt.subplots(nrows=3)\n\nfor ax in axes:\n ax.plot([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\n\naxes[0].set_title('Normal Autoscaling', y=0.7, x=0.8)\n\naxes[1].set_title('ax.axis(\"tight\")', y=0.7, x=0.8)\naxes[1].axis('tight')\n\naxes[2].set_title('ax.axis(\"equal\")', y=0.7, x=0.8)\naxes[2].axis('equal')\n\nplt.show()",
"_____no_output_____"
]
],
[
[
"### Manually setting only one limit\n\nAnother trick with limits is to specify only half of a limit. When done **after** a plot is made, this has the effect of allowing the user to anchor a limit while letting Matplotlib autoscale the rest of it.",
"_____no_output_____"
]
],
[
[
"# Good -- setting limits after plotting is done\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=plt.figaspect(0.5))\nax1.plot([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\nax2.scatter([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\nax1.set_ylim(bottom=-10)\nax2.set_xlim(right=25)\nplt.show()",
"_____no_output_____"
],
[
"# Bad -- Setting limits before plotting is done\nfig, (ax1, ax2) = plt.subplots(1, 2, figsize=plt.figaspect(0.5))\nax1.set_ylim(bottom=-10)\nax2.set_xlim(right=25)\nax1.plot([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\nax2.scatter([-10, -5, 0, 5, 10, 15], [-1.2, 2, 3.5, -0.3, -4, 1])\nplt.show()",
"_____no_output_____"
]
],
[
[
"# Legends\n\nAs you've seen in some of the examples so far, the X and Y axis can also be labeled, as well as the subplot itself via the title. \n\nHowever, another thing you can label is the line/point/bar/etc that you plot. You can provide a label to your plot, which allows your legend to automatically build itself. ",
"_____no_output_____"
]
],
[
[
"fig, ax = plt.subplots()\nax.plot([1, 2, 3, 4], [10, 20, 25, 30], label='Philadelphia')\nax.plot([1, 2, 3, 4], [30, 23, 13, 4], label='Boston')\nax.set(ylabel='Temperature (deg C)', xlabel='Time', title='A tale of two cities')\nax.legend()\nplt.show()",
"_____no_output_____"
]
],
[
[
"In `classic` mode, legends will go in the upper right corner by default (you can control this with the `loc` kwarg). As of v2.0, by default Matplotlib will choose a location to avoid overlapping plot elements as much as possible. To force this option, you can pass in:\n\n ax.legend(loc=\"best\")\n \nAlso, if you happen to be plotting something that you do not want to appear in the legend, just set the label to \"\\_nolegend\\_\".",
"_____no_output_____"
]
],
[
[
"fig, ax = plt.subplots(1, 1)\nax.bar([1, 2, 3, 4], [10, 20, 25, 30], label=\"Foobar\", align='center', color='lightblue')\nax.plot([1, 2, 3, 4], [10, 20, 25, 30], label=\"_nolegend_\", marker='o', color='darkred')\nax.legend(loc='best')\nplt.show()",
"_____no_output_____"
]
],
[
[
"# Exercise 4.1\n\nOnce again, let's use a bit of what we've learned. Try to reproduce the following figure:\n\n<img src=\"images/exercise_4-1.png\">\n\nHint: You'll need to combine `ax.axis(...)` and `ax.margins(...)`. Here's the data and some code to get you started:",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\n\nt = np.linspace(0, 2 * np.pi, 150)\nx1, y1 = np.cos(t), np.sin(t)\nx2, y2 = 2 * x1, 2 * y1\n\ncolors = ['darkred', 'darkgreen']\n\n# Try to plot the two circles, scale the axes as shown and add a legend\n# Hint: it's easiest to combine `ax.axis(...)` and `ax.margins(...)` to scale the axes",
"_____no_output_____"
],
[
"%load solutions/4.1-legends_and_scaling.py",
"_____no_output_____"
]
],
[
[
"# Dealing with the boundaries: Layout, ticks, spines, etc\n\nOne key thing we haven't talked about yet is all of the annotation on the outside of the axes, the borders of the axes, and how to adjust the amount of space around the axes. We won't go over every detail, but this next section should give you a reasonable working knowledge of how to configure what happens around the edges of your axes.\n\n## Ticks, Tick Lines, Tick Labels and Tickers\nThis is a constant source of confusion:\n\n* A Tick is the *location* of a Tick Label.\n* A Tick Line is the line that denotes the location of the tick.\n* A Tick Label is the text that is displayed at that tick.\n* A [`Ticker`](http://matplotlib.org/api/ticker_api.html#module-matplotlib.ticker) automatically determines the ticks for an Axis and formats the tick labels.\n\n[`tick_params()`](https://matplotlib.org/api/axes_api.html#ticks-and-tick-labels) is often used to help configure your tickers.",
"_____no_output_____"
]
],
[
[
"fig, ax = plt.subplots()\nax.plot([1, 2, 3, 4], [10, 20, 25, 30])\n\n# Manually set ticks and tick labels *on the x-axis* (note ax.xaxis.set, not ax.set!)\nax.xaxis.set(ticks=range(1, 5), ticklabels=[3, 100, -12, \"foo\"]) \n\n# Make the y-ticks a bit longer and go both in and out...\nax.tick_params(axis='y', direction='inout', length=10)\n\nplt.show()",
"_____no_output_____"
]
],
[
[
"A commonly-asked question is \"How do I plot categories?\"\n\nStarting in version 2.0 of mpl, just like any other data.\n\nFor example:",
"_____no_output_____"
]
],
[
[
"data = [('apples', 2), ('oranges', 3), ('peaches', 1)]\nfruit, value = zip(*data)\n\nfig, ax = plt.subplots()\nax.bar(fruit, value, align='center', color='gray')\nplt.show()",
"_____no_output_____"
]
],
[
[
"## Subplot Spacing\nThe spacing between the subplots can be adjusted using [`fig.subplots_adjust()`](http://matplotlib.org/api/pyplot_api.html?#matplotlib.pyplot.subplots_adjust). Play around with the example below to see how the different arguments affect the spacing.",
"_____no_output_____"
]
],
[
[
"fig, axes = plt.subplots(2, 2, figsize=(9, 9))\nfig.subplots_adjust(wspace=0.5, hspace=0.3,\n left=0.125, right=0.9,\n top=0.9, bottom=0.1)\nplt.show()",
"_____no_output_____"
]
],
[
[
"A common \"gotcha\" is that the labels are not automatically adjusted to avoid overlapping those of another subplot. Matplotlib does not currently have any sort of robust layout engine, as it is a design decision to minimize the amount of \"magical plotting\". We intend to let users have complete, 100% control over their plots. LaTeX users would be quite familiar with the amount of frustration that can occur with automatic placement of figures in their documents.\n\nThat said, there have been some efforts to develop tools that users can use to help address the most common compaints. The \"[Tight Layout](http://matplotlib.org/users/tight_layout_guide.html)\" feature, when invoked, will attempt to resize margins and subplots so that nothing overlaps.\n\nIf you have multiple subplots, and want to avoid overlapping titles/axis labels/etc, `fig.tight_layout` is a great way to do so:",
"_____no_output_____"
]
],
[
[
"def example_plot(ax):\n ax.plot([1, 2])\n ax.set_xlabel('x-label', fontsize=16)\n ax.set_ylabel('y-label', fontsize=8)\n ax.set_title('Title', fontsize=24)\n\nfig, ((ax1, ax2), (ax3, ax4)) = plt.subplots(nrows=2, ncols=2)\nexample_plot(ax1)\nexample_plot(ax2)\nexample_plot(ax3)\nexample_plot(ax4)\n\n# Enable fig.tight_layout to compare...\nfig.tight_layout()\n\nplt.show()",
"_____no_output_____"
]
],
[
[
"## GridSpec\nUnder the hood, Matplotlib utilizes [`GridSpec`](http://matplotlib.org/api/gridspec_api.html) to lay out the subplots. While `plt.subplots()` is fine for simple cases, sometimes you will need more advanced subplot layouts. In such cases, you should use GridSpec directly. GridSpec is outside the scope of this tutorial, but it is handy to know that it exists. [Here](http://matplotlib.org/users/gridspec.html) is a guide on how to use it.",
"_____no_output_____"
],
[
"## Sharing axes\nThere will be times when you want to have the x axis and/or the y axis of your subplots to be \"shared\". Sharing an axis means that the axis in one or more subplots will be tied together such that any change in one of the axis changes all of the other shared axes. This works very nicely with autoscaling arbitrary datasets that may have overlapping domains. Furthermore, when interacting with the plots (panning and zooming), all of the shared axes will pan and zoom automatically.",
"_____no_output_____"
]
],
[
[
"fig, (ax1, ax2) = plt.subplots(1, 2, sharex=True, sharey=True)\nax1.plot([1, 2, 3, 4], [1, 2, 3, 4])\nax2.plot([3, 4, 5, 6], [6, 5, 4, 3])\nplt.show()",
"_____no_output_____"
]
],
[
[
"## \"Twinning\" axes\nSometimes one may want to overlay two plots on the same axes, but the scales may be entirely different. You can simply treat them as separate plots, but then twin them.",
"_____no_output_____"
]
],
[
[
"fig, ax1 = plt.subplots(1, 1)\nax1.plot([1, 2, 3, 4], [1, 2, 3, 4])\nax2 = ax1.twinx()\nax2.scatter([1, 2, 3, 4], [60, 50, 40, 30])\nax1.set(xlabel='X', ylabel='First scale')\nax2.set(ylabel='Other scale')\nplt.show()",
"_____no_output_____"
]
],
[
[
"# Axis Spines\nSpines are the axis lines for a plot. Each plot can have four spines: \"top\", \"bottom\", \"left\" and \"right\". By default, they are set so that they frame the plot, but they can be individually positioned and configured via the [`set_position()`](http://matplotlib.org/api/spines_api.html#matplotlib.spines.Spine.set_position) method of the spine. Here are some different configurations.",
"_____no_output_____"
]
],
[
[
"fig, ax = plt.subplots()\nax.plot([-2, 2, 3, 4], [-10, 20, 25, 5])\nax.spines['top'].set_visible(False)\nax.xaxis.set_ticks_position('bottom') # no ticklines at the top\nax.spines['right'].set_visible(False)\nax.yaxis.set_ticks_position('left') # no ticklines on the right\n\n# \"outward\"\n# Move the two remaining spines \"out\" away from the plot by 10 points\n#ax.spines['bottom'].set_position(('outward', 10))\n#ax.spines['left'].set_position(('outward', 10))\n\n# \"data\"\n# Have the spines stay intersected at (0,0)\n#ax.spines['bottom'].set_position(('data', 0))\n#ax.spines['left'].set_position(('data', 0))\n\n# \"axes\"\n# Have the two remaining spines placed at a fraction of the axes\n#ax.spines['bottom'].set_position(('axes', 0.75))\n#ax.spines['left'].set_position(('axes', 0.3))\n\nplt.show()",
"_____no_output_____"
]
],
[
[
"# Exercise 4.2\n\nThis one is a bit trickier. Once again, try to reproduce the figure below:\n\n<img src=\"images/exercise_4-2.png\">\n\n\nA few key hints: The two subplots have no vertical space between them (this means that the `hspace` is `0`). Note that the bottom spine is at 0 in data coordinates and the tick lines are missing from the right and top sides.\n\nBecause you're going to be doing a lot of the same things to both subplots, to avoid repitive code you might consider writing a function that takes an `Axes` object and makes the spine changes, etc to it. \n\n",
"_____no_output_____"
]
],
[
[
"import matplotlib.pyplot as plt\nimport numpy as np\n\n# Try to reproduce the figure shown in images/exercise_4.2.png\n# This one is a bit trickier!\n\n# Here's the data...\ndata = [('dogs', 4, 4), ('frogs', -3, 1), ('cats', 1, 5), ('goldfish', -2, 2)]\nanimals, friendliness, popularity = zip(*data)",
"_____no_output_____"
],
[
"%load solutions/4.2-spines_ticks_and_subplot_spacing.py",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
] |
d0cbe9eb039959ef8342e6dbd3ae1d3fa2ee2294 | 160,536 | ipynb | Jupyter Notebook | Data Visualization/Matplot/matplot_usage.ipynb | PS3132/pyDS_ML_bootcamp | eb68ca0b768e8ed30fd7cab2b77390a826527fcc | [
"MIT"
] | null | null | null | Data Visualization/Matplot/matplot_usage.ipynb | PS3132/pyDS_ML_bootcamp | eb68ca0b768e8ed30fd7cab2b77390a826527fcc | [
"MIT"
] | 5 | 2020-03-24T16:41:06.000Z | 2021-12-13T19:54:19.000Z | Data Visualization/Matplot/matplot_usage.ipynb | PS3132/pyDS_ML_bootcamp | eb68ca0b768e8ed30fd7cab2b77390a826527fcc | [
"MIT"
] | null | null | null | 292.948905 | 17,968 | 0.936288 | [
[
[
"# Matplot normal usage and example",
"_____no_output_____"
]
],
[
[
"import matplotlib.pyplot as plt",
"_____no_output_____"
],
[
"%matplotlib inline",
"_____no_output_____"
],
[
"import numpy as np",
"_____no_output_____"
],
[
"x = np.linspace(0,5, 11)\ny = x ** 2",
"_____no_output_____"
],
[
"x",
"_____no_output_____"
],
[
"y",
"_____no_output_____"
],
[
"plt.plot(x,y,\"black\")\nplt.xlabel(\"x label\")\nplt.ylabel(\"y label\")\nplt.title(\"title\")\nplt.show()",
"_____no_output_____"
],
[
"plt.subplot(1, 2, 1)\nplt.plot(x,y, \"b\")\n\nplt.subplot(2, 2, 2)\nplt.plot(y, x, \"r\")\n",
"_____no_output_____"
],
[
"fig = plt.figure()\n\naxes = fig.add_axes([0.1, 0.1, 0.8, 0.8])\naxes.plot(x, y)\naxes.set_xlabel(\"x axis\")\naxes.set_ylabel(\"y axis\")\naxes.set_title(\"title\")",
"_____no_output_____"
],
[
"fig = plt.figure()\n\naxes1 = fig.add_axes([0.1, 0.1, 0.8, 0.8])\naxes1.plot(x,y,\"r\")\naxes1.set_xlabel(\"x axis\")\naxes1.set_ylabel(\"y axis\")\naxes1.set_title(\"Larger Plot\")\n\naxes2 = fig.add_axes([0.2, 0.4, 0.4, 0.4])\naxes2.plot(y,x,\"b\")\naxes2.set_title(\"Smaller Plot\")",
"_____no_output_____"
],
[
"fig,axes = plt.subplots(nrows=2, ncols=2)\n\naxes[0][0].plot(x, y, \"r\")\naxes[1][1].plot(y, x, \"r\")\n\nplt.tight_layout()",
"_____no_output_____"
]
],
[
[
"### Figure Size and DPI",
"_____no_output_____"
]
],
[
[
"fig, axes = plt.subplots(figsize=(8,2))\nax = fig.add_axes([0,0,1,1])\nax.plot(x,y)",
"_____no_output_____"
],
[
"fig, axes = plt.subplots(figsize=(8,2), dpi=100)\nax = fig.add_axes([0,0,1,1])\nax.plot(x,y)",
"_____no_output_____"
],
[
"fig, axes = plt.subplots(nrows=2, ncols =1, figsize=(8,2))\naxes[0].plot(x,y)\naxes[1].plot(y,x)\n\nplt.tight_layout()",
"_____no_output_____"
],
[
"fig",
"_____no_output_____"
],
[
"fig.savefig(\"axis plot\", dpi=100)",
"_____no_output_____"
],
[
"fig = plt.figure()\n\nax = fig.add_axes([0,0,1,1])\nax.plot(x, x**2, label=\"x Squared\")\nax.plot(x, x**3, label=\"x Cube\")\n\nax.legend(loc=0)",
"_____no_output_____"
]
],
[
[
"### Plot Color and decoration",
"_____no_output_____"
]
],
[
[
"fig = plt.figure()\n\nax = fig.add_axes([0,0,1,1])\nax.plot(x, y, \"#000000\", lw=3, linestyle=\"--\", marker=\"o\", markersize=20, \n markerfacecolor=\"yellow\", markeredgewidth=3, markeredgecolor=\"green\") # rgb, hex #linewidth is lw\n",
"_____no_output_____"
],
[
"fig = plt.figure()\n\nax = fig.add_axes([0,0,1,1])\nax.plot(x,y, \"r--\")\nax.set_xlim([0,1])\nax.set_ylim([0,2])",
"_____no_output_____"
]
],
[
[
"#### Further Reading:\nhttp://www.labri.fr/perso/nrougier/teaching/matplotlib/matplotlib.html\n\nhttps://matplotlib.org/gallery.html",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0cc11c4be6fd7b401defc9bc34050b55452a0ba | 23,343 | ipynb | Jupyter Notebook | NLP/Resources/EVA_P2S3.ipynb | piyushjain220/TSAI | a3298326272bbb8225c15f6d9bded5550beb5ce6 | [
"MIT"
] | null | null | null | NLP/Resources/EVA_P2S3.ipynb | piyushjain220/TSAI | a3298326272bbb8225c15f6d9bded5550beb5ce6 | [
"MIT"
] | null | null | null | NLP/Resources/EVA_P2S3.ipynb | piyushjain220/TSAI | a3298326272bbb8225c15f6d9bded5550beb5ce6 | [
"MIT"
] | null | null | null | 30.876984 | 237 | 0.449771 | [
[
[
"<a href=\"https://colab.research.google.com/github/piyushjain220/TSAI/blob/main/NLP/Resources/EVA_P2S3.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
],
[
"#Imports",
"_____no_output_____"
]
],
[
[
"import numpy as np\n%matplotlib inline\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom IPython import display\nplt.style.use('seaborn-white')",
"_____no_output_____"
]
],
[
[
"# Read and process data. \n\nDownload the file from this URL: https://drive.google.com/file/d/1UWWIi-sz9g0x3LFvkIZjvK1r2ZaCqgGS/view?usp=sharing",
"_____no_output_____"
]
],
[
[
"data = open('text.txt', 'r').read()",
"_____no_output_____"
]
],
[
[
"Process data and calculate indices",
"_____no_output_____"
]
],
[
[
"chars = list(set(data))\ndata_size, X_size = len(data), len(chars)\nprint(\"Corona Virus article has %d characters, %d unique characters\" %(data_size, X_size))\nchar_to_idx = {ch:i for i,ch in enumerate(chars)}\nidx_to_char = {i:ch for i,ch in enumerate(chars)}",
"_____no_output_____"
]
],
[
[
"# Constants and Hyperparameters",
"_____no_output_____"
]
],
[
[
"Hidden_Layer_size = 10 #size of the hidden layer\nTime_steps = 10 # Number of time steps (length of the sequence) used for training\nlearning_rate = 1e-1 # Learning Rate\nweight_sd = 0.1 #Standard deviation of weights for initialization\nz_size = Hidden_Layer_size + X_size #Size of concatenation(H, X) vector",
"_____no_output_____"
]
],
[
[
"# Activation Functions and Derivatives",
"_____no_output_____"
]
],
[
[
"def sigmoid(x): # sigmoid function\n return # write your code here\n\ndef dsigmoid(y): # derivative of sigmoid function\n return # write your code here\n\ndef tanh(x): # tanh function\n return # write your code here\n\ndef dtanh(y): # derivative of tanh\n return # write your code here",
"_____no_output_____"
]
],
[
[
"# Quiz Question 1\n\nWhat is the value of sigmoid(0) calculated from your code? (Answer up to 1 decimal point, e.g. 4.2 and NOT 4.29999999, no rounding off).\n\n# Quiz Question 2\n\nWhat is the value of dsigmoid(sigmoid(0)) calculated from your code?? (Answer up to 2 decimal point, e.g. 4.29 and NOT 4.29999999, no rounding off). \n\n# Quiz Question 3\n\nWhat is the value of tanh(dsigmoid(sigmoid(0))) calculated from your code?? (Answer up to 5 decimal point, e.g. 4.29999 and NOT 4.29999999, no rounding off).\n\n# Quiz Question 4\n\nWhat is the value of dtanh(tanh(dsigmoid(sigmoid(0)))) calculated from your code?? (Answer up to 5 decimal point, e.g. 4.29999 and NOT 4.29999999, no rounding off).",
"_____no_output_____"
],
[
"# Parameters",
"_____no_output_____"
]
],
[
[
"class Param:\n def __init__(self, name, value):\n self.name = name\n self.v = value # parameter value\n self.d = np.zeros_like(value) # derivative\n self.m = np.zeros_like(value) # momentum for Adagrad",
"_____no_output_____"
]
],
[
[
"We use random weights with normal distribution (0, weight_sd) for tanh activation function and (0.5, weight_sd) for `sigmoid` activation function.\n\nBiases are initialized to zeros.",
"_____no_output_____"
],
[
"# LSTM \nYou are making this network, please note f, i, c and o (also \"v\") in the image below:\n\n\nPlease note that we are concatenating the old_hidden_vector and new_input.",
"_____no_output_____"
],
[
"# Quiz Question 4\n\nIn the class definition below, what should be size_a, size_b, and size_c? ONLY use the variables defined above.",
"_____no_output_____"
]
],
[
[
"size_a = # write your code here\nsize_b = # write your code here\nsize_c = # write your code here\n\nclass Parameters:\n def __init__(self):\n self.W_f = Param('W_f', np.random.randn(size_a, size_b) * weight_sd + 0.5)\n self.b_f = Param('b_f', np.zeros((size_a, 1)))\n\n self.W_i = Param('W_i', np.random.randn(size_a, size_b) * weight_sd + 0.5)\n self.b_i = Param('b_i', np.zeros((size_a, 1)))\n\n self.W_C = Param('W_C', np.random.randn(size_a, size_b) * weight_sd)\n self.b_C = Param('b_C', np.zeros((size_a, 1)))\n\n self.W_o = Param('W_o', np.random.randn(size_a, size_b) * weight_sd + 0.5)\n self.b_o = Param('b_o', np.zeros((size_a, 1)))\n\n #For final layer to predict the next character\n self.W_v = Param('W_v', np.random.randn(X_size, size_a) * weight_sd)\n self.b_v = Param('b_v', np.zeros((size_c, 1)))\n \n def all(self):\n return [self.W_f, self.W_i, self.W_C, self.W_o, self.W_v,\n self.b_f, self.b_i, self.b_C, self.b_o, self.b_v]\n \nparameters = Parameters()",
"_____no_output_____"
]
],
[
[
"Look at these operations which we'll be writing:\n\n**Concatenation of h and x:**\n\n$z\\:=\\:\\left[h_{t-1},\\:x\\right]$\n\n$f_t=\\sigma\\left(W_f\\cdot z\\:+\\:b_f\\:\\right)$\n\n$i_i=\\sigma\\left(W_i\\cdot z\\:+\\:b_i\\right)$\n\n$\\overline{C_t}=\\tanh\\left(W_C\\cdot z\\:+\\:b_C\\right)$\n\n$C_t=f_t\\ast C_{t-1}+i_t\\ast \\overline{C}_t$\n\n$o_t=\\sigma\\left(W_o\\cdot z\\:+\\:b_i\\right)$\n\n$h_t=o_t\\ast\\tanh\\left(C_t\\right)$\n\n**Logits:**\n\n$v_t=W_v\\cdot h_t+b_v$\n\n**Softmax:**\n\n$\\hat{y}=softmax\\left(v_t\\right)$\n",
"_____no_output_____"
]
],
[
[
"def forward(x, h_prev, C_prev, p = parameters):\n assert x.shape == (X_size, 1)\n assert h_prev.shape == (Hidden_Layer_size, 1)\n assert C_prev.shape == (Hidden_Layer_size, 1)\n \n z = np.row_stack((h_prev, x))\n f = # write your code here\n i = # write your code here\n C_bar = # write your code here\n\n C = # write your code here\n o = # write your code here\n h = # write your code here\n\n v = # write your code here\n y = np.exp(v) / np.sum(np.exp(v)) #softmax\n\n return z, f, i, C_bar, C, o, h, v, y",
"_____no_output_____"
]
],
[
[
"You must finish the function above before you can attempt the questions below. \n\n# Quiz Question 5\n\nWhat is the output of 'print(len(forward(np.zeros((X_size, 1)), np.zeros((Hidden_Layer_size, 1)), np.zeros((Hidden_Layer_size, 1)), parameters)))'?",
"_____no_output_____"
],
[
"# Quiz Question 6. \n\nAssuming you have fixed the forward function, run this command: \nz, f, i, C_bar, C, o, h, v, y = forward(np.zeros((X_size, 1)), np.zeros((Hidden_Layer_size, 1)), np.zeros((Hidden_Layer_size, 1)))\n\nNow, find these values:\n\n\n1. print(z.shape)\n2. print(np.sum(z))\n3. print(np.sum(f))\n\nCopy and paste exact values you get in the logs into the quiz.\n\n",
"_____no_output_____"
]
],
[
[
"z, f, i, C_bar, C, o, h, v, y = forward(np.zeros((X_size, 1)), np.zeros((Hidden_Layer_size, 1)), np.zeros((Hidden_Layer_size, 1)))",
"_____no_output_____"
]
],
[
[
"# Backpropagation\n\nHere we are defining the backpropagation. It's too complicated, here is the whole code. (Please note that this would work only if your earlier code is perfect).",
"_____no_output_____"
]
],
[
[
"def backward(target, dh_next, dC_next, C_prev,\n z, f, i, C_bar, C, o, h, v, y,\n p = parameters):\n \n assert z.shape == (X_size + Hidden_Layer_size, 1)\n assert v.shape == (X_size, 1)\n assert y.shape == (X_size, 1)\n \n for param in [dh_next, dC_next, C_prev, f, i, C_bar, C, o, h]:\n assert param.shape == (Hidden_Layer_size, 1)\n \n dv = np.copy(y)\n dv[target] -= 1\n\n p.W_v.d += np.dot(dv, h.T)\n p.b_v.d += dv\n\n dh = np.dot(p.W_v.v.T, dv) \n dh += dh_next\n do = dh * tanh(C)\n do = dsigmoid(o) * do\n p.W_o.d += np.dot(do, z.T)\n p.b_o.d += do\n\n dC = np.copy(dC_next)\n dC += dh * o * dtanh(tanh(C))\n dC_bar = dC * i\n dC_bar = dtanh(C_bar) * dC_bar\n p.W_C.d += np.dot(dC_bar, z.T)\n p.b_C.d += dC_bar\n\n di = dC * C_bar\n di = dsigmoid(i) * di\n p.W_i.d += np.dot(di, z.T)\n p.b_i.d += di\n\n df = dC * C_prev\n df = dsigmoid(f) * df\n p.W_f.d += np.dot(df, z.T)\n p.b_f.d += df\n\n dz = (np.dot(p.W_f.v.T, df)\n + np.dot(p.W_i.v.T, di)\n + np.dot(p.W_C.v.T, dC_bar)\n + np.dot(p.W_o.v.T, do))\n dh_prev = dz[:Hidden_Layer_size, :]\n dC_prev = f * dC\n \n return dh_prev, dC_prev",
"_____no_output_____"
]
],
[
[
"# Forward and Backward Combined Pass\n\nLet's first clear the gradients before each backward pass",
"_____no_output_____"
]
],
[
[
"def clear_gradients(params = parameters):\n for p in params.all():\n p.d.fill(0)",
"_____no_output_____"
]
],
[
[
"Clip gradients to mitigate exploding gradients",
"_____no_output_____"
]
],
[
[
"def clip_gradients(params = parameters):\n for p in params.all():\n np.clip(p.d, -1, 1, out=p.d)",
"_____no_output_____"
]
],
[
[
"Calculate and store the values in forward pass. Accumulate gradients in backward pass and clip gradients to avoid exploding gradients.\n\ninput, target are list of integers, with character indexes.\nh_prev is the array of initial h at h−1 (size H x 1)\nC_prev is the array of initial C at C−1 (size H x 1)\nReturns loss, final hT and CT",
"_____no_output_____"
]
],
[
[
"def forward_backward(inputs, targets, h_prev, C_prev):\n global paramters\n \n # To store the values for each time step\n x_s, z_s, f_s, i_s, = {}, {}, {}, {}\n C_bar_s, C_s, o_s, h_s = {}, {}, {}, {}\n v_s, y_s = {}, {}\n \n # Values at t - 1\n h_s[-1] = np.copy(h_prev)\n C_s[-1] = np.copy(C_prev)\n \n loss = 0\n # Loop through time steps\n assert len(inputs) == Time_steps\n for t in range(len(inputs)):\n x_s[t] = np.zeros((X_size, 1))\n x_s[t][inputs[t]] = 1 # Input character\n \n (z_s[t], f_s[t], i_s[t],\n C_bar_s[t], C_s[t], o_s[t], h_s[t],\n v_s[t], y_s[t]) = \\\n forward(x_s[t], h_s[t - 1], C_s[t - 1]) # Forward pass\n \n loss += -np.log(y_s[t][targets[t], 0]) # Loss for at t\n \n clear_gradients()\n\n dh_next = np.zeros_like(h_s[0]) #dh from the next character\n dC_next = np.zeros_like(C_s[0]) #dh from the next character\n\n for t in reversed(range(len(inputs))):\n # Backward pass\n dh_next, dC_next = \\\n backward(target = targets[t], dh_next = dh_next,\n dC_next = dC_next, C_prev = C_s[t-1],\n z = z_s[t], f = f_s[t], i = i_s[t], C_bar = C_bar_s[t],\n C = C_s[t], o = o_s[t], h = h_s[t], v = v_s[t],\n y = y_s[t])\n\n clip_gradients()\n \n return loss, h_s[len(inputs) - 1], C_s[len(inputs) - 1]",
"_____no_output_____"
]
],
[
[
"# Sample the next character",
"_____no_output_____"
]
],
[
[
"def sample(h_prev, C_prev, first_char_idx, sentence_length):\n x = np.zeros((X_size, 1))\n x[first_char_idx] = 1\n\n h = h_prev\n C = C_prev\n\n indexes = []\n \n for t in range(sentence_length):\n _, _, _, _, C, _, h, _, p = forward(x, h, C)\n idx = np.random.choice(range(X_size), p=p.ravel())\n x = np.zeros((X_size, 1))\n x[idx] = 1\n indexes.append(idx)\n\n return indexes",
"_____no_output_____"
]
],
[
[
"# Training (Adagrad)\n\nUpdate the graph and display a sample output\n\n",
"_____no_output_____"
]
],
[
[
"def update_status(inputs, h_prev, C_prev):\n #initialized later\n global plot_iter, plot_loss\n global smooth_loss\n \n # Get predictions for 200 letters with current model\n\n sample_idx = sample(h_prev, C_prev, inputs[0], 200)\n txt = ''.join(idx_to_char[idx] for idx in sample_idx)\n\n # Clear and plot\n plt.plot(plot_iter, plot_loss)\n display.clear_output(wait=True)\n plt.show()\n\n #Print prediction and loss\n print(\"----\\n %s \\n----\" % (txt, ))\n print(\"iter %d, loss %f\" % (iteration, smooth_loss))",
"_____no_output_____"
]
],
[
[
"# Update Parameters\n\n\\begin{align}\n\\theta_i &= \\theta_i - \\eta\\frac{d\\theta_i}{\\sum dw_{\\tau}^2} \\\\\nd\\theta_i &= \\frac{\\partial L}{\\partial \\theta_i}\n\\end{align}",
"_____no_output_____"
]
],
[
[
"def update_paramters(params = parameters):\n for p in params.all():\n p.m += p.d * p.d # Calculate sum of gradients\n #print(learning_rate * dparam)\n p.v += -(learning_rate * p.d / np.sqrt(p.m + 1e-8))",
"_____no_output_____"
]
],
[
[
"To delay the keyboard interrupt to prevent the training from stopping in the middle of an iteration\n\n",
"_____no_output_____"
]
],
[
[
"# Exponential average of loss\n# Initialize to a error of a random model\nsmooth_loss = -np.log(1.0 / X_size) * Time_steps\n\niteration, pointer = 0, 0\n\n# For the graph\nplot_iter = np.zeros((0))\nplot_loss = np.zeros((0))",
"_____no_output_____"
]
],
[
[
"# Training Loop",
"_____no_output_____"
]
],
[
[
"iter = 1000\nwhile iter > 0:\n # Reset\n if pointer + Time_steps >= len(data) or iteration == 0:\n g_h_prev = np.zeros((Hidden_Layer_size, 1))\n g_C_prev = np.zeros((Hidden_Layer_size, 1))\n pointer = 0\n\n\n inputs = ([char_to_idx[ch] \n for ch in data[pointer: pointer + Time_steps]])\n targets = ([char_to_idx[ch] \n for ch in data[pointer + 1: pointer + Time_steps + 1]])\n\n loss, g_h_prev, g_C_prev = \\\n forward_backward(inputs, targets, g_h_prev, g_C_prev)\n smooth_loss = smooth_loss * 0.999 + loss * 0.001\n\n # Print every hundred steps\n if iteration % 100 == 0:\n update_status(inputs, g_h_prev, g_C_prev)\n\n update_paramters()\n\n plot_iter = np.append(plot_iter, [iteration])\n plot_loss = np.append(plot_loss, [loss])\n\n pointer += Time_steps\n iteration += 1\n iter = iter -1",
"_____no_output_____"
]
],
[
[
"# Quiz Question 7. \n\nRun the above code for 50000 iterations making sure that you have 100 hidden layers and time_steps is 40. What is the loss value you're seeing?",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
]
] |
d0cc12500dcb8f095a5641625a979ad26e5ce687 | 2,641 | ipynb | Jupyter Notebook | packaging/google_colab/Install_AIMET_GoogleColab_torch_cpu.ipynb | mikeseven/aimet | 63211a4f259b6457c58dfae1097c70acb93319fe | [
"BSD-3-Clause"
] | 945 | 2020-04-30T02:23:55.000Z | 2022-03-31T08:44:32.000Z | packaging/google_colab/Install_AIMET_GoogleColab_torch_cpu.ipynb | mikeseven/aimet | 63211a4f259b6457c58dfae1097c70acb93319fe | [
"BSD-3-Clause"
] | 563 | 2020-05-01T03:07:22.000Z | 2022-03-30T05:35:58.000Z | packaging/google_colab/Install_AIMET_GoogleColab_torch_cpu.ipynb | mikeseven/aimet | 63211a4f259b6457c58dfae1097c70acb93319fe | [
"BSD-3-Clause"
] | 186 | 2020-04-30T00:55:26.000Z | 2022-03-30T09:54:51.000Z | 25.394231 | 150 | 0.601666 | [
[
[
"import os\nos.environ['SRC_URL'] = 'https://raw.githubusercontent.com/quic/aimet/develop/packaging/google_colab/'\n!curl ${SRC_URL}reqs_deb_common.txt | xargs apt-get --assume-yes install",
"_____no_output_____"
],
[
"!wget ${SRC_URL}reqs_pip_torch_cpu.txt\n!pip3 install -r reqs_pip_torch_cpu.txt -f https://download.pytorch.org/whl/torch_stable.html",
"_____no_output_____"
],
[
"import os\nos.environ['release_tag']=\"1.16.2.py37\"\n!pip3 install https://github.com/quic/aimet/releases/download/${release_tag}/AimetCommon-torch_cpu_${release_tag}-cp37-cp37m-linux_x86_64.whl\n!pip3 install https://github.com/quic/aimet/releases/download/${release_tag}/AimetTorch-torch_cpu_${release_tag}-cp37-cp37m-linux_x86_64.whl",
"_____no_output_____"
],
[
"import sys\nsys.path.append('/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu')\nsys.path.append('/usr/local/lib/python3.7/dist-packages/aimet_common/x86_64-linux-gnu/aimet_tensor_quantizer-0.0.0-py3.7-linux-x86_64.egg/')\n\nimport os\nos.environ['LD_LIBRARY_PATH'] +=':/usr/local/lib/python3.6/dist-packages/aimet_common/x86_64-linux-gnu'",
"_____no_output_____"
],
[
"import torch\nfrom torchvision import models\nfrom aimet_torch.quantsim import QuantizationSimModel\nm = models.resnet18()\nsim = QuantizationSimModel(m, dummy_input=torch.rand(1, 3, 224, 224))\nprint(sim)",
"_____no_output_____"
],
[
"",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cc1714b8b2e0548d257a3313ef9892a0c442ef | 36,068 | ipynb | Jupyter Notebook | 5_interactive_qe/1_LiH/test_QE_methods.ipynb | compchem-cybertraining/Tutorials_QE_and_eQE | e7315621d4a670b1abd72da8f4c6622aa7986a5a | [
"CC0-1.0"
] | 1 | 2021-09-24T01:44:34.000Z | 2021-09-24T01:44:34.000Z | 5_interactive_qe/1_LiH/test_QE_methods.ipynb | compchem-cybertraining/Tutorials_QE_and_eQE | e7315621d4a670b1abd72da8f4c6622aa7986a5a | [
"CC0-1.0"
] | null | null | null | 5_interactive_qe/1_LiH/test_QE_methods.ipynb | compchem-cybertraining/Tutorials_QE_and_eQE | e7315621d4a670b1abd72da8f4c6622aa7986a5a | [
"CC0-1.0"
] | 1 | 2021-09-24T01:44:37.000Z | 2021-09-24T01:44:37.000Z | 37.649269 | 1,289 | 0.559554 | [
[
[
"## QE methods and QE_utils\n\nIn this tutorial, we will explore various methods needed to handle Quantum Espresso (QE) calculations - to run them, prepare input, and extract output. All that will be done with the help of the **QE_methods** and **QE_utils** modules, which contains the following functions:\n\n**QE_methods**\n* cryst2cart(a1,a2,a3,r)\n* [Topic 2](#topic-2) read_qe_schema(filename, verbose=0)\n* [Topic 3](#topic-3) read_qe_index(filename, orb_list, verbose=0)\n* [Topic 4](#topic-4) read_qe_wfc_info(filename, verbose=0)\n* [Topic 9](#topic-9) read_qe_wfc_grid(filename, verbose=0)\n* [Topic 5](#topic-5) read_qe_wfc(filename, orb_list, verbose=0)\n* read_md_data(filename)\n* read_md_data_xyz(filename, PT, dt)\n* read_md_data_xyz2(filename, PT) \n* read_md_data_cell(filename)\n* out2inp(out_filename,templ_filename,wd,prefix,t0,tmax,dt)\n* out2pdb(out_filename,T,dt,pdb_prefix)\n* out2xyz(out_filename,T,dt,xyz_filename)\n* xyz2inp(out_filename,templ_filename,wd,prefix,t0,tmax,dt)\n* get_QE_normal_modes(filename, verbosity=0)\n* [Topic 1](#topic-1) run_qe(params, t, dirname0, dirname1) \n* read_info(params)\n* read_all(params)\n* read_wfc_grid(params)\n\n**QE_utils**\n* get_value(params,key,default,typ)\n* split_orbitals_energies(C, E)\n* [Topic 7](#topic-7) merge_orbitals(Ca, Cb)\n* post_process(coeff, ene, issoc)\n* [Topic 6](#topic-6) orthogonalize_orbitals(C)\n* [Topic 8](#topic-8) orthogonalize_orbitals2(Ca,Cb)",
"_____no_output_____"
]
],
[
[
"import os\nimport sys\nimport math\nimport copy\n\nif sys.platform==\"cygwin\":\n from cyglibra_core import *\nelif sys.platform==\"linux\" or sys.platform==\"linux2\":\n from liblibra_core import *\n#from libra_py import *\nfrom libra_py import units\nfrom libra_py import QE_methods\nfrom libra_py import QE_utils\nfrom libra_py import scan\n\nfrom libra_py import hpc_utils\nfrom libra_py import data_read\nfrom libra_py import data_outs\nfrom libra_py import data_conv\nfrom libra_py.workflows.nbra import step2\n\n\nimport py3Dmol # molecular visualization\nimport matplotlib.pyplot as plt # plots\n%matplotlib inline \n\nplt.rc('axes', titlesize=24) # fontsize of the axes title\nplt.rc('axes', labelsize=20) # fontsize of the x and y labels\nplt.rc('legend', fontsize=20) # legend fontsize\nplt.rc('xtick', labelsize=16) # fontsize of the tick labels\nplt.rc('ytick', labelsize=16) # fontsize of the tick labels\n\nplt.rc('figure.subplot', left=0.2)\nplt.rc('figure.subplot', right=0.95)\nplt.rc('figure.subplot', bottom=0.13)\nplt.rc('figure.subplot', top=0.88)\n\ncolors = {}\n\ncolors.update({\"11\": \"#8b1a0e\"}) # red \ncolors.update({\"12\": \"#FF4500\"}) # orangered \ncolors.update({\"13\": \"#B22222\"}) # firebrick \ncolors.update({\"14\": \"#DC143C\"}) # crimson \n\ncolors.update({\"21\": \"#5e9c36\"}) # green\ncolors.update({\"22\": \"#006400\"}) # darkgreen \ncolors.update({\"23\": \"#228B22\"}) # forestgreen\ncolors.update({\"24\": \"#808000\"}) # olive \n\ncolors.update({\"31\": \"#8A2BE2\"}) # blueviolet\ncolors.update({\"32\": \"#00008B\"}) # darkblue \n\ncolors.update({\"41\": \"#2F4F4F\"}) # darkslategray\n\nclrs_index = [\"11\", \"21\", \"31\", \"41\", \"12\", \"22\", \"32\", \"13\",\"23\", \"14\", \"24\"]",
"/projects/academic/cyberwksp21/Software/Conda/Miniconda3/envs/libra/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > > already registered; second conversion method ignored.\n return f(*args, **kwds)\n/projects/academic/cyberwksp21/Software/Conda/Miniconda3/envs/libra/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for boost::python::detail::container_element<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, unsigned long, boost::python::detail::final_vector_derived_policies<std::vector<std::vector<int, std::allocator<int> >, std::allocator<std::vector<int, std::allocator<int> > > >, false> > already registered; second conversion method ignored.\n return f(*args, **kwds)\n/projects/academic/cyberwksp21/Software/Conda/Miniconda3/envs/libra/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > > already registered; second conversion method ignored.\n return f(*args, **kwds)\n/projects/academic/cyberwksp21/Software/Conda/Miniconda3/envs/libra/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for boost::python::detail::container_element<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, unsigned long, boost::python::detail::final_vector_derived_policies<std::vector<std::vector<float, std::allocator<float> >, std::allocator<std::vector<float, std::allocator<float> > > >, false> > already registered; second conversion method ignored.\n return f(*args, **kwds)\n/projects/academic/cyberwksp21/Software/Conda/Miniconda3/envs/libra/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > > already registered; second conversion method ignored.\n return f(*args, **kwds)\n/projects/academic/cyberwksp21/Software/Conda/Miniconda3/envs/libra/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for boost::python::detail::container_element<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, unsigned long, boost::python::detail::final_vector_derived_policies<std::vector<std::vector<double, std::allocator<double> >, std::allocator<std::vector<double, std::allocator<double> > > >, false> > already registered; second conversion method ignored.\n return f(*args, **kwds)\n/projects/academic/cyberwksp21/Software/Conda/Miniconda3/envs/libra/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for std::vector<std::vector<std::complex<double>, std::allocator<std::complex<double> > >, std::allocator<std::vector<std::complex<double>, std::allocator<std::complex<double> > > > > already registered; second conversion method ignored.\n return f(*args, **kwds)\n/projects/academic/cyberwksp21/Software/Conda/Miniconda3/envs/libra/lib/python3.6/importlib/_bootstrap.py:219: RuntimeWarning: to-Python converter for boost::python::detail::container_element<std::vector<std::vector<std::complex<double>, std::allocator<std::complex<double> > >, std::allocator<std::vector<std::complex<double>, std::allocator<std::complex<double> > > > >, unsigned long, boost::python::detail::final_vector_derived_policies<std::vector<std::vector<std::complex<double>, std::allocator<std::complex<double> > >, std::allocator<std::vector<std::complex<double>, std::allocator<std::complex<double> > > > >, false> > already registered; second conversion method ignored.\n return f(*args, **kwds)\n"
]
],
[
[
"First, lets prepare the working directories and run simple SCF calculations to generate the output files",
"_____no_output_____"
]
],
[
[
"PWSCF = os.environ['PWSCF62']",
"/util/academic/espresso/6.2.1/bin\n"
],
[
"# Setup the calculations\nparams = {}\n\n# I run the calculations on laptop, so no BATCH system\nparams[\"BATCH_SYSTEM\"] = None\n\n# The number of processors to use\nparams[\"NP\"] = 1\n\n# The QE executable\nparams[\"EXE\"] = F\"{PWSCF}/pw.x\"\n\n# The executable to generate the wavefunction files\nparams[\"EXE_EXPORT\"] = F\"{PWSCF}/pw_export.x\" #\"/mnt/c/cygwin/home/Alexey-user/Soft/espresso/bin/pw_export.x\"\n\n# The type of the calculations to be performed - in this case only a single SCF with spin-polarization\nparams[\"nac_method\"] = 1\n \n# The prefix of the input file\nparams[\"prefix0\"] = \"x0.scf\" \n\n# Working directory - where all stuff happen\nparams[\"wd\"] = os.getcwd()+\"/wd\"\n\n\n# Remove the previous results and temporary working directory from the previous runs\nos.system(F\"rm -r {params['wd']}\")\nos.system(F\"mkdir {params['wd']}\")\n\n# Copy the input files into the working directory\n# also, notice how the SCF input file name has been changed\nos.system(F\"cp x0.scf.in {params['wd']}/x0.scf.0.in\")\nos.system(F\"cp x0.exp.in {params['wd']}\")\nos.system(F\"cp Li.pbe-sl-kjpaw_psl.1.0.0.UPF {params['wd']}\")\nos.system(F\"cp H.pbe-rrkjus_psl.1.0.0.UPF {params['wd']}\")\n",
"_____no_output_____"
]
],
[
[
"<a name=\"topic-1\"></a>\n### 1. run_qe(params, t, dirname0, dirname1)\n\n\nUse it to actually run the calculations\n\nComment this out if you have already done the calculations",
"_____no_output_____"
]
],
[
[
"help(QE_methods.run_qe)",
"Help on function run_qe in module libra_py.QE_methods:\n\nrun_qe(params, t, dirname0, dirname1)\n This function runs necessary QE calculations as defined by the \"params\" dictionary\n \n Args:\n params ( dictionary ): A dictionary containing important simulation parameters\n \n * **params[\"BATCH_SYSTEM\"]** ( string ): the name of the job submission command\n use \"srun\" if run calculations on SLURM system or \"mpirun\" if run on PBS system\n [default: \"srun\"]\n * **params[\"NP\"]** ( int ): the number of nodes on which execute calculations\n [default: 1]\n * **params[\"EXE\"]** ( string ): the name of the program to be executed. This may be \n the absolute path to the QE (pw.x) binary\n * **params[\"EXE_EXPORT\"]** ( string ): the name of the program that converts the binary files\n with the QE wavefunctions to the text format (pw_export.x). The name includes the \n absolute path to the binary\n * **params[\"prefix0\"]** ( string ): the name of scf template input file - it should \n contain all the parameters controlling the computational methodology for QE.\n If the file is called \"x0.scf.in\", use \"x0.scf\" as the value of the \"prefix0\"\n [default: \"x0.scf\"]\n * **params[\"prefix1\"]** ( string ): the name of scf template input file - it should \n contain all the parameters controlling the computational methodology for QE.\n Presently is used for SOC-enabled calculations, whereas the \"prefix0\" defines the\n no-SOC calculations. If the file is called \"x1.scf.in\", use \"x1.scf\" as the value\n of the \"prefix1\" [default: \"x1.scf\"]\n * **params[\"nac_method\"]** ( int ): selects the type of calculations to perform:\n \n - 0 : non-spin-polarized calculations (needs only \"prefix0\")\n - 1 : spin-polarized calculations (needs only \"prefix0\")\n - 2 : non-collinear calculation (SOC) only (needs only \"prefix1\")\n - 3 : spin-polarized and non-collinear calculation (SOC) (needs both \"prefix0\" and \"prefix1\")\n \n [default: 0]\n \n * **params[\"wd\"]** ( string ): the name of a \"working directory (can be removed once the calculatons\n are done)\" that will be created during this function execution.\n \n t ( int ): the current time step\n dirname0 ( string ): Name of the temporary directory where data will be stored \n for the case without SOC \n dirname1 ( string ): Name of the temporary directory where data will be stored \n for the case with SOC\n\n"
],
[
"!pwd",
"/projects/academic/cyberwksp21/Instructors_material/alexeyak/qe/ex6\r\n"
],
[
"os.chdir(\"wd\")\nQE_methods.run_qe(params, 0, \"res\", \"res2\")\nos.chdir(\"../\")",
"The time to run the QE calculations = 0.01\n"
]
],
[
[
"<a name=\"topic-2\"></a>\n### 2. read_qe_schema(filename, verbose=0)\n\nCan be used to read the information about the completed run",
"_____no_output_____"
]
],
[
[
"pwd",
"_____no_output_____"
],
[
"info = QE_methods.read_qe_schema(\"wd/res/x0.save/data-file-schema.xml\", verbose=0)\nprint(info)",
"{'conv': 5, 'etot': -8.04731987990019, 'nbnd': 0, 'nelec': 4, 'efermi': -0.1498027412442092, 'alat': 37.79452249252, 'nat': 2, 'coords': <liblibra_core.MATRIX object at 0x2b34eca9f9d0>, 'atom_labels': ['Li', 'H'], 'forces': <liblibra_core.MATRIX object at 0x2b34eca9fb90>}\n"
],
[
"nat = info[\"nat\"]\nR, F = info[\"coords\"], info[\"forces\"]\n\nfor at in range(nat):\n print(F\"Atom {at} \\t {info['atom_labels'][at]} \\t\\\n x={R.get(3*at+0):.5f}, y={R.get(3*at+1):.5f}, z={R.get(3*at+2):.5f}\\\n fx={F.get(3*at+0):.5f}, fy={F.get(3*at+1):.5f}, fz={F.get(3*at+2):.5f}\")",
"Atom 0 \t Li \t x=0.00000, y=0.00000, z=0.00000 fx=0.00000, fy=0.00000, fz=0.00000\nAtom 1 \t H \t x=2.83459, y=0.00000, z=0.00000 fx=0.00000, fy=0.00000, fz=0.00000\n"
]
],
[
[
"<a name=\"topic-3\"></a>\n### 3. read_qe_index(filename, orb_list, verbose=0)\n\nIs analogous to **read_qe_schema** in many regards, it just extracts a bit different info, including orbital energies.\n\nOne would also need to specify which energy levels we want to extract, so one would need that info beforehands.\n\nIn this example, we have just 4 electrons, so:\n\n1 - HOMO-1\n2 - HOMO \n3 - LUMO\n4 - LUMO+1\n\nLets try just the 4 orbitals",
"_____no_output_____"
]
],
[
[
"info2, all_e = QE_methods.read_qe_index(\"wd/res/x0.export/index.xml\", [1,2,3,4], verbose=1)",
"_____no_output_____"
],
[
"print( info2)",
"{'nspin': 2, 'nk': 2, 'nbnd': 10, 'efermi': -0.12376709627891, 'alat': 37.79452265771, 'omega': 8637.868266355206, 'tpiba': 0.1662459230953623, 'tpiba2': 0.02763770694582913, 'a1': <liblibra_core.VECTOR object at 0x7fae681b5df8>, 'a2': <liblibra_core.VECTOR object at 0x7fae68178500>, 'a3': <liblibra_core.VECTOR object at 0x7fae681789d0>, 'b1': <liblibra_core.VECTOR object at 0x7fae68178378>, 'b2': <liblibra_core.VECTOR object at 0x7fae68178fb8>, 'b3': <liblibra_core.VECTOR object at 0x7fae681787d8>, 'weights': [1.0, 1.0], 'k': [<liblibra_core.VECTOR object at 0x7fae68178ea0>, <liblibra_core.VECTOR object at 0x7fae68178ca8>]}\n"
],
[
"print(all_e)",
"[<liblibra_core.CMATRIX object at 0x7fae68178dc0>, <liblibra_core.CMATRIX object at 0x7fae68178df8>]\n"
],
[
"e_alp = all_e[0]\ne_bet = all_e[1]",
"_____no_output_____"
],
[
"for i in range(4):\n print(F\"E_{i}^alpha = {e_alp.get(i,i).real:12.8f} \\t E_{i}^beta = {e_bet.get(i,i).real:12.8f}\")",
"E_0^alpha = -1.86244053 \t E_0^beta = -1.86219594\nE_1^alpha = -0.16462949 \t E_1^beta = -0.16475681\nE_2^alpha = -0.08691250 \t E_2^beta = -0.08650036\nE_3^alpha = -0.04025010 \t E_3^beta = -0.04013592\n"
]
],
[
[
"<a name=\"topic-4\"></a>\n### 4. read_qe_wfc_info(filename, verbose=0)\n\nCan be used to extract some descriptors of the wavefunctions produced",
"_____no_output_____"
]
],
[
[
"wfc_info1 = QE_methods.read_qe_wfc_info(\"wd/res/x0.export/wfc.1\", verbose=1)\nwfc_info2 = QE_methods.read_qe_wfc_info(\"wd/res/x0.export/wfc.2\", verbose=1)",
"path= Kpoint.1\n ngw = 36889 igwx = 36889 nbnd = 10 nspin = 2 gamma_only = F ik = 1 nk = 2\npath= Kpoint.2\n ngw = 36889 igwx = 36889 nbnd = 10 nspin = 2 gamma_only = F ik = 2 nk = 2\n"
],
[
"print(wfc_info1)\nprint(wfc_info2)",
"{'ngw': 36889, 'igwx': 36889, 'nbnd': 10, 'nspin': 2, 'gamma_only': 'F', 'ik': 1, 'nk': 2}\n{'ngw': 36889, 'igwx': 36889, 'nbnd': 10, 'nspin': 2, 'gamma_only': 'F', 'ik': 2, 'nk': 2}\n"
]
],
[
[
"<a name=\"topic-5\"></a>\n### 5. read_qe_wfc(filename, orb_list, verbose=0)\n\nCan be used to read in the actual wavefunctions produced",
"_____no_output_____"
]
],
[
[
"alpha = QE_methods.read_qe_wfc(\"wd/res/x0.export/wfc.1\", [1,2,3,4], verbose=0)\nbeta = QE_methods.read_qe_wfc(\"wd/res/x0.export/wfc.2\", [1,2,3,4], verbose=0)",
"path= Kpoint.1\npath= Kpoint.1\npath= Kpoint.2\npath= Kpoint.2\n"
],
[
"print(alpha)\nprint(alpha.num_of_rows, alpha.num_of_cols)\n\nprint(beta)\nprint(beta.num_of_rows, beta.num_of_cols)",
"<liblibra_core.CMATRIX object at 0x7fae6817b340>\n36889 4\n<liblibra_core.CMATRIX object at 0x7fae3ffb3730>\n36889 4\n"
]
],
[
[
"Orthogonality and normalization\n\nBelow we can see that MO overlaps <alpha(i)|alpha(j)> are almost orthonormal - the diagonal elements are coorectly 1.0\n\nBut the off-diagonal elements are not quite 0.0\n\nSame is true for <beta(i)|beta(j)> \n\nHowever, there is no any expectation about the orthogonality or normalization across the two sets",
"_____no_output_____"
]
],
[
[
"S_aa = alpha.H() * alpha\nS_bb = beta.H() * beta\nS_ab = alpha.H() * beta",
"_____no_output_____"
],
[
"def print_mat(X):\n nr, nc = X.num_of_rows, X.num_of_cols\n for i in range(nr):\n \n line = \"\"\n for j in range(nc):\n \n line = line + \"%8.5f \" % (X.get(i,j).real)\n print(line)\n\nprint(\"S_aa\")\nprint_mat(S_aa)\n\nprint(\"S_bb\")\nprint_mat(S_bb)\n\nprint(\"S_ab\")\nprint_mat(S_ab)",
"S_aa\n 1.00000 -0.08150 -0.04761 0.03307 \n-0.08150 1.00000 0.03712 -0.02467 \n-0.04761 0.03712 1.00000 -0.01177 \n 0.03307 -0.02467 -0.01177 1.00000 \nS_bb\n 1.00000 -0.08093 -0.04785 0.03336 \n-0.08093 1.00000 0.03755 -0.02485 \n-0.04785 0.03755 1.00000 -0.01246 \n 0.03336 -0.02485 -0.01246 1.00000 \nS_ab\n 0.17301 -0.01049 -0.00412 0.00214 \n-0.01635 0.15735 0.00452 -0.00236 \n-0.00102 -0.00083 -0.06732 0.00139 \n 0.01173 -0.00747 -0.00248 0.24420 \n"
]
],
[
[
"<a name=\"topic-6\"></a>\n### 6. QE_utils.orthogonalize_orbitals(C)\nCan be used to orthogonalize orbitals if they are not.\n\nSo lets transform alpha and beta orbitals such they are now orthonormal within each set.\n\nThe resulting orbitals are not orthonormal across the two sets still ",
"_____no_output_____"
]
],
[
[
"alp = QE_utils.orthogonalize_orbitals(alpha)\nbet = QE_utils.orthogonalize_orbitals(beta)\n\nS_aa = alp.H() * alp\nS_bb = bet.H() * bet\nS_ab = alp.H() * bet\n\nprint(\"S_aa\")\nprint_mat(S_aa)\n\nprint(\"S_bb\")\nprint_mat(S_bb)\n\nprint(\"S_ab\")\nprint_mat(S_ab)",
"\nTesting if S is invertabile\n\n[4, 1]\nDet = (0.9881907434095535-8.072456740942809e-20j)\n\nTesting if S is invertabile\n\n[4, 1]\nDet = (0.9883023952546621+8.762301957458487e-20j)\nS_aa\n 1.00000 0.00000 0.00000 -0.00000 \n 0.00000 1.00000 -0.00000 0.00000 \n 0.00000 -0.00000 1.00000 0.00000 \n-0.00000 0.00000 0.00000 1.00000 \nS_bb\n 1.00000 -0.00000 0.00000 0.00000 \n-0.00000 1.00000 -0.00000 0.00000 \n 0.00000 -0.00000 1.00000 -0.00000 \n 0.00000 0.00000 -0.00000 1.00000 \nS_ab\n 0.17301 0.00000 -0.00001 0.00000 \n-0.00001 0.15735 0.00024 -0.00006 \n-0.00001 0.00005 -0.06733 0.00028 \n 0.00002 0.00017 0.00083 0.24420 \n"
]
],
[
[
"<a name=\"topic-7\"></a>\n### 7. QE_utils.merge_orbitals(Ca, Cb)\n\nSometimes (usually in the non-collinear case), we want to have a single set of orbitals (many are nearly doubly degenerate), not just alpha and beta components. We can prepare the single set from the spinor components using this function. In this example, we just gonna mimic non-collinear SOC calculations, pretending that alpha and beta orbital sets are the spinor components. \n",
"_____no_output_____"
]
],
[
[
"C = QE_utils.merge_orbitals(alpha, beta)\n\nS = C.H() * C\nprint_mat(S)",
" 1.00000 -0.08150 -0.04761 0.03307 0.17301 -0.01049 -0.00412 0.00214 \n-0.08150 1.00000 0.03712 -0.02467 -0.01635 0.15735 0.00452 -0.00236 \n-0.04761 0.03712 1.00000 -0.01177 -0.00102 -0.00083 -0.06732 0.00139 \n 0.03307 -0.02467 -0.01177 1.00000 0.01173 -0.00747 -0.00248 0.24420 \n 0.17301 -0.01635 -0.00102 0.01173 1.00000 -0.08093 -0.04785 0.03336 \n-0.01049 0.15735 -0.00083 -0.00747 -0.08093 1.00000 0.03755 -0.02485 \n-0.00412 0.00452 -0.06732 -0.00248 -0.04785 0.03755 1.00000 -0.01246 \n 0.00214 -0.00236 0.00139 0.24420 0.03336 -0.02485 -0.01246 1.00000 \n"
]
],
[
[
"<a name=\"topic-8\"></a>\n### 8. QE_utils.orthogonalize_orbitals2(Ca, Cb)\n\nThis is a special orthogonalization procedure - the one for 2-component spinors. The inputs are assumed to be the components for each orbital. The orthogonalization works such that it is S_aa + S_bb = I",
"_____no_output_____"
]
],
[
[
"alpha = QE_methods.read_qe_wfc(\"wd/res/x0.export/wfc.1\", [1,2,3,4], verbose=0)\nbeta = QE_methods.read_qe_wfc(\"wd/res/x0.export/wfc.2\", [1,2,3,4], verbose=0)",
"path= Kpoint.1\npath= Kpoint.1\npath= Kpoint.2\npath= Kpoint.2\n"
],
[
"alp, bet = QE_utils.orthogonalize_orbitals2(alpha, beta)\n\nS_aa = alp.H() * alp\nS_bb = bet.H() * bet\nprint(\"S_aa\")\nprint_mat(S_aa)\n\nprint(\"S_bb\")\nprint_mat(S_bb)\n\nprint(\"S_aa + S_bb\")\nprint_mat(S_aa + S_bb)\n\nS_ab = alp.H() * bet\nprint(\"S_ab\")\nprint_mat(S_ab)\n",
"S_aa\n 0.49999 -0.00014 0.00006 -0.00007 \n-0.00014 0.49999 -0.00010 0.00004 \n 0.00006 -0.00010 0.50000 0.00016 \n-0.00007 0.00004 0.00016 0.50000 \nS_bb\n 0.50001 0.00014 -0.00006 0.00007 \n 0.00014 0.50001 0.00010 -0.00004 \n-0.00006 0.00010 0.50000 -0.00016 \n 0.00007 -0.00004 -0.00016 0.50000 \nS_aa + S_bb\n 1.00000 -0.00000 0.00000 -0.00000 \n-0.00000 1.00000 -0.00000 0.00000 \n 0.00000 -0.00000 1.00000 0.00000 \n-0.00000 0.00000 0.00000 1.00000 \nS_ab\n 0.08657 -0.00003 0.00001 0.00004 \n-0.00005 0.07869 0.00008 -0.00006 \n 0.00003 -0.00004 -0.03377 0.00018 \n 0.00004 0.00006 0.00040 0.12212 \n"
]
],
[
[
"<a name=\"topic-9\"></a>\n### 9. read_qe_wfc_grid(filename, verbose=0)\n\nCan be used to read the grid points for the given PW representation.",
"_____no_output_____"
]
],
[
[
"G1 = QE_methods.read_qe_wfc_grid(\"wd/res/x0.export/grid.1\", verbose=0)",
"path= Kpoint.1\n"
],
[
"print(len(G1))",
"36889\n"
],
[
"for i in range(10):\n print(F\"{i} \\t {G1[i].x} \\t {G1[i].y} \\t {G1[i].z}\")",
"0 \t 0.0 \t 0.0 \t 0.0\n1 \t -1.0 \t 0.0 \t 0.0\n2 \t 1.0 \t 0.0 \t 0.0\n3 \t -2.0 \t 0.0 \t 0.0\n4 \t 2.0 \t 0.0 \t 0.0\n5 \t 0.0 \t -1.0 \t 0.0\n6 \t 0.0 \t 0.0 \t -1.0\n7 \t 0.0 \t 0.0 \t 1.0\n8 \t 0.0 \t 1.0 \t 0.0\n9 \t -1.0 \t -1.0 \t 0.0\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
] |
d0cc2e50b27f7511370e04645407349652cb3244 | 7,791 | ipynb | Jupyter Notebook | Modulo1/Clase0_GuiaSimMat.ipynb | HissamQA/simmatp2021 | 63bb82c65d25148a871ab520325a023fcd876ebc | [
"MIT"
] | null | null | null | Modulo1/Clase0_GuiaSimMat.ipynb | HissamQA/simmatp2021 | 63bb82c65d25148a871ab520325a023fcd876ebc | [
"MIT"
] | null | null | null | Modulo1/Clase0_GuiaSimMat.ipynb | HissamQA/simmatp2021 | 63bb82c65d25148a871ab520325a023fcd876ebc | [
"MIT"
] | null | null | null | 36.237209 | 413 | 0.613528 | [
[
[
"___\n<img style=\"float: right; margin: 0px 0px 15px 15px;\" src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/4/4a/Python3-powered_hello-world.svg/1000px-Python3-powered_hello-world.svg.png\" width=\"300px\" height=\"100px\" />\n\n\n# <font color= #8A0829> Simulación matemática.</font>\n#### <font color= #2E9AFE> `Miércoles-Viernes (Videoconferencia) de 13:00 a 15:00 hrs`</font>\n- <Strong> Esteban Jiménez Rodríguez </Strong>\n- <Strong> Año </Strong>: 2021\n- <Strong> Copyright: </Strong> MIT, excepto donde se indique lo contrario.\n\n- <Strong> Email: </Strong> <font color=\"blue\"> `[email protected], [email protected]` </font>\n___",
"_____no_output_____"
],
[
"### `Presentación mía`\n___",
"_____no_output_____"
],
[
"### `Presentación de ustedes`\n___",
"_____no_output_____"
],
[
"### `Algunas reglas de juego`\n\n[Normas mínimas disciplinarias](https://www.dropbox.com/s/sbez0e0rv34na14/NORMAS_MINIMAS_DISCIPLINARIAS.pdf?dl=0)\n\n- Todas las entregas deben hacerse através de los espacios provistos en canvas, a menos que se especifique lo contrario.\n- No se recibirán entregas por ningún otro medio. Sin excepción.\n___",
"_____no_output_____"
],
[
"### `Horario de asesoría`\n\nA convenir.\n___",
"_____no_output_____"
],
[
"### `Descripción de la asignatura`\n\n*Este es un curso básico de simulación utilizando python, por ende vamos a iniciar elaborando programas simples y conforme avancemos el nivel de exigencia aumentará.*\n\n- Problemas de ingeniería: requieren soluciones adecuadas, eficientes y óptimas.\n- La simulación matemática de escenarios es una estrategia relevante para resolver tales problemas, consiste en modelar numéricamente los principios físicos y matemáticos que rigen un fenómeno mediante el uso de lenguajes de modelado y herramientas de tecnologías de información.\n- La asignatura está diseñada para que logres dichos propósitos e inicies un proceso que te permita apropiarte de desempeños profesionales muy útiles en tu formación profesional y en tu futuro, al incorporarte a la industria u organizaciones que te demandarán resolver e implementar la simulación de escenarios bajo diferentes situaciones a través de la sistematización de la solución al problema planteado.",
"_____no_output_____"
],
[
"#### `OBJETIVO GENERAL `\n> <p style='text-align: justify;'> A partir de la modelación de fenómenos físicos desarrollarás las competencias necesarias para reproducir escenarios de aplicación profesional que representen de manera más cercana el fenómeno objetivo. Podrás además realizar inferencias que ayuden a la óptima toma de decisiones en la solución de problemas.</p>",
"_____no_output_____"
],
[
"`Módulo 1.` **Optimización**\n> Se evaluará una presentación de **proyecto.**\n 1. ¿Qué es una simulación?\n - Introducción e instalación de software\n - Uso de Markdown\n - Control de versiones con git\n 2. Optimización de funciones de variable escalar con SymPy\n 3. Programación Lineal\n 5. Ajuste de curvas\n 7. Clasificación binaria",
"_____no_output_____"
],
[
"`Módulo 2.` **Montecarlo**\n> Se evaluará una presentación de **proyecto.**\n 1. Generación de números aleatorios\n - Generación de variables aleatorias (Uniforme, triangular, exponencial).\n - Simulación de una fila un servidor (fila de un banco, cafetería, etc).\n 2. Caminata aleatoria\n 3. Integrales\n 4. Fractales aleatorios\n 5. Bajar y organizar datos de Yahoo Finance (Pandas)\n 6. Probabilidad precio-umbral",
"_____no_output_____"
],
[
"`Módulo 2.` **Ecuaciones diferenciales**\n> Se evaluará una presentación de **proyecto.**\n 1. Introducción a ecuaciones diferenciales\n 2. ¿Cómo se muve un péndulo?\n 3. ¿Cómo funciona la suspensión de un auto?\n 4. ¿Cómo crece una población?\n 5. Modelo del rendimiento de una cuenta de ahorro",
"_____no_output_____"
],
[
"### `Evaluación`\n\n- 3 Proyectos (trabajo en equipo) 45%\n - Cada proyecto tiene un valor del 15% \n - La evaluación de cada proyecto se divide en dos partes \n - Reporte 7.5%\n - Exposición 7.5% \n - Equipos de 2 integrantes mínimo y 3 máximo. *Esto no se negocia*.\n - Si durante algún proyecto las cosas no funcionan entre los integrantes, para el siguiente proyecto se pueden formar equipos nuevos.\n- Examen final 19%\n- Quices 16%\n- Tareas 20%\n - La evaluación de cada tarea se divide en dos partes \n - Primera entrega 30%\n - Segunda entrega 70% \n - Si sacan 100 en la primera entrega, no es necesario hacer la segunda entrega.\n - Si sacan menos de 100 en la primera entrega, y no realizan las correcciones para la segunda entrega, se calificará como si no se hubiera hecho segunda entrega.\n - Si sacan menos de 100 en la primera entrega, y no realizan segunda entrega, se calificará como si no se hubiera hecho segunda entrega.\n - Para tener derecho a segunda entrega, deben realizar la primera entrega.",
"_____no_output_____"
],
[
"### `Bibliografía `",
"_____no_output_____"
],
[
"- Process Dynamics: Modeling, Analysis and Simulation by B. Wayne Bequette\n- Stochastic Simulation and Applications in Financewith MATLAB Programs by HuuTueHuynh\n- Fluent Python by Ramalho, Luciano \n- Python for Finance by Hilpisch, Yves \n- Python for Scientists by Stewart, John M. \n- Mathematical Modeling in Continuum Mechanics by Temam & Miranville\n\nEstos y muchos mas libros los pueden encontrar en la Biblioteca.",
"_____no_output_____"
],
[
"<script>\n $(document).ready(function(){\n $('div.prompt').hide();\n $('div.back-to-top').hide();\n $('nav#menubar').hide();\n $('.breadcrumb').hide();\n $('.hidden-print').hide();\n });\n</script>\n\n<footer id=\"attribution\" style=\"float:right; color:#808080; background:#fff;\">\nCreated with Jupyter by Esteban Jiménez Rodríguez.\n</footer>",
"_____no_output_____"
]
]
] | [
"markdown"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
]
] |
d0cc72a50408427c3e38a0d35618ae48a9837f2c | 132,189 | ipynb | Jupyter Notebook | ANZIAM-2019/ANZIAM Slides.ipynb | peter-cudmore/seminars | bdc60024e5c43c41cff5a7bc86c2810323ef0f70 | [
"CC-BY-4.0"
] | null | null | null | ANZIAM-2019/ANZIAM Slides.ipynb | peter-cudmore/seminars | bdc60024e5c43c41cff5a7bc86c2810323ef0f70 | [
"CC-BY-4.0"
] | null | null | null | ANZIAM-2019/ANZIAM Slides.ipynb | peter-cudmore/seminars | bdc60024e5c43c41cff5a7bc86c2810323ef0f70 | [
"CC-BY-4.0"
] | null | null | null | 110.341402 | 16,808 | 0.869792 | [
[
[
"import matplotlib.pyplot as plt\nimport BondGraphTools\nfrom BondGraphTools.config import config\nfrom BondGraphTools.reaction_builder import Reaction_Network\njulia = config.julia",
"_____no_output_____"
]
],
[
[
"# `BondGraphTools`\n## Modelling Network Bioenergetics.\n\n\nhttps://github.com/peter-cudmore/seminars/ANZIAM-2019\n\n \n\n Dr. Peter Cudmore. \n Systems Biology Labratory, \n The School of Chemical and Biomedical Engineering, \n The University of Melbourne. ",
"_____no_output_____"
],
[
"In this talk i discuss\n* Problems in compartmental modelling of cellular processes,\n* Some solutions from engineering and physics,\n* Software to make life easier.\n\n \n\nFor this talk; a *model* is a set of ordinary differential equations.",
"_____no_output_____"
],
[
"## Part 1: Problems in Cellular Process Modelling.",
"_____no_output_____"
],
[
"<center> <img src=\"images/map.png\"> </center>",
"_____no_output_____"
],
[
"<center><i>Parameters (or the lack thereof) are the bane of the mathematical biologists existence!</i></center>",
"_____no_output_____"
],
[
"Consinder $S + E = ES = E + P$ (one 'edge' of metabolism).\n\nAssuming mass action, the dynamics are: \n$$\\begin{align}\n\\dot{[S]} &= k_1^b[ES] - k_1^f[E][S],\\\\\n\\dot{[E]} &= (k_1^b + k_2^f)[ES] - [E](k_1^f[S] + k_2^b[P]),\\\\\n\\dot{[ES]} &= -(k_1^b + k_2^f)[ES] + [E](k_1^f[S] + k_2^b[P]),\\\\\n\\dot{[P]} &= k_2^f[ES] - k_2^f[E][P].\n\\end{align}\n$$",
"_____no_output_____"
],
[
"*What are the kinetic parameters $k_1^b, k_1^f, k_2^b, k_2^f$?*",
"_____no_output_____"
],
[
"*How do we find them for large systems?*",
"_____no_output_____"
],
[
"Can kinetic parameters be estimated from available data?\n\n \n",
"_____no_output_____"
],
[
"<center><h3>No!</h3></center> ",
"_____no_output_____"
],
[
" \n\nWhen fitting data to a system of kinetics parameters may be: \n- unobservable (for example, rate constants from equilibrium data), \n- or *sloppy* (aways underdetermined for a set of data).",
"_____no_output_____"
],
[
"Do kinetic parameters generalise across different experiments (and hence can be tabulated)?\n\n \n\n",
"_____no_output_____"
],
[
"<center><h3>No!</h3></center> ",
"_____no_output_____"
],
[
" \n\nAt the very least kinetic parameters fail to generalise across temperatures.\n\nFor example; physiological conditions are around $37^\\circ C$ while labs are around $21^\\circ C$.",
"_____no_output_____"
],
[
"Do kinetic parameters violate the laws physics?",
"_____no_output_____"
],
[
"\n<center><h3>Often!</h3></center>\n\n",
"_____no_output_____"
],
[
" \n\n_The principal of detailed balance_ requires that at equilibirum each simple process should be balanced by its reverse process.\n\nThis puts constraints on the kinetic parameters which are often broken, for example, by setting $k^b_i = 0$ (no back reaction for that step).",
"_____no_output_____"
],
[
"An alternative is to think of kinetic parameters as derived from physical constants!\n\nFor instance:\n- Oster, G. and Perelson, A. and Katchalsy, A. *Network Thermodynamics*. Nature 1971; 234:5329. \n- Erderer, M. and Gilles, E. D. *Thermodynamically Feasible Kinetic Models of Reaction Networks*. Biophys J. 2007; 92(6): 1846–1857. \n- Saa, P. A. and Nielsen, L. K. *Construction of feasible and accurate kinetic models of metabolism: A Bayesian approach.* Sci Rep. 2016;6:29635.",
"_____no_output_____"
],
[
"# Part 2: A Solution via Network Thermodynamics",
"_____no_output_____"
],
[
"<center> <img src=\"images/map.png\"> </center>",
"_____no_output_____"
],
[
"### Network Thermodynamics\n\nPartitions $S + B = P$ into _components_.\n\n1. Energy Storage.\n2. Dissipative Processes.\n3. Conservation Laws.\n\nHere:\n- Chem. potential acts like _pressure_ or _voltage_.\n- Molar flow acts like _velocity_ or _current_.",
"_____no_output_____"
]
],
[
[
"# Reaction Network from BondGraphTools\nreaction = Reaction_Network(\n \"S + B = P\", name=\"One Step Reaction\"\n)\n\nmodel = reaction.as_network_model()\n \n# Basic Visualisation.\nfrom BondGraphTools import draw \nfigure = draw(model, size=(8,6))",
"_____no_output_____"
]
],
[
[
"### Kinetic parameters from Network Thermodynamics.",
"_____no_output_____"
],
[
"Partitions $S + B = P$ into _components_.\n\n1. Energy Storage Compartments: \n$S$, $B$ and $P$.\n2. Dissipative Processes: (The chemical reaction itself).\n3. Conservation Laws: (The flow from A is the flow from B and is equal to the flow into reaction).",
"_____no_output_____"
],
[
"Gibbs Energy:\n\n$$\\mathrm{d}G = P\\mathrm{d}v +S\\mathrm{d}T + \\sum_i\\mu_i\\mathrm{d}n_i$$\n\n- $\\mu_i$ is the Chemical Potential of species $A_i$\n- $n_i$ is the amount (in mols) of $A_i$",
"_____no_output_____"
],
[
"Chemical Potential is usually modelled as\n\n \n\n$$\\mu_i = PT\\ln\\left(\\frac{k_in_i}{V}\\right)$$ where $$k_i = \\frac{1}{c^\\text{ref}}\\exp\\left[\\frac{\\mu_i^\\text{ref}}{PT}\\right]$$",
"_____no_output_____"
],
[
" \n\n \n\n- $P$, $T$ and $V$ are pressure, temperature and volume respectively.\n- $c^\\text{ref}$ is the reference concentration (often $10^{-9} \\text{mol/L}$).\n- $\\mu_i^\\text{ref}$ is the reference potential.",
"_____no_output_____"
],
[
"<center><i> The reference potential can be tabulated, approximated and (in somecase) directly measured!</i> </center>",
"_____no_output_____"
],
[
"Reaction flow $v$ is assumed to obey the Marcelin-de Donder formula:\n\n$$ v \\propto \\exp\\left(\\frac{A_f}{PT}\\right) - \\exp\\left(\\frac{A_r}{PT}\\right)$$\n\nwhere $A_f, A_r$ are the forward and reverse chemical affinities.\n\nFor $S + B = P$, $$A_f = \\mu_S + \\mu_B \\quad \\text{and}\\quad A_r = \\mu_P.$$\n",
"_____no_output_____"
],
[
"### Kinetic parameters from Network Thermodynamics.\n\nFor the equation $S + B= P$, in thermodynamic parameters:\n \n\n$$\n\\dot{[P]} = \\kappa(k_Sk_B[S][B] - k_P[P])\n$$",
"_____no_output_____"
],
[
"Here $$k^f = \\kappa k_Sk_B, \\quad k^b = \\kappa k_P, \\quad \\text{with} \\quad k_i = \\frac{1}{c^\\text{ref}}\\exp\\left[\\frac{\\mu_i^\\text{ref}}{PT}\\right], \\quad \\kappa > 0.$$",
"_____no_output_____"
],
[
"*$k^f$ and $k^b$ are now related to physical constants!*",
"_____no_output_____"
],
[
"# Part 3: Network Thermodynamics with `BondGraphTools`",
"_____no_output_____"
],
[
"<center> <img src=\"images/map.png\"> </center>",
"_____no_output_____"
]
],
[
[
"import BondGraphTools\nhelp(BondGraphTools)",
"Help on package BondGraphTools:\n\nNAME\n BondGraphTools\n\nDESCRIPTION\n BondGraphTools\n ==============\n BondGraphTools is a python library for symbolic modelling and control of multi-physics\n systems using bond graphs. Bond graph modelling is a network base framework concerned\n with the distribution of energy and the flow of power through lumped-element or\n compartmental models of physical system.\n \n Package Documentation::\n \n https://bondgraphtools.readthedocs.io/\n \n Source::\n \n https://github.com/BondGraphTools/BondGraphTools\n \n Bug reports:\n \n https://github.com/BondGraphTools/BondGraphTools/issues\n \n \n Simple Example\n --------------\n \n Build and simulate a RLC driven RLC circuit::\n \n import BondGraphTools as bgt\n \n # Create a new model\n model = bgt.new(name=\"RLC\")\n \n # Create components\n # 1 Ohm Resistor\n resistor = bgt.new(\"R\", name=\"R1\", value=1.0)\n \n # 1 Henry Inductor\n inductor = bgt.new(\"L\", name=\"L1\", value=1.0)\n # 1 Farad Capacitor\n capacitor = bgt.new(\"C\", name=\"C1\", value=1.0)\n # Conservation Law\n law = bgt.new(\"0\") # Common voltage conservation law\n \n # Connect the components\n connect(law, resistor)\n connect(law, capacitor)\n connect(law, inductor)\n \n # produce timeseries data\n t, x = simulate(model, x0=[1,1], timespan=[0, 10])\n \n Bugs\n ----\n \n Please report any bugs `here <https://github.com/BondGraphTools/BondGraphTools/issues>`_,\n or fork the repository and submit a pull request.\n \n License\n -------\n Released under the Apache 2.0 License::\n \n Copyright (C) 2018\n Peter Cudmore <[email protected]>\n\nPACKAGE CONTENTS\n actions\n algebra\n atomic\n base\n component_manager\n compound\n config\n ds_model\n exceptions\n fileio\n port_hamiltonian\n reaction_builder\n sim_tools\n version\n view\n\nFILE\n /Users/pete/Workspace/BondGraphTools/BondGraphTools/__init__.py\n\n\n"
]
],
[
[
"### Network Energetics\nNetwork Energetics, which includes Network Thermodynamics partitions $S + B = P$ into _components_.\n\n1. Energy Storage Compartments: $C: S$, $C: B$ and $C: P$.\n2. Dissipative Processes: $R: r_{1;0}$\n3. Conservation Laws: $1$ (common flow).\n\n*Bond Graphs represent of energy networks.*",
"_____no_output_____"
]
],
[
[
"#from BondGraphTools.reaction_builder\n# import Reaction_Network\n\nreaction = Reaction_Network(\n \"S + B = P\", name=\"One Step Reaction\"\n)\nmodel = reaction.as_network_model()\n\n# Basic Visualisation.\nfrom BondGraphTools import draw \nfigure = draw(model, size=(8,6))\n",
"_____no_output_____"
],
[
"# Initialise latex printing\nfrom sympy import init_printing\ninit_printing() \n# Print the equations of motion\nmodel.constitutive_relations",
"_____no_output_____"
],
[
"figure",
"_____no_output_____"
],
[
"for v in model.state_vars:\n (component, local_v) = model.state_vars[v]\n meta_data = component.state_vars[local_v]\n print(f\"{v} is {component}\\'s {meta_data}\")",
"x_0 is C: S's Molar Amount\nx_1 is C: B's Molar Amount\nx_2 is C: P's Molar Amount\n"
],
[
"#\n#\nfigure",
"_____no_output_____"
]
],
[
[
"### A peak under the hood\n\nIn `BondGraphTools`, components have a number of power ports defined such that the power $P_i$ entering the $i$th port is $P_i = e_if_i$\n\nThe power vaiables $(e,f)$ are related to the component state variables $(x, \\mathrm{d}x)$ by _constitutive relations_.",
"_____no_output_____"
]
],
[
[
"from BondGraphTools import new\n\nchemical_potential = new(\"Ce\", library=\"BioChem\")\nchemical_potential.constitutive_relations",
"_____no_output_____"
],
[
"figure",
"_____no_output_____"
]
],
[
[
"##### A peak under the hood (cont.) \n\nThe harpoons represent _shared power variables_.\n\nFor example the harpoon from port 1 on $R: r_{1;0}$ to $C:P$ indiciates that\n\n\n$$\nf^{C:P}_0 = - f^{R:r_{1;0}}_1 \\qquad \ne^{C:P}_0 = e^{R:r_{1;0}}_1 \n$$\n \n\nso that power is conserved through the connection\n\n \n$$\nP^{C:P}_0 + P^{R:r_{1;0}}_1 = 0\n$$\n",
"_____no_output_____"
]
],
[
[
"figure",
"_____no_output_____"
]
],
[
[
"##### A peak under the hood (cont.)\nThe resulting system is of the form:\n$$\nLX + V(X) = 0\n$$ \n \nwhere \n\n$$\nX = \\left(\\frac{\\mathrm{d}\\mathbf{x}}{\\mathrm{d}t}, \n\\mathbf{e},\n\\mathbf{f}, \n\\mathbf{x},\n\\mathbf{u}\\right)^T\n$$\n \n- $\\mathbf{e},\\mathbf{f}$ vectors of power variables\n- $\\mathrm{d}\\mathbf{x}, \\mathbf{x}$ similarly state variables.\n- and $\\mathbf{u}$ control variables\n- $L$ is a sparse matrix\n- $V$ is a nonlinear vector field.",
"_____no_output_____"
],
[
"### So what does this have to do with parameters?\n\nHaving a network energetics library allows for:\n- automation via dataflow scripting (eq; `request`, `xlrd`),\n- 'computational modularity' for model/parameter reuse,\n- intergration with existing parameter estimators,\n- use with your favourite data analysis technology.\n\n*Enables the tabuation of paramaters!*",
"_____no_output_____"
],
[
"### Why Python?\n\n- open source, commonly available and commonly used\n- 'executable pseudocode' (easy to read) and excellent for rapid development\n- great libraries for both science and general purpose computing\n- excellent quality management tools\n- pacakge management, version control",
"_____no_output_____"
],
[
"*`BondGraphTools` is developed with sustainable development practices.*",
"_____no_output_____"
],
[
"## `BondGraphTools` now and in the future.",
"_____no_output_____"
],
[
"#### Current Version\n\nVersion 0.3.6 (on PyPI) is being used by in the Systems Biology Lab:\n- Prof. Peter Gawrthop (mitochondrial electron transport).\n- Michael Pan (ionic homeostasis).\n- Myself (coupled oscillators, synthetic biology)",
"_____no_output_____"
],
[
"#### Features Already Implemented\n- Component libraries, (mechotronic and biochem)\n- Numerical simulations,\n- Control variables,\n- Stiochiometric analysis",
"_____no_output_____"
],
[
"The big challenge: _scaling up_!",
"_____no_output_____"
],
[
"# Thanks for Listening!\nThanks to:\n- Prof. Edmund Crampin Prof. Peter Gawthrop, Michael Pan & The Systems Biology Lab. \n- The University of Melbourne \n- The ARC Center of Excellence for Convergent Bio-Nano Science.\n- ANZIAM Organisers and sessions chairs, and Victoria University.",
"_____no_output_____"
],
[
"Please check out `BondGraphTools` \n- documentation at [bondgraphtools.readthedocs.io](http://bondgraphtools.readthedocs.io)\n- source at [https://github.com/BondGraphTools](https://github.com/BondGraphTools)",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
]
] |
d0cc7f2c1c8adf95d3b61ab29c1bbab042c59287 | 793,720 | ipynb | Jupyter Notebook | nb_mlcy7.ipynb | vvb231/VinayProject | 3173d737128ba4c873cba3a573da0134fd341c7b | [
"MIT"
] | 1 | 2018-11-04T11:53:21.000Z | 2018-11-04T11:53:21.000Z | nb_mlcy7.ipynb | vvb231/ML-Cybersecurity-Project | 3ceb3e37369be08d4cefae909a77294f2a75cfb7 | [
"MIT"
] | null | null | null | nb_mlcy7.ipynb | vvb231/ML-Cybersecurity-Project | 3ceb3e37369be08d4cefae909a77294f2a75cfb7 | [
"MIT"
] | null | null | null | 1,119.492243 | 167,804 | 0.945613 | [
[
[
"# Naive-Bayes Classifier",
"_____no_output_____"
]
],
[
[
"#Baseline SVM with PCA classifier\nimport sklearn\nimport numpy as np\nimport sklearn.datasets as skd\nimport ast\nfrom sklearn.feature_extraction import DictVectorizer\nfrom sklearn import linear_model\nfrom sklearn import naive_bayes\nfrom sklearn.metrics import precision_recall_fscore_support\nfrom sklearn.neighbors.nearest_centroid import NearestCentroid\nfrom sklearn.metrics.pairwise import pairwise_distances\nfrom sklearn.metrics import confusion_matrix\nfrom scipy.sparse import vstack\nimport matplotlib.pyplot as plt\nimport itertools\n",
"_____no_output_____"
],
[
"import pickle\n\nfile = open(\"mr_train.obj\",'rb')\nmr_train = pickle.load(file)\nfile.close()\n\nfile = open(\"mr_test.obj\",'rb')\nmr_test = pickle.load(file)\nfile.close()\n\nfile = open(\"mr_cv.obj\",'rb')\nmr_cv = pickle.load(file)\nfile.close()\n\n'''\nfile = open(\"b_train.obj\",'rb')\nb = pickle.load(file)\nfile.close()\n\nfile = open(\"c_cv.obj\",'rb')\nc = pickle.load(file)\nfile.close()\n\nfile = open(\"d_test.obj\",'rb')\nd = pickle.load(file)\nfile.close()\n'''\n\nfile = open(\"x_train.obj\",'rb')\nx_train = pickle.load(file)\nfile.close()\n\n\nfile = open(\"x_test.obj\",'rb')\nx_test = pickle.load(file)\nfile.close()\n\nfile = open(\"x_cv.obj\",'rb')\nx_cv = pickle.load(file)\nfile.close()",
"_____no_output_____"
],
[
"def plot_confusion_matrix(cm, classes,\n normalize=False,\n title='Confusion matrix',\n cmap=plt.cm.Blues):\n plt.figure(figsize=(20,10))\n \"\"\"\n This function prints and plots the confusion matrix.\n Normalization can be applied by setting `normalize=True`.\n \"\"\"\n if normalize:\n cm = cm.astype('float') / cm.sum(axis=1)[:, np.newaxis]\n print(\"Normalized confusion matrix\")\n else:\n print('Confusion matrix, without normalization')\n\n print(cm)\n\n plt.imshow(cm, interpolation='nearest', cmap=cmap)\n plt.title(title)\n plt.colorbar()\n tick_marks = np.arange(len(classes))\n plt.xticks(tick_marks, classes, rotation=45,fontsize=10)\n plt.yticks(tick_marks, classes,fontsize=10)\n\n fmt = '.2f' if normalize else 'd'\n thresh = cm.max() / 2.\n for i, j in itertools.product(range(cm.shape[0]), range(cm.shape[1])):\n plt.text(j, i, format(cm[i, j], fmt),\n horizontalalignment=\"center\",\n color=\"white\" if cm[i, j] > thresh else \"black\")\n\n plt.tight_layout()\n plt.ylabel('True label')\n plt.xlabel('Predicted label')",
"_____no_output_____"
],
[
"\n\n\nprint(\"Training data has %d malware samples and %d features\" % (x_train.shape[0], x_train.shape[1]))\nprint(\"Crossval data has %d malware samples and %d features\" % (x_cv.shape[0], x_cv.shape[1]))\nprint(\"Test data has %d malware samples and %d features\" % (x_test.shape[0], x_test.shape[1]))\n\nprint(\"Performing IG Feature selection...\")\n\nindices=np.argsort(np.asarray(x_train.sum(axis=0)).ravel(),axis=0)[::-1]\nx_train_ig = x_train[:,indices]\nx_cv_ig = x_cv[:,indices]\nx_test_ig = x_test[:,indices]\n\nprint(\"Training NB Classifier with top 5000 IG features ...\")\nNB = sklearn.naive_bayes.MultinomialNB()\nNB.fit(x_train_ig,mr_train.target)\n\nprint(\"Obtaining predictions on test data...\")\ny_pred_cv=NB.predict(x_cv_ig)\ny_pred_test=NB.predict(x_test_ig)\n\nprec_cv, rec_cv, fsc_cv, sup_cv = precision_recall_fscore_support(mr_cv.target, y_pred_cv, average='weighted')\nprec_test, rec_test, fsc_test, sup_test = precision_recall_fscore_support(mr_test.target, y_pred_test, average='weighted')\n\nprint(\"Precision on crossval data is %.4f\" % prec_cv)\nprint(\"Recall on crossval data is %.4f\" % rec_cv)\nprint(\"Precision on test data is %.4f\" % prec_test)\nprint(\"Recall on test data is %.4f\" % rec_test)",
"Training data has 5757 malware samples and 425200 features\nCrossval data has 1237 malware samples and 425200 features\nTest data has 2067 malware samples and 425200 features\nPerforming IG Feature selection...\nTraining NB Classifier with top 5000 IG features ...\nObtaining predictions on test data...\nPrecision on crossval data is 0.9023\nRecall on crossval data is 0.8925\nPrecision on test data is 0.1149\nRecall on test data is 0.1190\n"
],
[
"#Distance measure to class centroids\n#Confusion Matrices\n\n\n\n\nprint(\"Finding class centroids and computing distance of samples to centroids\")\nclf = NearestCentroid()\nclf.fit(x_train_ig,mr_train.target)\n\ndist_train = pairwise_distances(x_train_ig, clf.centroids_)\ndist_test = pairwise_distances(x_test_ig, clf.centroids_)\n\nprint(\"Calculating drift_l2 thresholds...\")\nm = np.resize(np.array([]),8)\nvar = np.resize(np.array([]),8)\nthresh = np.resize(np.array([]),8)\nfor i in range(8):\n m[i] = np.mean(dist_train[np.where(np.argmin(dist_train,axis=1)==i)][:,i])\n var[i] = np.sqrt(np.std(dist_train[np.where(np.argmin(dist_train,axis=1)==i)][:,i]))\n thresh[i] = m[i]+var[i] \n \n\ntest_drift_l2 = np.resize(np.array([]),8)\ntest_total = np.resize(np.array([]),8)\ntest_d_per = np.resize(np.array([]),8)\n\n\"Calculating drift_l2 on test data with new classes...\"\nfor r in range(8):\n test_drift_l2[r]=sum(dist_test[np.where(np.argmin(dist_test,axis=1)==r)][:,r] > thresh[r])\n test_total[r]= sum(np.argmin(dist_test,axis=1)==r)\n if test_total[r]!=0:\n test_d_per[r]=test_drift_l2[r]/test_total[r]\n else:\n test_d_per[r]='nan'\n \nprint(\"In test set there are %d drift_l2ed malware of a total of %d samples, total drift_l2 percentage is %.4f\" % (sum(test_drift_l2), sum(test_total), sum(test_drift_l2)/sum(test_total)))\n\nprint(\"Selecting drift_l2ed malware samples from test set...\")\nind_array_test = np.array([])\nindices_test = np.array([])\n\nfor i in range(8):\n ind_array_test = np.where(np.argmin(dist_test,axis=1)==i)\n indices_test = np.append(indices_test,ind_array_test[0][dist_test[np.where(np.argmin(dist_test,axis=1)==i)][:,i] > thresh[i]])\n\nprint(\"Appending drift_l2ed malware samples from test set to training set, and re-labelling...\")\nx_train_drift_l2 = vstack([x_train_ig,x_test_ig[indices_test.astype(int)]])\nmr_train_drift_l2_target = np.append(mr_train.target,mr_test.target[indices_test.astype(int)],axis=0)\n\nprint(\"Training drift_l2-Aware SVM classifier with new training set...\")\nNB_drift_l2 = sklearn.naive_bayes.MultinomialNB()\nNB_drift_l2.fit(x_train_drift_l2,mr_train_drift_l2_target)\n\nprint(\"Computing predictions on test data with newly trained model...\")\ny_drift_l2 = NB_drift_l2.predict(x_test_ig)\n\nprec_drift_l2, rec_drift_l2, fsc_drift_l2, sup_drift_l2 = precision_recall_fscore_support(mr_test.target,y_drift_l2, average='weighted')\n\nprint(\"Precision on test data with new classes with original model was %.4f\" %prec_test)\nprint(\"Recall on test data with new classes with original model was %.4f\" %rec_test)\nprint(\"Precision on test data with new classes with concept drift_l2-aware model %.4f\" %prec_drift_l2)\nprint(\"Recall on test data with new classes with concept drift_l2-aware model %.4f\" %rec_drift_l2)\n\n",
"Finding class centroids and computing distance of samples to centroids\nCalculating drift_l2 thresholds...\nIn test set there are 699 drift_l2ed malware of a total of 1314 samples, total drift_l2 percentage is 0.5320\nSelecting drift_l2ed malware samples from test set...\nAppending drift_l2ed malware samples from test set to training set, and re-labelling...\nTraining drift_l2-Aware SVM classifier with new training set...\nComputing predictions on test data with newly trained model...\nPrecision on test data with new classes with original model was 0.1149\nRecall on test data with new classes with original model was 0.1190\nPrecision on test data with new classes with concept drift_l2-aware model 0.5921\nRecall on test data with new classes with concept drift_l2-aware model 0.4465\n"
],
[
"# Computing intersections of flagged samples and actual new class samples for l2 centroid drift\nintersection = np.intersect1d(np.sort(indices_test),np.flatnonzero(mr_test.target > 7))\nprint(intersection.shape)\nprint(\"Precision with mean + 1std threshold is %.4f, recall is %.4f, flagged samples are %d, percentage of samples flagged is %.4f and percentage of flagged samples that actually belong to new families is %.4f\" % (prec_drift_l2,rec_drift_l2,len(indices_test),np.double(len(indices_test))/np.double(len(mr_test.data)),np.double(intersection.shape[0])/np.double(np.flatnonzero(mr_test.target > 7).size)))\n",
"(489,)\nPrecision with mean + 1std threshold is 0.5921, recall is 0.4465, flagged samples are 699, percentage of samples flagged is 0.3382 and percentage of flagged samples that actually belong to new families is 0.3159\n"
],
[
"#Confusion Matrices\n\nplt.figure(figsize=(50,30))\n\nprint(\"Computing confusion matrices...\")\ncnf_matrix_cv = confusion_matrix(mr_cv.target, y_pred_cv)\ncnf_matrix_test = confusion_matrix(mr_test.target,y_pred_test)\ncnf_matrix_drift_l2 = confusion_matrix(mr_test.target,y_drift_l2)\n\n\nprint(\"Plotting confusion matrix for crossvalidation data\")\nnp.set_printoptions(precision=2)\nplt.figure()\nplot_confusion_matrix(cnf_matrix_cv, classes=mr_cv.target_names,\n title='Confusion matrix, without normalization, crossval data')\n\n# Plot normalized confusion matrix\nplt.figure()\nplot_confusion_matrix(cnf_matrix_cv, classes=mr_cv.target_names, normalize=True,\n title='Normalized confusion matrix, crossval data')\n\nplt.show()\n\nprint(\"Plotting confusion matrix for test data in base model\")\nnp.set_printoptions(precision=2)\nplt.figure()\nplot_confusion_matrix(cnf_matrix_test, classes=mr_test.target_names,\n title='Confusion matrix, without normalization, test data')\n\n# Plot normalized confusion matrix\nplt.figure()\nplot_confusion_matrix(cnf_matrix_test, classes=mr_test.target_names, normalize=True,\n title='Normalized confusion matrix, test data')\n\n\nplt.show()\n\nprint(\"Plotting confusion matrix for test data in drift-aware l2 model\")\nnp.set_printoptions(precision=2)\nplt.figure()\nplot_confusion_matrix(cnf_matrix_drift_l2, classes=mr_test.target_names,\n title='Confusion matrix, without normalization, l2 model')\n\n# Plot normalized confusion matrix\nplt.figure()\nplot_confusion_matrix(cnf_matrix_drift_l2, classes=mr_test.target_names, normalize=True,\n title='Normalized confusion matrix, l2 model')\n\nplt.show()",
"Computing confusion matrices...\nPlotting confusion matrix for crossvalidation data\nConfusion matrix, without normalization\n[[ 28 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0]\n [ 1 138 0 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0\n 1 0 0 0 5 1 0]\n [ 0 0 27 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1\n 0 0 0 0 0 3 0]\n [ 0 0 0 42 2 2 0 0 0 1 0 0 0 0 0 0 0 0\n 0 0 0 0 0 5 1]\n [ 0 0 0 0 18 0 0 0 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0]\n [ 0 0 0 0 0 40 0 0 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0]\n [ 0 0 0 0 0 1 143 0 0 0 0 2 0 0 0 0 0 0\n 0 0 0 1 0 3 0]\n [ 0 0 0 0 0 0 0 17 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 0 0 0]\n [ 0 0 0 0 1 1 1 0 9 0 2 0 0 0 0 0 0 0\n 0 0 0 0 0 0 1]\n [ 0 0 3 0 0 1 1 0 0 19 0 0 0 0 0 0 0 0\n 0 0 0 0 0 1 0]\n [ 0 0 0 0 0 0 0 0 1 0 25 0 0 0 0 0 0 0\n 0 3 0 0 1 0 0]\n [ 0 0 0 0 0 0 0 0 0 0 0 31 0 0 0 0 0 0\n 0 0 0 0 0 1 0]\n [ 0 0 0 0 0 0 0 0 0 0 0 0 15 0 0 0 0 0\n 0 0 0 0 0 0 0]\n [ 0 0 0 0 0 0 0 0 0 0 0 0 0 22 0 0 0 0\n 0 0 0 0 0 1 0]\n [ 0 0 0 0 1 0 0 0 3 2 0 0 0 4 14 0 7 0\n 0 0 0 1 1 4 0]\n [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 111 0 0\n 0 0 0 0 0 0 0]\n [ 0 0 0 0 0 0 0 0 2 1 0 0 0 0 0 0 16 0\n 0 0 0 0 0 0 0]\n [ 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 48\n 0 0 0 0 0 1 0]\n [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n 28 0 0 0 0 0 0]\n [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n 0 22 0 0 0 0 0]\n [ 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0\n 0 0 50 0 0 0 0]\n [ 5 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0\n 0 0 0 32 0 1 0]\n [ 0 0 0 0 0 0 1 0 0 1 0 1 0 0 1 0 1 0\n 0 0 0 0 76 0 0]\n [ 0 0 1 0 0 0 8 0 0 0 0 0 0 0 0 0 0 0\n 0 0 0 0 2 120 17]\n [ 0 0 0 0 0 3 0 0 1 0 0 0 0 0 0 0 0 0\n 0 0 0 0 1 4 13]]\nNormalized confusion matrix\n[[ 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]\n [ 0.01 0.92 0. 0.01 0.01 0. 0. 0.01 0. 0.01 0. 0. 0.\n 0. 0. 0. 0. 0. 0.01 0. 0. 0. 0.03 0.01 0. ]\n [ 0. 0. 0.82 0. 0. 0. 0.03 0. 0. 0. 0. 0. 0.\n 0. 0. 0. 0.03 0.03 0. 0. 0. 0. 0. 0.09 0. ]\n [ 0. 0. 0. 0.79 0.04 0.04 0. 0. 0. 0.02 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.09 0.02]\n [ 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]\n [ 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]\n [ 0. 0. 0. 0. 0. 0.01 0.95 0. 0. 0. 0. 0.01\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.01 0. 0.02\n 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]\n [ 0. 0. 0. 0. 0.07 0.07 0.07 0. 0.6 0. 0.13 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.07]\n [ 0. 0. 0.12 0. 0. 0.04 0.04 0. 0. 0.76 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.04 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0.03 0. 0.83 0. 0.\n 0. 0. 0. 0. 0. 0. 0.1 0. 0. 0.03 0. 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.97\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.03\n 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 1.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n 0.96 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.04 0. ]\n [ 0. 0. 0. 0. 0.03 0. 0. 0. 0.08 0.05 0. 0. 0.\n 0.11 0.38 0. 0.19 0. 0. 0. 0. 0.03 0.03 0.11 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n 0. 0. 1. 0. 0. 0. 0. 0. 0. 0. 0. 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0.11 0.05 0. 0. 0.\n 0. 0. 0. 0.84 0. 0. 0. 0. 0. 0. 0. 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0.02 0. 0. 0. 0.\n 0. 0. 0. 0. 0.96 0. 0. 0. 0. 0. 0.02 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. 0. ]\n [ 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 1. 0. 0. 0. 0. ]\n [ 0.12 0. 0. 0. 0.03 0. 0. 0. 0. 0.03 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0.8 0. 0.03 0. ]\n [ 0. 0. 0. 0. 0. 0. 0.01 0. 0. 0.01 0. 0.01\n 0. 0. 0.01 0. 0.01 0. 0. 0. 0. 0. 0.94 0. 0. ]\n [ 0. 0. 0.01 0. 0. 0. 0.05 0. 0. 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.01 0.81 0.11]\n [ 0. 0. 0. 0. 0. 0.14 0. 0. 0.05 0. 0. 0. 0.\n 0. 0. 0. 0. 0. 0. 0. 0. 0. 0.05 0.18 0.59]]\n"
],
[
"from sklearn.metrics import confusion_matrix\nC = confusion_matrix(mr_test.target_names,cnf_matrix_drift_l2)\n\n# Normalize the confusion matrix\nCsum = np.sum(C,1)\nC = C / Csum[None,:]\n\n# Print the confusion matrix\nprint(np.array_str(C, precision=3, suppress_small=True))\nplt.imshow(C, interpolation='none')\nplt.colorbar()",
"_____no_output_____"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cc8416f6ae60938f4e2c2d965d14b1d9df90bc | 17,017 | ipynb | Jupyter Notebook | .ipynb_checkpoints/whale_analysis-checkpoint.ipynb | globalproweb/Unit-4-Homework | 92b2afa3e5d8ab7952e9388da129cc35eb6d1163 | [
"ADSL"
] | null | null | null | .ipynb_checkpoints/whale_analysis-checkpoint.ipynb | globalproweb/Unit-4-Homework | 92b2afa3e5d8ab7952e9388da129cc35eb6d1163 | [
"ADSL"
] | null | null | null | .ipynb_checkpoints/whale_analysis-checkpoint.ipynb | globalproweb/Unit-4-Homework | 92b2afa3e5d8ab7952e9388da129cc35eb6d1163 | [
"ADSL"
] | null | null | null | 22.157552 | 348 | 0.557031 | [
[
[
" # A Whale off the Port(folio)\n ---\n\n In this assignment, you'll get to use what you've learned this week to evaluate the performance among various algorithmic, hedge, and mutual fund portfolios and compare them against the S&P 500 Index.",
"_____no_output_____"
]
],
[
[
"# Initial imports\nimport pandas as pd\nimport numpy as np\nimport datetime as dt\nfrom pathlib import Path\n\n%matplotlib inline",
"_____no_output_____"
]
],
[
[
"# Data Cleaning\n\nIn this section, you will need to read the CSV files into DataFrames and perform any necessary data cleaning steps. After cleaning, combine all DataFrames into a single DataFrame.\n\nFiles:\n\n* `whale_returns.csv`: Contains returns of some famous \"whale\" investors' portfolios.\n\n* `algo_returns.csv`: Contains returns from the in-house trading algorithms from Harold's company.\n\n* `sp500_history.csv`: Contains historical closing prices of the S&P 500 Index.",
"_____no_output_____"
],
[
"## Whale Returns\n\nRead the Whale Portfolio daily returns and clean the data",
"_____no_output_____"
]
],
[
[
"# Reading whale returns\n",
"_____no_output_____"
],
[
"# Count nulls\n",
"_____no_output_____"
],
[
"# Drop nulls\n",
"_____no_output_____"
]
],
[
[
"## Algorithmic Daily Returns\n\nRead the algorithmic daily returns and clean the data",
"_____no_output_____"
]
],
[
[
"# Reading algorithmic returns\n",
"_____no_output_____"
],
[
"# Count nulls\n",
"_____no_output_____"
],
[
"# Drop nulls\n",
"_____no_output_____"
]
],
[
[
"## S&P 500 Returns\n\nRead the S&P 500 historic closing prices and create a new daily returns DataFrame from the data. ",
"_____no_output_____"
]
],
[
[
"# Reading S&P 500 Closing Prices\n",
"_____no_output_____"
],
[
"# Check Data Types\n",
"_____no_output_____"
],
[
"# Fix Data Types\n",
"_____no_output_____"
],
[
"# Calculate Daily Returns\n",
"_____no_output_____"
],
[
"# Drop nulls\n",
"_____no_output_____"
],
[
"# Rename `Close` Column to be specific to this portfolio.\n",
"_____no_output_____"
]
],
[
[
"## Combine Whale, Algorithmic, and S&P 500 Returns",
"_____no_output_____"
]
],
[
[
"# Join Whale Returns, Algorithmic Returns, and the S&P 500 Returns into a single DataFrame with columns for each portfolio's returns.\n",
"_____no_output_____"
]
],
[
[
"---",
"_____no_output_____"
],
[
"# Conduct Quantitative Analysis\n\nIn this section, you will calculate and visualize performance and risk metrics for the portfolios.",
"_____no_output_____"
],
[
"## Performance Anlysis\n\n#### Calculate and Plot the daily returns.",
"_____no_output_____"
]
],
[
[
"# Plot daily returns of all portfolios\n",
"_____no_output_____"
]
],
[
[
"#### Calculate and Plot cumulative returns.",
"_____no_output_____"
]
],
[
[
"# Calculate cumulative returns of all portfolios\n\n# Plot cumulative returns\n",
"_____no_output_____"
]
],
[
[
"---",
"_____no_output_____"
],
[
"## Risk Analysis\n\nDetermine the _risk_ of each portfolio:\n\n1. Create a box plot for each portfolio. \n2. Calculate the standard deviation for all portfolios\n4. Determine which portfolios are riskier than the S&P 500\n5. Calculate the Annualized Standard Deviation",
"_____no_output_____"
],
[
"### Create a box plot for each portfolio\n",
"_____no_output_____"
]
],
[
[
"# Box plot to visually show risk\n",
"_____no_output_____"
]
],
[
[
"### Calculate Standard Deviations",
"_____no_output_____"
]
],
[
[
"# Calculate the daily standard deviations of all portfolios\n",
"_____no_output_____"
]
],
[
[
"### Determine which portfolios are riskier than the S&P 500",
"_____no_output_____"
]
],
[
[
"# Calculate the daily standard deviation of S&P 500\n\n# Determine which portfolios are riskier than the S&P 500\n",
"_____no_output_____"
]
],
[
[
"### Calculate the Annualized Standard Deviation",
"_____no_output_____"
]
],
[
[
"# Calculate the annualized standard deviation (252 trading days)\n",
"_____no_output_____"
]
],
[
[
"---",
"_____no_output_____"
],
[
"## Rolling Statistics\n\nRisk changes over time. Analyze the rolling statistics for Risk and Beta. \n\n1. Calculate and plot the rolling standard deviation for all portfolios using a 21-day window\n2. Calculate the correlation between each stock to determine which portfolios may mimick the S&P 500\n3. Choose one portfolio, then calculate and plot the 60-day rolling beta between it and the S&P 500",
"_____no_output_____"
],
[
"### Calculate and plot rolling `std` for all portfolios with 21-day window",
"_____no_output_____"
]
],
[
[
"# Calculate the rolling standard deviation for all portfolios using a 21-day window\n\n# Plot the rolling standard deviation\n",
"_____no_output_____"
]
],
[
[
"### Calculate and plot the correlation",
"_____no_output_____"
]
],
[
[
"# Calculate the correlation\n\n# Display de correlation matrix\n",
"_____no_output_____"
]
],
[
[
"### Calculate and Plot Beta for a chosen portfolio and the S&P 500",
"_____no_output_____"
]
],
[
[
"# Calculate covariance of a single portfolio\n\n# Calculate variance of S&P 500\n\n# Computing beta\n\n# Plot beta trend\n",
"_____no_output_____"
]
],
[
[
"## Rolling Statistics Challenge: Exponentially Weighted Average \n\nAn alternative way to calculate a rolling window is to take the exponentially weighted moving average. This is like a moving window average, but it assigns greater importance to more recent observations. Try calculating the [`ewm`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.ewm.html) with a 21-day half-life.",
"_____no_output_____"
]
],
[
[
"# Use `ewm` to calculate the rolling window\n",
"_____no_output_____"
]
],
[
[
"---",
"_____no_output_____"
],
[
"# Sharpe Ratios\nIn reality, investment managers and thier institutional investors look at the ratio of return-to-risk, and not just returns alone. After all, if you could invest in one of two portfolios, and each offered the same 10% return, yet one offered lower risk, you'd take that one, right?\n\n### Using the daily returns, calculate and visualize the Sharpe ratios using a bar plot",
"_____no_output_____"
]
],
[
[
"# Annualized Sharpe Ratios\n",
"_____no_output_____"
],
[
"# Visualize the sharpe ratios as a bar plot\n",
"_____no_output_____"
]
],
[
[
"### Determine whether the algorithmic strategies outperform both the market (S&P 500) and the whales portfolios.\n\nWrite your answer here!",
"_____no_output_____"
],
[
"---",
"_____no_output_____"
],
[
"# Create Custom Portfolio\n\nIn this section, you will build your own portfolio of stocks, calculate the returns, and compare the results to the Whale Portfolios and the S&P 500. \n\n1. Choose 3-5 custom stocks with at last 1 year's worth of historic prices and create a DataFrame of the closing prices and dates for each stock.\n2. Calculate the weighted returns for the portfolio assuming an equal number of shares for each stock\n3. Join your portfolio returns to the DataFrame that contains all of the portfolio returns\n4. Re-run the performance and risk analysis with your portfolio to see how it compares to the others\n5. Include correlation analysis to determine which stocks (if any) are correlated",
"_____no_output_____"
],
[
"## Choose 3-5 custom stocks with at last 1 year's worth of historic prices and create a DataFrame of the closing prices and dates for each stock.\n\nFor this demo solution, we fetch data from three companies listes in the S&P 500 index.\n\n* `GOOG` - [Google, LLC](https://en.wikipedia.org/wiki/Google)\n\n* `AAPL` - [Apple Inc.](https://en.wikipedia.org/wiki/Apple_Inc.)\n\n* `COST` - [Costco Wholesale Corporation](https://en.wikipedia.org/wiki/Costco)",
"_____no_output_____"
]
],
[
[
"# Reading data from 1st stock\n",
"_____no_output_____"
],
[
"# Reading data from 2nd stock\n",
"_____no_output_____"
],
[
"# Reading data from 3rd stock\n",
"_____no_output_____"
],
[
"# Combine all stocks in a single DataFrame\n",
"_____no_output_____"
],
[
"# Reset Date index\n",
"_____no_output_____"
],
[
"# Reorganize portfolio data by having a column per symbol\n",
"_____no_output_____"
],
[
"# Calculate daily returns\n\n# Drop NAs\n\n# Display sample data\n",
"_____no_output_____"
]
],
[
[
"## Calculate the weighted returns for the portfolio assuming an equal number of shares for each stock",
"_____no_output_____"
]
],
[
[
"# Set weights\nweights = [1/3, 1/3, 1/3]\n\n# Calculate portfolio return\n\n# Display sample data\n",
"_____no_output_____"
]
],
[
[
"## Join your portfolio returns to the DataFrame that contains all of the portfolio returns",
"_____no_output_____"
]
],
[
[
"# Join your returns DataFrame to the original returns DataFrame\n",
"_____no_output_____"
],
[
"# Only compare dates where return data exists for all the stocks (drop NaNs)\n",
"_____no_output_____"
]
],
[
[
"## Re-run the risk analysis with your portfolio to see how it compares to the others",
"_____no_output_____"
],
[
"### Calculate the Annualized Standard Deviation",
"_____no_output_____"
]
],
[
[
"# Calculate the annualized `std`\n",
"_____no_output_____"
]
],
[
[
"### Calculate and plot rolling `std` with 21-day window",
"_____no_output_____"
]
],
[
[
"# Calculate rolling standard deviation\n\n# Plot rolling standard deviation\n",
"_____no_output_____"
]
],
[
[
"### Calculate and plot the correlation",
"_____no_output_____"
]
],
[
[
"# Calculate and plot the correlation\n",
"_____no_output_____"
]
],
[
[
"### Calculate and Plot Rolling 60-day Beta for Your Portfolio compared to the S&P 500",
"_____no_output_____"
]
],
[
[
"# Calculate and plot Beta\n",
"_____no_output_____"
]
],
[
[
"### Using the daily returns, calculate and visualize the Sharpe ratios using a bar plot",
"_____no_output_____"
]
],
[
[
"# Calculate Annualzied Sharpe Ratios\n",
"_____no_output_____"
],
[
"# Visualize the sharpe ratios as a bar plot\n",
"_____no_output_____"
]
],
[
[
"### How does your portfolio do?\n\nWrite your answer here!",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0cc8d23027b755ab7a6ddef508aff97157b4423 | 5,222 | ipynb | Jupyter Notebook | ipynb/Germany-Nordrhein-Westfalen-SK-Mülheim-a.d.Ruhr.ipynb | oscovida/oscovida.github.io | c74d6da79feda1b5ccce107ad3acd48cf0e74c1c | [
"CC-BY-4.0"
] | 2 | 2020-06-19T09:16:14.000Z | 2021-01-24T17:47:56.000Z | ipynb/Germany-Nordrhein-Westfalen-SK-Mülheim-a.d.Ruhr.ipynb | oscovida/oscovida.github.io | c74d6da79feda1b5ccce107ad3acd48cf0e74c1c | [
"CC-BY-4.0"
] | 8 | 2020-04-20T16:49:49.000Z | 2021-12-25T16:54:19.000Z | ipynb/Germany-Nordrhein-Westfalen-SK-Mülheim-a.d.Ruhr.ipynb | oscovida/oscovida.github.io | c74d6da79feda1b5ccce107ad3acd48cf0e74c1c | [
"CC-BY-4.0"
] | 4 | 2020-04-20T13:24:45.000Z | 2021-01-29T11:12:12.000Z | 31.269461 | 206 | 0.529108 | [
[
[
"# Germany: SK Mülheim a.d.Ruhr (Nordrhein-Westfalen)\n\n* Homepage of project: https://oscovida.github.io\n* Plots are explained at http://oscovida.github.io/plots.html\n* [Execute this Jupyter Notebook using myBinder](https://mybinder.org/v2/gh/oscovida/binder/master?filepath=ipynb/Germany-Nordrhein-Westfalen-SK-Mülheim-a.d.Ruhr.ipynb)",
"_____no_output_____"
]
],
[
[
"import datetime\nimport time\n\nstart = datetime.datetime.now()\nprint(f\"Notebook executed on: {start.strftime('%d/%m/%Y %H:%M:%S%Z')} {time.tzname[time.daylight]}\")",
"_____no_output_____"
],
[
"%config InlineBackend.figure_formats = ['svg']\nfrom oscovida import *",
"_____no_output_____"
],
[
"overview(country=\"Germany\", subregion=\"SK Mülheim a.d.Ruhr\", weeks=5);",
"_____no_output_____"
],
[
"overview(country=\"Germany\", subregion=\"SK Mülheim a.d.Ruhr\");",
"_____no_output_____"
],
[
"compare_plot(country=\"Germany\", subregion=\"SK Mülheim a.d.Ruhr\", dates=\"2020-03-15:\");\n",
"_____no_output_____"
],
[
"# load the data\ncases, deaths = germany_get_region(landkreis=\"SK Mülheim a.d.Ruhr\")\n\n# get population of the region for future normalisation:\ninhabitants = population(country=\"Germany\", subregion=\"SK Mülheim a.d.Ruhr\")\nprint(f'Population of country=\"Germany\", subregion=\"SK Mülheim a.d.Ruhr\": {inhabitants} people')\n\n# compose into one table\ntable = compose_dataframe_summary(cases, deaths)\n\n# show tables with up to 1000 rows\npd.set_option(\"max_rows\", 1000)\n\n# display the table\ntable",
"_____no_output_____"
]
],
[
[
"# Explore the data in your web browser\n\n- If you want to execute this notebook, [click here to use myBinder](https://mybinder.org/v2/gh/oscovida/binder/master?filepath=ipynb/Germany-Nordrhein-Westfalen-SK-Mülheim-a.d.Ruhr.ipynb)\n- and wait (~1 to 2 minutes)\n- Then press SHIFT+RETURN to advance code cell to code cell\n- See http://jupyter.org for more details on how to use Jupyter Notebook",
"_____no_output_____"
],
[
"# Acknowledgements:\n\n- Johns Hopkins University provides data for countries\n- Robert Koch Institute provides data for within Germany\n- Atlo Team for gathering and providing data from Hungary (https://atlo.team/koronamonitor/)\n- Open source and scientific computing community for the data tools\n- Github for hosting repository and html files\n- Project Jupyter for the Notebook and binder service\n- The H2020 project Photon and Neutron Open Science Cloud ([PaNOSC](https://www.panosc.eu/))\n\n--------------------",
"_____no_output_____"
]
],
[
[
"print(f\"Download of data from Johns Hopkins university: cases at {fetch_cases_last_execution()} and \"\n f\"deaths at {fetch_deaths_last_execution()}.\")",
"_____no_output_____"
],
[
"# to force a fresh download of data, run \"clear_cache()\"",
"_____no_output_____"
],
[
"print(f\"Notebook execution took: {datetime.datetime.now()-start}\")\n",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
]
] |
d0cc8fbc94bf75d3b88bdf8eebc3e9fe897b007f | 18,408 | ipynb | Jupyter Notebook | _build/jupyter_execute/content/Module01/M01_N01_Probability_Recap.ipynb | cdds-uiuc/simles-book | 79f0fe1133d44f6b94b4bdcd0f05ff65434240c9 | [
"CC0-1.0"
] | null | null | null | _build/jupyter_execute/content/Module01/M01_N01_Probability_Recap.ipynb | cdds-uiuc/simles-book | 79f0fe1133d44f6b94b4bdcd0f05ff65434240c9 | [
"CC0-1.0"
] | null | null | null | _build/jupyter_execute/content/Module01/M01_N01_Probability_Recap.ipynb | cdds-uiuc/simles-book | 79f0fe1133d44f6b94b4bdcd0f05ff65434240c9 | [
"CC0-1.0"
] | null | null | null | 58.624204 | 995 | 0.626412 | [
[
[
"# Basics of probability",
"_____no_output_____"
],
[
"We'll start by reviewing some basics of probability theory. I will use some simple examples - dice and roullete - to illustrate basic probability concepts. We'll also use these simple examples to build intuition on several properties of probabilities - the law of total probability, independence, conditional probability, and Bayes's rule - that can be generalized, and will be used throughout the course. \n\n\n# Probability Spaces\n\nTo work with probabilites we need to define three things:\n1. A sample space, $\\Omega$\n2. An event space, $\\mathcal F$\n3. A probability function, $P$\n\nRead more about probability spaces on <a href=\"https://en.wikipedia.org/wiki/Probability_space\"> Wikipedia</a>\n\n## Discrete Sample Space\n**Roulette**\nA simple example to illustrate the concept or probability spaces is the roullete. Here we'll consider an American Roullete with 38 equally-probably numbers.\n\n\n\n- ***Sample Space***:<br>\n The sample space is the space of all possible outcomes.\n \n$$\\Omega=\\{\\color{green}{00},\\color{green}0,\\color{red}1,2,\\color{red}3,4,\\ldots, \\color{red}{36}\\}$$\n\n- ***Event Space:***<br>\n The event space is the set of all subsets of the sample space: \n \n$$\\mathcal F=\\left\\{\n\\{\\color{green}{00}\\},\n\\{\\color{green}{0}\\},\n\\{\\color{red}1\\},\n\\{2\\},\\{\\color{red}3\\}\\ldots,\n\\{\\color{green}{00},\\color{green}0\\},\\ldots,\n\\{ \\color{red}1,\\ldots, \n\\color{red}36\\}\\right\\}$$\n\n- ***Probability:***<br>\n For a roullete the probability is defined as $P=1/38$ for each of the 38 possible outcomes in the sample space. Each event also has an associated probability \n\nWe note a couple of things. The Sample space and the event space do not uniquely define the probability. For example, we could have a biased roullete (perhaps using a magnet and a metal ball), such that the ball is more likely to fall on particular numbers. In that case, the probability of individual outcomes in the sample space may not be equal. However, as we discusss more below, the total sum of probabilities across the possible outcomes still has to equal 1, unless there is a chance that the ball falls off the roullete table and none of the outcomes is hit. \n\nNote also that outcomes are different from events. A single outcome, e.g. a roullete roll of $\\color{green}{00}$ is associated with multiple possible events. It helps to think of an event as a possible bet , and the event space as *the space of all possible bets*. Any bet you make on the roullete can be expressed as a subset of $\\mathcal F$, and has a probability associated with it. \n\nFor example, consider a bet on a single number (e.g. on $\\color{red}7$), also called a straight-up bet. This event is equivalent to the outcome of the roullete being in the set $E_1=\\{\\color{red}1\\}$. The probability of this event is $P(E_1)$=1/38.\n\n\n\nAlternatively consider a bet on red. This event is equivalent to the outcome being in $E_2=\\left\\{\\color{red}{1},\\color{red}{2},\\color{red}{3},\\ldots,\\color{red}{36}\\right\\}$, and its probability is $P(E_2)=18/38$.\n\n\n\n*Note*: Formally, the event space is a $\\sigma$-algebra, and the probability function is a measure.\n\n## Infinite Sample Spaces\nWhy do we need to go through these definitions of event spaces and sample spaces? For probability spaces with a finite number of possibl outcomes we can assign a probability to each outcome and it becomes trivial to compute the probability of events. However, that is no longer the case when we start working with infinite sample spaces, such as an interval on the real line. For example, if the sample space of a random process is the interval $\\Omega=[0,1]\\in \\mathbb R$, there are an infinite number of possible outcomes, and thus not all of them can have finite (non-zero) probability. In that case, we can only assign finite probabilities to sub-intervals, or subsets of the sample space. In other words, *in the most general case we can only assign finite probabilities to member of the event space $\\mathcal E$*. However, the same rules of probabilites apply for both infinite and finite samples spaces, and it is easier to get an intuition for them on small, finite spaces. \n\nFor purposes of this class, we don't need to worry about probability spaces, event spaces, and probability functions. However, simple examples such as these are useful in illustrating some very general properties of probabilities that we *will* use extensively in the class, especially in the chapters on statistical inference and Bayesian data analysis. ",
"_____no_output_____"
],
[
"<hr style=\"border:1px solid black\n \"> </hr>",
"_____no_output_____"
],
[
"# Calculus of Probabilities\n## Combining probabilities\nThe probability of roullete bets illustrates a general rule about combining probabilities. How do we compute the probability of an event? Consider two friends Alice and Bob, betting on the roullete, and say we want to compute the probability that at least one of them wins. We'll call this event $E$. \n\nFirst, let's say each of them bets one of the green zeros. Rolling a green zero is equivalent to rolling either $\\color{green}0$ OR $\\color{green}{00}$. The two friends going home with some money is associated with the subset $E=\\{\\color{green}0,\\color{green}{00}\\}$of the event space. If we allso associate Alice winning with event $A$ with rolling $\\color{green}{00}$ and Bob winning event $B$ with rolling $\\color{green}{00}$, we can write: \n\n$$P(E)=P(A \\text{ OR } B)\\equiv P(A \\lor B)$$\n\nNotice that \n- $\\{\\color{green}{00,0}\\}$=$\\{\\color{green}{00}\\}\\cup\\{\\color{green}{0}\\}$\n- $\\{\\color{green}{00}\\}\\cap\\{\\color{green}{0}\\}=0$\n- $P(\\{\\color{green}{00}\\}\\cup\\{\\color{green}{0}\\})=P(\\{\\color{green}{00}\\})+P(\\{\\color{green}{0}\\})$\n\nOn the other hand, consider a case where Alice bets on all the numbers between $1-6$, with win probability $P(A)=6/38$ and the Bob bets on his favourite numbers, $3$ and $33$, with win probability $P(B)=2/38$ Them winning something is associated with $E=\\{1,2,3,4,5,6,33\\}$, with $P(E)=7/38$. Notice that in thise $P(E)\\neq P(A)+P(B)$\n\n\n```{important}\nThus, the general rule of combining probabilities is:\n$$P(A \\text{ OR } B)=P(A \\cup B)=P(A)+P(B)-P(A\\cap B)$$\n\nwith \n\n$$P(A \\text{ OR } B)=P(A \\cup B)=P(A)+P(B)\\text{, if } P(A\\cap B)=\\phi$$\n```\n\n\n## Valid Probability Functions\nIn order for a function on the event space to be a valid probability function, it neeeds to obey the following properties \n\n```{important}\n\n- $P:\\Omega \\rightarrow [0,1]$\n- $P(\\phi)=0$, where $\\phi$ is the null-set\n- $P(\\Omega)=1$\n- If $E_1$ and and $E_2$ are mutually exclusive events (i.e. $E_1 \\cap E_2=\\phi$), then the probability of $E_1$ OR $E_2$ occuring is \n\n $$P(E_1 \\text{ OR } E_2)=P(E_1\\cup E_2)=P(E_1)+P(E_2)$$\n```\n\n \n## Joint Probabilities\nThe joint probability of two events is the probability of both being true simultaneously. Consider the probability of both Alice AND Bob winning. We would denote this as \n\n$$P(A\\text{ AND }B)\\equiv P(A\\land B)\\equiv P(A,B)$$\n\nThe latter notation is the one we will be using a lot throughout the course. If each of them bets on one of the zeros, and there is thus no overlap between their bets, the probability of both winning is zero. In the second case, where Alice bets on $1$ through $6$ and Bob bets on $3$ and $33$, the probability of both of them winning is the probability of rolling a $3$, whith the intersection of the two events. This is a general rule of probability calculus:\n\n```{imporatant}\nThe joint probability of two events is the probability of their intersection:\n- $P(A,B)=P(A\\cap B)$\n- $P(A,B)=0 \\text{ if } A\\cap B=\\phi$, and we would say that $A$ and $B$ are mutually exclusive\n```",
"_____no_output_____"
],
[
"<hr style=\"border:1px solid black\n \"> </hr>",
"_____no_output_____"
],
[
"# Conditional Probabilities & Independence\nHere we'll review some definitions and properties of conditional probabilities and independence that we will use throughout the course. This is more easily done when we have two random processes occuring simultaneously. So we will consider the roll of two independent and *fair* dice. \n\nThe sample space, $\\Omega$ is illustrated by the following table: \n\n\n\nThe event space is the set of all subsets of $\\Omega$ and the probability function for a fair dice is a constant functoin $P=1/36$. \n\nFor example the *event* $E$=\"a total roll of 3\" is the intersection of two different outcome \"red dice rolls 1 and greeen dice rolls 2\" is different from \"red dice rolls 2 and green dice rolls 1\", i.e. $\\{\\color{red}1,\\color{green}2\\} ,\\{\\color{green}2,\\color{red}1\\}$ The probability of rolling a 3 is thus $P(\\{\\color{red}1,\\color{green}2\\})+P(\\{\\color{green}1,\\color{red}2)\\}=2/36$.\n\nWe can also define events applicable to a single dice. For example, \"the red dice rolled a 1\". The probability of the red dice rolling a 1 is 1/6, and it can also be written as the union of all the six outcomes in which the red dice rolls 1. \n\n## Independent Events\n\nThe role of one dice should not affect the role of the other. The two dice are ***independent***. \n\nExample: what is the probability of rolling a <span style=\"color:blue\">⚅</span> <span style=\"color:red\">⚅</span> is 1/36. It is also the probability of rolling both a <span style=\"color:blue\">⚅</span> and a <span style=\"color:red\">⚅</span> at the same time. The probability for each dice 1/6, so their combined probability is \n\n$P($<span style=\"color:blue\">⚅</span> <span style=\"color:red\">⚅</span>$)=P($<span style=\"color:blue\">⚅</span>$)P($<span style=\"color:red\">⚅</span>$)$\n\n```{important}\n\n<b>Definition</b>: Two events are independent iff:\n\n$$P(A \\text{ AND } B)=P(A,B)=P(A)P(B)$$\n```\n\n\nFun sidenote: although it's harder, we can define independent events for a single dice! Consider the two events:\n- A: \"Green dice rolled even\" with probability $P(A)=1/2$\n- B: \"Green dice rolled less than three\", with probability $P(B)=1/3$<br>\n\nThe joint probability of both events happening is the probability of the dice rolling a 2, so it is $P(A,B)=1/6=P(A)P(B)$ \n\n\n\n## Conditional Probability\nConsider the previous example, with two independent events. How can two events on the same dice be independent? It's easier to think through this process sequentially, or *conditionally*. Think of the probability of both \"rolling even\" and \"rolling less than three\" as \"the probability of rolling even\" and, subsequently, also \"rolling less than three\". The truth values of those statemetns do not change if you look at them one at a time. \n\nIf you roll even, the probability of rolling less than 3 is 1/3, i.e. the probability of rolling a 2. \n\nIf you roll odd, the probability of rolling <3 is still 1/3, i.e. the probability of rolling a 1. \n\nSo whether you roll odd or even does not impact the P of rolling less than three. Thus, the two events are independent. \n\nThis notion of whether the realization of one event affects the probability of another event is quantified using conditoinal probabilities. \n\n***Notation***: $P(A|B)$=The conditional probability of event $A$ being true **given** that event $B$ is true. \n\nExamples: What is the probability of the event \"A\" =\"rolling a combined 10\"? It is the probability of the events consisting of {{<span style=\"color:blue\">⚃</span> <span style=\"color:red\">⚅</span>},{<span style=\"color:blue\">⚄</span> <span style=\"color:red\">⚄</span>},{<span style=\"color:blue\">⚅</span> <span style=\"color:red\">⚃</span>}} and it is 3/36. Now, what is the probability of rolling a combined 10, **given** that the red dice rolled a 4. Well, it is the probability of the green dice rolling a 6, which is 1/6. \n- $P(\"10\")=3/36$\n- $P(\"10\"|$<span style=\"color:red\">⚃</span>$)=1/6$\n\nLet's use our sequential thinking to come up with a very useful properties of conditional probabilities. Consider the joint event of \"A\"=\"rolling a combined \"10\" and \"B\" the red dice rolling 4.\n\nThe probabiliy of both being true is equal to 1/36. But you can think of it as the probability of rolling a 4 with the red dice (P(B)=1/6), and then rolling a \"10\" given that the red dice rolled 4 P(A|B)=1/6). \n\n```{important}\n\n<b>Definition</b>: The following relationships hold between joint and conditional probabilities:\n\n$$P(A,B)=P(A|B)P(B)$$\n$$P(A|B)=\\frac{P(A,B)}{P(B)}$$\n```\n\n\n## Bayes Rule\nThe above relation between conditional probabilities and joint probabilities leads us to one of the most useful formulas in statistics: Bayes' Rule. \nNotice that we can write $P(A,B)$ as either $P(A|B)P(B)$ or $P(B|A)P(A)$. We can manipulate this relation to understand how the relation between the conditional probability of A given B and the conditional probability of B given A\n\n$$P(A,B)=P(A|B)P(B)=P(B|A)P(A)$$\n\n```{important}\n\n**Bayes' Rule**: \n$$P(A|B)=\\frac{P(B|A)P(A)}{P(B)}$$\n\n```\n\n## Law of Total probability\n\n```{important}\n\nThe law of total probability says that if we have a partition of the sample space, $A_n$ such that $A_i\\cap A_j=\\phi$ if $i\\neq j$. and $\\cap_{n} A_n = \\Omega$, then\n\n$$P(E)=\\sum_n P(E|A_n)P(A_n)$$\n\n```\n\nThis should be intuitive with the fair dice example. For example, let $E$ be the event 'A total roll $D=6$ was rolled'. A partition $A_n$ could be 'the dice $X$ rolled n' for $n$ between 1 and 6. Thus, the total probability of $D=6$ is the sum of the probability of rolling a seven given that $X$ rolled 1, plus the probability of rolling a seven given that $X$ rolled a 2, and so on....",
"_____no_output_____"
],
[
"<hr style=\"border:1px solid black\n \"> </hr>\n",
"_____no_output_____"
],
[
"# Random variables\n\n***Definition***: A random variable is a real-valued function whose whose values depend on outcomes of a random phenomenon.**\n\n$$X:\\Omega \\rightarrow \\mathbb R$$\n\nConsider the case of a single fair dice, with possible values, i.e. sample space: \n\n$$\\Omega=\\{1,2,3,4,5,6\\}$$ \n\nWe can define a random variable $X$ whose value is equal to the dice roll. This random variable could take ***discrete*** values between 1 and 6. \n\n$$X:\\{1,2,3,4,5,6\\} \\rightarrow \\{1,2,3,4,5,6\\} $$\n\nIf the dice is fair, than the probability of X taking each value is the same, and equal to 1/6. We would call this a discrete uniform random variable. \n\n",
"_____no_output_____"
],
[
"\nAt this point it may seem like I'm inventing new terminology. For example, why do we need to call $X$ a random variable, and talk about the possibility that it takes on different values? It seems like the probability of X taking on each value is just the probability of each event in $\\Omega$? \n\nHere is another example of a random variable on the same sample space: $Z$ is a random variable which takes the value $Z=0$ if the dice roll is odd and $Z=1$ if the dice roll is even. Thus, even though $X$ and $Z$ are associated with the same sample space and events, they take on different values. In this case, since $Z$ takes on only two values, 0 and 1 $Z$ would be called a Bernoulli random variable.\n\n$$Z:\\{1,2,3,4,5,6\\} \\rightarrow \\{1,2\\} $$\n\n\n\n",
"_____no_output_____"
]
]
] | [
"markdown"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
]
] |
d0ccbe4f49f52ec19d8f619f25aac15e183d36d8 | 82,288 | ipynb | Jupyter Notebook | aula_utils.ipynb | thalesvalente/machinelearning | 1a516121d2578614355f9231585e95e5afee7a05 | [
"MIT"
] | null | null | null | aula_utils.ipynb | thalesvalente/machinelearning | 1a516121d2578614355f9231585e95e5afee7a05 | [
"MIT"
] | null | null | null | aula_utils.ipynb | thalesvalente/machinelearning | 1a516121d2578614355f9231585e95e5afee7a05 | [
"MIT"
] | null | null | null | 82,288 | 82,288 | 0.793372 | [
[
[
"# A simple example of an animated plot\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.animation as animation\n\nfig, ax = plt.subplots()\n\n# Initial plot\nx = np.arange(0., 10., 0.2)\ny = np.arange(0., 10., 0.2)\nline, = ax.plot(x, y)\n\nplt.rcParams[\"figure.figsize\"] = (10,8)\nplt.ylabel(\"Price\")\nplt.xlabel(\"Size (sq.ft)\")\nplt.plot([1, 1.2, 3], [3, 3.5, 4.7], 'go', label='Training data')\n#ax.plot(test_house_size, test_house_price, 'mo', label='Testing data')\n\ndef animate(i):\n print(i) \n x = np.arange(0., 6, 0.05)\n line.set_xdata(x) # update the data\n line.set_ydata( x ** (1 + (i/10.0))) # update the data\n\n return line,\n\n\n# Init only required for blitting to give a clean slate.\ndef init():\n line.set_ydata(y)\n return line,\n\nani = animation.FuncAnimation(fig, animate, frames=np.arange(1, 10), init_func=init, interval=1000, blit=True)\nplt.show()",
"_____no_output_____"
]
],
[
[
"#1. Carregar imagem\nNas próximas seções, iremos aprender como carregar imagens de duas fontes distintas para exibí-las através de nosso código: (a) Internet e (b) diretório de seu próprio google drive. Também, veremos qual vantagem cada uma das formas de aquisição. ",
"_____no_output_____"
],
[
"## 1.1 URLs\nA vantagem de carregarmos imagens diretamente de *urls* é que ela não precisamos nos preocupar com a aquisição ou armazenamento dela de forma direta. Ou seja, podemos acessá-la e exibí-la diretamente através de seu *link*. Será mostrado duas formas de acessá-las e exibí-las logo a seguir",
"_____no_output_____"
],
[
"### 1.1.1 OpenCV + matplot + urllib",
"_____no_output_____"
]
],
[
[
"#Importação das bibliotecas que iremos utilizar\nimport cv2\nimport numpy as np\nimport urllib\nimport matplotlib.pyplot as plt\n\n\nI = url_to_image(\"https://live.staticflickr.com/65535/48055207731_98367225e3_m.jpg\")\n# se conseguiu carregar a imagem\nif(I is not None):\n # exibe a imagem\n plt.show()\n\n\ndef url_to_image(url):\n # Abre a url para acessar o dado\n resp = urllib.request.urlopen(url)\n # conversão da imagem para array de bytes do tamanho de inteiros de 8 bits\n image_array = np.asarray(bytearray(resp.read()), dtype=\"uint8\")\n # conversão do array para imagem\n image = cv2.imdecode(image_array, cv2.IMREAD_COLOR)\n \n # verifica se a imagem possui 3 dimensões: altura, largura e número de canais\n if (len(image.shape)==3):\n # remove os informações dos eixos de coordenadas\n plt.axis(\"off\")\n # converte a imagem de bgr para rgb\n image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n # adiciona a imagem no plot\n plt.imshow(image_rgb)\n # retorna\n return image_rgb\n \n # caso não possua as 3 informações, então ou o link é inválido ou o dado \n # não é imagem\n else:\n print('Erro to load image !!') \n return None",
"_____no_output_____"
]
],
[
[
"### 1.1.2 Pil.Image + comandos Linux",
"_____no_output_____"
]
],
[
[
"import PIL.Image\n\ndef show_results(content_path, max_dim):\n #plt.figure(figsize=(10, 5))\n content = img = PIL.Image.open(content_path)\n\n long = max(img.size)\n scale = max_dim/long\n img = img.resize((round(img.size[0]*scale), round(img.size[1]*scale)), PIL.Image.ANTIALIAS)\n #plt.subplot(1, 2, 1)\n plt.imshow(img)\n \n!wget --quiet -P /tmp/nst/ https://live.staticflickr.com/65535/48055207731_98367225e3_m.jpg\nshow_results(\"/tmp/nst/48055207731_98367225e3_m.jpg\", 256)",
"_____no_output_____"
]
],
[
[
"## 1.2 Arquivos no gdrive\nA vantagem de carregarmos imagens diretamente do gdrive pessoal é que não precisamos nos preocupar com o fato da página estar acessível ou não. No entanto, é necessário seguir os seguintes passos: \n- executar o código \n- clicar no *link* que aparecer\n- dar autorização\n- copiar o código gerado e\n- colar na barra que apareceu colab \n\nÉ importante informar que outras pessoas não terão acesso as imagens dessa forma, mesmo que você torne as imagens públicas.",
"_____no_output_____"
]
],
[
[
"from google.colab import drive\ndrive.mount('/content/gdrive')",
"_____no_output_____"
]
],
[
[
"### 1.2.1 Usando OpenCV + Matplotlib",
"_____no_output_____"
]
],
[
[
"import cv2\nimport matplotlib.pyplot as plt\n\n# carrega a imagem\nbgr_img = cv2.imread('/content/gdrive/My Drive/Colab Notebooks/docencia/MLP/figuras/decisao_linear.png')\n\nplt.axis(\"off\")\n\n# adiciona a imagem no plot e exibe\nplt.imshow(cv2.cvtColor(bgr_img, cv2.COLOR_BGR2RGB))\nplt.show()",
"_____no_output_____"
]
],
[
[
"### 1.2.2 Usando Ipython.display",
"_____no_output_____"
]
],
[
[
"from IPython.display import Image\n\n# carrega, adiciona no display e exibe\nImage(filename=\"/content/gdrive/My Drive/Colab Notebooks/docencia/MLP/figuras/decisao_linear.png\")\n\n",
"Drive already mounted at /content/gdrive; to attempt to forcibly remount, call drive.mount(\"/content/gdrive\", force_remount=True).\n"
],
[
"%matplotlib notebook\n\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom matplotlib import animation, rc\nfrom IPython.display import HTML\n\nfig, ax = plt.subplots()\n\nax.set_xlim(( 0, 2))\nax.set_ylim((-2, 2))\n\nline, = ax.plot([], [], lw=2)\n\ndef init():\n line.set_data([], [])\n return (line,)\n \ndef animate(i):\n x = np.linspace(0, 2, 1000)\n y = np.sin(2 * np.pi * (x - 0.01 * i))\n line.set_data(x, y)\n return (line,)\n \n \nanim = animation.FuncAnimation(fig, animate, init_func=init,\n frames=100, interval=20, \n blit=True)\n\n#plt.show()\n#rc('animation', html='jshtml')\n\nHTML(anim.to_jshtml())\n#anim\n",
"_____no_output_____"
]
],
[
[
"#2. Matplotlib\nEssa seção fornece algumas dicas básicas para utilização da biblioteca matplotlib, principal biblioteca utilizada para exibição de imagens e gráficos no python",
"_____no_output_____"
]
],
[
[
"# Testei ams não funcionou. Não apareceu UI\n!jupyter nbextension install https://bitbucket.org/ipre/calico/downloads/calico-document-tools-1.0.zip\n!jupyter nbextension enable calico-document-tools",
"Please supply at least one subcommand: disable, enable, install, list, uninstall\nEnabling notebook extension calico-document-tools...\n - Validating: \u001b[32mOK\u001b[0m\n"
],
[
"#%matplotlib inline\n\n#from IPython.core.magics.display import Javascript\n#Javascript(\"\"\"\"load_extensions\": {\"calico-spell-check\":true,\n# \"calico-document-tools\":true,\n# \"calico-cell-tools\":true\"\"\")\n\n#%#javascript \n#IPython.notebook.config.update({\n# \"load_extensions\": {\"calico-spell-check\":true,\n# \"calico-document-tools\":true,\n# \"calico-cell-tools\":true\n# }\n#})\n\n\n# Testei ams não funcionou. Não apareceu UI\n# https://github.com/takluyver/cite2c\n# https://pypi.org/project/cite2c/\n#!pip install cite2c\n#!python -m cite2c.install",
"_____no_output_____"
],
[
"!sudo apt-get install texlive-latex-extra\n!sudo apt-get install texlive-bibtex-extra",
"Reading package lists... Done\nBuilding dependency tree \nReading state information... Done\nThe following package was automatically installed and is no longer required:\n libnvidia-common-410\nUse 'sudo apt autoremove' to remove it.\nThe following additional packages will be installed:\n fonts-droid-fallback fonts-lato fonts-lmodern fonts-noto-mono fonts-texgyre\n javascript-common libcupsfilters1 libcupsimage2 libgs9 libgs9-common\n libijs-0.35 libjbig2dec0 libjs-jquery libkpathsea6 libpotrace0 libptexenc1\n libruby2.5 libsynctex1 libtexlua52 libtexluajit2 libzzip-0-13 lmodern\n poppler-data preview-latex-style rake ruby ruby-did-you-mean ruby-minitest\n ruby-net-telnet ruby-power-assert ruby-test-unit ruby2.5\n rubygems-integration t1utils tex-common tex-gyre texlive-base\n texlive-binaries texlive-fonts-recommended texlive-latex-base\n texlive-latex-recommended texlive-pictures texlive-plain-generic tipa\nSuggested packages:\n fonts-noto apache2 | lighttpd | httpd poppler-utils ghostscript\n fonts-japanese-mincho | fonts-ipafont-mincho fonts-japanese-gothic\n | fonts-ipafont-gothic fonts-arphic-ukai fonts-arphic-uming fonts-nanum ri\n ruby-dev bundler debhelper gv | postscript-viewer perl-tk xpdf-reader\n | pdf-viewer texlive-fonts-recommended-doc texlive-latex-base-doc\n python-pygments icc-profiles libfile-which-perl\n libspreadsheet-parseexcel-perl texlive-latex-extra-doc\n texlive-latex-recommended-doc texlive-pstricks dot2tex prerex ruby-tcltk\n | libtcltk-ruby texlive-pictures-doc vprerex\nThe following NEW packages will be installed:\n fonts-droid-fallback fonts-lato fonts-lmodern fonts-noto-mono fonts-texgyre\n javascript-common libcupsfilters1 libcupsimage2 libgs9 libgs9-common\n libijs-0.35 libjbig2dec0 libjs-jquery libkpathsea6 libpotrace0 libptexenc1\n libruby2.5 libsynctex1 libtexlua52 libtexluajit2 libzzip-0-13 lmodern\n poppler-data preview-latex-style rake ruby ruby-did-you-mean ruby-minitest\n ruby-net-telnet ruby-power-assert ruby-test-unit ruby2.5\n rubygems-integration t1utils tex-common tex-gyre texlive-base\n texlive-binaries texlive-fonts-recommended texlive-latex-base\n texlive-latex-extra texlive-latex-recommended texlive-pictures\n texlive-plain-generic tipa\n0 upgraded, 45 newly installed, 0 to remove and 8 not upgraded.\nNeed to get 135 MB of archives.\nAfter this operation, 438 MB of additional disk space will be used.\nGet:1 http://archive.ubuntu.com/ubuntu bionic/main amd64 fonts-droid-fallback all 1:6.0.1r16-1.1 [1,805 kB]\nGet:2 http://archive.ubuntu.com/ubuntu bionic/main amd64 fonts-lato all 2.0-2 [2,698 kB]\nGet:3 http://archive.ubuntu.com/ubuntu bionic/main amd64 poppler-data all 0.4.8-2 [1,479 kB]\nGet:4 http://archive.ubuntu.com/ubuntu bionic/main amd64 tex-common all 6.09 [33.0 kB]\nGet:5 http://archive.ubuntu.com/ubuntu bionic/main amd64 fonts-lmodern all 2.004.5-3 [4,551 kB]\nGet:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 fonts-noto-mono all 20171026-2 [75.5 kB]\nGet:7 http://archive.ubuntu.com/ubuntu bionic/universe amd64 fonts-texgyre all 20160520-1 [8,761 kB]\nGet:8 http://archive.ubuntu.com/ubuntu bionic/main amd64 javascript-common all 11 [6,066 B]\nGet:9 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcupsfilters1 amd64 1.20.2-0ubuntu3.1 [108 kB]\nErr:10 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcupsimage2 amd64 2.2.7-1ubuntu2.5\n 404 Not Found [IP: 91.189.88.24 80]\nGet:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 libijs-0.35 amd64 0.35-13 [15.5 kB]\nGet:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 libjbig2dec0 amd64 0.13-6 [55.9 kB]\nGet:13 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgs9-common all 9.26~dfsg+0-0ubuntu0.18.04.9 [5,092 kB]\nGet:14 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgs9 amd64 9.26~dfsg+0-0ubuntu0.18.04.9 [2,264 kB]\nGet:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 libjs-jquery all 3.2.1-1 [152 kB]\nGet:16 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libkpathsea6 amd64 2017.20170613.44572-8ubuntu0.1 [54.9 kB]\nGet:17 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpotrace0 amd64 1.14-2 [17.4 kB]\nGet:18 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libptexenc1 amd64 2017.20170613.44572-8ubuntu0.1 [34.5 kB]\nGet:19 http://archive.ubuntu.com/ubuntu bionic/main amd64 rubygems-integration all 1.11 [4,994 B]\nGet:20 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 ruby2.5 amd64 2.5.1-1ubuntu1.2 [48.6 kB]\nGet:21 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby amd64 1:2.5.1 [5,712 B]\nGet:22 http://archive.ubuntu.com/ubuntu bionic/main amd64 rake all 12.3.1-1 [45.1 kB]\nGet:23 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-did-you-mean all 1.2.0-2 [9,700 B]\nGet:24 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-minitest all 5.10.3-1 [38.6 kB]\nGet:25 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-net-telnet all 0.1.1-2 [12.6 kB]\nGet:26 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-power-assert all 0.3.0-1 [7,952 B]\nGet:27 http://archive.ubuntu.com/ubuntu bionic/main amd64 ruby-test-unit all 3.2.5-1 [61.1 kB]\nGet:28 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libruby2.5 amd64 2.5.1-1ubuntu1.2 [3,066 kB]\nGet:29 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libsynctex1 amd64 2017.20170613.44572-8ubuntu0.1 [41.4 kB]\nGet:30 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libtexlua52 amd64 2017.20170613.44572-8ubuntu0.1 [91.2 kB]\nGet:31 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libtexluajit2 amd64 2017.20170613.44572-8ubuntu0.1 [230 kB]\nGet:32 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libzzip-0-13 amd64 0.13.62-3.1ubuntu0.18.04.1 [26.0 kB]\nGet:33 http://archive.ubuntu.com/ubuntu bionic/main amd64 lmodern all 2.004.5-3 [9,631 kB]\nGet:34 http://archive.ubuntu.com/ubuntu bionic/main amd64 preview-latex-style all 11.91-1ubuntu1 [185 kB]\nGet:35 http://archive.ubuntu.com/ubuntu bionic/main amd64 t1utils amd64 1.41-2 [56.0 kB]\nGet:36 http://archive.ubuntu.com/ubuntu bionic/universe amd64 tex-gyre all 20160520-1 [4,998 kB]\nGet:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 texlive-binaries amd64 2017.20170613.44572-8ubuntu0.1 [8,179 kB]\nGet:38 http://archive.ubuntu.com/ubuntu bionic/main amd64 texlive-base all 2017.20180305-1 [18.7 MB]\nGet:39 http://archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-fonts-recommended all 2017.20180305-1 [5,262 kB]\nGet:40 http://archive.ubuntu.com/ubuntu bionic/main amd64 texlive-latex-base all 2017.20180305-1 [951 kB]\nGet:41 http://archive.ubuntu.com/ubuntu bionic/main amd64 texlive-latex-recommended all 2017.20180305-1 [14.9 MB]\nGet:42 http://archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-pictures all 2017.20180305-1 [4,026 kB]\nGet:43 http://archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-latex-extra all 2017.20180305-2 [10.6 MB]\nGet:44 http://archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-plain-generic all 2017.20180305-2 [23.6 MB]\nGet:45 http://archive.ubuntu.com/ubuntu bionic/universe amd64 tipa all 2:1.3-20 [2,978 kB]\nFetched 135 MB in 9s (15.7 MB/s)\nE: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/c/cups/libcupsimage2_2.2.7-1ubuntu2.5_amd64.deb 404 Not Found [IP: 91.189.88.24 80]\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?\nReading package lists... Done\nBuilding dependency tree \nReading state information... Done\nThe following package was automatically installed and is no longer required:\n libnvidia-common-410\nUse 'sudo apt autoremove' to remove it.\nThe following additional packages will be installed:\n fonts-droid-fallback fonts-lmodern fonts-noto-mono libcupsfilters1\n libcupsimage2 libgs9 libgs9-common libijs-0.35 libjbig2dec0 libkpathsea6\n libpotrace0 libptexenc1 libsynctex1 libtexlua52 libtexluajit2 libzzip-0-13\n lmodern poppler-data t1utils tex-common texlive-base texlive-binaries\n texlive-latex-base\nSuggested packages:\n fonts-noto poppler-utils ghostscript fonts-japanese-mincho\n | fonts-ipafont-mincho fonts-japanese-gothic | fonts-ipafont-gothic\n fonts-arphic-ukai fonts-arphic-uming fonts-nanum debhelper gv\n | postscript-viewer perl-tk xpdf-reader | pdf-viewer texlive-latex-base-doc\nThe following NEW packages will be installed:\n fonts-droid-fallback fonts-lmodern fonts-noto-mono libcupsfilters1\n libcupsimage2 libgs9 libgs9-common libijs-0.35 libjbig2dec0 libkpathsea6\n libpotrace0 libptexenc1 libsynctex1 libtexlua52 libtexluajit2 libzzip-0-13\n lmodern poppler-data t1utils tex-common texlive-base texlive-bibtex-extra\n texlive-binaries texlive-latex-base\n0 upgraded, 24 newly installed, 0 to remove and 8 not upgraded.\nNeed to get 56.1 MB/110 MB of archives.\nAfter this operation, 286 MB of additional disk space will be used.\nErr:1 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcupsimage2 amd64 2.2.7-1ubuntu2.5\n 404 Not Found [IP: 91.189.88.24 80]\nGet:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 texlive-bibtex-extra all 2017.20180305-2 [56.0 MB]\nFetched 56.0 MB in 4s (14.1 MB/s)\nE: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/c/cups/libcupsimage2_2.2.7-1ubuntu2.5_amd64.deb 404 Not Found [IP: 91.189.88.24 80]\nE: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?\n"
]
],
[
[
"\n\nAAAAAAAAAAAAAA <cite data-cite=\"PER-GRA:2007\">(Granger, 2013)</cite>\n \n \n\n\n<figure>\n <a href=\"https://www.fullstackpython.com/img/logos/markdown.png\">\n <img src=\"https://www.fullstackpython.com/img/logos/markdown.png\" alt=\"You can use Markdown to add images to Jupyter Notebook files, such as this image of the Markdown logo. Source: Full Stack Python.\"></a>\n <figcaption> You can use Markdown to add images to Jupyter Notebook files, such as this image of the Markdown logo. Source: Full Stack Python.\n </figcaption>\n</figure>",
"_____no_output_____"
],
[
"\n@article{PER-GRA:2007,\n Author = {P\\'erez, Fernando and Granger, Brian E.},\n Title = {{IP}ython: a System for Interactive Scientific Computing},\n Journal = {Computing in Science and Engineering},\n Volume = {9},\n Number = {3},\n Pages = {21--29},\n month = may,\n year = 2007,\n url = \"http://ipython.org\",\n ISSN = \"1521-9615\",\n doi = {10.1109/MCSE.2007.53},\n publisher = {IEEE Computer Society},\n}\n",
"_____no_output_____"
],
[
"Referências citation <a name=\"ref-1\"/>[(Pérez and Granger, 2007)](#cite-PER-GRA:2007) \n[1] https://www.datacamp.com/community/tutorials/matplotlib-tutorial-python#anatomy\n\n<cite data-cite=\"granger2013\">(Granger, 2013)</cite>\n\n<strong data-cite=\"granger2013\">(Granger, 2013)</strong>",
"_____no_output_____"
]
],
[
[
"# nbconvert funcionou. No entanto, os outros comandos não\n%%bash\nls\njupyter nbconvert aula_utils.ipynb --to latex\n#python latex aula_utils.tex\n#!python bibtex aula_utils.aux\n#!python pdflatex aula_utils.tex\n#!python pdflatex aula_utils.tex\npdflatex aula_utils.tex",
"aula_utils_files\naula_utils.ipynb\naula_utils.tex\ncitations.tplx\nref.bib\nsample_data\n"
],
[
"%%bash\n# mudar para o diretório onde está o notebook que será convertido\n%cd \"/content/drive/My Drive/Colab Experimental/mltutorial/\"\nipython nbconvert mynotebook.ipynb --to latex --template citations.tplx\nlatex mynotebook.tex\nbibtex mynotebook.aux\npdflatex mynotebook.tex\npdflatex mynotebook.tex\npdflatex mynotebook.tex",
"[TerminalIPythonApp] WARNING | Subcommand `ipython nbconvert` is deprecated and will be removed in future versions.\n[TerminalIPythonApp] WARNING | You likely want to use `jupyter nbconvert` in the future\n[NbConvertApp] Converting notebook mynotebook.ipynb to latex\n[NbConvertApp] Writing 20861 bytes to mynotebook.tex\nbash: line 3: latex: command not found\nbash: line 4: bibtex: command not found\nbash: line 5: pdflatex: command not found\nbash: line 6: pdflatex: command not found\nbash: line 7: pdflatex: command not found\n"
],
[
"#!pip install cite2c\n#!python3 -m cite2c.install",
"Installing nbextension ...\nEnabling the nbextension ...\nEnabling the server extension ...\nDone.\n"
]
],
[
[
"\n<!--bibtex\n\n@Article{PER-GRA:2007,\n Author = {P\\'erez, Fernando and Granger, Brian E.},\n Title = {{IP}ython: a System for Interactive Scientific Computing},\n Journal = {Computing in Science and Engineering},\n Volume = {9},\n Number = {3},\n Pages = {21--29},\n month = may,\n year = 2007,\n url = \"http://ipython.org\",\n ISSN = \"1521-9615\",\n doi = {10.1109/MCSE.2007.53},\n publisher = {IEEE Computer Society},\n}\n\n-->",
"_____no_output_____"
]
],
[
[
"# NÃO FINCIONOU - não carrega o arquivo com o comando load\n# - o colab abre arquivos somente como leitura. Não dá para editar\n# - tentei gambi para editar o conf.py, deu\n# - tentei gambi para jogar o notebook na pasta source do projeto sphinx e encontrei 2 problemas:\n# - 1: tudo copiado para a pasta Files é deletado quando você sai\n# - 2: \n# https://sphinxcontrib-bibtex.readthedocs.io/en/latest/quickstart.html#overview\n#!pip install sphinxcontrib-bibtex\n#!sphinx-quickstart\n#!cd /content/docs/source/\n#%load conf.py\n#%pycat code.py \n#!rm code.py\n#%%writefile conf.py \n# -*- coding: utf-8 -*-\n#\n# Configuration file for the Sphinx documentation builder.\n#\n# This file does only contain a selection of the most common options. For a\n# full list see the documentation:\n# http://www.sphinx-doc.org/en/master/config\n\n# -- Path setup --------------------------------------------------------------\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#\nimport os\nimport sys\nsys.path.insert(0, os.path.abspath('../..'))\nsys.setrecursionlimit(1500)\n\n# -- Project information -----------------------------------------------------\n\nproject = u'teste_sphinxlib'\ncopyright = u'2019, Thales'\nauthor = u'Thales'\n\n# The short X.Y version\nversion = u''\n# The full version, including alpha/beta/rc tags\nrelease = u'0.0.1'\n\n\n# -- General configuration ---------------------------------------------------\n\n# If your documentation needs a minimal Sphinx version, state it here.\n#\n# needs_sphinx = '1.0'\n\n# Add any Sphinx extension module names here, as strings. They can be\n# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom\n# ones.\nextensions = [\n 'sphinx.ext.autodoc',\n 'sphinx.ext.ifconfig',\n 'sphinx.ext.viewcode',\n 'sphinx.ext.githubpages',\n 'sphinxcontrib.bibtex',\n]\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix(es) of source filenames.\n# You can specify multiple suffix as a list of string:\n#\n# source_suffix = ['.rst', '.md']\nsource_suffix = '.rst'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#\n# This is also used if you do content translation via gettext catalogs.\n# Usually you set \"language\" from the command line for these cases.\nlanguage = None\n\n# List of patterns, relative to source directory, that match files and\n# directories to ignore when looking for source files.\n# This pattern also affects html_static_path and html_extra_path.\nexclude_patterns = []\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = None\n\n\n# -- Options for HTML output -------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. See the documentation for\n# a list of builtin themes.\n#\nhtml_theme = 'alabaster'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#\n# html_theme_options = {}\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# Custom sidebar templates, must be a dictionary that maps document names\n# to template names.\n#\n# The default sidebars (for documents that don't match any pattern) are\n# defined by theme itself. Builtin themes are using these templates by\n# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',\n# 'searchbox.html']``.\n#\n# html_sidebars = {}\n\n\n# -- Options for HTMLHelp output ---------------------------------------------\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'teste_sphinxlibdoc'\n\n\n# -- Options for LaTeX output ------------------------------------------------\n\nlatex_elements = {\n # The paper size ('letterpaper' or 'a4paper').\n #\n # 'papersize': 'letterpaper',\n\n # The font size ('10pt', '11pt' or '12pt').\n #\n # 'pointsize': '10pt',\n\n # Additional stuff for the LaTeX preamble.\n #\n # 'preamble': '',\n\n # Latex figure (float) alignment\n #\n # 'figure_align': 'htbp',\n}\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title,\n# author, documentclass [howto, manual, or own class]).\nlatex_documents = [\n (master_doc, 'teste_sphinxlib.tex', u'teste\\\\_sphinxlib Documentation',\n u'Thales', 'manual'),\n]\n\n\n# -- Options for manual page output ------------------------------------------\n\n# One entry per manual page. List of tuples\n# (source start file, name, description, authors, manual section).\nman_pages = [\n (master_doc, 'teste_sphinxlib', u'teste_sphinxlib Documentation',\n [author], 1)\n]\n\n\n# -- Options for Texinfo output ----------------------------------------------\n\n# Grouping the document tree into Texinfo files. List of tuples\n# (source start file, target name, title, author,\n# dir menu entry, description, category)\ntexinfo_documents = [\n (master_doc, 'teste_sphinxlib', u'teste_sphinxlib Documentation',\n author, 'teste_sphinxlib', 'One line description of project.',\n 'Miscellaneous'),\n]\n\n\n# -- Options for Epub output -------------------------------------------------\n\n# Bibliographic Dublin Core info.\nepub_title = project\n\n# The unique identifier of the text. This can be a ISBN number\n# or the project homepage.\n#\n# epub_identifier = ''\n\n# A unique identification for the text.\n#\n# epub_uid = ''\n\n# A list of files that should not be packed into the epub file.\nepub_exclude_files = ['search.html']\n\n\n# -- Extension configuration -------------------------------------------------",
"_____no_output_____"
]
],
[
[
"",
"_____no_output_____"
],
[
"See :cite:`1987:nelson` for an introduction to non-standard analysis.\n\n.. bibliography:: refs.bib\n :cited:\n \n Here is a link :func:`time.time`.\n \n .,,.\n ,;;*;;;;,\n .-'``;-');;.\n /' .-. /*;;\n .' \\d \\;; .;;;,\n/ o ` \\; ,__. ,;*;;;*;,\n\\__, _.__,' \\_.-') __)--.;;;;;*;;;;,\n `\"\"`;;;\\ /-')_) __) `\\' ';;;;;;\n ;*;;; -') `)_) |\\ | ;;;;*;\n ;;;;| `---` O | | ;;*;;;\n *;*;\\| O / ;;;;;*\n ;;;;;/| .-------\\ / ;*;;;;;\n ;;;*;/ \\ | '. (`. ;;;*;;;\n ;;;;;'. ; | ) \\ | ;;;;;;\n ,;*;;;;\\/ |. / /` | ';;;*;\n ;;;;;;/ |/ / /__/ ';;;\n '*jgs/ | / | ;*;\n `\"\"\"\"` `\"\"\"\"` ;'",
"_____no_output_____"
]
],
[
[
"%cd source",
"/content/docs/source\n"
],
[
"",
"_____no_output_____"
]
],
[
[
"%load conf.py\n",
"_____no_output_____"
]
],
[
[
"%load conf.py",
"_____no_output_____"
],
[
"# acessar google drive\nfrom os.path import join\nfrom google.colab import drive\n\nROOT = \"/content/drive\"\ndrive.mount(ROOT)\n",
"Drive already mounted at /content/drive; to attempt to forcibly remount, call drive.mount(\"/content/drive\", force_remount=True).\n"
],
[
"# criar um diretório para seus projetos\nPROJ = \"My Drive/Colab Experimental/Workspace\" # This is a custom path.\nPROJECT_PATH = join(ROOT, PROJ)\n!mkdir \"{PROJECT_PATH}\"\n# Iniciar o git no diretório\n!git init \"{PROJECT_PATH}\"\n\n",
"_____no_output_____"
],
[
"#%%bash\n%cd \"/content/drive/My Drive/Colab Experimental/Workspace/\"\n!ls\n!git clone git://github.com/schlaicha/jupyter-publication-scripts.git jupyter-publication-scripts\n%cd jupyter-publication-scripts\n!ls",
"/content/drive/My Drive/Colab Experimental/Workspace\nCloning into 'jupyter-publication-scripts'...\nremote: Enumerating objects: 364, done.\u001b[K\nremote: Total 364 (delta 0), reused 0 (delta 0), pack-reused 364\u001b[K\nReceiving objects: 100% (364/364), 1.45 MiB | 11.33 MiB/s, done.\nResolving deltas: 100% (200/200), done.\n/root\n"
],
[
"%cd \"/content/drive/My Drive/Colab Experimental/Workspace/jupyter-publication-scripts/\"\n!ls\n!python setup.py install\n!python -m jupyterpublicationscripts",
"/content/drive/My Drive/Colab Experimental/Workspace/jupyter-publication-scripts\nexample\t\t\t LICENSE\t\t setup.py\t tutorial\nextensions\t\t publicationextensions templates\njupyterpublicationscripts README.md\t\t todo_ideas.md\n/usr/local/lib/python3.6/dist-packages/setuptools/dist.py:472: UserWarning: Normalizing '0.1-dev' to '0.1.dev0'\n normalized_version,\nrunning install\nrunning bdist_egg\nrunning egg_info\ncreating jupyter_publication_scripts.egg-info\nwriting jupyter_publication_scripts.egg-info/PKG-INFO\nwriting dependency_links to jupyter_publication_scripts.egg-info/dependency_links.txt\nwriting requirements to jupyter_publication_scripts.egg-info/requires.txt\nwriting top-level names to jupyter_publication_scripts.egg-info/top_level.txt\nwriting manifest file 'jupyter_publication_scripts.egg-info/SOURCES.txt'\nfile publicationextensions/replace.py (for module publicationextensions.replace) not found\nwriting manifest file 'jupyter_publication_scripts.egg-info/SOURCES.txt'\ninstalling library code to build/bdist.linux-x86_64/egg\nrunning install_lib\nrunning build_py\nfile publicationextensions/replace.py (for module publicationextensions.replace) not found\ncreating build\ncreating build/lib\ncreating build/lib/publicationextensions\ncopying publicationextensions/__init__.py -> build/lib/publicationextensions\ncopying publicationextensions/PrettyTable.py -> build/lib/publicationextensions\nfile publicationextensions/replace.py (for module publicationextensions.replace) not found\ncreating build/bdist.linux-x86_64\ncreating build/bdist.linux-x86_64/egg\ncreating build/bdist.linux-x86_64/egg/publicationextensions\ncopying build/lib/publicationextensions/__init__.py -> build/bdist.linux-x86_64/egg/publicationextensions\ncopying build/lib/publicationextensions/PrettyTable.py -> build/bdist.linux-x86_64/egg/publicationextensions\nbyte-compiling build/bdist.linux-x86_64/egg/publicationextensions/__init__.py to __init__.cpython-36.pyc\nbyte-compiling build/bdist.linux-x86_64/egg/publicationextensions/PrettyTable.py to PrettyTable.cpython-36.pyc\ncreating build/bdist.linux-x86_64/egg/EGG-INFO\ncopying jupyter_publication_scripts.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO\ncopying jupyter_publication_scripts.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO\ncopying jupyter_publication_scripts.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO\ncopying jupyter_publication_scripts.egg-info/requires.txt -> build/bdist.linux-x86_64/egg/EGG-INFO\ncopying jupyter_publication_scripts.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO\nzip_safe flag not set; analyzing archive contents...\ncreating dist\ncreating 'dist/jupyter_publication_scripts-0.1.dev0-py3.6.egg' and adding 'build/bdist.linux-x86_64/egg' to it\nremoving 'build/bdist.linux-x86_64/egg' (and everything under it)\nProcessing jupyter_publication_scripts-0.1.dev0-py3.6.egg\nCopying jupyter_publication_scripts-0.1.dev0-py3.6.egg to /usr/local/lib/python3.6/dist-packages\nAdding jupyter-publication-scripts 0.1.dev0 to easy-install.pth file\n\nInstalled /usr/local/lib/python3.6/dist-packages/jupyter_publication_scripts-0.1.dev0-py3.6.egg\nProcessing dependencies for jupyter-publication-scripts==0.1.dev0\nSearching for citeproc-py\nReading https://pypi.org/simple/citeproc-py/\nDownloading https://files.pythonhosted.org/packages/22/9a/d3383c4af068d0e82ec71fd88c74ae55e85b49c0acaf9951b3075c8a3b40/citeproc_py-0.4.0-py2.py3-none-any.whl#sha256=ee1569e8b1f2c057c7893bbb067986bc362a6c861009d310700a12a1a0107b57\nBest match: citeproc-py 0.4.0\nProcessing citeproc_py-0.4.0-py2.py3-none-any.whl\nInstalling citeproc_py-0.4.0-py2.py3-none-any.whl to /usr/local/lib/python3.6/dist-packages\nwriting requirements to /usr/local/lib/python3.6/dist-packages/citeproc_py-0.4.0-py3.6.egg/EGG-INFO/requires.txt\nAdding citeproc-py 0.4.0 to easy-install.pth file\nInstalling csl_unsorted script to /usr/local/bin\n\nInstalled /usr/local/lib/python3.6/dist-packages/citeproc_py-0.4.0-py3.6.egg\nSearching for unicode_tex\nReading https://pypi.org/simple/unicode_tex/\nDownloading https://files.pythonhosted.org/packages/ec/ff/d90a87c3565c087ab888327057d7d4b5de7eda26fba51b068825372995be/unicode_tex-0.1.1.tar.gz#sha256=c1a3595e925b1dc43cfcbd0370518fc0a9d6fc4a5db0eebb6b0894f6dc2238de\nBest match: unicode-tex 0.1.1\nProcessing unicode_tex-0.1.1.tar.gz\nWriting /tmp/easy_install-lc7horsc/unicode_tex-0.1.1/setup.cfg\nRunning unicode_tex-0.1.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-lc7horsc/unicode_tex-0.1.1/egg-dist-tmp-eumeg75f\ncreating /usr/local/lib/python3.6/dist-packages/unicode_tex-0.1.1-py3.6.egg\nExtracting unicode_tex-0.1.1-py3.6.egg to /usr/local/lib/python3.6/dist-packages\nAdding unicode-tex 0.1.1 to easy-install.pth file\n\nInstalled /usr/local/lib/python3.6/dist-packages/unicode_tex-0.1.1-py3.6.egg\nSearching for lxml==4.2.6\nBest match: lxml 4.2.6\nAdding lxml 4.2.6 to easy-install.pth file\n\nUsing /usr/local/lib/python3.6/dist-packages\nFinished processing dependencies for jupyter-publication-scripts==0.1.dev0\nConfiguration files directory: /root/.jupyter\nExtensions and templates path: /root/.local/share/jupyter\nInstall Python extensions to /root/.local/share/jupyter/extensions\nInstall templates to /root/.local/share/jupyter/templates\n"
],
[
"#Change IPython/Jupyter notebook working directory\n# default : /root/.local/share/jupyter\n%%bash\njupyter -h",
"usage: jupyter [-h] [--version] [--config-dir] [--data-dir] [--runtime-dir]\n [--paths] [--json]\n [subcommand]\n\nJupyter: Interactive Computing\n\npositional arguments:\n subcommand the subcommand to launch\n\noptional arguments:\n -h, --help show this help message and exit\n --version show the jupyter command's version and exit\n --config-dir show Jupyter config dir\n --data-dir show Jupyter data dir\n --runtime-dir show Jupyter runtime dir\n --paths show all Jupyter paths. Add --json for machine-readable\n format.\n --json output paths as machine-readable json\n\nAvailable subcommands: bundlerextension console kernel kernelspec migrate\nnbconvert nbextension notebook qtconsole run serverextension troubleshoot\ntrust\n"
],
[
"\\(ax^2 + \\sqrt{bx} + c = 0 \\)\n ",
"_____no_output_____"
]
],
[
[
"",
"_____no_output_____"
],
[
"",
"_____no_output_____"
],
[
"\n\n---\n\n\n\n---\n\n\n\n```\n#How to use MathJax\n\n\n# centered:\n```\n1. $$ x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a} $$\n\n2. \\\\[ x = {-b \\pm \\sqrt{b^2-4ac} \\over 2a} \\\\]\n\n3. $$\\begin{vmatrix}a & b\\\\\nc & d\n## \\end{vmatrix}=ad-bc$$\n\n```\n# Inline: \n```\n1. \\\\( ax^2 + \\sqrt{bx} + c = 0 \\\\)\n\n\n",
"_____no_output_____"
],
[
"<p align=\"center\">\n <b>Some Links:</b><br>\n <a href=\"#\">Link 1</a> |\n <a href=\"#\">Link 2</a> |\n <a href=\"#\">Link 3</a>\n <br><br>\n <img src=\"http://s.4cdn.org/image/title/105.gif\">\n</p>",
"_____no_output_____"
],
[
"#Como referenciar outro notebook contido no drive\n\n[Aula CNN](1pbbIqPmZiLoFKDYvmZiF4tHNspTmLi42#scrollTo=tfgzKfNFgxmB)",
"_____no_output_____"
],
[
"# Como criar hiperlink \n[link](http://example.com \"Title\").\n\nSome text with [a link][1] and\nanother [link][2].\n\n[1]: http://example.com/ \"Title\"\n[2]: http://example.org/ \"Title\"\n\n\n![Alt2][3]\n\n[3]: https://segredosdomundo.r7.com/wp-content/uploads/2017/09/7-41.jpg \"EXAMPLE2\"\n\nLinked logo: \n(http://wordpress.com/ \"Title\")\n\n- [x] Write the press release\n- [ ] Update the website\n- [ ] Contact the media\n\t\n\n",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
]
] |
d0ccc0ee2a3bea1e64136e6bb2614463dc029d88 | 10,697 | ipynb | Jupyter Notebook | site/ja/addons/tutorials/image_ops.ipynb | RedContritio/docs-l10n | f69a7c0d2157703a26cef95bac34b39ac0250373 | [
"Apache-2.0"
] | 1 | 2022-03-29T22:32:18.000Z | 2022-03-29T22:32:18.000Z | site/ja/addons/tutorials/image_ops.ipynb | RedContritio/docs-l10n | f69a7c0d2157703a26cef95bac34b39ac0250373 | [
"Apache-2.0"
] | null | null | null | site/ja/addons/tutorials/image_ops.ipynb | RedContritio/docs-l10n | f69a7c0d2157703a26cef95bac34b39ac0250373 | [
"Apache-2.0"
] | null | null | null | 26.543424 | 257 | 0.492942 | [
[
[
"##### Copyright 2020 The TensorFlow Authors.",
"_____no_output_____"
]
],
[
[
"#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.",
"_____no_output_____"
]
],
[
[
"# TensorFlow Addons 画像 : 操作\n\n<table class=\"tfo-notebook-buttons\" align=\"left\">\n <td><a target=\"_blank\" href=\"https://www.tensorflow.org/addons/tutorials/image_ops\"><img src=\"https://www.tensorflow.org/images/tf_logo_32px.png\"> TensorFlow.orgで表示</a></td>\n <td><a target=\"_blank\" href=\"https://colab.research.google.com/github/tensorflow/docs-l10n/blob/master/site/ja/addons/tutorials/image_ops.ipynb\"><img src=\"https://www.tensorflow.org/images/colab_logo_32px.png\"> Google Colab で実行</a></td>\n <td><a target=\"_blank\" href=\"https://github.com/tensorflow/docs-l10n/blob/master/site/ja/addons/tutorials/image_ops.ipynb\"><img src=\"https://www.tensorflow.org/images/GitHub-Mark-32px.png\">GitHub でソースを表示{</a></td>\n <td><a href=\"https://storage.googleapis.com/tensorflow_docs/docs-l10n/site/ja/addons/tutorials/image_ops.ipynb\"><img src=\"https://www.tensorflow.org/images/download_logo_32px.png\">ノートブックをダウンロード/a0}</a></td>\n</table>",
"_____no_output_____"
],
[
"## 概要\n\nこのノートブックでは、TensorFlow Addons で画像操作を使用する方法をいくつか紹介します。\n\nこの例では、以下の画像操作について説明します。\n\n- `tfa.image.mean_filter2d`\n\n- `tfa.image.rotate`\n\n- `tfa.image.transform`\n\n- `tfa.image.random_hsv_in_yiq`\n\n- `tfa.image.adjust_hsv_in_yiq`\n\n- `tfa.image.dense_image_warp`\n\n- `tfa.image.euclidean_dist_transform`",
"_____no_output_____"
],
[
"# セットアップ",
"_____no_output_____"
]
],
[
[
"!pip install -U tensorflow-addons",
"_____no_output_____"
],
[
"import tensorflow as tf\nimport numpy as np\nimport tensorflow_addons as tfa\nimport matplotlib.pyplot as plt",
"_____no_output_____"
]
],
[
[
"# 画像を準備して検査する",
"_____no_output_____"
],
[
"## 画像をダウンロードする",
"_____no_output_____"
]
],
[
[
"img_path = tf.keras.utils.get_file('tensorflow.png','https://tensorflow.org/images/tf_logo.png')",
"_____no_output_____"
]
],
[
[
"## 画像を検査する",
"_____no_output_____"
],
[
"### TensorFlow のアイコン",
"_____no_output_____"
]
],
[
[
"img_raw = tf.io.read_file(img_path)\nimg = tf.io.decode_image(img_raw)\nimg = tf.image.convert_image_dtype(img, tf.float32)\nimg = tf.image.resize(img, [500,500])\n\nplt.title(\"TensorFlow Logo with shape {}\".format(img.shape))\n_ = plt.imshow(img)",
"_____no_output_____"
]
],
[
[
"### 白黒バージョンを作成する",
"_____no_output_____"
]
],
[
[
"bw_img = 1.0 - tf.image.rgb_to_grayscale(img)\n\nplt.title(\"Mask image with shape {}\".format(bw_img.shape))\n_ = plt.imshow(bw_img[...,0], cmap='gray')",
"_____no_output_____"
]
],
[
[
"# tfa.image を使って遊ぶ",
"_____no_output_____"
],
[
"## 平均フィルタリング\n\n平均フィルタリングはフィルタリング技術の 1 つで、画像や信号のノイズ除去によく使用されます。この考え方は、画像をピクセル単位で処理し、隣接するピクセルの平均値で置き換えるというものです。",
"_____no_output_____"
]
],
[
[
"mean = tfa.image.mean_filter2d(img, filter_shape=11)\n_ = plt.imshow(mean)",
"_____no_output_____"
]
],
[
[
"## 回転\n\nこの操作は、特定の画像をユーザーが入力した角度(ラジアン単位)に回転させます。 ",
"_____no_output_____"
]
],
[
[
"rotate = tfa.image.rotate(img, tf.constant(np.pi/8))\n_ = plt.imshow(rotate)",
"_____no_output_____"
]
],
[
[
"## 変換\n\nこの操作は、特定の画像をユーザーが指定した変換ベクトルに基づいて変換します。 ",
"_____no_output_____"
]
],
[
[
"transform = tfa.image.transform(img, [1.0, 1.0, -250, 0.0, 1.0, 0.0, 0.0, 0.0])\n_ = plt.imshow(transform)",
"_____no_output_____"
]
],
[
[
"## YIQ でランダムに HSV 変換する\n\nこの操作は、特定の RGB 画像のカラースケールを YIQ に変更しますが、ここではデルタ色相と彩度の値を指定された範囲からランダムに選択します。",
"_____no_output_____"
]
],
[
[
"delta = 0.5\nlower_saturation = 0.1\nupper_saturation = 0.9\nlower_value = 0.2\nupper_value = 0.8\nrand_hsvinyiq = tfa.image.random_hsv_in_yiq(img, delta, lower_saturation, upper_saturation, lower_value, upper_value)\n_ = plt.imshow(rand_hsvinyiq)",
"_____no_output_____"
]
],
[
[
"## YIQ で HSV を調整する\n\nこの操作は、特定の RGB 画像のカラースケールを YIQ に変更しますが、ここではランダムに選択するのではなく、デルタ色相と彩度の値はユーザーの入力値です。",
"_____no_output_____"
]
],
[
[
"delta = 0.5\nsaturation = 0.3\nvalue = 0.6\nadj_hsvinyiq = tfa.image.adjust_hsv_in_yiq(img, delta, saturation, value)\n_ = plt.imshow(adj_hsvinyiq)",
"_____no_output_____"
]
],
[
[
"## 高密度画像ワープ\n\nこの操作は、オフセットベクトルのフローフィールドで指定された任意の画像の非線形ワープを行います(例えば、ここではランダムな値を使用します)。 ",
"_____no_output_____"
]
],
[
[
"input_img = tf.image.convert_image_dtype(tf.expand_dims(img, 0), tf.dtypes.float32)\n\nflow_shape = [1, input_img.shape[1], input_img.shape[2], 2]\ninit_flows = np.float32(np.random.normal(size=flow_shape) * 2.0)\ndense_img_warp = tfa.image.dense_image_warp(input_img, init_flows)\ndense_img_warp = tf.squeeze(dense_img_warp, 0)\n_ = plt.imshow(dense_img_warp)",
"_____no_output_____"
]
],
[
[
"## ユークリッド距離変換\n\nこの操作は、前景ピクセルから背景ピクセルまでのピクセル値をユークリッド距離で更新します。\n\n- 注意: これは二値化画像のみを受け取り、結果は変換された画像になります。異なる画像を指定した場合は、結果は単一の値の画像になります。",
"_____no_output_____"
]
],
[
[
"gray = tf.image.convert_image_dtype(bw_img,tf.uint8)\n# The op expects a batch of images, so add a batch dimension\ngray = tf.expand_dims(gray, 0)\neucid = tfa.image.euclidean_dist_transform(gray)\neucid = tf.squeeze(eucid, (0, -1))\n_ = plt.imshow(eucid, cmap='gray')",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0ccd09a2c27cd95bd8ffe717e31f80c705220e7 | 105,697 | ipynb | Jupyter Notebook | Neural_Networks_and_Deep_Learning/Week_4/Logistic+Regression+with+a+Neural+Network+mindset+v5.ipynb | anoushkrit/MOOCs | 7bb4a031224af87a67d0c94043a8f15d7e718bb5 | [
"MIT"
] | 3 | 2019-10-28T19:03:43.000Z | 2021-12-02T14:39:53.000Z | Neural_Networks_and_Deep_Learning/Week_2/Logistic+Regression+with+a+Neural+Network+mindset+v5.ipynb | anoushkrit/MOOCs | 7bb4a031224af87a67d0c94043a8f15d7e718bb5 | [
"MIT"
] | null | null | null | Neural_Networks_and_Deep_Learning/Week_2/Logistic+Regression+with+a+Neural+Network+mindset+v5.ipynb | anoushkrit/MOOCs | 7bb4a031224af87a67d0c94043a8f15d7e718bb5 | [
"MIT"
] | 1 | 2020-12-22T05:57:27.000Z | 2020-12-22T05:57:27.000Z | 81.556327 | 22,812 | 0.775471 | [
[
[
"# Logistic Regression with a Neural Network mindset\n\nWelcome to your first (required) programming assignment! You will build a logistic regression classifier to recognize cats. This assignment will step you through how to do this with a Neural Network mindset, and so will also hone your intuitions about deep learning.\n\n**Instructions:**\n- Do not use loops (for/while) in your code, unless the instructions explicitly ask you to do so.\n\n**You will learn to:**\n- Build the general architecture of a learning algorithm, including:\n - Initializing parameters\n - Calculating the cost function and its gradient\n - Using an optimization algorithm (gradient descent) \n- Gather all three functions above into a main model function, in the right order.",
"_____no_output_____"
],
[
"## 1 - Packages ##\n\nFirst, let's run the cell below to import all the packages that you will need during this assignment. \n- [numpy](https://www.numpy.org/) is the fundamental package for scientific computing with Python.\n- [h5py](http://www.h5py.org) is a common package to interact with a dataset that is stored on an H5 file.\n- [matplotlib](http://matplotlib.org) is a famous library to plot graphs in Python.\n- [PIL](http://www.pythonware.com/products/pil/) and [scipy](https://www.scipy.org/) are used here to test your model with your own picture at the end.",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\nimport h5py\nimport scipy\nfrom PIL import Image\nfrom scipy import ndimage\nfrom lr_utils import load_dataset\n\n%matplotlib inline",
"_____no_output_____"
]
],
[
[
"## 2 - Overview of the Problem set ##\n\n**Problem Statement**: You are given a dataset (\"data.h5\") containing:\n - a training set of m_train images labeled as cat (y=1) or non-cat (y=0)\n - a test set of m_test images labeled as cat or non-cat\n - each image is of shape (num_px, num_px, 3) where 3 is for the 3 channels (RGB). Thus, each image is square (height = num_px) and (width = num_px).\n\nYou will build a simple image-recognition algorithm that can correctly classify pictures as cat or non-cat.\n\nLet's get more familiar with the dataset. Load the data by running the following code.",
"_____no_output_____"
]
],
[
[
"# Loading the data (cat/non-cat)\ntrain_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset()",
"_____no_output_____"
]
],
[
[
"We added \"_orig\" at the end of image datasets (train and test) because we are going to preprocess them. After preprocessing, we will end up with train_set_x and test_set_x (the labels train_set_y and test_set_y don't need any preprocessing).\n\nEach line of your train_set_x_orig and test_set_x_orig is an array representing an image. You can visualize an example by running the following code. Feel free also to change the `index` value and re-run to see other images. ",
"_____no_output_____"
]
],
[
[
"# Example of a picture\nindex = 25\nplt.imshow(train_set_x_orig[index])\nprint (\"y = \" + str(train_set_y[:, index]) + \", it's a '\" + classes[np.squeeze(train_set_y[:, index])].decode(\"utf-8\") + \"' picture.\")",
"y = [1], it's a 'cat' picture.\n"
]
],
[
[
"Many software bugs in deep learning come from having matrix/vector dimensions that don't fit. If you can keep your matrix/vector dimensions straight you will go a long way toward eliminating many bugs. \n\n**Exercise:** Find the values for:\n - m_train (number of training examples)\n - m_test (number of test examples)\n - num_px (= height = width of a training image)\nRemember that `train_set_x_orig` is a numpy-array of shape (m_train, num_px, num_px, 3). For instance, you can access `m_train` by writing `train_set_x_orig.shape[0]`.",
"_____no_output_____"
]
],
[
[
"### START CODE HERE ### (≈ 3 lines of code)\nm_train = train_set_x_orig.shape[0]\nm_test = test_set_x_orig.shape[0]\nnum_px = train_set_x_orig.shape[1]\n### END CODE HERE ###\n\nprint (\"Number of training examples: m_train = \" + str(m_train))\nprint (\"Number of testing examples: m_test = \" + str(m_test))\nprint (\"Height/Width of each image: num_px = \" + str(num_px))\nprint (\"Each image is of size: (\" + str(num_px) + \", \" + str(num_px) + \", 3)\")\nprint (\"train_set_x shape: \" + str(train_set_x_orig.shape))\nprint (\"train_set_y shape: \" + str(train_set_y.shape))\nprint (\"test_set_x shape: \" + str(test_set_x_orig.shape))\nprint (\"test_set_y shape: \" + str(test_set_y.shape))",
"Number of training examples: m_train = 209\nNumber of testing examples: m_test = 50\nHeight/Width of each image: num_px = 64\nEach image is of size: (64, 64, 3)\ntrain_set_x shape: (209, 64, 64, 3)\ntrain_set_y shape: (1, 209)\ntest_set_x shape: (50, 64, 64, 3)\ntest_set_y shape: (1, 50)\n"
]
],
[
[
"**Expected Output for m_train, m_test and num_px**: \n<table style=\"width:15%\">\n <tr>\n <td>**m_train**</td>\n <td> 209 </td> \n </tr>\n \n <tr>\n <td>**m_test**</td>\n <td> 50 </td> \n </tr>\n \n <tr>\n <td>**num_px**</td>\n <td> 64 </td> \n </tr>\n \n</table>\n",
"_____no_output_____"
],
[
"For convenience, you should now reshape images of shape (num_px, num_px, 3) in a numpy-array of shape (num_px $*$ num_px $*$ 3, 1). After this, our training (and test) dataset is a numpy-array where each column represents a flattened image. There should be m_train (respectively m_test) columns.\n\n**Exercise:** Reshape the training and test data sets so that images of size (num_px, num_px, 3) are flattened into single vectors of shape (num\\_px $*$ num\\_px $*$ 3, 1).\n\nA trick when you want to flatten a matrix X of shape (a,b,c,d) to a matrix X_flatten of shape (b$*$c$*$d, a) is to use: \n```python\nX_flatten = X.reshape(X.shape[0], -1).T # X.T is the transpose of X\n```",
"_____no_output_____"
]
],
[
[
"# Reshape the training and test examples\n\n### START CODE HERE ### (≈ 2 lines of code)\ntrain_set_x_flatten = train_set_x_orig.reshape(train_set_x_orig.shape[0], -1).T\ntest_set_x_flatten = test_set_x_orig.reshape(test_set_x_orig.shape[0], -1).T\n### END CODE HERE ###\n\nprint (\"train_set_x_flatten shape: \" + str(train_set_x_flatten.shape))\nprint (\"train_set_y shape: \" + str(train_set_y.shape))\nprint (\"test_set_x_flatten shape: \" + str(test_set_x_flatten.shape))\nprint (\"test_set_y shape: \" + str(test_set_y.shape))\nprint (\"sanity check after reshaping: \" + str(train_set_x_flatten[0:5,0]))",
"train_set_x_flatten shape: (12288, 209)\ntrain_set_y shape: (1, 209)\ntest_set_x_flatten shape: (12288, 50)\ntest_set_y shape: (1, 50)\nsanity check after reshaping: [17 31 56 22 33]\n"
]
],
[
[
"**Expected Output**: \n\n<table style=\"width:35%\">\n <tr>\n <td>**train_set_x_flatten shape**</td>\n <td> (12288, 209)</td> \n </tr>\n <tr>\n <td>**train_set_y shape**</td>\n <td>(1, 209)</td> \n </tr>\n <tr>\n <td>**test_set_x_flatten shape**</td>\n <td>(12288, 50)</td> \n </tr>\n <tr>\n <td>**test_set_y shape**</td>\n <td>(1, 50)</td> \n </tr>\n <tr>\n <td>**sanity check after reshaping**</td>\n <td>[17 31 56 22 33]</td> \n </tr>\n</table>",
"_____no_output_____"
],
[
"To represent color images, the red, green and blue channels (RGB) must be specified for each pixel, and so the pixel value is actually a vector of three numbers ranging from 0 to 255.\n\nOne common preprocessing step in machine learning is to center and standardize your dataset, meaning that you substract the mean of the whole numpy array from each example, and then divide each example by the standard deviation of the whole numpy array. But for picture datasets, it is simpler and more convenient and works almost as well to just divide every row of the dataset by 255 (the maximum value of a pixel channel).\n\n<!-- During the training of your model, you're going to multiply weights and add biases to some initial inputs in order to observe neuron activations. Then you backpropogate with the gradients to train the model. But, it is extremely important for each feature to have a similar range such that our gradients don't explode. You will see that more in detail later in the lectures. !--> \n\nLet's standardize our dataset.",
"_____no_output_____"
]
],
[
[
"train_set_x = train_set_x_flatten/255.\ntest_set_x = test_set_x_flatten/255.",
"_____no_output_____"
]
],
[
[
"<font color='blue'>\n**What you need to remember:**\n\nCommon steps for pre-processing a new dataset are:\n- Figure out the dimensions and shapes of the problem (m_train, m_test, num_px, ...)\n- Reshape the datasets such that each example is now a vector of size (num_px \\* num_px \\* 3, 1)\n- \"Standardize\" the data",
"_____no_output_____"
],
[
"## 3 - General Architecture of the learning algorithm ##\n\nIt's time to design a simple algorithm to distinguish cat images from non-cat images.\n\nYou will build a Logistic Regression, using a Neural Network mindset. The following Figure explains why **Logistic Regression is actually a very simple Neural Network!**\n\n<img src=\"images/LogReg_kiank.png\" style=\"width:650px;height:400px;\">\n\n**Mathematical expression of the algorithm**:\n\nFor one example $x^{(i)}$:\n$$z^{(i)} = w^T x^{(i)} + b \\tag{1}$$\n$$\\hat{y}^{(i)} = a^{(i)} = sigmoid(z^{(i)})\\tag{2}$$ \n$$ \\mathcal{L}(a^{(i)}, y^{(i)}) = - y^{(i)} \\log(a^{(i)}) - (1-y^{(i)} ) \\log(1-a^{(i)})\\tag{3}$$\n\nThe cost is then computed by summing over all training examples:\n$$ J = \\frac{1}{m} \\sum_{i=1}^m \\mathcal{L}(a^{(i)}, y^{(i)})\\tag{6}$$\n\n**Key steps**:\nIn this exercise, you will carry out the following steps: \n - Initialize the parameters of the model\n - Learn the parameters for the model by minimizing the cost \n - Use the learned parameters to make predictions (on the test set)\n - Analyse the results and conclude",
"_____no_output_____"
],
[
"## 4 - Building the parts of our algorithm ## \n\nThe main steps for building a Neural Network are:\n1. Define the model structure (such as number of input features) \n2. Initialize the model's parameters\n3. Loop:\n - Calculate current loss (forward propagation)\n - Calculate current gradient (backward propagation)\n - Update parameters (gradient descent)\n\nYou often build 1-3 separately and integrate them into one function we call `model()`.\n\n### 4.1 - Helper functions\n\n**Exercise**: Using your code from \"Python Basics\", implement `sigmoid()`. As you've seen in the figure above, you need to compute $sigmoid( w^T x + b) = \\frac{1}{1 + e^{-(w^T x + b)}}$ to make predictions. Use np.exp().",
"_____no_output_____"
]
],
[
[
"# GRADED FUNCTION: sigmoid\n\ndef sigmoid(z):\n \"\"\"\n Compute the sigmoid of z\n\n Arguments:\n z -- A scalar or numpy array of any size.\n\n Return:\n s -- sigmoid(z)\n \"\"\"\n\n ### START CODE HERE ### (≈ 1 line of code)\n s = 1 / (1 + np.exp(-z))\n ### END CODE HERE ###\n \n return s",
"_____no_output_____"
],
[
"print (\"sigmoid([0, 2]) = \" + str(sigmoid(np.array([0,2]))))",
"sigmoid([0, 2]) = [ 0.5 0.88079708]\n"
]
],
[
[
"**Expected Output**: \n\n<table>\n <tr>\n <td>**sigmoid([0, 2])**</td>\n <td> [ 0.5 0.88079708]</td> \n </tr>\n</table>",
"_____no_output_____"
],
[
"### 4.2 - Initializing parameters\n\n**Exercise:** Implement parameter initialization in the cell below. You have to initialize w as a vector of zeros. If you don't know what numpy function to use, look up np.zeros() in the Numpy library's documentation.",
"_____no_output_____"
]
],
[
[
"# GRADED FUNCTION: initialize_with_zeros\n\ndef initialize_with_zeros(dim):\n \"\"\"\n This function creates a vector of zeros of shape (dim, 1) for w and initializes b to 0.\n \n Argument:\n dim -- size of the w vector we want (or number of parameters in this case)\n \n Returns:\n w -- initialized vector of shape (dim, 1)\n b -- initialized scalar (corresponds to the bias)\n \"\"\"\n \n ### START CODE HERE ### (≈ 1 line of code)\n w = np.zeros(shape=(dim, 1))\n b = 0\n ### END CODE HERE ###\n\n assert(w.shape == (dim, 1))\n assert(isinstance(b, float) or isinstance(b, int))\n \n return w, b",
"_____no_output_____"
],
[
"dim = 2\nw, b = initialize_with_zeros(dim)\nprint (\"w = \" + str(w))\nprint (\"b = \" + str(b))",
"w = [[ 0.]\n [ 0.]]\nb = 0\n"
]
],
[
[
"**Expected Output**: \n\n\n<table style=\"width:15%\">\n <tr>\n <td> ** w ** </td>\n <td> [[ 0.]\n [ 0.]] </td>\n </tr>\n <tr>\n <td> ** b ** </td>\n <td> 0 </td>\n </tr>\n</table>\n\nFor image inputs, w will be of shape (num_px $\\times$ num_px $\\times$ 3, 1).",
"_____no_output_____"
],
[
"### 4.3 - Forward and Backward propagation\n\nNow that your parameters are initialized, you can do the \"forward\" and \"backward\" propagation steps for learning the parameters.\n\n**Exercise:** Implement a function `propagate()` that computes the cost function and its gradient.\n\n**Hints**:\n\nForward Propagation:\n- You get X\n- You compute $A = \\sigma(w^T X + b) = (a^{(1)}, a^{(2)}, ..., a^{(m-1)}, a^{(m)})$\n- You calculate the cost function: $J = -\\frac{1}{m}\\sum_{i=1}^{m}y^{(i)}\\log(a^{(i)})+(1-y^{(i)})\\log(1-a^{(i)})$\n\nHere are the two formulas you will be using: \n\n$$ \\frac{\\partial J}{\\partial w} = \\frac{1}{m}X(A-Y)^T\\tag{7}$$\n$$ \\frac{\\partial J}{\\partial b} = \\frac{1}{m} \\sum_{i=1}^m (a^{(i)}-y^{(i)})\\tag{8}$$",
"_____no_output_____"
]
],
[
[
"# GRADED FUNCTION: propagate\n\ndef propagate(w, b, X, Y):\n \"\"\"\n Implement the cost function and its gradient for the propagation explained above\n\n Arguments:\n w -- weights, a numpy array of size (num_px * num_px * 3, 1)\n b -- bias, a scalar\n X -- data of size (num_px * num_px * 3, number of examples)\n Y -- true \"label\" vector (containing 0 if non-cat, 1 if cat) of size (1, number of examples)\n\n Return:\n cost -- negative log-likelihood cost for logistic regression\n dw -- gradient of the loss with respect to w, thus same shape as w\n db -- gradient of the loss with respect to b, thus same shape as b\n \n Tips:\n - Write your code step by step for the propagation. np.log(), np.dot()\n \"\"\"\n \n m = X.shape[1]\n \n # FORWARD PROPAGATION (FROM X TO COST)\n ### START CODE HERE ### (≈ 2 lines of code)\n A = sigmoid(np.dot(w.T,X) + b)# compute activation\n cost = (- 1 / m) * np.sum(Y * np.log(A) + (1 - Y) * (np.log(1 - A)))# compute cost\n ### END CODE HERE ###\n \n # BACKWARD PROPAGATION (TO FIND GRAD)\n ### START CODE HERE ### (≈ 2 lines of code)\n dw = (1 / m) * np.dot(X, (A - Y).T)\n db = (1 / m) * np.sum(A- Y)\n ### END CODE HERE ###\n\n assert(dw.shape == w.shape)\n assert(db.dtype == float)\n cost = np.squeeze(cost)\n assert(cost.shape == ())\n \n grads = {\"dw\": dw,\n \"db\": db}\n \n return grads, cost",
"_____no_output_____"
],
[
"w, b, X, Y = np.array([[1.],[2.]]), 2., np.array([[1.,2.,-1.],[3.,4.,-3.2]]), np.array([[1,0,1]])\ngrads, cost = propagate(w, b, X, Y)\nprint (\"dw = \" + str(grads[\"dw\"]))\nprint (\"db = \" + str(grads[\"db\"]))\nprint (\"cost = \" + str(cost))",
"dw = [[ 0.99845601]\n [ 2.39507239]]\ndb = 0.00145557813678\ncost = 5.80154531939\n"
]
],
[
[
"**Expected Output**:\n\n<table style=\"width:50%\">\n <tr>\n <td> ** dw ** </td>\n <td> [[ 0.99845601]\n [ 2.39507239]]</td>\n </tr>\n <tr>\n <td> ** db ** </td>\n <td> 0.00145557813678 </td>\n </tr>\n <tr>\n <td> ** cost ** </td>\n <td> 5.801545319394553 </td>\n </tr>\n\n</table>",
"_____no_output_____"
],
[
"### 4.4 - Optimization\n- You have initialized your parameters.\n- You are also able to compute a cost function and its gradient.\n- Now, you want to update the parameters using gradient descent.\n\n**Exercise:** Write down the optimization function. The goal is to learn $w$ and $b$ by minimizing the cost function $J$. For a parameter $\\theta$, the update rule is $ \\theta = \\theta - \\alpha \\text{ } d\\theta$, where $\\alpha$ is the learning rate.",
"_____no_output_____"
]
],
[
[
"# GRADED FUNCTION: optimize\n\ndef optimize(w, b, X, Y, num_iterations, learning_rate, print_cost = False):\n \"\"\"\n This function optimizes w and b by running a gradient descent algorithm\n \n Arguments:\n w -- weights, a numpy array of size (num_px * num_px * 3, 1)\n b -- bias, a scalar\n X -- data of shape (num_px * num_px * 3, number of examples)\n Y -- true \"label\" vector (containing 0 if non-cat, 1 if cat), of shape (1, number of examples)\n num_iterations -- number of iterations of the optimization loop\n learning_rate -- learning rate of the gradient descent update rule\n print_cost -- True to print the loss every 100 steps\n \n Returns:\n params -- dictionary containing the weights w and bias b\n grads -- dictionary containing the gradients of the weights and bias with respect to the cost function\n costs -- list of all the costs computed during the optimization, this will be used to plot the learning curve.\n \n Tips:\n You basically need to write down two steps and iterate through them:\n 1) Calculate the cost and the gradient for the current parameters. Use propagate().\n 2) Update the parameters using gradient descent rule for w and b.\n \"\"\"\n \n costs = []\n \n for i in range(num_iterations):\n \n \n # Cost and gradient calculation (≈ 1-4 lines of code)\n ### START CODE HERE ### \n grads, cost = propagate(w, b, X, Y)\n ### END CODE HERE ###\n \n # Retrieve derivatives from grads\n dw = grads[\"dw\"]\n db = grads[\"db\"]\n \n # update rule (≈ 2 lines of code)\n ### START CODE HERE ###\n w = w - learning_rate * dw\n b = b - learning_rate * db\n ### END CODE HERE ###\n \n # Record the costs\n if i % 100 == 0:\n costs.append(cost)\n \n # Print the cost every 100 training iterations\n if print_cost and i % 100 == 0:\n print (\"Cost after iteration %i: %f\" %(i, cost))\n \n params = {\"w\": w,\n \"b\": b}\n \n grads = {\"dw\": dw,\n \"db\": db}\n \n return params, grads, costs",
"_____no_output_____"
],
[
"params, grads, costs = optimize(w, b, X, Y, num_iterations= 100, learning_rate = 0.009, print_cost = False)\n\nprint (\"w = \" + str(params[\"w\"]))\nprint (\"b = \" + str(params[\"b\"]))\nprint (\"dw = \" + str(grads[\"dw\"]))\nprint (\"db = \" + str(grads[\"db\"]))",
"w = [[ 0.19033591]\n [ 0.12259159]]\nb = 1.92535983008\ndw = [[ 0.67752042]\n [ 1.41625495]]\ndb = 0.219194504541\n"
]
],
[
[
"**Expected Output**: \n\n<table style=\"width:40%\">\n <tr>\n <td> **w** </td>\n <td>[[ 0.19033591]\n [ 0.12259159]] </td>\n </tr>\n \n <tr>\n <td> **b** </td>\n <td> 1.92535983008 </td>\n </tr>\n <tr>\n <td> **dw** </td>\n <td> [[ 0.67752042]\n [ 1.41625495]] </td>\n </tr>\n <tr>\n <td> **db** </td>\n <td> 0.219194504541 </td>\n </tr>\n\n</table>",
"_____no_output_____"
],
[
"**Exercise:** The previous function will output the learned w and b. We are able to use w and b to predict the labels for a dataset X. Implement the `predict()` function. There are two steps to computing predictions:\n\n1. Calculate $\\hat{Y} = A = \\sigma(w^T X + b)$\n\n2. Convert the entries of a into 0 (if activation <= 0.5) or 1 (if activation > 0.5), stores the predictions in a vector `Y_prediction`. If you wish, you can use an `if`/`else` statement in a `for` loop (though there is also a way to vectorize this). ",
"_____no_output_____"
]
],
[
[
"# GRADED FUNCTION: predict\n\ndef predict(w, b, X):\n '''\n Predict whether the label is 0 or 1 using learned logistic regression parameters (w, b)\n \n Arguments:\n w -- weights, a numpy array of size (num_px * num_px * 3, 1)\n b -- bias, a scalar\n X -- data of size (num_px * num_px * 3, number of examples)\n \n Returns:\n Y_prediction -- a numpy array (vector) containing all predictions (0/1) for the examples in X\n '''\n \n m = X.shape[1]\n Y_prediction = np.zeros((1,m))\n w = w.reshape(X.shape[0], 1)\n \n # Compute vector \"A\" predicting the probabilities of a cat being present in the picture\n ### START CODE HERE ### (≈ 1 line of code)\n A = sigmoid(np.dot(w.T, X) + b)\n ### END CODE HERE ###\n \n for i in range(A.shape[1]):\n \n # Convert probabilities A[0,i] to actual predictions p[0,i]\n ### START CODE HERE ### (≈ 4 lines of code)\n Y_prediction[0, i] = 1 if A[0, i] > 0.5 else 0\n ### END CODE HERE ###\n \n assert(Y_prediction.shape == (1, m))\n \n return Y_prediction",
"_____no_output_____"
],
[
"w = np.array([[0.1124579],[0.23106775]])\nb = -0.3\nX = np.array([[1.,-1.1,-3.2],[1.2,2.,0.1]])\nprint (\"predictions = \" + str(predict(w, b, X)))",
"predictions = [[ 1. 1. 0.]]\n"
]
],
[
[
"**Expected Output**: \n\n<table style=\"width:30%\">\n <tr>\n <td>\n **predictions**\n </td>\n <td>\n [[ 1. 1. 0.]]\n </td> \n </tr>\n\n</table>\n",
"_____no_output_____"
],
[
"<font color='blue'>\n**What to remember:**\nYou've implemented several functions that:\n- Initialize (w,b)\n- Optimize the loss iteratively to learn parameters (w,b):\n - computing the cost and its gradient \n - updating the parameters using gradient descent\n- Use the learned (w,b) to predict the labels for a given set of examples",
"_____no_output_____"
],
[
"## 5 - Merge all functions into a model ##\n\nYou will now see how the overall model is structured by putting together all the building blocks (functions implemented in the previous parts) together, in the right order.\n\n**Exercise:** Implement the model function. Use the following notation:\n - Y_prediction_test for your predictions on the test set\n - Y_prediction_train for your predictions on the train set\n - w, costs, grads for the outputs of optimize()",
"_____no_output_____"
]
],
[
[
"# GRADED FUNCTION: model\n\ndef model(X_train, Y_train, X_test, Y_test, num_iterations = 2000, learning_rate = 0.5, print_cost = False):\n \"\"\"\n Builds the logistic regression model by calling the function you've implemented previously\n \n Arguments:\n X_train -- training set represented by a numpy array of shape (num_px * num_px * 3, m_train)\n Y_train -- training labels represented by a numpy array (vector) of shape (1, m_train)\n X_test -- test set represented by a numpy array of shape (num_px * num_px * 3, m_test)\n Y_test -- test labels represented by a numpy array (vector) of shape (1, m_test)\n num_iterations -- hyperparameter representing the number of iterations to optimize the parameters\n learning_rate -- hyperparameter representing the learning rate used in the update rule of optimize()\n print_cost -- Set to true to print the cost every 100 iterations\n \n Returns:\n d -- dictionary containing information about the model.\n \"\"\"\n \n ### START CODE HERE ###\n \n # initialize parameters with zeros (≈ 1 line of code)\n w, b = initialize_with_zeros(X_train.shape[0])\n\n # Gradient descent (≈ 1 line of code)\n parameters, grads, costs = parameters, grads, costs = optimize(w, b, X_train, Y_train, num_iterations, learning_rate, print_cost)\n \n # Retrieve parameters w and b from dictionary \"parameters\"\n w = parameters[\"w\"]\n b = parameters[\"b\"]\n \n # Predict test/train set examples (≈ 2 lines of code)\n Y_prediction_test = predict(w, b, X_test)\n Y_prediction_train = predict(w, b, X_train)\n\n ### END CODE HERE ###\n\n # Print train/test Errors\n print(\"train accuracy: {} %\".format(100 - np.mean(np.abs(Y_prediction_train - Y_train)) * 100))\n print(\"test accuracy: {} %\".format(100 - np.mean(np.abs(Y_prediction_test - Y_test)) * 100))\n\n \n d = {\"costs\": costs,\n \"Y_prediction_test\": Y_prediction_test, \n \"Y_prediction_train\" : Y_prediction_train, \n \"w\" : w, \n \"b\" : b,\n \"learning_rate\" : learning_rate,\n \"num_iterations\": num_iterations}\n \n return d",
"_____no_output_____"
]
],
[
[
"Run the following cell to train your model.",
"_____no_output_____"
]
],
[
[
"d = model(train_set_x, train_set_y, test_set_x, test_set_y, num_iterations = 2000, learning_rate = 0.005, print_cost = True)",
"Cost after iteration 0: 0.693147\nCost after iteration 100: 0.584508\nCost after iteration 200: 0.466949\nCost after iteration 300: 0.376007\nCost after iteration 400: 0.331463\nCost after iteration 500: 0.303273\nCost after iteration 600: 0.279880\nCost after iteration 700: 0.260042\nCost after iteration 800: 0.242941\nCost after iteration 900: 0.228004\nCost after iteration 1000: 0.214820\nCost after iteration 1100: 0.203078\nCost after iteration 1200: 0.192544\nCost after iteration 1300: 0.183033\nCost after iteration 1400: 0.174399\nCost after iteration 1500: 0.166521\nCost after iteration 1600: 0.159305\nCost after iteration 1700: 0.152667\nCost after iteration 1800: 0.146542\nCost after iteration 1900: 0.140872\ntrain accuracy: 99.04306220095694 %\ntest accuracy: 70.0 %\n"
]
],
[
[
"**Expected Output**: \n\n<table style=\"width:40%\"> \n\n <tr>\n <td> **Cost after iteration 0 ** </td> \n <td> 0.693147 </td>\n </tr>\n <tr>\n <td> <center> $\\vdots$ </center> </td> \n <td> <center> $\\vdots$ </center> </td> \n </tr> \n <tr>\n <td> **Train Accuracy** </td> \n <td> 99.04306220095694 % </td>\n </tr>\n\n <tr>\n <td>**Test Accuracy** </td> \n <td> 70.0 % </td>\n </tr>\n</table> \n\n\n",
"_____no_output_____"
],
[
"**Comment**: Training accuracy is close to 100%. This is a good sanity check: your model is working and has high enough capacity to fit the training data. Test accuracy is 68%. It is actually not bad for this simple model, given the small dataset we used and that logistic regression is a linear classifier. But no worries, you'll build an even better classifier next week!\n\nAlso, you see that the model is clearly overfitting the training data. Later in this specialization you will learn how to reduce overfitting, for example by using regularization. Using the code below (and changing the `index` variable) you can look at predictions on pictures of the test set.",
"_____no_output_____"
]
],
[
[
"# Example of a picture that was wrongly classified.\nindex = 1\nplt.imshow(test_set_x[:,index].reshape((num_px, num_px, 3)))\nprint (\"y = \" + str(test_set_y[0,index]) + \", you predicted that it is a \\\"\" + classes[d[\"Y_prediction_test\"][0,index]].decode(\"utf-8\") + \"\\\" picture.\")",
"y = 1, you predicted that it is a \"cat\" picture.\n"
]
],
[
[
"Let's also plot the cost function and the gradients.",
"_____no_output_____"
]
],
[
[
"# Plot learning curve (with costs)\ncosts = np.squeeze(d['costs'])\nplt.plot(costs)\nplt.ylabel('cost')\nplt.xlabel('iterations (per hundreds)')\nplt.title(\"Learning rate =\" + str(d[\"learning_rate\"]))\nplt.show()",
"_____no_output_____"
]
],
[
[
"**Interpretation**:\nYou can see the cost decreasing. It shows that the parameters are being learned. However, you see that you could train the model even more on the training set. Try to increase the number of iterations in the cell above and rerun the cells. You might see that the training set accuracy goes up, but the test set accuracy goes down. This is called overfitting. ",
"_____no_output_____"
],
[
"## 6 - Further analysis (optional/ungraded exercise) ##\n\nCongratulations on building your first image classification model. Let's analyze it further, and examine possible choices for the learning rate $\\alpha$. ",
"_____no_output_____"
],
[
"#### Choice of learning rate ####\n\n**Reminder**:\nIn order for Gradient Descent to work you must choose the learning rate wisely. The learning rate $\\alpha$ determines how rapidly we update the parameters. If the learning rate is too large we may \"overshoot\" the optimal value. Similarly, if it is too small we will need too many iterations to converge to the best values. That's why it is crucial to use a well-tuned learning rate.\n\nLet's compare the learning curve of our model with several choices of learning rates. Run the cell below. This should take about 1 minute. Feel free also to try different values than the three we have initialized the `learning_rates` variable to contain, and see what happens. ",
"_____no_output_____"
]
],
[
[
"learning_rates = [0.01, 0.001, 0.0001]\nmodels = {}\nfor i in learning_rates:\n print (\"learning rate is: \" + str(i))\n models[str(i)] = model(train_set_x, train_set_y, test_set_x, test_set_y, num_iterations = 1500, learning_rate = i, print_cost = False)\n print ('\\n' + \"-------------------------------------------------------\" + '\\n')\n\nfor i in learning_rates:\n plt.plot(np.squeeze(models[str(i)][\"costs\"]), label= str(models[str(i)][\"learning_rate\"]))\n\nplt.ylabel('cost')\nplt.xlabel('iterations (hundreds)')\n\nlegend = plt.legend(loc='upper center', shadow=True)\nframe = legend.get_frame()\nframe.set_facecolor('0.90')\nplt.show()",
"learning rate is: 0.01\ntrain accuracy: 99.52153110047847 %\ntest accuracy: 68.0 %\n\n-------------------------------------------------------\n\nlearning rate is: 0.001\ntrain accuracy: 88.99521531100478 %\ntest accuracy: 64.0 %\n\n-------------------------------------------------------\n\nlearning rate is: 0.0001\n"
]
],
[
[
"**Interpretation**: \n- Different learning rates give different costs and thus different predictions results.\n- If the learning rate is too large (0.01), the cost may oscillate up and down. It may even diverge (though in this example, using 0.01 still eventually ends up at a good value for the cost). \n- A lower cost doesn't mean a better model. You have to check if there is possibly overfitting. It happens when the training accuracy is a lot higher than the test accuracy.\n- In deep learning, we usually recommend that you: \n - Choose the learning rate that better minimizes the cost function.\n - If your model overfits, use other techniques to reduce overfitting. (We'll talk about this in later videos.) \n",
"_____no_output_____"
],
[
"## 7 - Test with your own image (optional/ungraded exercise) ##\n\nCongratulations on finishing this assignment. You can use your own image and see the output of your model. To do that:\n 1. Click on \"File\" in the upper bar of this notebook, then click \"Open\" to go on your Coursera Hub.\n 2. Add your image to this Jupyter Notebook's directory, in the \"images\" folder\n 3. Change your image's name in the following code\n 4. Run the code and check if the algorithm is right (1 = cat, 0 = non-cat)!",
"_____no_output_____"
]
],
[
[
"## START CODE HERE ## (PUT YOUR IMAGE NAME) \nmy_image = \"my_image.jpg\" # change this to the name of your image file \n## END CODE HERE ##\n\n# We preprocess the image to fit your algorithm.\nfname = \"images/\" + my_image\nimage = np.array(ndimage.imread(fname, flatten=False))\nimage = image/255.\nmy_image = scipy.misc.imresize(image, size=(num_px,num_px)).reshape((1, num_px*num_px*3)).T\nmy_predicted_image = predict(d[\"w\"], d[\"b\"], my_image)\n\nplt.imshow(image)\nprint(\"y = \" + str(np.squeeze(my_predicted_image)) + \", your algorithm predicts a \\\"\" + classes[int(np.squeeze(my_predicted_image)),].decode(\"utf-8\") + \"\\\" picture.\")",
"_____no_output_____"
]
],
[
[
"<font color='blue'>\n**What to remember from this assignment:**\n1. Preprocessing the dataset is important.\n2. You implemented each function separately: initialize(), propagate(), optimize(). Then you built a model().\n3. Tuning the learning rate (which is an example of a \"hyperparameter\") can make a big difference to the algorithm. You will see more examples of this later in this course!",
"_____no_output_____"
],
[
"Finally, if you'd like, we invite you to try different things on this Notebook. Make sure you submit before trying anything. Once you submit, things you can play with include:\n - Play with the learning rate and the number of iterations\n - Try different initialization methods and compare the results\n - Test other preprocessings (center the data, or divide each row by its standard deviation)",
"_____no_output_____"
],
[
"Bibliography:\n- http://www.wildml.com/2015/09/implementing-a-neural-network-from-scratch/\n- https://stats.stackexchange.com/questions/211436/why-do-we-normalize-images-by-subtracting-the-datasets-image-mean-and-not-the-c",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
]
] |
d0ccefdd66ee04748222e051cd761d3f7045112b | 35,417 | ipynb | Jupyter Notebook | Regression.ipynb | itouchz/TRepNet | 5fa9f273dc57b778ac0a94fffcb926de333ecc37 | [
"Apache-2.0"
] | null | null | null | Regression.ipynb | itouchz/TRepNet | 5fa9f273dc57b778ac0a94fffcb926de333ecc37 | [
"Apache-2.0"
] | null | null | null | Regression.ipynb | itouchz/TRepNet | 5fa9f273dc57b778ac0a94fffcb926de333ecc37 | [
"Apache-2.0"
] | 1 | 2021-07-16T09:46:58.000Z | 2021-07-16T09:46:58.000Z | 36.739627 | 202 | 0.537934 | [
[
[
"import numpy as np\nimport pandas as pd\nimport tensorflow as tf\nimport os\nimport warnings\nwarnings.filterwarnings('ignore') \n\nfrom tensorflow import keras\nfrom sklearn.preprocessing import RobustScaler, MinMaxScaler, StandardScaler\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.ensemble import RandomForestRegressor\nfrom sklearn.svm import SVR\nfrom sklearn.neural_network import MLPClassifier\nfrom sklearn.neighbors import KNeighborsClassifier\nfrom sklearn.metrics import f1_score, accuracy_score\nfrom Models import SAE, CNN_AE, LSTM_AE, GRU_AE, Bi_LSTM_AE, CNN_Bi_LSTM_AE, Causal_CNN_AE, Wavenet, Attention_Bi_LSTM_AE, Attention_CNN_Bi_LSTM_AE, Attention_Wavenet\n\nnp.random.seed(7)\ntf.random.set_seed(7)",
"_____no_output_____"
],
[
"os.environ[\"CUDA_DEVICE_ORDER\"] = \"PCI_BUS_ID\";\nos.environ[\"CUDA_VISIBLE_DEVICES\"] = \"0\"\n\ngpus = tf.config.experimental.list_physical_devices('GPU')\nif gpus:\n # Restrict TensorFlow to only allocate 1GB of memory on the first GPU\n try:\n tf.config.experimental.set_virtual_device_configuration(\n gpus[0],\n [tf.config.experimental.VirtualDeviceConfiguration(memory_limit=2048)])\n logical_gpus = tf.config.experimental.list_logical_devices('GPU')\n print(len(gpus), \"Physical GPUs,\", len(logical_gpus), \"Logical GPUs\")\n except RuntimeError as e:\n # Virtual devices must be set before GPUs have been initialized\n print(e)\n",
"1 Physical GPUs, 1 Logical GPUs\n"
],
[
"svm_reg = SVR(gamma='scale')",
"_____no_output_____"
],
[
"from sklearn.metrics import mean_squared_error as mse\nfrom sklearn.metrics import r2_score\ndataset_path = './datasets/regression/'",
"_____no_output_____"
],
[
"def n_steps_reshape(X_train_full, y_train_full, n_steps=10, for_rnn=False):\n new_data = []\n new_label = []\n columns = X_train_full.columns\n for i in range(X_train_full.shape[0]-n_steps):\n new_instance = []\n train_data = X_train_full[i:i+n_steps]\n for c in columns:\n for v in train_data[c].values:\n new_instance.append(v)\n# for _, row in train_data.iterrows():\n# for c in columns:\n# new_instance.append(row[c])\n new_label.append(y_train_full[i+n_steps])\n new_data.append(new_instance)\n\n scaler = RobustScaler()\n new_data = scaler.fit_transform(new_data)\n new_label = scaler.fit_transform(np.array(new_label).reshape(-1,1))\n\n if for_rnn:\n return np.array(new_data).reshape(len(new_data), n_steps, columns.shape[0]), new_label\n else:\n return np.array(new_data), new_label",
"_____no_output_____"
],
[
"def LSTM_Model(n_steps, n_features):\n return keras.models.Sequential([\n keras.layers.LSTM(128, return_sequences=True, input_shape=[n_steps, n_features]),\n keras.layers.LSTM(128),\n keras.layers.Dense(1, activation=keras.layers.LeakyReLU(alpha=0.5))\n ])",
"_____no_output_____"
],
[
"results = []",
"_____no_output_____"
],
[
"from TRepNet import TRepNet\n\ndef get_codings(X_train, n_steps, n_features):\n# X_train, X_test, n_steps = flatten_ts(train_x, test_x)\n# X_train, X_test = rnn_reshape(X_train, X_test, n_steps // n_features, n_features)\n encoder, decoder = TRepNet(n_steps, n_features, activation='elu')\n model = keras.models.Sequential([encoder, decoder])\n \n model.compile(loss=\"mae\", optimizer=keras.optimizers.Nadam(lr=0.001, clipnorm=1.), metrics=['mae'])\n history = model.fit(X_train, X_train, epochs=500, batch_size=16, validation_split=0.20, callbacks=[es], verbose=1, shuffle=False)\n\n # Codings\n return encoder.predict(X_train)",
"_____no_output_____"
],
[
"es = keras.callbacks.EarlyStopping(patience=5, restore_best_weights=True)",
"_____no_output_____"
],
[
"# for fn in [SAE, CNN_AE, LSTM_AE, GRU_AE, Bi_LSTM_AE, CNN_Bi_LSTM_AE, Causal_CNN_AE, Wavenet, TRepNet]:\n# results = []\n\n# print(fn.__name__)\n \n# name = 'Solar Generation'\n# solar_data = pd.read_csv(dataset_path + 'Solar/data.csv', quotechar='\"').fillna(0)\n# solar_data_X = solar_data.drop(columns=['SITE_NO', 'DATE', 'TIME'])\n# solar_data_y = solar_data['GEN_ENERGY']\n# X_train_full, y_train_full = n_steps_reshape(solar_data_X, solar_data_y, 10, for_rnn=True)\n# X_train_full = get_codings(X_train_full, 10, X_train_full.shape[2])\n# X_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\n# svm_reg.fit(X_train, y_train)\n# pred = svm_reg.predict(X_test)\n# print(mse(y_test, pred))\n# results.append({'dataset': name, 'MSE': mse(y_test, pred)})\n \n# name = 'Beijing PM 2.5'\n# beijing_data = pd.read_csv(dataset_path + 'Beijing-PM25.csv').dropna().drop(columns=['No', 'year']).reset_index(drop=True)\n# beijing_data_X = pd.get_dummies(beijing_data, columns=['cbwd'])\n# beijing_data_y = beijing_data['pm2.5']\n# X_train_full, y_train_full = n_steps_reshape(beijing_data_X, beijing_data_y, 10, for_rnn=True)\n# X_train_full = get_codings(X_train_full, 10, X_train_full.shape[2])\n# X_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\n# svm_reg.fit(X_train, y_train)\n# pred = svm_reg.predict(X_test)\n# print(mse(y_test, pred))\n# results.append({'dataset': name, 'MSE': mse(y_test, pred)})\n \n# name = 'Appliance Energy Prediction'\n# energy_data = pd.read_csv(dataset_path + 'energydata_complete.csv')\n# enery_data_X = energy_data.drop(columns=['date'])\n# enery_data_y = energy_data['Appliances']\n# X_train_full, y_train_full = n_steps_reshape(enery_data_X, enery_data_y, 10, for_rnn=True)\n# X_train_full = get_codings(X_train_full, 10, X_train_full.shape[2])\n# X_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\n# svm_reg.fit(X_train, y_train)\n# pred = svm_reg.predict(X_test)\n# print(mse(y_test, pred))\n# results.append({'dataset': name, 'MSE': mse(y_test, pred)})\n \n# name = 'Parking Birmingham'\n# parking_data = pd.read_csv(dataset_path + 'Parking Birmingham.csv')\n# parking_data_X = parking_data.drop(columns=['SystemCodeNumber', 'LastUpdated'])\n# parking_data_y = parking_data['Occupancy']\n# X_train_full, y_train_full = n_steps_reshape(parking_data_X, parking_data_y, 10, for_rnn=True)\n# X_train_full = get_codings(X_train_full, 10, X_train_full.shape[2])\n# X_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\n# svm_reg.fit(X_train, y_train)\n# pred = svm_reg.predict(X_test)\n# print(mse(y_test, pred))\n# results.append({'dataset': name, 'MSE': mse(y_test, pred)})\n \n# name = 'Daily Deemand Forecasting'\n# demand_data = pd.read_csv(dataset_path + 'Daily_Demand_Forecasting_Orders.csv', sep=';')\n# demand_data_X = demand_data\n# demand_data_y = demand_data['Target']\n# X_train_full, y_train_full = n_steps_reshape(demand_data_X, demand_data_y, 10, for_rnn=True)\n# X_train_full = get_codings(X_train_full, 10, X_train_full.shape[2])\n# X_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\n# svm_reg.fit(X_train, y_train)\n# pred = svm_reg.predict(X_test)\n# print(mse(y_test, pred))\n# results.append({'dataset': name, 'MSE': mse(y_test, pred)})\n \n# pd.DataFrame(results).to_csv('./results/regression-'+ fn.__name__ +'-results.csv', index=False)\n# print('END')",
"_____no_output_____"
]
],
[
[
"### Solar Generation",
"_____no_output_____"
]
],
[
[
"solar_data = pd.read_csv(dataset_path + 'Solar/data.csv', quotechar='\"').fillna(0)\nsolar_data_X = solar_data.drop(columns=['SITE_NO', 'DATE', 'TIME'])\nsolar_data_y = solar_data['GEN_ENERGY']\nX_train_full, y_train_full = n_steps_reshape(solar_data_X, solar_data_y, 10)\nX_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\nsvm_reg.fit(X_train, y_train)\npred = svm_reg.predict(X_test)\nprint(mse(y_test, pred))",
"0.021132202063766075\n"
],
[
"X_train, X_test = X_train.reshape(X_train.shape[0], 10, solar_data_X.shape[1]), X_test.reshape(X_test.shape[0], 10, solar_data_X.shape[1])",
"_____no_output_____"
],
[
"model = LSTM_Model(X_train.shape[1], X_train.shape[2])\nmodel.compile(loss='mse', optimizer='adam', metrics=['mse'])\nhistory = model.fit(X_train, y_train, epochs=10, validation_split=0.1, shuffle=False, callbacks=[es])",
"Train on 39514 samples, validate on 4391 samples\nEpoch 1/10\n39514/39514 [==============================] - 23s 588us/sample - loss: 0.1823 - mse: 0.1823 - val_loss: 0.0337 - val_mse: 0.0337\nEpoch 2/10\n39514/39514 [==============================] - 14s 350us/sample - loss: 0.1681 - mse: 0.1681 - val_loss: 0.0265 - val_mse: 0.0265\nEpoch 3/10\n39514/39514 [==============================] - 13s 323us/sample - loss: 0.1595 - mse: 0.1595 - val_loss: 0.0237 - val_mse: 0.0237\nEpoch 4/10\n39514/39514 [==============================] - 13s 331us/sample - loss: 0.1549 - mse: 0.1549 - val_loss: 0.0190 - val_mse: 0.0190\nEpoch 5/10\n39514/39514 [==============================] - 12s 306us/sample - loss: 0.1535 - mse: 0.1535 - val_loss: 0.0167 - val_mse: 0.0167\nEpoch 6/10\n39514/39514 [==============================] - 13s 319us/sample - loss: 0.1538 - mse: 0.1538 - val_loss: 0.0166 - val_mse: 0.0166\nEpoch 7/10\n39514/39514 [==============================] - 12s 297us/sample - loss: 0.1511 - mse: 0.1511 - val_loss: 0.0157 - val_mse: 0.0157\nEpoch 8/10\n39514/39514 [==============================] - 12s 313us/sample - loss: 0.1528 - mse: 0.1528 - val_loss: 0.0149 - val_mse: 0.0149\nEpoch 9/10\n39514/39514 [==============================] - 13s 328us/sample - loss: 0.1491 - mse: 0.1491 - val_loss: 0.0148 - val_mse: 0.0148\nEpoch 10/10\n39514/39514 [==============================] - 13s 319us/sample - loss: 0.1466 - mse: 0.1466 - val_loss: 0.0144 - val_mse: 0.0144\n"
],
[
"pred = model.predict(X_test)\nmse(y_test, pred)",
"_____no_output_____"
]
],
[
[
"### Beijing PM 2.5",
"_____no_output_____"
]
],
[
[
"beijing_data = pd.read_csv(dataset_path + 'Beijing-PM25.csv').dropna().drop(columns=['No', 'year']).reset_index(drop=True)\nbeijing_data_X = pd.get_dummies(beijing_data, columns=['cbwd'])\nbeijing_data_y = beijing_data['pm2.5']\nX_train_full, y_train_full = n_steps_reshape(beijing_data_X, beijing_data_y, 10)\n\nX_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\nsvm_reg.fit(X_train, y_train)\npred = svm_reg.predict(X_test)\nprint(mse(y_test, pred))",
"0.04616497588589663\n"
],
[
"X_train, X_test, y_train, y_test = X_train.reshape(X_train.shape[0], 10, beijing_data_X.shape[1]), X_test.reshape(X_test.shape[0], 10, beijing_data_X.shape[1]), np.array(y_train), np.array(y_test)",
"_____no_output_____"
],
[
"model = LSTM_Model(X_train.shape[1], X_train.shape[2])\nmodel.compile(loss='mse', optimizer='adam', metrics=['mse'])\nhistory = model.fit(X_train, y_train, epochs=10, validation_split=0.1, shuffle=False, callbacks=[es])",
"Train on 30057 samples, validate on 3340 samples\nEpoch 1/10\n30057/30057 [==============================] - 14s 481us/sample - loss: 0.1118 - mse: 0.1118 - val_loss: 0.0915 - val_mse: 0.0915\nEpoch 2/10\n30057/30057 [==============================] - 8s 264us/sample - loss: 0.0689 - mse: 0.0689 - val_loss: 0.0678 - val_mse: 0.0678\nEpoch 3/10\n30057/30057 [==============================] - 8s 259us/sample - loss: 0.0634 - mse: 0.0634 - val_loss: 0.0560 - val_mse: 0.0560\nEpoch 4/10\n30057/30057 [==============================] - 8s 263us/sample - loss: 0.0592 - mse: 0.0592 - val_loss: 0.0508 - val_mse: 0.0508\nEpoch 5/10\n30057/30057 [==============================] - 8s 257us/sample - loss: 0.0565 - mse: 0.0565 - val_loss: 0.0491 - val_mse: 0.0491\nEpoch 6/10\n30057/30057 [==============================] - 8s 259us/sample - loss: 0.0545 - mse: 0.0545 - val_loss: 0.0482 - val_mse: 0.0482\nEpoch 7/10\n30057/30057 [==============================] - 8s 263us/sample - loss: 0.0530 - mse: 0.0530 - val_loss: 0.0483 - val_mse: 0.0483\nEpoch 8/10\n30057/30057 [==============================] - 8s 262us/sample - loss: 0.0518 - mse: 0.0518 - val_loss: 0.0477 - val_mse: 0.0477\nEpoch 9/10\n30057/30057 [==============================] - 8s 260us/sample - loss: 0.0505 - mse: 0.0505 - val_loss: 0.0492 - val_mse: 0.0492\nEpoch 10/10\n30057/30057 [==============================] - 8s 262us/sample - loss: 0.0494 - mse: 0.0494 - val_loss: 0.0491 - val_mse: 0.0491\n"
],
[
"pred = model.predict(X_test)\nmse(y_test, pred)",
"_____no_output_____"
]
],
[
[
"### Energy Data",
"_____no_output_____"
]
],
[
[
"energy_data = pd.read_csv(dataset_path + 'energydata_complete.csv')\nenery_data_X = energy_data.drop(columns=['date'])\nenery_data_y = energy_data['Appliances']\nX_train_full, y_train_full = n_steps_reshape(enery_data_X, enery_data_y, 10, for_rnn=True)\nX_train_full = get_codings(X_train_full, 10, X_train_full.shape[2])\nX_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\nsvm_reg.fit(X_train, y_train)\npred = svm_reg.predict(X_test)\nprint(mse(y_test, pred))",
"Train on 15780 samples, validate on 3945 samples\nEpoch 1/500\n15780/15780 [==============================] - 258s 16ms/sample - loss: 0.4215 - mae: 0.4215 - val_loss: 0.8134 - val_mae: 0.8134\nEpoch 2/500\n15780/15780 [==============================] - 198s 13ms/sample - loss: 0.3698 - mae: 0.3698 - val_loss: 0.8269 - val_mae: 0.8269\nEpoch 3/500\n15780/15780 [==============================] - 198s 13ms/sample - loss: 0.3537 - mae: 0.3537 - val_loss: 0.7886 - val_mae: 0.7886\nEpoch 4/500\n15780/15780 [==============================] - 208s 13ms/sample - loss: 0.3432 - mae: 0.3432 - val_loss: 0.7836 - val_mae: 0.7836\nEpoch 5/500\n15780/15780 [==============================] - 212s 13ms/sample - loss: 0.3356 - mae: 0.3356 - val_loss: 0.8037 - val_mae: 0.8037\nEpoch 6/500\n15780/15780 [==============================] - 198s 13ms/sample - loss: 0.3319 - mae: 0.3319 - val_loss: 0.7722 - val_mae: 0.7722\nEpoch 7/500\n15780/15780 [==============================] - 196s 12ms/sample - loss: 0.3266 - mae: 0.3266 - val_loss: 0.7833 - val_mae: 0.7833\nEpoch 8/500\n15780/15780 [==============================] - 204s 13ms/sample - loss: 0.3267 - mae: 0.3267 - val_loss: 0.8209 - val_mae: 0.8209\nEpoch 9/500\n15780/15780 [==============================] - 203s 13ms/sample - loss: 0.3204 - mae: 0.3204 - val_loss: 0.7595 - val_mae: 0.7595\nEpoch 10/500\n15780/15780 [==============================] - 205s 13ms/sample - loss: 0.3170 - mae: 0.3170 - val_loss: 0.7464 - val_mae: 0.7464\nEpoch 11/500\n15780/15780 [==============================] - 209s 13ms/sample - loss: 0.3166 - mae: 0.3166 - val_loss: 0.7563 - val_mae: 0.7563\nEpoch 12/500\n15780/15780 [==============================] - 204s 13ms/sample - loss: 0.3121 - mae: 0.3121 - val_loss: 0.7087 - val_mae: 0.7087\nEpoch 13/500\n15780/15780 [==============================] - 203s 13ms/sample - loss: 0.3106 - mae: 0.3106 - val_loss: 0.7422 - val_mae: 0.7422\nEpoch 14/500\n15780/15780 [==============================] - 203s 13ms/sample - loss: 0.3064 - mae: 0.3064 - val_loss: 0.6955 - val_mae: 0.6955\nEpoch 15/500\n15780/15780 [==============================] - 205s 13ms/sample - loss: 0.3015 - mae: 0.3015 - val_loss: 0.6649 - val_mae: 0.6649\nEpoch 16/500\n15780/15780 [==============================] - 205s 13ms/sample - loss: 0.3009 - mae: 0.3009 - val_loss: 0.6845 - val_mae: 0.6845\nEpoch 17/500\n15780/15780 [==============================] - 200s 13ms/sample - loss: 0.2939 - mae: 0.2939 - val_loss: 0.6214 - val_mae: 0.6214\nEpoch 18/500\n15780/15780 [==============================] - 204s 13ms/sample - loss: 0.2940 - mae: 0.2940 - val_loss: 0.6114 - val_mae: 0.6114\nEpoch 19/500\n15780/15780 [==============================] - 206s 13ms/sample - loss: 0.2920 - mae: 0.2920 - val_loss: 0.6060 - val_mae: 0.6060\nEpoch 20/500\n15780/15780 [==============================] - 212s 13ms/sample - loss: 0.2898 - mae: 0.2898 - val_loss: 0.6412 - val_mae: 0.6412\nEpoch 21/500\n15780/15780 [==============================] - 207s 13ms/sample - loss: 0.2892 - mae: 0.2892 - val_loss: 0.6324 - val_mae: 0.6324\nEpoch 22/500\n15780/15780 [==============================] - 202s 13ms/sample - loss: 0.2841 - mae: 0.2841 - val_loss: 0.6134 - val_mae: 0.6134\nEpoch 23/500\n15780/15780 [==============================] - 204s 13ms/sample - loss: 0.2827 - mae: 0.2827 - val_loss: 0.6404 - val_mae: 0.6404\nEpoch 24/500\n15780/15780 [==============================] - 208s 13ms/sample - loss: 0.2797 - mae: 0.2797 - val_loss: 0.6306 - val_mae: 0.6306\n3.263552092699289\n"
],
[
"X_train, X_test, y_train, y_test = X_train.reshape(X_train.shape[0], 10, enery_data_X.shape[1]), X_test.reshape(X_test.shape[0], 10, enery_data_X.shape[1]), np.array(y_train), np.array(y_test)",
"_____no_output_____"
],
[
"model = LSTM_Model(X_train.shape[1], X_train.shape[2])\nmodel.compile(loss='mse', optimizer='adam', metrics=['mse'])\nhistory = model.fit(X_train, y_train, epochs=10, validation_split=0.1, shuffle=False, callbacks=[es])",
"Train on 14202 samples, validate on 1578 samples\nEpoch 1/10\n14202/14202 [==============================] - 11s 754us/sample - loss: 2.3596 - mse: 2.3596 - val_loss: 2.2066 - val_mse: 2.2066\nEpoch 2/10\n14202/14202 [==============================] - 4s 302us/sample - loss: 1.9699 - mse: 1.9699 - val_loss: 2.1274 - val_mse: 2.1274\nEpoch 3/10\n14202/14202 [==============================] - 4s 285us/sample - loss: 1.8586 - mse: 1.8586 - val_loss: 2.1824 - val_mse: 2.1824\nEpoch 4/10\n14202/14202 [==============================] - 4s 284us/sample - loss: 1.7828 - mse: 1.7828 - val_loss: 2.1673 - val_mse: 2.1673\nEpoch 5/10\n14202/14202 [==============================] - 4s 291us/sample - loss: 1.7056 - mse: 1.7056 - val_loss: 2.0879 - val_mse: 2.0879\nEpoch 6/10\n14202/14202 [==============================] - 4s 280us/sample - loss: 1.6557 - mse: 1.6557 - val_loss: 2.0062 - val_mse: 2.0062\nEpoch 7/10\n14202/14202 [==============================] - 4s 288us/sample - loss: 1.6291 - mse: 1.6291 - val_loss: 1.9741 - val_mse: 1.9741\nEpoch 8/10\n14202/14202 [==============================] - 4s 279us/sample - loss: 1.5202 - mse: 1.5202 - val_loss: 2.0345 - val_mse: 2.0345\nEpoch 9/10\n14202/14202 [==============================] - 4s 310us/sample - loss: 1.4698 - mse: 1.4698 - val_loss: 2.1634 - val_mse: 2.1634\nEpoch 10/10\n14202/14202 [==============================] - 4s 294us/sample - loss: 1.4631 - mse: 1.4631 - val_loss: 2.1316 - val_mse: 2.1316\n"
],
[
"pred = model.predict(X_test)\nmse(y_test, pred)",
"_____no_output_____"
]
],
[
[
"### Parking Birmingham",
"_____no_output_____"
]
],
[
[
"parking_data = pd.read_csv(dataset_path + 'Parking Birmingham.csv')\nparking_data_X = parking_data.drop(columns=['SystemCodeNumber', 'LastUpdated'])\nparking_data_y = parking_data['Occupancy']\nX_train_full, y_train_full = n_steps_reshape(parking_data_X, parking_data_y, 10)\n\nX_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\nsvm_reg.fit(X_train, y_train)\npred = svm_reg.predict(X_test)\nprint(mse(y_test, pred))",
"0.0347304968433626\n"
],
[
"X_train, X_test, y_train, y_test = X_train.reshape(X_train.shape[0], 10, parking_data_X.shape[1]), X_test.reshape(X_test.shape[0], 10, parking_data_X.shape[1]), np.array(y_train), np.array(y_test)",
"_____no_output_____"
],
[
"model = LSTM_Model(X_train.shape[1], X_train.shape[2])\nmodel.compile(loss='mse', optimizer='adam', metrics=['mse'])\nhistory = model.fit(X_train, y_train, epochs=10, validation_split=0.1, shuffle=False, callbacks=[es])",
"Train on 25708 samples, validate on 2857 samples\nEpoch 1/10\n25708/25708 [==============================] - 14s 531us/sample - loss: 0.1127 - mse: 0.1127 - val_loss: 0.0607 - val_mse: 0.0607\nEpoch 2/10\n25708/25708 [==============================] - 7s 285us/sample - loss: 0.0532 - mse: 0.0532 - val_loss: 0.0479 - val_mse: 0.0479\nEpoch 3/10\n25708/25708 [==============================] - 7s 286us/sample - loss: 0.0488 - mse: 0.0488 - val_loss: 0.0447 - val_mse: 0.0447\nEpoch 4/10\n25708/25708 [==============================] - 7s 282us/sample - loss: 0.0454 - mse: 0.0454 - val_loss: 0.0424 - val_mse: 0.0424\nEpoch 5/10\n25708/25708 [==============================] - 7s 274us/sample - loss: 0.0428 - mse: 0.0428 - val_loss: 0.0406 - val_mse: 0.0406\nEpoch 6/10\n25708/25708 [==============================] - 7s 279us/sample - loss: 0.0401 - mse: 0.0401 - val_loss: 0.0389 - val_mse: 0.0389\nEpoch 7/10\n25708/25708 [==============================] - 7s 276us/sample - loss: 0.0376 - mse: 0.0376 - val_loss: 0.0370 - val_mse: 0.0370\nEpoch 8/10\n25708/25708 [==============================] - 7s 271us/sample - loss: 0.0356 - mse: 0.0356 - val_loss: 0.0347 - val_mse: 0.0347\nEpoch 9/10\n25708/25708 [==============================] - 7s 280us/sample - loss: 0.0340 - mse: 0.0340 - val_loss: 0.0326 - val_mse: 0.0326\nEpoch 10/10\n25708/25708 [==============================] - 7s 274us/sample - loss: 0.0338 - mse: 0.0338 - val_loss: 0.0324 - val_mse: 0.0324\n"
],
[
"pred = model.predict(X_test)\nmse(y_test, pred)",
"_____no_output_____"
]
],
[
[
"### Daily Demand",
"_____no_output_____"
]
],
[
[
"demand_data = pd.read_csv(dataset_path + 'Daily_Demand_Forecasting_Orders.csv', sep=';')\ndemand_data_X = demand_data\ndemand_data_y = demand_data['Target']\nX_train_full, y_train_full = n_steps_reshape(demand_data_X, demand_data_y, 10)\n\nX_train, X_test, y_train, y_test = train_test_split(X_train_full, y_train_full, test_size=0.20, random_state=7)\nsvm_reg.fit(X_train, y_train)\npred = svm_reg.predict(X_test)\nprint(mse(y_test, pred))",
"1.4818427980593791\n"
],
[
"X_train, X_test, y_train, y_test = X_train.reshape(X_train.shape[0], 10, demand_data_X.shape[1]), X_test.reshape(X_test.shape[0], 10, demand_data_X.shape[1]), np.array(y_train), np.array(y_test)",
"_____no_output_____"
],
[
"model = LSTM_Model(X_train.shape[1], X_train.shape[2])\nmodel.compile(loss='mse', optimizer='adam', metrics=['mse'])\nhistory = model.fit(X_train, y_train, epochs=10, validation_split=0.1, shuffle=False, callbacks=[es])",
"Train on 36 samples, validate on 4 samples\nEpoch 1/10\n36/36 [==============================] - 7s 202ms/sample - loss: 0.6588 - mse: 0.6588 - val_loss: 0.2509 - val_mse: 0.2509\nEpoch 2/10\n36/36 [==============================] - 0s 2ms/sample - loss: 0.5866 - mse: 0.5866 - val_loss: 0.2805 - val_mse: 0.2805\nEpoch 3/10\n36/36 [==============================] - 0s 2ms/sample - loss: 0.5192 - mse: 0.5192 - val_loss: 0.3176 - val_mse: 0.3176\nEpoch 4/10\n36/36 [==============================] - 0s 2ms/sample - loss: 0.4640 - mse: 0.4640 - val_loss: 0.3429 - val_mse: 0.3429\nEpoch 5/10\n36/36 [==============================] - 0s 2ms/sample - loss: 0.4172 - mse: 0.4172 - val_loss: 0.3804 - val_mse: 0.3804\nEpoch 6/10\n36/36 [==============================] - 0s 2ms/sample - loss: 0.3776 - mse: 0.3776 - val_loss: 0.4345 - val_mse: 0.4345\n"
],
[
"pred = model.predict(X_test)\nmse(y_test, pred)",
"_____no_output_____"
]
]
] | [
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
]
] |
d0ccf241e9558d2ff73da8d06be1db8b32d7eb63 | 19,322 | ipynb | Jupyter Notebook | playground/issuer/notebooks/1. issuer.ipynb | wip-abramson/aries-jupyter-playground | 872f1a319f9072d7160298fcce82fb64c93d7397 | [
"Apache-2.0"
] | 6 | 2021-05-27T12:51:32.000Z | 2022-01-11T05:49:12.000Z | playground/issuer/notebooks/1. issuer.ipynb | wip-abramson/aries-jupyter-playground | 872f1a319f9072d7160298fcce82fb64c93d7397 | [
"Apache-2.0"
] | 2 | 2021-10-05T07:38:05.000Z | 2022-02-10T11:38:18.000Z | playground/issuer/notebooks/1. issuer.ipynb | wip-abramson/aries-jupyter-playground | 872f1a319f9072d7160298fcce82fb64c93d7397 | [
"Apache-2.0"
] | 7 | 2021-04-22T14:18:06.000Z | 2022-02-14T10:30:52.000Z | 34.940325 | 3,152 | 0.608063 | [
[
[
"# ACA-Py & ACC-Py Basic Template\n\n## Copy this template into the root folder of your notebook workspace to get started",
"_____no_output_____"
],
[
"### Imports",
"_____no_output_____"
]
],
[
[
"from aries_cloudcontroller import AriesAgentController\nimport os\nfrom termcolor import colored",
"_____no_output_____"
]
],
[
[
"### Initialise the Agent Controller",
"_____no_output_____"
]
],
[
[
"api_key = os.getenv(\"ACAPY_ADMIN_API_KEY\")\nadmin_url = os.getenv(\"ADMIN_URL\")\n\nprint(f\"Initialising a controller with admin api at {admin_url} and an api key of {api_key}\")\nagent_controller = AriesAgentController(admin_url,api_key)",
"Initialising a controller with admin api at http://issuer-agent:3021 and an api key of adminApiKey\n"
]
],
[
[
"### Start a Webhook Server",
"_____no_output_____"
]
],
[
[
"webhook_port = int(os.getenv(\"WEBHOOK_PORT\"))\nwebhook_host = \"0.0.0.0\"\n\nawait agent_controller.init_webhook_server(webhook_host, webhook_port)\n\nprint(f\"Listening for webhooks from agent at http://{webhook_host}:{webhook_port}\")",
"Listening for webhooks from agent at http://0.0.0.0:3010\n"
]
],
[
[
"## Register Agent Event Listeners\n\nYou can see some examples within the webhook_listeners recipe. Copy any relevant cells across and fill in additional logic as needed.",
"_____no_output_____"
]
],
[
[
"listeners = []",
"_____no_output_____"
],
[
"## YOUR LISTENERS HERE\n# Receive connection messages\ndef connections_handler(payload):\n state = payload['state']\n connection_id = payload[\"connection_id\"]\n their_role = payload[\"their_role\"]\n routing_state = payload[\"routing_state\"]\n \n print(\"----------------------------------------------------------\")\n print(\"Connection Webhook Event Received\")\n print(\"Connection ID : \", connection_id)\n print(\"State : \", state)\n print(\"Routing State : \", routing_state)\n print(\"Their Role : \", their_role)\n print(\"----------------------------------------------------------\")\n if state == \"active\":\n # Your business logic\n print(colored(\"Connection ID: {0} is now active.\".format(connection_id), \"green\", attrs=[\"bold\"]))\n\nconnection_listener = {\n \"handler\": connections_handler,\n \"topic\": \"connections\"\n}\n\nlisteners.append(connection_listener)",
"_____no_output_____"
],
[
"def issuer_handler(payload):\n connection_id = payload['connection_id']\n exchange_id = payload['credential_exchange_id']\n state = payload['state']\n role = payload['role']\n print(\"\\n---------------------------------------------------\\n\")\n print(\"Handle Issue Credential Webhook\")\n print(f\"Connection ID : {connection_id}\")\n print(f\"Credential exchange ID : {exchange_id}\")\n print(\"Agent Protocol Role : \", role)\n print(\"Protocol State : \", state )\n print(\"\\n---------------------------------------------------\\n\")\n \n \n if state == \"offer_sent\":\n proposal = payload[\"credential_proposal_dict\"]\n attributes = proposal['credential_proposal']['attributes']\n\n print(f\"Offering credential with attributes : {attributes}\")\n ## YOUR LOGIC HERE\n elif state == \"request_received\":\n print(\"Request for credential received\")\n ## YOUR LOGIC HERE\n elif state == \"credential_sent\":\n print(\"Credential Sent\")\n ## YOUR LOGIC HERE\n \nissuer_listener = {\n \"topic\": \"issue_credential\",\n \"handler\": issuer_handler\n}\n\nlisteners.append(issuer_listener)",
"_____no_output_____"
],
[
"agent_controller.register_listeners(listeners)",
"_____no_output_____"
]
],
[
[
"## Store Issuing Schema and Cred Def Identifiers\n\nIf you intend for this agent to issue credentials you should first initialise your agent as an issuer and author the relevant identifiers to the public ledger. The issuer_initialisation recipe notebook can be duplicated and used as a starting point.\n\nOnce schema and cred def identifiers are created copy across and store in variables as illustrated in the cell below. Be sure to use unique names for each variable.",
"_____no_output_____"
]
],
[
[
"schema_id='ABsZzHjqQSfKUCEquCaAkN:2:aries_playground:0.0.1'\ncred_def_id='ABsZzHjqQSfKUCEquCaAkN:3:CL:9916:default'\n\n\n# %store <schema_id>\n# %store <cred_def_id>",
"_____no_output_____"
]
],
[
[
"## Load any Identifiers from Store\n\nIf you are writing your logic across multiple notebooks, which I have found can make it easier to break things up, then rather than defining the schema and cred def identifiers every time it can be easier to load them from the jupyter store. Note: this assumes they have been written to the store in a previous notebook during the time the current docker containers have been running.",
"_____no_output_____"
]
],
[
[
"# %store -r <schema_id>\n# %store -r <cred_def_id>",
"_____no_output_____"
]
],
[
[
"## Establish Connection with the Holder (PORT 8889)\n\nBefore you can issue a credential you must first establish a connection across which the credential will be issued to a holder. (see recipes/connection)",
"_____no_output_____"
]
],
[
[
"# Alias for invited connection\nalias = None\nauto_accept = \"true\"\n# Use public DID?\npublic = \"false\"\n# Should this invitation be usable by multiple invitees?\nmulti_use = \"false\"\n\ninvitation_response = await agent_controller.connections.create_invitation(alias, auto_accept, public, multi_use)\n# Is equivalent to above. Arguments are optionally\n# invitation_response = await agent_controller.connections.create_invitation()\n\n\n\n# You will use this identifier to issue a credential across this connection\nconnection_id = invitation_response[\"connection_id\"]",
"----------------------------------------------------------\nConnection Webhook Event Received\nConnection ID : 77c0b816-5c82-4d8c-a8a7-bbdbfbabe5fe\nState : invitation\nRouting State : none\nTheir Role : invitee\n----------------------------------------------------------\n"
]
],
[
[
"## Copy Invitation Object to Holder Notebook",
"_____no_output_____"
]
],
[
[
"invitation = invitation_response[\"invitation\"]\n## Copy this output\nprint(invitation)",
"{'@type': 'did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/connections/1.0/invitation', '@id': '0e502654-0258-4aee-93c3-386f16db826e', 'label': 'Issuer', 'serviceEndpoint': 'https://0751-86-18-68-143.ngrok.io', 'recipientKeys': ['HtSkAapeZfrzQvv66HAetE8uejEb6nPuxoUzVjSewBwL']}\n"
]
],
[
[
"## OPTIONAL: Display Invite as QR Code\n\nThis is useful if you wish to issue a credential to a mobile wallet.",
"_____no_output_____"
]
],
[
[
"import qrcode\n# Link for connection invitation\ninvitation_url = invitation_response[\"invitation_url\"]\n# Creating an instance of qrcode\nqr = qrcode.QRCode(\n version=1,\n box_size=5,\n border=5)\nqr.add_data(invitation_url)\nqr.make(fit=True)\nimg = qr.make_image(fill='black', back_color='white')\nimg",
"_____no_output_____"
]
],
[
[
"## Populate Credential Attributes\n\nBefore you can issue a credential, you must define the values that will be issued in this credential. The attribute names **MUST** match those in the schem identified by the <schema_id> value.\n\nMake sure to change all code enclosed with <>.\n",
"_____no_output_____"
]
],
[
[
"comment=input(\"Please enter some comment: \")\ncredential_attributes = [\n {\"name\": \"comment\", \"value\": comment},\n]\nprint(credential_attributes)",
"Please enter some comment: Some comment\n"
]
],
[
[
"## Send Credential\n\nThis is the easiest way to issue a credential because it automates the rest of the protocol steps. \n\nNote: The `connection_id` must be in the active state before a credential can be sent.",
"_____no_output_____"
]
],
[
[
"# Do you want the ACA-Py instance to trace it's processes (for testing/timing analysis)\ntrace = False\ncomment = \"\"\n# Remove credential record after issued?\nauto_remove = True\n\n# Change <schema_id> and <cred_def_id> to correct pair. Cred_def_id must identify a definition to which your agent has corresponding private issuing key.\nsend_cred_response = await agent_controller.issuer.send_credential(connection_id, schema_id, cred_def_id, credential_attributes, comment, auto_remove, trace)\n\n# Note last three args are optional.\n# await agent_controller.issuer.send_credential(connection_id, <schema_id>, <cred_def_id, credential_attributes)",
"\n---------------------------------------------------\n\nHandle Issue Credential Webhook\nConnection ID : 6bbe8551-f056-49b4-9d12-839f67b5db5e\nCredential exchange ID : e321550f-3e59-4c4a-8314-b3845141142e\nAgent Protocol Role : issuer\nProtocol State : offer_sent\n\n---------------------------------------------------\n\nOffering credential with attributes : [{'name': 'comment', 'value': 'Some comment'}]\n\n---------------------------------------------------\n\nHandle Issue Credential Webhook\nConnection ID : 6bbe8551-f056-49b4-9d12-839f67b5db5e\nCredential exchange ID : e321550f-3e59-4c4a-8314-b3845141142e\nAgent Protocol Role : issuer\nProtocol State : request_received\n\n---------------------------------------------------\n\nRequest for credential received\n\n---------------------------------------------------\n\nHandle Issue Credential Webhook\nConnection ID : 6bbe8551-f056-49b4-9d12-839f67b5db5e\nCredential exchange ID : e321550f-3e59-4c4a-8314-b3845141142e\nAgent Protocol Role : issuer\nProtocol State : credential_issued\n\n---------------------------------------------------\n\n\n---------------------------------------------------\n\nHandle Issue Credential Webhook\nConnection ID : 6bbe8551-f056-49b4-9d12-839f67b5db5e\nCredential exchange ID : e321550f-3e59-4c4a-8314-b3845141142e\nAgent Protocol Role : issuer\nProtocol State : credential_acked\n\n---------------------------------------------------\n\n"
]
],
[
[
"## Now Request a Proof of this Credential Through the Verifier Notebook (Port 8891)\n",
"_____no_output_____"
],
[
"## Terminate Controller\n\nWhenever you have finished with this notebook, be sure to terminate the controller. This is especially important if your business logic runs across multiple notebooks.",
"_____no_output_____"
]
],
[
[
"await agent_controller.terminate()",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
]
] |
d0ccf9445e3804464f071f0e8e100b4796e7c1db | 217,414 | ipynb | Jupyter Notebook | S+P_Week_4_Lesson_1.ipynb | 100rab-S/Tensorflow-Developer-Certificate | 5d1f0b6dfc3452e11e3c6de14b195997dbc0e124 | [
"MIT"
] | null | null | null | S+P_Week_4_Lesson_1.ipynb | 100rab-S/Tensorflow-Developer-Certificate | 5d1f0b6dfc3452e11e3c6de14b195997dbc0e124 | [
"MIT"
] | null | null | null | S+P_Week_4_Lesson_1.ipynb | 100rab-S/Tensorflow-Developer-Certificate | 5d1f0b6dfc3452e11e3c6de14b195997dbc0e124 | [
"MIT"
] | null | null | null | 127.965862 | 65,034 | 0.717263 | [
[
[
"<a href=\"https://colab.research.google.com/github/100rab-S/Tensorflow-Developer-Certificate/blob/main/S%2BP_Week_4_Lesson_1.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
]
],
[
[
"#@title Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.",
"_____no_output_____"
]
],
[
[
"<a href=\"https://colab.research.google.com/github/lmoroney/dlaicourse/blob/master/TensorFlow%20In%20Practice/Course%204%20-%20S%2BP/S%2BP%20Week%204%20Lesson%201.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
]
],
[
[
"try:\n # %tensorflow_version only exists in Colab.\n %tensorflow_version 2.x\nexcept Exception:\n pass\n",
"_____no_output_____"
],
[
"import tensorflow as tf\nimport numpy as np\nimport matplotlib.pyplot as plt\nprint(tf.__version__)",
"2.4.1\n"
],
[
"def plot_series(time, series, format=\"-\", start=0, end=None):\n plt.plot(time[start:end], series[start:end], format)\n plt.xlabel(\"Time\")\n plt.ylabel(\"Value\")\n plt.grid(True)\n\ndef trend(time, slope=0):\n return slope * time\n\ndef seasonal_pattern(season_time):\n \"\"\"Just an arbitrary pattern, you can change it if you wish\"\"\"\n return np.where(season_time < 0.4,\n np.cos(season_time * 2 * np.pi),\n 1 / np.exp(3 * season_time))\n\ndef seasonality(time, period, amplitude=1, phase=0):\n \"\"\"Repeats the same pattern at each period\"\"\"\n season_time = ((time + phase) % period) / period\n return amplitude * seasonal_pattern(season_time)\n\ndef noise(time, noise_level=1, seed=None):\n rnd = np.random.RandomState(seed)\n return rnd.randn(len(time)) * noise_level\n\ntime = np.arange(4 * 365 + 1, dtype=\"float32\")\nbaseline = 10\nseries = trend(time, 0.1) \nbaseline = 10\namplitude = 40\nslope = 0.05\nnoise_level = 5\n\n# Create the series\nseries = baseline + trend(time, slope) + seasonality(time, period=365, amplitude=amplitude)\n# Update with noise\nseries += noise(time, noise_level, seed=42)\n\nsplit_time = 1000\ntime_train = time[:split_time]\nx_train = series[:split_time]\ntime_valid = time[split_time:]\nx_valid = series[split_time:]\n\nwindow_size = 20\nbatch_size = 32\nshuffle_buffer_size = 1000",
"_____no_output_____"
],
[
"def windowed_dataset(series, window_size, batch_size, shuffle_buffer):\n series = tf.expand_dims(series, axis=-1)\n ds = tf.data.Dataset.from_tensor_slices(series)\n ds = ds.window(window_size + 1, shift=1, drop_remainder=True)\n ds = ds.flat_map(lambda w: w.batch(window_size + 1))\n ds = ds.shuffle(shuffle_buffer)\n ds = ds.map(lambda w: (w[:-1], w[1:]))\n return ds.batch(batch_size).prefetch(1)",
"_____no_output_____"
],
[
"def model_forecast(model, series, window_size):\n ds = tf.data.Dataset.from_tensor_slices(series)\n ds = ds.window(window_size, shift=1, drop_remainder=True)\n ds = ds.flat_map(lambda w: w.batch(window_size))\n ds = ds.batch(32).prefetch(1)\n forecast = model.predict(ds)\n return forecast",
"_____no_output_____"
],
[
"tf.keras.backend.clear_session()\ntf.random.set_seed(51)\nnp.random.seed(51)\n\nwindow_size = 30\ntrain_set = windowed_dataset(x_train, window_size, batch_size=128, shuffle_buffer=shuffle_buffer_size)\n\nmodel = tf.keras.models.Sequential([\n tf.keras.layers.Conv1D(filters=32, kernel_size=5,\n strides=1, padding=\"causal\",\n activation=\"relu\",\n input_shape=[None, 1]),\n tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(32, return_sequences=True)),\n tf.keras.layers.Bidirectional(tf.keras.layers.LSTM(32, return_sequences=True)),\n tf.keras.layers.Dense(1),\n tf.keras.layers.Lambda(lambda x: x * 200)\n])\nlr_schedule = tf.keras.callbacks.LearningRateScheduler(\n lambda epoch: 1e-8 * 10**(epoch / 20))\noptimizer = tf.keras.optimizers.SGD(lr=1e-8, momentum=0.9)\nmodel.compile(loss=tf.keras.losses.Huber(),\n optimizer=optimizer,\n metrics=[\"mae\"])\nhistory = model.fit(train_set, epochs=100, callbacks=[lr_schedule], verbose=2)",
"Epoch 1/100\n8/8 - 36s - loss: 73.1912 - mae: 73.6904\nEpoch 2/100\n8/8 - 0s - loss: 72.4799 - mae: 72.9791\nEpoch 3/100\n8/8 - 0s - loss: 71.3446 - mae: 71.8437\nEpoch 4/100\n8/8 - 0s - loss: 69.9230 - mae: 70.4223\nEpoch 5/100\n8/8 - 0s - loss: 68.2678 - mae: 68.7669\nEpoch 6/100\n8/8 - 0s - loss: 66.3621 - mae: 66.8609\nEpoch 7/100\n8/8 - 0s - loss: 64.2432 - mae: 64.7424\nEpoch 8/100\n8/8 - 0s - loss: 61.8749 - mae: 62.3738\nEpoch 9/100\n8/8 - 0s - loss: 59.2491 - mae: 59.7479\nEpoch 10/100\n8/8 - 0s - loss: 56.3267 - mae: 56.8254\nEpoch 11/100\n8/8 - 0s - loss: 53.0701 - mae: 53.5686\nEpoch 12/100\n8/8 - 0s - loss: 49.3867 - mae: 49.8849\nEpoch 13/100\n8/8 - 0s - loss: 45.1182 - mae: 45.6165\nEpoch 14/100\n8/8 - 0s - loss: 41.6538 - mae: 42.1518\nEpoch 15/100\n8/8 - 0s - loss: 40.6341 - mae: 41.1322\nEpoch 16/100\n8/8 - 0s - loss: 39.5119 - mae: 40.0100\nEpoch 17/100\n8/8 - 0s - loss: 38.1009 - mae: 38.5985\nEpoch 18/100\n8/8 - 0s - loss: 36.5304 - mae: 37.0279\nEpoch 19/100\n8/8 - 0s - loss: 34.9672 - mae: 35.4641\nEpoch 20/100\n8/8 - 0s - loss: 33.5379 - mae: 34.0347\nEpoch 21/100\n8/8 - 0s - loss: 32.2358 - mae: 32.7321\nEpoch 22/100\n8/8 - 0s - loss: 31.0509 - mae: 31.5469\nEpoch 23/100\n8/8 - 0s - loss: 29.9243 - mae: 30.4202\nEpoch 24/100\n8/8 - 0s - loss: 28.8317 - mae: 29.3274\nEpoch 25/100\n8/8 - 0s - loss: 27.7314 - mae: 28.2272\nEpoch 26/100\n8/8 - 0s - loss: 26.6107 - mae: 27.1066\nEpoch 27/100\n8/8 - 0s - loss: 25.4565 - mae: 25.9519\nEpoch 28/100\n8/8 - 0s - loss: 24.2668 - mae: 24.7617\nEpoch 29/100\n8/8 - 0s - loss: 23.0459 - mae: 23.5406\nEpoch 30/100\n8/8 - 0s - loss: 21.8057 - mae: 22.3000\nEpoch 31/100\n8/8 - 0s - loss: 20.5264 - mae: 21.0202\nEpoch 32/100\n8/8 - 0s - loss: 19.2341 - mae: 19.7269\nEpoch 33/100\n8/8 - 0s - loss: 17.9646 - mae: 18.4568\nEpoch 34/100\n8/8 - 0s - loss: 16.9362 - mae: 17.4279\nEpoch 35/100\n8/8 - 0s - loss: 16.2657 - mae: 16.7576\nEpoch 36/100\n8/8 - 0s - loss: 15.6281 - mae: 16.1192\nEpoch 37/100\n8/8 - 0s - loss: 15.0540 - mae: 15.5447\nEpoch 38/100\n8/8 - 0s - loss: 14.5219 - mae: 15.0126\nEpoch 39/100\n8/8 - 0s - loss: 13.9836 - mae: 14.4747\nEpoch 40/100\n8/8 - 0s - loss: 13.4414 - mae: 13.9318\nEpoch 41/100\n8/8 - 0s - loss: 12.8781 - mae: 13.3677\nEpoch 42/100\n8/8 - 0s - loss: 12.2855 - mae: 12.7749\nEpoch 43/100\n8/8 - 0s - loss: 11.6690 - mae: 12.1582\nEpoch 44/100\n8/8 - 0s - loss: 11.0181 - mae: 11.5063\nEpoch 45/100\n8/8 - 0s - loss: 10.3387 - mae: 10.8260\nEpoch 46/100\n8/8 - 0s - loss: 9.6894 - mae: 10.1757\nEpoch 47/100\n8/8 - 0s - loss: 9.0956 - mae: 9.5809\nEpoch 48/100\n8/8 - 0s - loss: 8.5688 - mae: 9.0536\nEpoch 49/100\n8/8 - 0s - loss: 8.1153 - mae: 8.5996\nEpoch 50/100\n8/8 - 0s - loss: 7.7040 - mae: 8.1884\nEpoch 51/100\n8/8 - 0s - loss: 7.3262 - mae: 7.8096\nEpoch 52/100\n8/8 - 0s - loss: 6.9725 - mae: 7.4548\nEpoch 53/100\n8/8 - 0s - loss: 6.6218 - mae: 7.1033\nEpoch 54/100\n8/8 - 0s - loss: 6.2898 - mae: 6.7712\nEpoch 55/100\n8/8 - 0s - loss: 5.9775 - mae: 6.4581\nEpoch 56/100\n8/8 - 0s - loss: 5.7096 - mae: 6.1898\nEpoch 57/100\n8/8 - 0s - loss: 5.4204 - mae: 5.8992\nEpoch 58/100\n8/8 - 0s - loss: 5.2126 - mae: 5.6904\nEpoch 59/100\n8/8 - 0s - loss: 4.9788 - mae: 5.4558\nEpoch 60/100\n8/8 - 0s - loss: 4.8674 - mae: 5.3438\nEpoch 61/100\n8/8 - 0s - loss: 4.7943 - mae: 5.2711\nEpoch 62/100\n8/8 - 0s - loss: 4.6056 - mae: 5.0814\nEpoch 63/100\n8/8 - 0s - loss: 4.7894 - mae: 5.2667\nEpoch 64/100\n8/8 - 0s - loss: 5.3931 - mae: 5.8744\nEpoch 65/100\n8/8 - 0s - loss: 5.8704 - mae: 6.3538\nEpoch 66/100\n8/8 - 0s - loss: 5.9405 - mae: 6.4240\nEpoch 67/100\n8/8 - 0s - loss: 4.9880 - mae: 5.4686\nEpoch 68/100\n8/8 - 0s - loss: 4.9470 - mae: 5.4262\nEpoch 69/100\n8/8 - 0s - loss: 5.5095 - mae: 5.9919\nEpoch 70/100\n8/8 - 0s - loss: 6.2344 - mae: 6.7195\nEpoch 71/100\n8/8 - 0s - loss: 5.3504 - mae: 5.8315\nEpoch 72/100\n8/8 - 0s - loss: 8.1685 - mae: 8.6570\nEpoch 73/100\n8/8 - 0s - loss: 6.3011 - mae: 6.7859\nEpoch 74/100\n8/8 - 0s - loss: 6.2988 - mae: 6.7822\nEpoch 75/100\n8/8 - 0s - loss: 8.0823 - mae: 8.5712\nEpoch 76/100\n8/8 - 0s - loss: 8.3261 - mae: 8.8174\nEpoch 77/100\n8/8 - 0s - loss: 8.1894 - mae: 8.6780\nEpoch 78/100\n8/8 - 0s - loss: 8.9568 - mae: 9.4391\nEpoch 79/100\n8/8 - 0s - loss: 20.0009 - mae: 20.4961\nEpoch 80/100\n8/8 - 0s - loss: 45.8220 - mae: 46.3212\nEpoch 81/100\n8/8 - 0s - loss: 36.0048 - mae: 36.5030\nEpoch 82/100\n8/8 - 0s - loss: 25.9797 - mae: 26.4764\nEpoch 83/100\n8/8 - 0s - loss: 25.5907 - mae: 26.0875\nEpoch 84/100\n8/8 - 0s - loss: 18.9500 - mae: 19.4445\nEpoch 85/100\n8/8 - 0s - loss: 14.4140 - mae: 14.9072\nEpoch 86/100\n8/8 - 0s - loss: 13.5874 - mae: 14.0804\nEpoch 87/100\n8/8 - 0s - loss: 16.2794 - mae: 16.7730\nEpoch 88/100\n8/8 - 0s - loss: 17.9068 - mae: 18.4010\nEpoch 89/100\n8/8 - 0s - loss: 14.7979 - mae: 15.2912\nEpoch 90/100\n8/8 - 0s - loss: 14.2635 - mae: 14.7551\nEpoch 91/100\n8/8 - 0s - loss: 22.1852 - mae: 22.6823\nEpoch 92/100\n8/8 - 0s - loss: 15.7619 - mae: 16.2554\nEpoch 93/100\n8/8 - 0s - loss: 14.9194 - mae: 15.4135\nEpoch 94/100\n8/8 - 0s - loss: 12.9806 - mae: 13.4721\nEpoch 95/100\n8/8 - 0s - loss: 14.2612 - mae: 14.7547\nEpoch 96/100\n8/8 - 0s - loss: 14.3768 - mae: 14.8698\nEpoch 97/100\n8/8 - 0s - loss: 26.0673 - mae: 26.5646\nEpoch 98/100\n8/8 - 0s - loss: 23.4079 - mae: 23.9040\nEpoch 99/100\n8/8 - 0s - loss: 16.6737 - mae: 17.1682\nEpoch 100/100\n8/8 - 0s - loss: 14.8034 - mae: 15.2982\n"
],
[
"plt.semilogx(history.history[\"lr\"], history.history[\"loss\"])\nplt.axis([1e-8, 1e-4, 0, 30])",
"_____no_output_____"
],
[
"tf.keras.backend.clear_session()\ntf.random.set_seed(51)\nnp.random.seed(51)\n#batch_size = 16\ndataset = windowed_dataset(x_train, window_size, batch_size, shuffle_buffer_size)\n\nmodel = tf.keras.models.Sequential([\n tf.keras.layers.Conv1D(filters=32, kernel_size=3,\n strides=1, padding=\"causal\",\n activation=\"relu\",\n input_shape=[None, 1]),\n tf.keras.layers.LSTM(32, return_sequences=True),\n tf.keras.layers.LSTM(32, return_sequences=True),\n tf.keras.layers.Dense(1),\n tf.keras.layers.Lambda(lambda x: x * 200)\n])\n\noptimizer = tf.keras.optimizers.SGD(lr=1e-5, momentum=0.9)\nmodel.compile(loss=tf.keras.losses.Huber(),\n optimizer=optimizer,\n metrics=[\"mae\"])\nhistory = model.fit(dataset,epochs=500)",
"Epoch 1/500\n31/31 [==============================] - 3s 8ms/step - loss: 33.5999 - mae: 34.0956\nEpoch 2/500\n31/31 [==============================] - 0s 7ms/step - loss: 8.4929 - mae: 8.9781\nEpoch 3/500\n31/31 [==============================] - 0s 7ms/step - loss: 6.9030 - mae: 7.3851\nEpoch 4/500\n31/31 [==============================] - 0s 7ms/step - loss: 6.3055 - mae: 6.7856\nEpoch 5/500\n31/31 [==============================] - 0s 6ms/step - loss: 5.7224 - mae: 6.2022\nEpoch 6/500\n31/31 [==============================] - 0s 7ms/step - loss: 5.6601 - mae: 6.1395\nEpoch 7/500\n31/31 [==============================] - 0s 7ms/step - loss: 5.5650 - mae: 6.0449\nEpoch 8/500\n31/31 [==============================] - 0s 6ms/step - loss: 5.3754 - mae: 5.8549\nEpoch 9/500\n31/31 [==============================] - 0s 7ms/step - loss: 5.3292 - mae: 5.8086\nEpoch 10/500\n31/31 [==============================] - 0s 7ms/step - loss: 5.1784 - mae: 5.6575\nEpoch 11/500\n31/31 [==============================] - 0s 6ms/step - loss: 5.3240 - mae: 5.8032\nEpoch 12/500\n31/31 [==============================] - 0s 6ms/step - loss: 5.1713 - mae: 5.6505\nEpoch 13/500\n31/31 [==============================] - 0s 6ms/step - loss: 5.2012 - mae: 5.6811\nEpoch 14/500\n31/31 [==============================] - 0s 7ms/step - loss: 5.0907 - mae: 5.5694\nEpoch 15/500\n31/31 [==============================] - 0s 7ms/step - loss: 5.0100 - mae: 5.4886\nEpoch 16/500\n31/31 [==============================] - 0s 6ms/step - loss: 5.1929 - mae: 5.6711\nEpoch 17/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.8762 - mae: 5.3543\nEpoch 18/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.9008 - mae: 5.3785\nEpoch 19/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.9682 - mae: 5.4469\nEpoch 20/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.8302 - mae: 5.3079\nEpoch 21/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.7030 - mae: 5.1813\nEpoch 22/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.6630 - mae: 5.1413\nEpoch 23/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.6781 - mae: 5.1558\nEpoch 24/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.7650 - mae: 5.2427\nEpoch 25/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.7013 - mae: 5.1780\nEpoch 26/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.6795 - mae: 5.1571\nEpoch 27/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.6728 - mae: 5.1500\nEpoch 28/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.5803 - mae: 5.0578\nEpoch 29/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.6176 - mae: 5.0946\nEpoch 30/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.6084 - mae: 5.0860\nEpoch 31/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.6702 - mae: 5.1474\nEpoch 32/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.5882 - mae: 5.0657\nEpoch 33/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.5362 - mae: 5.0134\nEpoch 34/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.5347 - mae: 5.0118\nEpoch 35/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4574 - mae: 4.9349\nEpoch 36/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4877 - mae: 4.9643\nEpoch 37/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.5073 - mae: 4.9842\nEpoch 38/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.6378 - mae: 5.1147\nEpoch 39/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.6021 - mae: 5.0794\nEpoch 40/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4462 - mae: 4.9224\nEpoch 41/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.5811 - mae: 5.0566\nEpoch 42/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4329 - mae: 4.9083\nEpoch 43/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4443 - mae: 4.9210\nEpoch 44/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4377 - mae: 4.9135\nEpoch 45/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.5207 - mae: 4.9956\nEpoch 46/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4015 - mae: 4.8770\nEpoch 47/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.4403 - mae: 4.9164\nEpoch 48/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.3866 - mae: 4.8631\nEpoch 49/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.4583 - mae: 4.9341\nEpoch 50/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.4710 - mae: 4.9474\nEpoch 51/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.4091 - mae: 4.8834\nEpoch 52/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.7087 - mae: 5.1863\nEpoch 53/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.4382 - mae: 4.9137\nEpoch 54/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.3961 - mae: 4.8724\nEpoch 55/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.5155 - mae: 4.9921\nEpoch 56/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.3755 - mae: 4.8517\nEpoch 57/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4590 - mae: 4.9352\nEpoch 58/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.3796 - mae: 4.8555\nEpoch 59/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3246 - mae: 4.7988\nEpoch 60/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.4047 - mae: 4.8797\nEpoch 61/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4516 - mae: 4.9281\nEpoch 62/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2963 - mae: 4.7715\nEpoch 63/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3468 - mae: 4.8211\nEpoch 64/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3635 - mae: 4.8385\nEpoch 65/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3949 - mae: 4.8696\nEpoch 66/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3001 - mae: 4.7751\nEpoch 67/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4494 - mae: 4.9260\nEpoch 68/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.6539 - mae: 5.1324\nEpoch 69/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2749 - mae: 4.7496\nEpoch 70/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2686 - mae: 4.7434\nEpoch 71/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2848 - mae: 4.7603\nEpoch 72/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4232 - mae: 4.8986\nEpoch 73/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2588 - mae: 4.7336\nEpoch 74/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.2994 - mae: 4.7741\nEpoch 75/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2601 - mae: 4.7345\nEpoch 76/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.2790 - mae: 4.7538\nEpoch 77/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2341 - mae: 4.7084\nEpoch 78/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3452 - mae: 4.8206\nEpoch 79/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3719 - mae: 4.8481\nEpoch 80/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3026 - mae: 4.7781\nEpoch 81/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2499 - mae: 4.7249\nEpoch 82/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3955 - mae: 4.8719\nEpoch 83/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3471 - mae: 4.8224\nEpoch 84/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3317 - mae: 4.8073\nEpoch 85/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4953 - mae: 4.9729\nEpoch 86/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2654 - mae: 4.7401\nEpoch 87/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3274 - mae: 4.8026\nEpoch 88/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2432 - mae: 4.7171\nEpoch 89/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2364 - mae: 4.7111\nEpoch 90/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1985 - mae: 4.6734\nEpoch 91/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2445 - mae: 4.7189\nEpoch 92/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.2837 - mae: 4.7588\nEpoch 93/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1819 - mae: 4.6564\nEpoch 94/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.4052 - mae: 4.8794\nEpoch 95/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3348 - mae: 4.8094\nEpoch 96/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2513 - mae: 4.7259\nEpoch 97/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.2370 - mae: 4.7112\nEpoch 98/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.4060 - mae: 4.8819\nEpoch 99/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.2352 - mae: 4.7100\nEpoch 100/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1935 - mae: 4.6669\nEpoch 101/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2486 - mae: 4.7236\nEpoch 102/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1936 - mae: 4.6682\nEpoch 103/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1639 - mae: 4.6379\nEpoch 104/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2213 - mae: 4.6952\nEpoch 105/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.1590 - mae: 4.6321\nEpoch 106/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2359 - mae: 4.7107\nEpoch 107/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.3044 - mae: 4.7800\nEpoch 108/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2099 - mae: 4.6832\nEpoch 109/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1928 - mae: 4.6674\nEpoch 110/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2204 - mae: 4.6944\nEpoch 111/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2275 - mae: 4.7014\nEpoch 112/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1893 - mae: 4.6630\nEpoch 113/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1793 - mae: 4.6535\nEpoch 114/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1777 - mae: 4.6514\nEpoch 115/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2394 - mae: 4.7145\nEpoch 116/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1290 - mae: 4.6024\nEpoch 117/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1785 - mae: 4.6519\nEpoch 118/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2195 - mae: 4.6935\nEpoch 119/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1868 - mae: 4.6596\nEpoch 120/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3462 - mae: 4.8218\nEpoch 121/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.1471 - mae: 4.6208\nEpoch 122/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2257 - mae: 4.6994\nEpoch 123/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1798 - mae: 4.6533\nEpoch 124/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1635 - mae: 4.6368\nEpoch 125/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2047 - mae: 4.6787\nEpoch 126/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1699 - mae: 4.6424\nEpoch 127/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1615 - mae: 4.6349\nEpoch 128/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2879 - mae: 4.7628\nEpoch 129/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2543 - mae: 4.7290\nEpoch 130/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2332 - mae: 4.7068\nEpoch 131/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2854 - mae: 4.7606\nEpoch 132/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3339 - mae: 4.8097\nEpoch 133/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3831 - mae: 4.8587\nEpoch 134/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1622 - mae: 4.6359\nEpoch 135/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1492 - mae: 4.6229\nEpoch 136/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1760 - mae: 4.6490\nEpoch 137/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1405 - mae: 4.6145\nEpoch 138/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2962 - mae: 4.7723\nEpoch 139/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1977 - mae: 4.6714\nEpoch 140/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2247 - mae: 4.6987\nEpoch 141/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1651 - mae: 4.6391\nEpoch 142/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1105 - mae: 4.5846\nEpoch 143/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1542 - mae: 4.6263\nEpoch 144/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1490 - mae: 4.6225\nEpoch 145/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1582 - mae: 4.6310\nEpoch 146/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1432 - mae: 4.6173\nEpoch 147/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1890 - mae: 4.6625\nEpoch 148/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1940 - mae: 4.6678\nEpoch 149/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1245 - mae: 4.5985\nEpoch 150/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1209 - mae: 4.5937\nEpoch 151/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1432 - mae: 4.6155\nEpoch 152/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.2976 - mae: 4.7740\nEpoch 153/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1829 - mae: 4.6573\nEpoch 154/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2043 - mae: 4.6774\nEpoch 155/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2501 - mae: 4.7259\nEpoch 156/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2495 - mae: 4.7256\nEpoch 157/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0984 - mae: 4.5705\nEpoch 158/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2097 - mae: 4.6839\nEpoch 159/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1224 - mae: 4.5958\nEpoch 160/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1851 - mae: 4.6583\nEpoch 161/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1057 - mae: 4.5793\nEpoch 162/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1071 - mae: 4.5802\nEpoch 163/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0984 - mae: 4.5718\nEpoch 164/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1532 - mae: 4.6283\nEpoch 165/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1725 - mae: 4.6475\nEpoch 166/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1335 - mae: 4.6079\nEpoch 167/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1346 - mae: 4.6086\nEpoch 168/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1342 - mae: 4.6083\nEpoch 169/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1107 - mae: 4.5848\nEpoch 170/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2969 - mae: 4.7728\nEpoch 171/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1087 - mae: 4.5826\nEpoch 172/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1358 - mae: 4.6097\nEpoch 173/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0940 - mae: 4.5674\nEpoch 174/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1477 - mae: 4.6211\nEpoch 175/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.1918 - mae: 4.6667\nEpoch 176/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0958 - mae: 4.5692\nEpoch 177/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1074 - mae: 4.5806\nEpoch 178/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1218 - mae: 4.5954\nEpoch 179/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3711 - mae: 4.8478\nEpoch 180/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1136 - mae: 4.5876\nEpoch 181/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1378 - mae: 4.6118\nEpoch 182/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1585 - mae: 4.6328\nEpoch 183/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2118 - mae: 4.6861\nEpoch 184/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0830 - mae: 4.5570\nEpoch 185/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0525 - mae: 4.5249\nEpoch 186/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1593 - mae: 4.6326\nEpoch 187/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1878 - mae: 4.6614\nEpoch 188/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.1435 - mae: 4.6179\nEpoch 189/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1251 - mae: 4.6003\nEpoch 190/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1179 - mae: 4.5920\nEpoch 191/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0868 - mae: 4.5585\nEpoch 192/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1071 - mae: 4.5807\nEpoch 193/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0722 - mae: 4.5454\nEpoch 194/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1647 - mae: 4.6392\nEpoch 195/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.0833 - mae: 4.5568\nEpoch 196/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2246 - mae: 4.6991\nEpoch 197/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1063 - mae: 4.5799\nEpoch 198/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0833 - mae: 4.5566\nEpoch 199/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0871 - mae: 4.5601\nEpoch 200/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1036 - mae: 4.5774\nEpoch 201/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0622 - mae: 4.5348\nEpoch 202/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.1026 - mae: 4.5751\nEpoch 203/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1392 - mae: 4.6124\nEpoch 204/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1623 - mae: 4.6371\nEpoch 205/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0813 - mae: 4.5546\nEpoch 206/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1121 - mae: 4.5873\nEpoch 207/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.0193 - mae: 4.4925\nEpoch 208/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1117 - mae: 4.5845\nEpoch 209/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0696 - mae: 4.5410\nEpoch 210/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0268 - mae: 4.5001\nEpoch 211/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0567 - mae: 4.5291\nEpoch 212/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0401 - mae: 4.5125\nEpoch 213/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.0368 - mae: 4.5085\nEpoch 214/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0791 - mae: 4.5520\nEpoch 215/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0164 - mae: 4.4875\nEpoch 216/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0585 - mae: 4.5328\nEpoch 217/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0995 - mae: 4.5723\nEpoch 218/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0419 - mae: 4.5151\nEpoch 219/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0822 - mae: 4.5552\nEpoch 220/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0610 - mae: 4.5341\nEpoch 221/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0774 - mae: 4.5496\nEpoch 222/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0488 - mae: 4.5214\nEpoch 223/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1568 - mae: 4.6311\nEpoch 224/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0649 - mae: 4.5382\nEpoch 225/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2209 - mae: 4.6957\nEpoch 226/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1075 - mae: 4.5793\nEpoch 227/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0081 - mae: 4.4803\nEpoch 228/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0436 - mae: 4.5163\nEpoch 229/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0978 - mae: 4.5711\nEpoch 230/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1597 - mae: 4.6354\nEpoch 231/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.3100 - mae: 4.7847\nEpoch 232/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1191 - mae: 4.5929\nEpoch 233/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0853 - mae: 4.5595\nEpoch 234/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1118 - mae: 4.5860\nEpoch 235/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1342 - mae: 4.6068\nEpoch 236/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0082 - mae: 4.4810\nEpoch 237/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0427 - mae: 4.5149\nEpoch 238/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.2221 - mae: 4.6966\nEpoch 239/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0747 - mae: 4.5486\nEpoch 240/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1373 - mae: 4.6108\nEpoch 241/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1892 - mae: 4.6650\nEpoch 242/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0333 - mae: 4.5064\nEpoch 243/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0944 - mae: 4.5684\nEpoch 244/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0878 - mae: 4.5604\nEpoch 245/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0677 - mae: 4.5407\nEpoch 246/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0569 - mae: 4.5296\nEpoch 247/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0447 - mae: 4.5182\nEpoch 248/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0122 - mae: 4.4839\nEpoch 249/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0467 - mae: 4.5193\nEpoch 250/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1065 - mae: 4.5802\nEpoch 251/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1318 - mae: 4.6059\nEpoch 252/500\n31/31 [==============================] - 0s 6ms/step - loss: 4.0228 - mae: 4.4960\nEpoch 253/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0616 - mae: 4.5340\nEpoch 254/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0410 - mae: 4.5145\nEpoch 255/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1512 - mae: 4.6261\nEpoch 256/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0636 - mae: 4.5368\nEpoch 257/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1104 - mae: 4.5840\nEpoch 258/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0680 - mae: 4.5410\nEpoch 259/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0556 - mae: 4.5290\nEpoch 260/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0095 - mae: 4.4820\nEpoch 261/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1057 - mae: 4.5790\nEpoch 262/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1259 - mae: 4.6001\nEpoch 263/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0403 - mae: 4.5137\nEpoch 264/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0579 - mae: 4.5315\nEpoch 265/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0614 - mae: 4.5347\nEpoch 266/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0620 - mae: 4.5353\nEpoch 267/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1240 - mae: 4.5986\nEpoch 268/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0799 - mae: 4.5530\nEpoch 269/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9879 - mae: 4.4606\nEpoch 270/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9884 - mae: 4.4619\nEpoch 271/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0234 - mae: 4.4956\nEpoch 272/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0366 - mae: 4.5090\nEpoch 273/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0711 - mae: 4.5453\nEpoch 274/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0217 - mae: 4.4950\nEpoch 275/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.0314 - mae: 4.5036\nEpoch 276/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0539 - mae: 4.5279\nEpoch 277/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1347 - mae: 4.6070\nEpoch 278/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0453 - mae: 4.5189\nEpoch 279/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0679 - mae: 4.5420\nEpoch 280/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0446 - mae: 4.5177\nEpoch 281/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9905 - mae: 4.4624\nEpoch 282/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9828 - mae: 4.4541\nEpoch 283/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1270 - mae: 4.6016\nEpoch 284/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0791 - mae: 4.5540\nEpoch 285/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0235 - mae: 4.4971\nEpoch 286/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0386 - mae: 4.5120\nEpoch 287/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0321 - mae: 4.5063\nEpoch 288/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0244 - mae: 4.4971\nEpoch 289/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0297 - mae: 4.5022\nEpoch 290/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.1000 - mae: 4.5741\nEpoch 291/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1222 - mae: 4.5973\nEpoch 292/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.0311 - mae: 4.5035\nEpoch 293/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1236 - mae: 4.5977\nEpoch 294/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9901 - mae: 4.4630\nEpoch 295/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0408 - mae: 4.5137\nEpoch 296/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1040 - mae: 4.5779\nEpoch 297/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1348 - mae: 4.6089\nEpoch 298/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.1125 - mae: 4.5869\nEpoch 299/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.1371 - mae: 4.6119\nEpoch 300/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1535 - mae: 4.6278\nEpoch 301/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9936 - mae: 4.4663\nEpoch 302/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0371 - mae: 4.5112\nEpoch 303/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0495 - mae: 4.5218\nEpoch 304/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0227 - mae: 4.4951\nEpoch 305/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0286 - mae: 4.5013\nEpoch 306/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9896 - mae: 4.4628\nEpoch 307/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0311 - mae: 4.5039\nEpoch 308/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9680 - mae: 4.4404\nEpoch 309/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0035 - mae: 4.4760\nEpoch 310/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9915 - mae: 4.4639\nEpoch 311/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1153 - mae: 4.5886\nEpoch 312/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0855 - mae: 4.5600\nEpoch 313/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1030 - mae: 4.5761\nEpoch 314/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9925 - mae: 4.4658\nEpoch 315/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0113 - mae: 4.4839\nEpoch 316/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0029 - mae: 4.4745\nEpoch 317/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0547 - mae: 4.5284\nEpoch 318/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1168 - mae: 4.5909\nEpoch 319/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0010 - mae: 4.4736\nEpoch 320/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9952 - mae: 4.4675\nEpoch 321/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0459 - mae: 4.5205\nEpoch 322/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1230 - mae: 4.5967\nEpoch 323/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0540 - mae: 4.5282\nEpoch 324/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0009 - mae: 4.4733\nEpoch 325/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0248 - mae: 4.4978\nEpoch 326/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9751 - mae: 4.4467\nEpoch 327/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9936 - mae: 4.4650\nEpoch 328/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9771 - mae: 4.4504\nEpoch 329/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.0579 - mae: 4.5313\nEpoch 330/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9748 - mae: 4.4474\nEpoch 331/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9993 - mae: 4.4726\nEpoch 332/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9624 - mae: 4.4353\nEpoch 333/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0106 - mae: 4.4823\nEpoch 334/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9678 - mae: 4.4382\nEpoch 335/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0943 - mae: 4.5687\nEpoch 336/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9950 - mae: 4.4679\nEpoch 337/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0777 - mae: 4.5515\nEpoch 338/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9935 - mae: 4.4657\nEpoch 339/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9749 - mae: 4.4468\nEpoch 340/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9770 - mae: 4.4492\nEpoch 341/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0998 - mae: 4.5746\nEpoch 342/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0274 - mae: 4.5005\nEpoch 343/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9749 - mae: 4.4481\nEpoch 344/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0273 - mae: 4.5008\nEpoch 345/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9865 - mae: 4.4605\nEpoch 346/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9707 - mae: 4.4426\nEpoch 347/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9578 - mae: 4.4293\nEpoch 348/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0071 - mae: 4.4805\nEpoch 349/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.0384 - mae: 4.5123\nEpoch 350/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9758 - mae: 4.4487\nEpoch 351/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9671 - mae: 4.4397\nEpoch 352/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9646 - mae: 4.4368\nEpoch 353/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9969 - mae: 4.4698\nEpoch 354/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9509 - mae: 4.4233\nEpoch 355/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9647 - mae: 4.4387\nEpoch 356/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0168 - mae: 4.4904\nEpoch 357/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0496 - mae: 4.5242\nEpoch 358/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9862 - mae: 4.4587\nEpoch 359/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9605 - mae: 4.4339\nEpoch 360/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9283 - mae: 4.3992\nEpoch 361/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9989 - mae: 4.4703\nEpoch 362/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0256 - mae: 4.4987\nEpoch 363/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0418 - mae: 4.5150\nEpoch 364/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9755 - mae: 4.4481\nEpoch 365/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0216 - mae: 4.4947\nEpoch 366/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0085 - mae: 4.4827\nEpoch 367/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9647 - mae: 4.4360\nEpoch 368/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0062 - mae: 4.4790\nEpoch 369/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0219 - mae: 4.4960\nEpoch 370/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9651 - mae: 4.4371\nEpoch 371/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0021 - mae: 4.4753\nEpoch 372/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0194 - mae: 4.4924\nEpoch 373/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9275 - mae: 4.3995\nEpoch 374/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9460 - mae: 4.4179\nEpoch 375/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9288 - mae: 4.4011\nEpoch 376/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9574 - mae: 4.4309\nEpoch 377/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0135 - mae: 4.4872\nEpoch 378/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9749 - mae: 4.4473\nEpoch 379/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9298 - mae: 4.4013\nEpoch 380/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0019 - mae: 4.4750\nEpoch 381/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0018 - mae: 4.4748\nEpoch 382/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9496 - mae: 4.4211\nEpoch 383/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9799 - mae: 4.4520\nEpoch 384/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9468 - mae: 4.4185\nEpoch 385/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9546 - mae: 4.4262\nEpoch 386/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9619 - mae: 4.4339\nEpoch 387/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0095 - mae: 4.4828\nEpoch 388/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9686 - mae: 4.4415\nEpoch 389/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0398 - mae: 4.5137\nEpoch 390/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0011 - mae: 4.4743\nEpoch 391/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.0381 - mae: 4.5111\nEpoch 392/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9886 - mae: 4.4602\nEpoch 393/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9888 - mae: 4.4614\nEpoch 394/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9761 - mae: 4.4485\nEpoch 395/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9732 - mae: 4.4454\nEpoch 396/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1098 - mae: 4.5854\nEpoch 397/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9624 - mae: 4.4349\nEpoch 398/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.2960 - mae: 4.7713\nEpoch 399/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9712 - mae: 4.4441\nEpoch 400/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9844 - mae: 4.4569\nEpoch 401/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0441 - mae: 4.5175\nEpoch 402/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0190 - mae: 4.4924\nEpoch 403/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9606 - mae: 4.4330\nEpoch 404/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9601 - mae: 4.4320\nEpoch 405/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.0747 - mae: 4.5483\nEpoch 406/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9918 - mae: 4.4661\nEpoch 407/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9411 - mae: 4.4132\nEpoch 408/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9505 - mae: 4.4217\nEpoch 409/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9690 - mae: 4.4412\nEpoch 410/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1622 - mae: 4.6370\nEpoch 411/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9395 - mae: 4.4112\nEpoch 412/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9426 - mae: 4.4152\nEpoch 413/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9336 - mae: 4.4049\nEpoch 414/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9386 - mae: 4.4105\nEpoch 415/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9781 - mae: 4.4509\nEpoch 416/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9654 - mae: 4.4379\nEpoch 417/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0138 - mae: 4.4866\nEpoch 418/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0239 - mae: 4.4972\nEpoch 419/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9430 - mae: 4.4158\nEpoch 420/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9480 - mae: 4.4199\nEpoch 421/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9579 - mae: 4.4296\nEpoch 422/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9204 - mae: 4.3937\nEpoch 423/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9375 - mae: 4.4086\nEpoch 424/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9405 - mae: 4.4124\nEpoch 425/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9882 - mae: 4.4614\nEpoch 426/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9615 - mae: 4.4330\nEpoch 427/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9660 - mae: 4.4383\nEpoch 428/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0550 - mae: 4.5289\nEpoch 429/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9210 - mae: 4.3927\nEpoch 430/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0330 - mae: 4.5053\nEpoch 431/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9431 - mae: 4.4148\nEpoch 432/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9529 - mae: 4.4249\nEpoch 433/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9791 - mae: 4.4517\nEpoch 434/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0053 - mae: 4.4767\nEpoch 435/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0204 - mae: 4.4934\nEpoch 436/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9684 - mae: 4.4417\nEpoch 437/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0000 - mae: 4.4740\nEpoch 438/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0622 - mae: 4.5353\nEpoch 439/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9530 - mae: 4.4247\nEpoch 440/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0377 - mae: 4.5100\nEpoch 441/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9834 - mae: 4.4551\nEpoch 442/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9936 - mae: 4.4672\nEpoch 443/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9754 - mae: 4.4479\nEpoch 444/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9951 - mae: 4.4675\nEpoch 445/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9406 - mae: 4.4108\nEpoch 446/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9556 - mae: 4.4270\nEpoch 447/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9258 - mae: 4.3971\nEpoch 448/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9527 - mae: 4.4247\nEpoch 449/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.1053 - mae: 4.5794\nEpoch 450/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9262 - mae: 4.3982\nEpoch 451/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9587 - mae: 4.4315\nEpoch 452/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9047 - mae: 4.3765\nEpoch 453/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9152 - mae: 4.3870\nEpoch 454/500\n31/31 [==============================] - 0s 8ms/step - loss: 4.0219 - mae: 4.4954\nEpoch 455/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9240 - mae: 4.3951\nEpoch 456/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9191 - mae: 4.3900\nEpoch 457/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.8850 - mae: 4.3556\nEpoch 458/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9002 - mae: 4.3718\nEpoch 459/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9617 - mae: 4.4331\nEpoch 460/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9756 - mae: 4.4469\nEpoch 461/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9536 - mae: 4.4254\nEpoch 462/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9237 - mae: 4.3956\nEpoch 463/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9217 - mae: 4.3934\nEpoch 464/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9637 - mae: 4.4352\nEpoch 465/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9013 - mae: 4.3739\nEpoch 466/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9813 - mae: 4.4527\nEpoch 467/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9435 - mae: 4.4154\nEpoch 468/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.8887 - mae: 4.3602\nEpoch 469/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9185 - mae: 4.3913\nEpoch 470/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9117 - mae: 4.3831\nEpoch 471/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0439 - mae: 4.5162\nEpoch 472/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9837 - mae: 4.4558\nEpoch 473/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9054 - mae: 4.3771\nEpoch 474/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.8889 - mae: 4.3605\nEpoch 475/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9605 - mae: 4.4323\nEpoch 476/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9835 - mae: 4.4550\nEpoch 477/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9991 - mae: 4.4726\nEpoch 478/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9700 - mae: 4.4425\nEpoch 479/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9734 - mae: 4.4467\nEpoch 480/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0484 - mae: 4.5213\nEpoch 481/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0351 - mae: 4.5094\nEpoch 482/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9644 - mae: 4.4361\nEpoch 483/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9569 - mae: 4.4280\nEpoch 484/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9485 - mae: 4.4210\nEpoch 485/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9445 - mae: 4.4185\nEpoch 486/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9912 - mae: 4.4645\nEpoch 487/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9291 - mae: 4.4001\nEpoch 488/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9489 - mae: 4.4206\nEpoch 489/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0295 - mae: 4.5024\nEpoch 490/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9735 - mae: 4.4447\nEpoch 491/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.8865 - mae: 4.3573\nEpoch 492/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9463 - mae: 4.4165\nEpoch 493/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9099 - mae: 4.3820\nEpoch 494/500\n31/31 [==============================] - 0s 7ms/step - loss: 4.0462 - mae: 4.5198\nEpoch 495/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9612 - mae: 4.4324\nEpoch 496/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9489 - mae: 4.4210\nEpoch 497/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9152 - mae: 4.3869\nEpoch 498/500\n31/31 [==============================] - 0s 7ms/step - loss: 3.9669 - mae: 4.4389\nEpoch 499/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.8910 - mae: 4.3627\nEpoch 500/500\n31/31 [==============================] - 0s 8ms/step - loss: 3.9002 - mae: 4.3710\n"
],
[
"rnn_forecast = model_forecast(model, series[..., np.newaxis], window_size)\nrnn_forecast = rnn_forecast[split_time - window_size:-1, -1, 0]",
"_____no_output_____"
],
[
"plt.figure(figsize=(10, 6))\nplot_series(time_valid, x_valid)\nplot_series(time_valid, rnn_forecast)",
"_____no_output_____"
],
[
"tf.keras.metrics.mean_absolute_error(x_valid, rnn_forecast).numpy()",
"_____no_output_____"
],
[
"import matplotlib.image as mpimg\nimport matplotlib.pyplot as plt\n\n#-----------------------------------------------------------\n# Retrieve a list of list results on training and test data\n# sets for each training epoch\n#-----------------------------------------------------------\nmae=history.history['mae']\nloss=history.history['loss']\n\nepochs=range(len(loss)) # Get number of epochs\n\n#------------------------------------------------\n# Plot MAE and Loss\n#------------------------------------------------\nplt.plot(epochs, mae, 'r')\nplt.plot(epochs, loss, 'b')\nplt.title('MAE and Loss')\nplt.xlabel(\"Epochs\")\nplt.ylabel(\"Accuracy\")\nplt.legend([\"MAE\", \"Loss\"])\n\nplt.figure()\n\nepochs_zoom = epochs[200:]\nmae_zoom = mae[200:]\nloss_zoom = loss[200:]\n\n#------------------------------------------------\n# Plot Zoomed MAE and Loss\n#------------------------------------------------\nplt.plot(epochs_zoom, mae_zoom, 'r')\nplt.plot(epochs_zoom, loss_zoom, 'b')\nplt.title('MAE and Loss')\nplt.xlabel(\"Epochs\")\nplt.ylabel(\"Accuracy\")\nplt.legend([\"MAE\", \"Loss\"])\n\nplt.figure()",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0ccfa451e353f43ca7677be43d5955c51ac8396 | 48,700 | ipynb | Jupyter Notebook | DCRI/ipynb/08_kmeans_test.ipynb | Kao-PMP/Pilot_Project | 79451e75b64d832644a4967f828bf5d685cd5a2d | [
"Apache-2.0"
] | null | null | null | DCRI/ipynb/08_kmeans_test.ipynb | Kao-PMP/Pilot_Project | 79451e75b64d832644a4967f828bf5d685cd5a2d | [
"Apache-2.0"
] | null | null | null | DCRI/ipynb/08_kmeans_test.ipynb | Kao-PMP/Pilot_Project | 79451e75b64d832644a4967f828bf5d685cd5a2d | [
"Apache-2.0"
] | null | null | null | 76.332288 | 19,174 | 0.674312 | [
[
[
"Program: 08_kmeans_test.R \nDate: September, 2019 \nProgrammer: Hillary Mulder \nPurpose: Show K means doesnt work well with harmonized trials data",
"_____no_output_____"
]
],
[
[
"library(cluster)\nlibrary(caret)\nlibrary(purrr)\nlibrary(dplyr)\nlibrary(boot)\n#library(table1)\nlibrary(Hmisc)",
"Loading required package: lattice\nLoading required package: ggplot2\n\nAttaching package: ‘purrr’\n\nThe following object is masked from ‘package:caret’:\n\n lift\n\n\nAttaching package: ‘dplyr’\n\nThe following objects are masked from ‘package:stats’:\n\n filter, lag\n\nThe following objects are masked from ‘package:base’:\n\n intersect, setdiff, setequal, union\n\n\nAttaching package: ‘boot’\n\nThe following object is masked from ‘package:lattice’:\n\n melanoma\n\nLoading required package: survival\n\nAttaching package: ‘survival’\n\nThe following object is masked from ‘package:boot’:\n\n aml\n\nThe following object is masked from ‘package:caret’:\n\n cluster\n\nLoading required package: Formula\n\nAttaching package: ‘Hmisc’\n\nThe following objects are masked from ‘package:dplyr’:\n\n src, summarize\n\nThe following objects are masked from ‘package:base’:\n\n format.pval, units\n\n"
],
[
"data=read.csv(\"Data/analysis_ds.csv\")\n\ndata$allhat=ifelse(data$study.1=='ALLHAT', 1, 0)\ndata$aimhigh=ifelse(data$study.1=='AIMHIGH', 1, 0)\ndata$accord=ifelse(data$study.1=='ACCORD', 1, 0)",
"_____no_output_____"
],
[
"train=data[which(data$train==1),]\nbase_nmiss=train[complete.cases(train[, c(1:3, 5, 6, 9:19, 20:22, 50, 51, 56:58)]), c(1:3, 5, 6, 9:19, 20:22, 50, 51, 56:58)]\nstudyn=base_nmiss$study.1\nenrolid=base_nmiss[,1]\nbase_nmiss=base_nmiss[, -c(1,20,21)]\n#base_nmiss=base_nmiss[, -c(1,9,10,22,23)]\ncolnames(base_nmiss)\nppr=preProcess(base_nmiss, method=c('center','scale'))\n\n#apply transformations\nbase_scale=predict(ppr, newdata=base_nmiss)\n\n#base_scale=scale(base_nmiss)",
"_____no_output_____"
],
[
"test=data[which(data$test==1),]\ntest_nmiss=test[complete.cases(test[, c(1:3, 5, 6, 9:19, 20:22, 50, 51, 56:58)]), c(1:3, 5, 6, 9:19, 20:22, 50, 51, 56:58)]\ntest_studyn=test_nmiss$study.1\ntest_enrolid=test_nmiss[,1]\ntest_nmiss=test_nmiss[, -c(1,20,21)]\n#base_nmiss=base_nmiss[, -c(1,9,10,22,23)]\n#test_scale=scale(_nmiss)\ntest_scale=predict(ppr, newdata=test_nmiss)",
"_____no_output_____"
],
[
"set.seed(123)\n\n# function to compute total within-cluster sum of square \nwss <- function(k) {\n kmeans(base_scale, k, iter.max=20, nstart = 4)$tot.withinss\n}\n\n# Compute and plot wss for k = 1 to k = 15\nk.values <- 2:15\n\n# extract wss for 2-15 clusters\nwss_values <- map_dbl(k.values, wss)\n\nplot(k.values, wss_values,\n type=\"b\", pch = 19, frame = FALSE, \n xlab=\"Number of clusters K\",\n ylab=\"Total within-clusters sum of squares\")\n",
"Warning message:\n“Quick-TRANSfer stage steps exceeded maximum (= 1233550)”"
],
[
"#going to use 4 or 5 clusters\n\nset.seed(123)\ncluster1 <- kmeans(base_scale, 4, iter.max=15, nstart = 6)\ncluster2 <- kmeans(base_scale, 5, iter.max=15, nstart = 6)",
"_____no_output_____"
],
[
"base_nmiss %>%\n mutate(Cluster = cluster1$cluster) %>%\n group_by(Cluster) %>%\n summarise_all(\"mean\")\n\nbase_nmiss %>%\n mutate(Cluster = cluster2$cluster) %>%\n group_by(Cluster) %>%\n summarise_all(\"mean\")",
"_____no_output_____"
],
[
"#table(base_nmiss$studyn, final$cluster)\ncheck=data.frame(person_id=enrolid, study=studyn, cluster1=cluster1$cluster, cluster2=cluster2$cluster)\n#head(check)\ntable(check$study, check$cluster1)\ntable(check$study, check$cluster2)",
"_____no_output_____"
],
[
"#table(base_nmiss$studyn, final$cluster)\npredict.kmeans <- function(object,\n newdata,\n method = c(\"centers\", \"classes\")) {\n method <- match.arg(method)\n\n centers <- object$centers\n ss_by_center <- apply(centers, 1, function(x) {\n colSums((t(newdata) - x) ^ 2)\n })\n best_clusters <- apply(ss_by_center, 1, which.min)\n\n if (method == \"centers\") {\n centers[best_clusters, ]\n } else {\n best_clusters\n }\n}\n\npred1=predict.kmeans(cluster1, newdata=test_scale, method=\"classes\")\npred2=predict.kmeans(cluster2, newdata=test_scale, method=\"classes\")\nstd=data.frame(person_id=test_enrolid, study=test_studyn, cluster1=pred1, cluster2=pred2)\n#head(std)\ntable(std$study, std$cluster1)\ntable(std$study, std$cluster2)",
"_____no_output_____"
],
[
"#train2=left_join(x=train, y=check, by='person_id')\n#colnames(train)\n#head(train)\n#test2=left_join(x=test, y=std, by='person_id')\n\n#all=rbind(train2, test2)\n#head(all)\n#write.csv(all, file='Data/analysis_ds_clusters.csv', quote = FALSE, row.names = FALSE)",
"_____no_output_____"
],
[
"base_new=base_scale[,-(19:21)]\ntest_new=test_scale[,-c(19:21)]\n\nset.seed(123)\ncluster3 <- kmeans(base_new, 4, iter.max=15, nstart = 6)\ncluster4 <- kmeans(base_new, 5, iter.max=15, nstart = 6)\n\n#table(base_nmiss$studyn, final$cluster)\ncheck=data.frame(person_id=enrolid, study=studyn, cluster3=cluster3$cluster, cluster4=cluster4$cluster)\n#head(check)\ntable(check$study, check$cluster3)\ntable(check$study, check$cluster4)\n\n\npred3=predict.kmeans(cluster3, newdata=test_new, method=\"classes\")\npred4=predict.kmeans(cluster4, newdata=test_new, method=\"classes\")\nstd=data.frame(person_id=test_enrolid, study=test_studyn, cluster3=pred3, cluster4=pred4)\n#head(std)\ntable(std$study, std$cluster3)\ntable(std$study, std$cluster4)",
"_____no_output_____"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cd1d0f42bf18e823eda7c7b92f5f8889beb656 | 10,406 | ipynb | Jupyter Notebook | FashionMNIST Challenge/knn.ipynb | m-L-0/17b-wangshuyun-2015 | acc40b0762b02758436e6daeb0c577c1add49aaa | [
"MIT"
] | 2 | 2017-11-15T06:39:16.000Z | 2019-02-17T04:41:07.000Z | FashionMNIST Challenge/knn.ipynb | m-L-0/17b-wangshuyun-2015 | acc40b0762b02758436e6daeb0c577c1add49aaa | [
"MIT"
] | null | null | null | FashionMNIST Challenge/knn.ipynb | m-L-0/17b-wangshuyun-2015 | acc40b0762b02758436e6daeb0c577c1add49aaa | [
"MIT"
] | null | null | null | 36.00692 | 241 | 0.551028 | [
[
[
"# 作业3:设计并训练KNN算法对图片进行分类。",
"_____no_output_____"
],
[
"## example1:",
"_____no_output_____"
]
],
[
[
"import tensorflow as tf\nimport numpy as np\nfrom tensorflow.examples.tutorials.mnist import input_data\n\nk=7\ntest_num=int(input('请输入需要测试的数据数量:'))\n\n#加载TFRecord训练集的数据\nreader = tf.TFRecordReader()\nfilename_queue = tf.train.string_input_producer([\"/home/srhyme/ML project/DS/train.tfrecords\"]) \n_, example = reader.read(filename_queue) \nfeatures = tf.parse_single_example(\n example,features={\n 'image_raw': tf.FixedLenFeature([], tf.string),\n 'pixels': tf.FixedLenFeature([], tf.int64), \n 'label': tf.FixedLenFeature([], tf.int64),\n })\ntrain_images = tf.decode_raw(features['image_raw'], tf.uint8)\ntrain_labels = tf.cast(features['label'], tf.int32)\ntrain_pixels = tf.cast(features['pixels'], tf.int32)\n\n#加载TFRecord测试集的数据\nreader = tf.TFRecordReader()\nfilename_queue = tf.train.string_input_producer([\"/home/srhyme/ML project/DS/test.tfrecords\"]) \n_, example = reader.read(filename_queue) \nfeatures = tf.parse_single_example(\n example,features={\n 'image_raw': tf.FixedLenFeature([], tf.string),\n 'pixels': tf.FixedLenFeature([], tf.int64), \n 'label': tf.FixedLenFeature([], tf.int64),\n })\ntest_images = tf.decode_raw(features['image_raw'], tf.uint8)\ntest_labels = tf.cast(features['label'], tf.int32)\ntest_pixels = tf.cast(features['pixels'], tf.int32)\n\ntri_list=[]\ntei_list=[]\ntrl_list=[]\ntel_list=[]\n\n#转换TFRecord里面的类型格式\nwith tf.Session() as sess: \n coord = tf.train.Coordinator() \n threads = tf.train.start_queue_runners(sess=sess, coord=coord)\n\n for i in range(sess.run(train_pixels)):\n image,label=sess.run([train_images,train_labels])\n tri_list.append(image)\n trl=np.zeros((1,10))\n trl[0][label]=1\n trl_list.append(trl[0])\n train_labels=np.array(trl_list)\n train_images=np.array(tri_list)\n print('训练集已加载完毕')\n\n for i in range(test_num):\n image,label=sess.run([test_images,test_labels])\n tei_list.append(image)\n tel=np.zeros((1,10))\n tel[0][label]=1\n tel_list.append(tel[0])\n test_labels=np.array(tel_list)\n test_images=np.array(tei_list)\n print('测试集已加载完毕')\n \nsess.close()\n\nx_train = tf.placeholder(tf.float32)\nx_test = tf.placeholder(tf.float32)\ny_train = tf.placeholder(tf.float32)\n\n# 欧式距离\neuclidean_distance = tf.sqrt(tf.reduce_sum(tf.square(x_train - x_test), 1))\n# 计算最相近的k个样本的索引\n_, nearest_index = tf.nn.top_k(-euclidean_distance, k)\n\nwith tf.Session() as sess:\n sess.run(tf.global_variables_initializer())\n \n predicted_num = 0\n # 对每个图片进行预测\n for i in range(test_images.shape[0]):\n # 最近k个样本的标记索引\n nearest_index_res = sess.run(\n nearest_index, \n feed_dict={\n x_train: train_images,\n y_train: train_labels,\n x_test: test_images[i]})\n # 最近k个样本的标记\n nearest_label = []\n for j in range(k):\n nearest_label.append(list(train_labels[nearest_index_res[j]]))\n\n predicted_class = sess.run(tf.argmax(tf.reduce_sum(nearest_label, 0), 0))\n true_class = sess.run(tf.argmax(test_labels[i]))\n if predicted_class == true_class:\n predicted_num += 1\n \n if i % 100 == 0:\n print('step is %d accuracy is %.4f' % (i, predicted_num / (i+1)))\n print('accuracy is %.4f' % (predicted_num / test_num))",
"请输入需要测试的数据数量:300\n训练集已加载完毕\n测试集已加载完毕\nINFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.CancelledError'>, Enqueue operation was cancelled\n\t [[Node: input_producer_1/input_producer_1_EnqueueMany = QueueEnqueueManyV2[Tcomponents=[DT_STRING], timeout_ms=-1, _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"](input_producer_1, input_producer_1/RandomShuffle)]]\nstep is 0 accuracy is 1.0000\nstep is 100 accuracy is 0.8515\nstep is 200 accuracy is 0.8756\naccuracy is 0.8867\n"
]
],
[
[
"## example2:",
"_____no_output_____"
]
],
[
[
"import tensorflow as tf\nimport numpy as np\nfrom tensorflow.examples.tutorials.mnist import input_data\nfrom collections import Counter\n\n\n#训练集数据的引入\nreader = tf.TFRecordReader()\nfilename_queue = tf.train.string_input_producer([\"/home/srhyme/ML project/DS/train.tfrecords\"]) \n_, example = reader.read(filename_queue) \nfeatures = tf.parse_single_example(\n example,features={\n 'image_raw': tf.FixedLenFeature([], tf.string),\n 'pixels': tf.FixedLenFeature([], tf.int64), \n 'label': tf.FixedLenFeature([], tf.int64),\n })\ntrain_images = tf.decode_raw(features['image_raw'], tf.uint8)\ntrain_labels = tf.cast(features['label'], tf.int32)\ntrain_pixels = tf.cast(features['pixels'], tf.int32) \n\n\n#测试集数据的引入\nreader = tf.TFRecordReader()\nfilename_queue = tf.train.string_input_producer([\"/home/srhyme/ML project/DS/test.tfrecords\"]) \n_, example = reader.read(filename_queue) \nfeatures = tf.parse_single_example(\n example,features={\n 'image_raw': tf.FixedLenFeature([], tf.string),\n 'pixels': tf.FixedLenFeature([], tf.int64), \n 'label': tf.FixedLenFeature([], tf.int64),\n })\ntest_images = tf.decode_raw(features['image_raw'], tf.uint8)\ntest_labels = tf.cast(features['label'], tf.int32)\ntest_pixels = tf.cast(features['pixels'], tf.int32)\n\n\n#设置变量\ntestnum=int(input('请输入需要测试的数据集数量:'))\nk=5\ncorrect_probability=testnum\n\nwith tf.Session() as sess: \n coord = tf.train.Coordinator() \n threads = tf.train.start_queue_runners(sess=sess, coord=coord)\n test_num=sess.run(test_pixels)\n train_num=sess.run(train_pixels)\n\n\n #生成一个训练标签的列表,方便索引\n c_labels=[]\n for n in range(train_num):\n train_label=sess.run(train_labels)\n c_labels.append(train_label)\n #生成一个测试标签的列表,方便索引\n g_labels=[]\n for n in range(test_num):\n test_label=sess.run(test_labels)\n g_labels.append(test_label)\n\n\n for i in range(testnum):#测试集数量\n test_image=sess.run(test_images)\n #生成每个测试集的距离列表\n min_label=[]\n for j in range(train_num):#训练集数量\n train_image=sess.run(train_images)\n euclidean_distance =np.sqrt(np.sum(np.square(train_image - test_image)))\n min_label.append(-euclidean_distance)\n \n\n #生成最近k个点的位置\n min_labels=tf.constant([min_label])\n _, nearest_index = tf.nn.top_k(min_labels, k)\n #生成一个最近k点标签列表\n nearest_label=[]\n near=nearest_index\n for m in range(k):\n nearest_label.append(c_labels[sess.run(near[0,m])])#在训练标签中找到该位置的标签\n \n\n #生成该测试集经过knn训练后拟合的标签\n nearset_dict=Counter(nearest_label)\n \n key_list=[]\n value_list=[]\n for key,value in nearset_dict.items():\n key_list.append(key)\n value_list.append(value)\n max_value=max(value_list)\n get_value_index = value_list.index(max_value)\n guess = key_list[get_value_index]\n #判断正确率\n correct=g_labels[i]\n if correct != guess:\n correct_probability=correct_probability - 1\n\nprint('正确率为',(correct_probability/testnum))",
"请输入需要测试的数据集数量:10\n正确率为 INFO:tensorflow:Error reported to Coordinator: <class 'tensorflow.python.framework.errors_impl.CancelledError'>, Enqueue operation was cancelled\n\t [[Node: input_producer_2/input_producer_2_EnqueueMany = QueueEnqueueManyV2[Tcomponents=[DT_STRING], timeout_ms=-1, _device=\"/job:localhost/replica:0/task:0/device:CPU:0\"](input_producer_2, input_producer_2/RandomShuffle)]]0.7\n\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0cd23fa328443ed9fa1c760abc57cfdaf2d22fb | 6,100 | ipynb | Jupyter Notebook | _notebooks/2020-02-25-continuous-delivery.ipynb | ineszz/blog | b7128c21c655cd3479f04c525c0ddca36af32051 | [
"Apache-2.0"
] | 7 | 2020-02-25T14:51:43.000Z | 2021-03-30T13:08:33.000Z | _notebooks/2020-02-25-continuous-delivery.ipynb | ineszz/blog | b7128c21c655cd3479f04c525c0ddca36af32051 | [
"Apache-2.0"
] | 9 | 2020-02-26T07:16:09.000Z | 2021-07-31T21:32:33.000Z | _notebooks/2020-02-25-continuous-delivery.ipynb | ineszz/blog | b7128c21c655cd3479f04c525c0ddca36af32051 | [
"Apache-2.0"
] | 11 | 2020-02-27T03:53:13.000Z | 2021-11-30T12:21:09.000Z | 42.361111 | 720 | 0.677213 | [
[
[
"# Continuous Delivery Explained\n> \"An introduction to the devops practice of CI/CD.\"\n- toc: false\n- branch: master\n- badges: true\n- comments: true\n- categories: [devops, continuous-delivery]\n- image: images/copied_from_nb/img/devops/feedback-cycle.png",
"_____no_output_____"
],
[
"\n\n> *I wrote this back in September 2014 and never published it, but since it's an introductory piece it stands its ground, so let this serve as an initial post…*",
"_____no_output_____"
],
[
"## CD in a Nutshell\n\nA typical mission statement for Continuous Delivery is this…\n\n> *Our highest priority is to satisfy the customer,*\n> *through early and **continuous delivery** of valuable software.*\n\nContinuous Delivery strives to improve the process of software delivery, by applying Continuous Deployment paired with automated testing and Continuous Integration. The goal is creating software developed to a high standard and easily packaged and deployed to test environments, resulting in the ability to rapidly, reliably and repeatedly push out enhancements and bug fixes to customers in small increments, at low risk and with minimal manual overhead.\n\nCD is effective because it facilitates an explorative approach by providing real, valuable measurements of the output of the process, and feeding those results back into the process. It's the next logical step after applying Agile principles to development, by expanding the scope to the whole software life-cycle and all involved parties, from inception to going live and then maintaining the product for a substantial amount of time in fast-paced iterations.",
"_____no_output_____"
],
[
"## Some More Details\n\nContinuous Delivery means that your software is production-ready from day one of your project (even when it's not “feature complete”), and that you can release to users on demand at the push of a button. There are several practices and patterns that enable this, but the foundation is formed in particular by excellent configuration management, continuous integration, and comprehensive automated testing at all levels. The key pattern is the deployment pipeline, which is effectively the extension of continuous integration out to production, whereby every check-in produces a release candidate which is assessed for its fitness to be released to production through a series of automated and then manual tests.\n\nIn order to be able to perform these validations against every build, your regression tests must be automated — both at the unit and acceptance level. Humans then perform tasks such as exploratory testing, usability testing, and showcases as later validations against builds that have already passed the automated tests. Builds can be deployed automatically on demand to testing, staging and production environments by the people authorized to do so — note that this means deployments are triggered by humans and performed by machines.\n\nThrough these practices, teams can get fast feedback on whether the software being delivered is useful, reduce the risk of release, and achieve a much more predictable, reliable process for software delivery. The backbone of CD is a culture in which everybody, if somehow involved in the delivery process, collaborates throughout the life-cycle of the product — developers, testers, infrastructure, operators, DBAs, managers, and customers alike.",
"_____no_output_____"
],
[
"## Where to Go From Here?\n\nHere are some resources for diving deeper into the topic:\n\n - [Jez Humble's Blog · Continuous Delivery](https://continuousdelivery.com/about/)\n - [CD Foundation](https://cd.foundation/) – A Neutral Home for the Next Generation of Continuous Delivery Collaboration.\n - [IT Revolution DevOps Blog](https://itrevolution.com/devops-blog/)\n - [Devops Weekly Mailing List](https://www.devopsweekly.com/) (by [@garethr](https://twitter.com/garethr))\n - [Team Topologies](https://teamtopologies.com/)",
"_____no_output_____"
],
[
"\n> 👍 *Credits:* [Devops-toolchain](https://commons.wikimedia.org/wiki/File:Devops-toolchain.svg)",
"_____no_output_____"
]
]
] | [
"markdown"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
]
] |
d0cd24d72345fb6b07969c493832616778531679 | 32,405 | ipynb | Jupyter Notebook | PY0101EN-1-2-Strings.ipynb | ferm36/IBMPforDS | 6b5725a3de7efb80344eb06d2075756b3cfaa198 | [
"Unlicense"
] | null | null | null | PY0101EN-1-2-Strings.ipynb | ferm36/IBMPforDS | 6b5725a3de7efb80344eb06d2075756b3cfaa198 | [
"Unlicense"
] | null | null | null | PY0101EN-1-2-Strings.ipynb | ferm36/IBMPforDS | 6b5725a3de7efb80344eb06d2075756b3cfaa198 | [
"Unlicense"
] | null | null | null | 22.302134 | 921 | 0.521123 | [
[
[
"<center>\n <img src=\"https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/IDSNlogo.png\" width=\"300\" alt=\"cognitiveclass.ai logo\" />\n</center>\n\n# String Operations\n\nEstimated time needed: **15** minutes\n\n## Objectives\n\nAfter completing this lab you will be able to:\n\n* Work with Strings\n* Perform operations on String\n* Manipulate Strings using indexing and escape sequences\n",
"_____no_output_____"
],
[
"<h2>Table of Contents</h2>\n<div class=\"alert alert-block alert-info\" style=\"margin-top: 20px\">\n <ul>\n <li>\n <a href=\"https://#strings\">What are Strings?</a>\n </li>\n <li>\n <a href=\"https://#index\">Indexing</a>\n <ul>\n <li><a href=\"https://neg/?utm_medium=Exinfluencer&utm_source=Exinfluencer&utm_content=000026UJ&utm_term=10006555&utm_id=NA-SkillsNetwork-Channel-SkillsNetworkCoursesIBMDeveloperSkillsNetworkPY0101ENSkillsNetwork19487395-2021-01-01\">Negative Indexing</a></li>\n <li><a href=\"https://slice/?utm_medium=Exinfluencer&utm_source=Exinfluencer&utm_content=000026UJ&utm_term=10006555&utm_id=NA-SkillsNetwork-Channel-SkillsNetworkCoursesIBMDeveloperSkillsNetworkPY0101ENSkillsNetwork19487395-2021-01-01\">Slicing</a></li>\n <li><a href=\"https://stride/?utm_medium=Exinfluencer&utm_source=Exinfluencer&utm_content=000026UJ&utm_term=10006555&utm_id=NA-SkillsNetwork-Channel-SkillsNetworkCoursesIBMDeveloperSkillsNetworkPY0101ENSkillsNetwork19487395-2021-01-01\">Stride</a></li>\n <li><a href=\"https://concat/?utm_medium=Exinfluencer&utm_source=Exinfluencer&utm_content=000026UJ&utm_term=10006555&utm_id=NA-SkillsNetwork-Channel-SkillsNetworkCoursesIBMDeveloperSkillsNetworkPY0101ENSkillsNetwork19487395-2021-01-01\">Concatenate Strings</a></li>\n </ul>\n </li>\n <li>\n <a href=\"https://#escape\">Escape Sequences</a>\n </li>\n <li>\n <a href=\"https://#operations\">String Operations</a>\n </li>\n <li>\n <a href=\"https://#quiz\">Quiz on Strings</a>\n </li>\n </ul>\n\n</div>\n\n<hr>\n",
"_____no_output_____"
],
[
"<h2 id=\"strings\">What are Strings?</h2>\n",
"_____no_output_____"
],
[
"The following example shows a string contained within 2 quotation marks:\n",
"_____no_output_____"
]
],
[
[
"# Use quotation marks for defining string\n\n\"Michael Jackson\"",
"_____no_output_____"
]
],
[
[
"We can also use single quotation marks:\n",
"_____no_output_____"
]
],
[
[
"# Use single quotation marks for defining string\n\n'Michael Jackson'",
"_____no_output_____"
]
],
[
[
"A string can be a combination of spaces and digits:\n",
"_____no_output_____"
]
],
[
[
"# Digitals and spaces in string\n\n'1 2 3 4 5 6 '",
"_____no_output_____"
]
],
[
[
"A string can also be a combination of special characters :\n",
"_____no_output_____"
]
],
[
[
"# Special characters in string\n\n'@#2_#]&*^%$'",
"_____no_output_____"
]
],
[
[
"We can print our string using the print statement:\n",
"_____no_output_____"
]
],
[
[
"# Print the string\n\nprint(\"hello!\")",
"hello!\n"
]
],
[
[
"We can bind or assign a string to another variable:\n",
"_____no_output_____"
]
],
[
[
"# Assign string to variable\n\nname = \"Michael Jackson\"\nprint(name)",
"Michael Jackson\n"
]
],
[
[
"<hr>\n",
"_____no_output_____"
],
[
"<h2 id=\"index\">Indexing</h2>\n",
"_____no_output_____"
],
[
"It is helpful to think of a string as an ordered sequence. Each element in the sequence can be accessed using an index represented by the array of numbers:\n",
"_____no_output_____"
],
[
"<img src=\"https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/labs/Module%201/images/StringsIndex.png\" width=\"600\" align=\"center\" />\n",
"_____no_output_____"
],
[
"The first index can be accessed as follows:\n",
"_____no_output_____"
],
[
"<hr/>\n<div class=\"alert alert-success alertsuccess\" style=\"margin-top: 20px\">\n[Tip]: Because indexing starts at 0, it means the first index is on the index 0.\n</div>\n<hr/>\n",
"_____no_output_____"
]
],
[
[
"# Print the first element in the string\n\nprint(name[0])",
"M\n"
]
],
[
[
"We can access index 6:\n",
"_____no_output_____"
]
],
[
[
"# Print the element on index 6 in the string\n\nprint(name[6])",
"l\n"
]
],
[
[
"Moreover, we can access the 13th index:\n",
"_____no_output_____"
]
],
[
[
"# Print the element on the 13th index in the string\n\nprint(name[13])",
"o\n"
]
],
[
[
"<h3 id=\"neg\">Negative Indexing</h3>\n",
"_____no_output_____"
],
[
"We can also use negative indexing with strings:\n",
"_____no_output_____"
],
[
"<img src=\"https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/labs/Module%201/images/StringsNeg.png\" width=\"600\" align=\"center\" />\n",
"_____no_output_____"
],
[
"Negative index can help us to count the element from the end of the string.\n",
"_____no_output_____"
],
[
"The last element is given by the index -1:\n",
"_____no_output_____"
]
],
[
[
"# Print the last element in the string\n\nprint(name[-1])",
"n\n"
]
],
[
[
"The first element can be obtained by index -15:\n",
"_____no_output_____"
]
],
[
[
"# Print the first element in the string\n\nprint(name[-15])",
"M\n"
]
],
[
[
"We can find the number of characters in a string by using <code>len</code>, short for length:\n",
"_____no_output_____"
]
],
[
[
"# Find the length of string\n\nlen(\"Michael Jackson\")",
"_____no_output_____"
]
],
[
[
"<h3 id=\"slice\">Slicing</h3>\n",
"_____no_output_____"
],
[
"We can obtain multiple characters from a string using slicing, we can obtain the 0 to 4th and 8th to the 12th element:\n",
"_____no_output_____"
],
[
"<img src=\"https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/labs/Module%201/images/StringsSlice.png\" width=\"600\" align=\"center\" />\n",
"_____no_output_____"
],
[
"<hr/>\n<div class=\"alert alert-success alertsuccess\" style=\"margin-top: 20px\">\n[Tip]: When taking the slice, the first number means the index (start at 0), and the second number means the length from the index to the last element you want (start at 1)\n</div>\n<hr/>\n",
"_____no_output_____"
]
],
[
[
"# Take the slice on variable name with only index 0 to index 3\n\nname[0:4]",
"_____no_output_____"
],
[
"# Take the slice on variable name with only index 8 to index 11\n\nname[8:12]",
"_____no_output_____"
]
],
[
[
"<h3 id=\"stride\">Stride</h3>\n",
"_____no_output_____"
],
[
"We can also input a stride value as follows, with the '2' indicating that we are selecting every second variable:\n",
"_____no_output_____"
],
[
"<img src=\"https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/labs/Module%201/images/StringsStride.png\" width=\"600\" align=\"center\" />\n",
"_____no_output_____"
]
],
[
[
"# Get every second element. The elments on index 1, 3, 5 ...\n\nname[::2]",
"_____no_output_____"
]
],
[
[
"We can also incorporate slicing with the stride. In this case, we select the first five elements and then use the stride:\n",
"_____no_output_____"
]
],
[
[
"# Get every second element in the range from index 0 to index 4\n\nname[0:5:2]",
"_____no_output_____"
]
],
[
[
"<h3 id=\"concat\">Concatenate Strings</h3>\n",
"_____no_output_____"
],
[
"We can concatenate or combine strings by using the addition symbols, and the result is a new string that is a combination of both:\n",
"_____no_output_____"
]
],
[
[
"# Concatenate two strings\n\nstatement = name + \"is the best\"\nstatement",
"_____no_output_____"
]
],
[
[
"To replicate values of a string we simply multiply the string by the number of times we would like to replicate it. In this case, the number is three. The result is a new string, and this new string consists of three copies of the original string:\n",
"_____no_output_____"
]
],
[
[
"# Print the string for 3 times\n\n3 * \"Michael Jackson\"",
"_____no_output_____"
]
],
[
[
"You can create a new string by setting it to the original variable. Concatenated with a new string, the result is a new string that changes from Michael Jackson to “Michael Jackson is the best\".\n",
"_____no_output_____"
]
],
[
[
"# Concatenate strings\n\nname = \"Michael Jackson\"\nname = name + \" is the best\"\nname",
"_____no_output_____"
]
],
[
[
"<hr>\n",
"_____no_output_____"
],
[
"<h2 id=\"escape\">Escape Sequences</h2>\n",
"_____no_output_____"
],
[
"Back slashes represent the beginning of escape sequences. Escape sequences represent strings that may be difficult to input. For example, back slash \"n\" represents a new line. The output is given by a new line after the back slash \"n\" is encountered:\n",
"_____no_output_____"
]
],
[
[
"# New line escape sequence\n\nprint(\" Michael Jackson \\n is the best\" )",
" Michael Jackson \n is the best\n"
]
],
[
[
"Similarly, back slash \"t\" represents a tab:\n",
"_____no_output_____"
]
],
[
[
"# Tab escape sequence\n\nprint(\" Michael Jackson \\t is the best\" )",
" Michael Jackson \t is the best\n"
]
],
[
[
"If you want to place a back slash in your string, use a double back slash:\n",
"_____no_output_____"
]
],
[
[
"# Include back slash in string\n\nprint(\" Michael Jackson \\\\ is the best\" )",
" Michael Jackson \\ is the best\n"
]
],
[
[
"We can also place an \"r\" before the string to display the backslash:\n",
"_____no_output_____"
]
],
[
[
"# r will tell python that string will be display as raw string\n\nprint(r\" Michael Jackson \\ is the best\" )",
" Michael Jackson \\ is the best\n"
]
],
[
[
"<hr>\n",
"_____no_output_____"
],
[
"<h2 id=\"operations\">String Operations</h2>\n",
"_____no_output_____"
],
[
"There are many string operation methods in Python that can be used to manipulate the data. We are going to use some basic string operations on the data.\n",
"_____no_output_____"
],
[
"Let's try with the method <code>upper</code>; this method converts lower case characters to upper case characters:\n",
"_____no_output_____"
]
],
[
[
"# Convert all the characters in string to upper case\n\na = \"Thriller is the sixth studio album\"\nprint(\"before upper:\", a)\nb = a.upper()\nprint(\"After upper:\", b)",
"before upper: Thriller is the sixth studio album\nAfter upper: THRILLER IS THE SIXTH STUDIO ALBUM\n"
]
],
[
[
"The method <code>replace</code> replaces a segment of the string, i.e. a substring with a new string. We input the part of the string we would like to change. The second argument is what we would like to exchange the segment with, and the result is a new string with the segment changed:\n",
"_____no_output_____"
]
],
[
[
"# Replace the old substring with the new target substring is the segment has been found in the string\n\na = \"Michael Jackson is the best\"\nb = a.replace('Michael', 'Janet')\nb",
"_____no_output_____"
]
],
[
[
"The method <code>find</code> finds a sub-string. The argument is the substring you would like to find, and the output is the first index of the sequence. We can find the sub-string <code>jack</code> or <code>el<code>.\n",
"_____no_output_____"
],
[
"<img src=\"https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/IBMDeveloperSkillsNetwork-PY0101EN-SkillsNetwork/labs/Module%201/images/StringsFind.png\" width=\"600\" align=\"center\" />\n",
"_____no_output_____"
]
],
[
[
"# Find the substring in the string. Only the index of the first elment of substring in string will be the output\n\nname = \"Michael Jackson\"\nname.find('el')",
"_____no_output_____"
],
[
"# Find the substring in the string.\n\nname.find('Jack')",
"_____no_output_____"
]
],
[
[
"If the sub-string is not in the string then the output is a negative one. For example, the string 'Jasdfasdasdf' is not a substring:\n",
"_____no_output_____"
]
],
[
[
"# If cannot find the substring in the string\n\nname.find('Jasdfasdasdf')",
"_____no_output_____"
]
],
[
[
"<hr>\n",
"_____no_output_____"
],
[
"<h2 id=\"quiz\">Quiz on Strings</h2>\n",
"_____no_output_____"
],
[
"What is the value of the variable <code>a</code> after the following code is executed?\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute \n\na = \"1\"",
"_____no_output_____"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\n\"1\"\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"What is the value of the variable <code>b</code> after the following code is executed?\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute\n\nb = \"2\"",
"_____no_output_____"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\n\"2\"\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"What is the value of the variable <code>c</code> after the following code is executed?\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute \n\nc = a + b",
"_____no_output_____"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\n\"12\"\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"<hr>\n",
"_____no_output_____"
],
[
"Consider the variable <code>d</code> use slicing to print out the first three elements:\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute\n\nd = \"ABCDEFG\"\nprint(d[:3])",
"ABC\n"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\nprint(d[:3]) \n\n# or \n\nprint(d[0:3])\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"<hr>\n",
"_____no_output_____"
],
[
"Use a stride value of 2 to print out every second character of the string <code>e</code>:\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute\n\ne = 'clocrkr1e1c1t'\nprint(e[::2])",
"correct\n"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\nprint(e[::2])\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"<hr>\n",
"_____no_output_____"
],
[
"Print out a backslash:\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute\nprint(\"\\\\\")",
"\\\n"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\nprint(\"\\\\\\\\\")\n\nor\n\nprint(r\"\\ \")\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"<hr>\n",
"_____no_output_____"
],
[
"Convert the variable <code>f</code> to uppercase:\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute\n\nf = \"You are wrong\"\nf.upper()",
"_____no_output_____"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\nf.upper()\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"<hr>\n",
"_____no_output_____"
],
[
"Consider the variable <code>g</code>, and find the first index of the sub-string <code>snow</code>:\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute\n\ng = \"Mary had a little lamb Little lamb, little lamb Mary had a little lamb \\\nIts fleece was white as snow And everywhere that Mary went Mary went, Mary went \\\nEverywhere that Mary went The lamb was sure to go\"\n\ng.find('snow')",
"_____no_output_____"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\ng.find(\"snow\")\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"In the variable <code>g</code>, replace the sub-string <code>Mary</code> with <code>Bob</code>:\n",
"_____no_output_____"
]
],
[
[
"# Write your code below and press Shift+Enter to execute\ng.replace(\"Mary\", \"Bob\")",
"_____no_output_____"
]
],
[
[
"<details><summary>Click here for the solution</summary>\n\n```python\ng.replace(\"Mary\", \"Bob\")\n\n```\n\n</details>\n",
"_____no_output_____"
],
[
"<hr>\n<h2>The last exercise!</h2>\n<p>Congratulations, you have completed your first lesson and hands-on lab in Python. However, there is one more thing you need to do. The Data Science community encourages sharing work. The best way to share and showcase your work is to share it on GitHub. By sharing your notebook on GitHub you are not only building your reputation with fellow data scientists, but you can also show it off when applying for a job. Even though this was your first piece of work, it is never too early to start building good habits. So, please read and follow <a href=\"https://cognitiveclass.ai/blog/data-scientists-stand-out-by-sharing-your-notebooks/?utm_medium=Exinfluencer&utm_source=Exinfluencer&utm_content=000026UJ&utm_term=10006555&utm_id=NA-SkillsNetwork-Channel-SkillsNetworkCoursesIBMDeveloperSkillsNetworkPY0101ENSkillsNetwork19487395-2021-01-01\" target=\"_blank\">this article</a> to learn how to share your work.\n<hr>\n",
"_____no_output_____"
],
[
"## Author\n\n<a href=\"https://www.linkedin.com/in/joseph-s-50398b136/?utm_medium=Exinfluencer&utm_source=Exinfluencer&utm_content=000026UJ&utm_term=10006555&utm_id=NA-SkillsNetwork-Channel-SkillsNetworkCoursesIBMDeveloperSkillsNetworkPY0101ENSkillsNetwork19487395-2021-01-01\" target=\"_blank\">Joseph Santarcangelo</a>\n\n## Change Log\n\n| Date (YYYY-MM-DD) | Version | Changed By | Change Description |\n| ----------------- | ------- | ---------- | ----------------------------------- |\n| 2020-11-11 | 2.1 | Aije | Updated variable names to lowercase |\n| 2020-08-26 | 2.0 | Lavanya | Moved lab to course repo in GitLab |\n\n## <h3 align=\"center\"> © IBM Corporation 2020. All rights reserved. <h3/>\n",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
]
] |
d0cd2fac9e1f3e7d22a6025c2ddda0d7bea968ea | 7,482 | ipynb | Jupyter Notebook | Pandas/2.Indexing, Selecting & Assigning.ipynb | nakshatra-garg/kaggle-learn-courses | c110792ae85cf343d606d13da86cc51c9e2bfdcf | [
"MIT"
] | null | null | null | Pandas/2.Indexing, Selecting & Assigning.ipynb | nakshatra-garg/kaggle-learn-courses | c110792ae85cf343d606d13da86cc51c9e2bfdcf | [
"MIT"
] | null | null | null | Pandas/2.Indexing, Selecting & Assigning.ipynb | nakshatra-garg/kaggle-learn-courses | c110792ae85cf343d606d13da86cc51c9e2bfdcf | [
"MIT"
] | null | null | null | 7,482 | 7,482 | 0.702486 | [
[
[
"**[Pandas Home Page](https://www.kaggle.com/learn/pandas)**\n\n---\n",
"_____no_output_____"
],
[
"# Introduction\n\nIn this set of exercises we will work with the [Wine Reviews dataset](https://www.kaggle.com/zynicide/wine-reviews). ",
"_____no_output_____"
],
[
"Run the following cell to load your data and some utility functions (including code to check your answers).",
"_____no_output_____"
]
],
[
[
"import pandas as pd\n\nreviews = pd.read_csv(\"../input/wine-reviews/winemag-data-130k-v2.csv\", index_col=0)\npd.set_option(\"display.max_rows\", 5)\n\nfrom learntools.core import binder; binder.bind(globals())\nfrom learntools.pandas.indexing_selecting_and_assigning import *\nprint(\"Setup complete.\")",
"_____no_output_____"
]
],
[
[
"Look at an overview of your data by running the following line.",
"_____no_output_____"
]
],
[
[
"reviews.head()",
"_____no_output_____"
]
],
[
[
"# Exercises",
"_____no_output_____"
],
[
"## 1.\n\nSelect the `description` column from `reviews` and assign the result to the variable `desc`.",
"_____no_output_____"
]
],
[
[
"# Your code here\ndesc = reviews['description'] #or reviews.description\n\n# Check your answer\nq1.check()",
"_____no_output_____"
]
],
[
[
"Follow-up question: what type of object is `desc`? If you're not sure, you can check by calling Python's `type` function: `type(desc)`.",
"_____no_output_____"
]
],
[
[
"#q1.hint()\n#q1.solution()\ntype(desc)",
"_____no_output_____"
]
],
[
[
"## 2.\n\nSelect the first value from the description column of `reviews`, assigning it to variable `first_description`.",
"_____no_output_____"
]
],
[
[
"first_description = reviews.description[0]\n\n# Check your answer\nq2.check()\nfirst_description",
"_____no_output_____"
],
[
"#q2.hint()\n#q2.solution()",
"_____no_output_____"
]
],
[
[
"## 3. \n\nSelect the first row of data (the first record) from `reviews`, assigning it to the variable `first_row`.",
"_____no_output_____"
]
],
[
[
"first_row = reviews.iloc[0]\n\n# Check your answer\nq3.check()\nfirst_row",
"_____no_output_____"
],
[
"#q3.hint()\n#q3.solution()",
"_____no_output_____"
]
],
[
[
"## 4.\n\nSelect the first 10 values from the `description` column in `reviews`, assigning the result to variable `first_descriptions`.\n\nHint: format your output as a pandas Series.",
"_____no_output_____"
]
],
[
[
"first_descriptions = reviews.loc[:9, 'description']\n\n# Check your answer\nq4.check()\nfirst_descriptions",
"_____no_output_____"
],
[
"#q4.hint()\n#q4.solution()",
"_____no_output_____"
]
],
[
[
"## 5.\n\nSelect the records with index labels `1`, `2`, `3`, `5`, and `8`, assigning the result to the variable `sample_reviews`.\n\nIn other words, generate the following DataFrame:\n\n",
"_____no_output_____"
]
],
[
[
"sample_reviews = reviews.loc[[1, 2, 3, 5, 8]]\n\n# Check your answer\nq5.check()\nsample_reviews",
"_____no_output_____"
],
[
"q5.hint()\n#q5.solution()",
"_____no_output_____"
]
],
[
[
"## 6.\n\nCreate a variable `df` containing the `country`, `province`, `region_1`, and `region_2` columns of the records with the index labels `0`, `1`, `10`, and `100`. In other words, generate the following DataFrame:\n\n",
"_____no_output_____"
]
],
[
[
"df = reviews.loc[[0, 1, 10, 100], ['country', 'province', 'region_1', 'region_2']]\n\n# Check your answer\nq6.check()\ndf",
"_____no_output_____"
],
[
"#q6.hint()\n#q6.solution()",
"_____no_output_____"
]
],
[
[
"## 7.\n\nCreate a variable `df` containing the `country` and `variety` columns of the first 100 records. \n\nHint: you may use `loc` or `iloc`. When working on the answer this question and the several of the ones that follow, keep the following \"gotcha\" described in the tutorial:\n\n> `iloc` uses the Python stdlib indexing scheme, where the first element of the range is included and the last one excluded. \n`loc`, meanwhile, indexes inclusively. \n\n> This is particularly confusing when the DataFrame index is a simple numerical list, e.g. `0,...,1000`. In this case `df.iloc[0:1000]` will return 1000 entries, while `df.loc[0:1000]` return 1001 of them! To get 1000 elements using `loc`, you will need to go one lower and ask for `df.iloc[0:999]`. ",
"_____no_output_____"
]
],
[
[
"df = reviews.loc[0:99, ['country', 'variety']]\n\n# Check your answer\nq7.check()\ndf",
"_____no_output_____"
],
[
"#q7.hint()\n#q7.solution()",
"_____no_output_____"
]
],
[
[
"## 8.\n\nCreate a DataFrame `italian_wines` containing reviews of wines made in `Italy`. Hint: `reviews.country` equals what?",
"_____no_output_____"
]
],
[
[
"italian_wines = reviews.loc[reviews.country == \"Italy\"]\n\n# Check your answer\nq8.check()\nitalian_wines",
"_____no_output_____"
],
[
"#q8.hint()\n#q8.solution()",
"_____no_output_____"
]
],
[
[
"## 9.\n\nCreate a DataFrame `top_oceania_wines` containing all reviews with at least 95 points (out of 100) for wines from Australia or New Zealand.",
"_____no_output_____"
]
],
[
[
"top_oceania_wines = reviews.loc[(reviews.country.isin([\"Australia\", \"New Zealand\"])) & (reviews.points >= 95)]\n\n# Check your answer\nq9.check()\ntop_oceania_wines",
"_____no_output_____"
],
[
"q9.hint()\n#q9.solution()",
"_____no_output_____"
]
],
[
[
"# Keep going\n\nMove on to learn about **[summary functions and maps](https://www.kaggle.com/residentmario/summary-functions-and-maps)**.",
"_____no_output_____"
],
[
"---\n**[Pandas Home Page](https://www.kaggle.com/learn/pandas)**\n\n\n\n\n\n*Have questions or comments? Visit the [Learn Discussion forum](https://www.kaggle.com/learn-forum/161299) to chat with other Learners.*",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
]
] |
d0cd3ed65771374f3a18db95cffd1aaf99d85693 | 215,470 | ipynb | Jupyter Notebook | example/recommenders/demo2-dssm.ipynb | wangyouze/incubator-mxnet | e9829e71a7f536d0fc78a0faf96f31336987770e | [
"Apache-2.0"
] | 228 | 2018-12-06T09:34:01.000Z | 2022-03-08T17:02:02.000Z | example/recommenders/demo2-dssm.ipynb | wangyouze/incubator-mxnet | e9829e71a7f536d0fc78a0faf96f31336987770e | [
"Apache-2.0"
] | 82 | 2016-03-29T02:40:02.000Z | 2021-02-06T22:20:40.000Z | example/recommenders/demo2-dssm.ipynb | wangyouze/incubator-mxnet | e9829e71a7f536d0fc78a0faf96f31336987770e | [
"Apache-2.0"
] | 58 | 2016-10-27T07:37:08.000Z | 2021-07-03T16:50:17.000Z | 97.453641 | 501 | 0.629735 | [
[
[
"# Content-based recommender using Deep Structured Semantic Model\n\nAn example of how to build a Deep Structured Semantic Model (DSSM) for incorporating complex content-based features into a recommender system. See [Learning Deep Structured Semantic Models for Web Search using Clickthrough Data](https://www.microsoft.com/en-us/research/publication/learning-deep-structured-semantic-models-for-web-search-using-clickthrough-data/). This example does not attempt to provide a datasource or train a model, but merely show how to structure a complex DSSM network.",
"_____no_output_____"
]
],
[
[
"import warnings\n\nimport mxnet as mx\nfrom mxnet import gluon, nd, autograd, sym\nimport numpy as np\nfrom sklearn.random_projection import johnson_lindenstrauss_min_dim\n",
"_____no_output_____"
],
[
"# Define some constants\nmax_user = int(1e5)\ntitle_vocab_size = int(3e4)\nquery_vocab_size = int(3e4)\nnum_samples = int(1e4)\nhidden_units = 128\nepsilon_proj = 0.25\n\nctx = mx.gpu() if mx.context.num_gpus() > 0 else mx.cpu()",
"_____no_output_____"
]
],
[
[
"## Bag of words random projection",
"_____no_output_____"
],
[
"A previous version of this example contained a bag of word random projection example, it is kept here for reference but not used in the next example.\nRandom Projection is a dimension reduction technique that guarantees the disruption of the pair-wise distance between your original data point within a certain bound.\nWhat is even more interesting is that the dimension to project onto to guarantee that bound does not depend on the original number of dimension but solely on the total number of datapoints.\nYou can see more explanation [in this blog post](http://jasonpunyon.com/blog/2017/12/02/fun-with-random-numbers-random-projection/)",
"_____no_output_____"
]
],
[
[
"proj_dim = johnson_lindenstrauss_min_dim(num_samples, epsilon_proj)\nprint(\"To keep a distance disruption ~< {}% of our {} samples we need to randomly project to at least {} dimensions\".format(epsilon_proj*100, num_samples, proj_dim))",
"To keep a distance disruption ~< 25.0% of our 10000 samples we need to randomly project to at least 1414 dimensions\n"
],
[
"class BagOfWordsRandomProjection(gluon.HybridBlock):\n def __init__(self, vocab_size, output_dim, random_seed=54321, pad_index=0):\n \"\"\"\n :param int vocab_size: number of element in the vocabulary\n :param int output_dim: projection dimension\n :param int ramdon_seed: seed to use to guarantee same projection\n :param int pad_index: index of the vocabulary used for padding sentences\n \"\"\"\n super(BagOfWordsRandomProjection, self).__init__()\n self._vocab_size = vocab_size\n self._output_dim = output_dim\n proj = self._random_unit_vecs(vocab_size=vocab_size, output_dim=output_dim, random_seed=random_seed)\n # we set the projection of the padding word to 0\n proj[pad_index, :] = 0\n self.proj = self.params.get_constant('proj', value=proj)\n\n def _random_unit_vecs(self, vocab_size, output_dim, random_seed):\n rs = np.random.RandomState(seed=random_seed)\n W = rs.normal(size=(vocab_size, output_dim))\n Wlen = np.linalg.norm(W, axis=1)\n W_unit = W / Wlen[:,None]\n return W_unit\n\n def hybrid_forward(self, F, x, proj):\n \"\"\"\n :param nd or sym F:\n :param nd.NDArray x: index of tokens\n returns the sum of the projected embeddings of each token\n \"\"\"\n embedded = F.Embedding(x, proj, input_dim=self._vocab_size, output_dim=self._output_dim)\n return embedded.sum(axis=1)",
"_____no_output_____"
],
[
"bowrp = BagOfWordsRandomProjection(1000, 20)\nbowrp.initialize()",
"_____no_output_____"
],
[
"bowrp(mx.nd.array([[10, 50, 100], [5, 10, 0]]))",
"_____no_output_____"
]
],
[
[
"With padding:",
"_____no_output_____"
]
],
[
[
"bowrp(mx.nd.array([[10, 50, 100, 0], [5, 10, 0, 0]]))",
"_____no_output_____"
]
],
[
[
"# Content-based recommender / ranking system using DSSM",
"_____no_output_____"
],
[
"For example in the search result ranking problem:\nYou have users, that have performed text-based searches. They were presented with results, and selected one of them.\nResults are composed of a title and an image.\n\nYour positive examples will be the clicked items in the search results, and the negative examples are sampled from the non-clicked examples.\n\nThe network will jointly learn embeddings for users and query text making up the \"Query\", title and image making the \"Item\" and learn how similar they are.\n\nAfter training, you can index the embeddings for your items and do a knn search with your query embeddings using the cosine similarity to return ranked items",
"_____no_output_____"
]
],
[
[
"proj_dim = 128",
"_____no_output_____"
],
[
"class DSSMRecommenderNetwork(gluon.HybridBlock):\n def __init__(self, query_vocab_size, proj_dim, max_user, title_vocab_size, hidden_units, random_seed=54321, p=0.5):\n super(DSSMRecommenderNetwork, self).__init__()\n with self.name_scope():\n \n # User/Query pipeline\n self.user_embedding = gluon.nn.Embedding(max_user, proj_dim)\n self.user_mlp = gluon.nn.Dense(hidden_units, activation=\"relu\")\n \n # Instead of bag of words, we use learned embeddings + stacked biLSTM average\n self.query_text_embedding = gluon.nn.Embedding(query_vocab_size, proj_dim)\n self.query_lstm = gluon.rnn.LSTM(hidden_units, 2, bidirectional=True)\n self.query_text_mlp = gluon.nn.Dense(hidden_units, activation=\"relu\") \n \n self.query_dropout = gluon.nn.Dropout(p)\n self.query_mlp = gluon.nn.Dense(hidden_units, activation=\"relu\")\n\n # Item pipeline\n # Instead of bag of words, we use learned embeddings + stacked biLSTM average\n self.title_embedding = gluon.nn.Embedding(title_vocab_size, proj_dim)\n self.title_lstm = gluon.rnn.LSTM(hidden_units, 2, bidirectional=True)\n self.title_mlp = gluon.nn.Dense(hidden_units, activation=\"relu\")\n \n # You could use vgg here for example\n self.image_embedding = gluon.model_zoo.vision.resnet18_v2(pretrained=False).features \n self.image_mlp = gluon.nn.Dense(hidden_units, activation=\"relu\")\n \n self.item_dropout = gluon.nn.Dropout(p)\n self.item_mlp = gluon.nn.Dense(hidden_units, activation=\"relu\")\n \n def hybrid_forward(self, F, user, query_text, title, image):\n # Query\n user = self.user_embedding(user)\n user = self.user_mlp(user)\n\n query_text = self.query_text_embedding(query_text)\n query_text = self.query_lstm(query_text.transpose((1,0,2)))\n # average the states\n query_text = query_text.mean(axis=0)\n query_text = self.query_text_mlp(query_text)\n \n query = F.concat(user, query_text)\n query = self.query_dropout(query)\n query = self.query_mlp(query)\n \n # Item\n title_text = self.title_embedding(title)\n title_text = self.title_lstm(title_text.transpose((1,0,2)))\n # average the states\n title_text = title_text.mean(axis=0)\n title_text = self.title_mlp(title_text)\n \n image = self.image_embedding(image)\n image = self.image_mlp(image)\n \n item = F.concat(title_text, image)\n item = self.item_dropout(item)\n item = self.item_mlp(item)\n \n # Cosine Similarity\n query = query.expand_dims(axis=2)\n item = item.expand_dims(axis=2)\n sim = F.batch_dot(query, item, transpose_a=True) / (query.norm(axis=1) * item.norm(axis=1) + 1e-9).expand_dims(axis=2)\n \n return sim.squeeze(axis=2)",
"_____no_output_____"
],
[
"network = DSSMRecommenderNetwork(\n query_vocab_size,\n proj_dim,\n max_user,\n title_vocab_size,\n hidden_units\n)\n\n\nnetwork.initialize(mx.init.Xavier(), ctx)\n\n# Load pre-trained vgg16 weights\nwith network.name_scope():\n network.image_embedding = gluon.model_zoo.vision.resnet18_v2(pretrained=True, ctx=ctx).features",
"_____no_output_____"
]
],
[
[
"It is quite hard to visualize the network since it is relatively complex but you can see the two-pronged structure, and the resnet18 branch",
"_____no_output_____"
]
],
[
[
"mx.viz.plot_network(network(\n mx.sym.var('user'), mx.sym.var('query_text'), mx.sym.var('title'), mx.sym.var('image')),\n shape={'user': (1,1), 'query_text': (1,30), 'title': (1,30), 'image': (1,3,224,224)},\n node_attrs={\"fixedsize\":\"False\"})",
"_____no_output_____"
]
],
[
[
"We can print the summary of the network using dummy data. We can see it is already training on 32M parameters!",
"_____no_output_____"
]
],
[
[
"user = mx.nd.array([[200], [100]], ctx)\nquery = mx.nd.array([[10, 20, 0, 0, 0], [40, 50, 0, 0, 0]], ctx) # Example of an encoded text\ntitle = mx.nd.array([[10, 20, 0, 0, 0], [40, 50, 0, 0, 0]], ctx) # Example of an encoded text\nimage = mx.nd.random.uniform(shape=(2,3, 224,224), ctx=ctx) # Example of an encoded image\n\n\nnetwork.summary(user, query, title, image)",
"--------------------------------------------------------------------------------\n Layer (type) Output Shape Param #\n================================================================================\n Input (2, 1), (2, 5), (2, 5), (2, 3, 224, 224) 0\n Embedding-1 (2, 1, 128) 12800000\n Activation-2 <Symbol dssmrecommendernetwork0_dense0_relu_fwd> 0\n Activation-3 (2, 128) 0\n Dense-4 (2, 128) 16512\n Embedding-5 (2, 5, 128) 3840000\n LSTM-6 (5, 2, 256) 659456\n Activation-7 <Symbol dssmrecommendernetwork0_dense1_relu_fwd> 0\n Activation-8 (2, 128) 0\n Dense-9 (2, 128) 32896\n Dropout-10 (2, 256) 0\n Activation-11 <Symbol dssmrecommendernetwork0_dense2_relu_fwd> 0\n Activation-12 (2, 128) 0\n Dense-13 (2, 128) 32896\n Embedding-14 (2, 5, 128) 3840000\n LSTM-15 (5, 2, 256) 659456\n Activation-16 <Symbol dssmrecommendernetwork0_dense3_relu_fwd> 0\n Activation-17 (2, 128) 0\n Dense-18 (2, 128) 32896\n BatchNorm-19 (2, 3, 224, 224) 12\n Conv2D-20 (2, 64, 112, 112) 9408\n BatchNorm-21 (2, 64, 112, 112) 256\n Activation-22 (2, 64, 112, 112) 0\n MaxPool2D-23 (2, 64, 56, 56) 0\n BatchNorm-24 (2, 64, 56, 56) 256\n Conv2D-25 (2, 64, 56, 56) 36864\n BatchNorm-26 (2, 64, 56, 56) 256\n Conv2D-27 (2, 64, 56, 56) 36864\n BasicBlockV2-28 (2, 64, 56, 56) 0\n BatchNorm-29 (2, 64, 56, 56) 256\n Conv2D-30 (2, 64, 56, 56) 36864\n BatchNorm-31 (2, 64, 56, 56) 256\n Conv2D-32 (2, 64, 56, 56) 36864\n BasicBlockV2-33 (2, 64, 56, 56) 0\n BatchNorm-34 (2, 64, 56, 56) 256\n Conv2D-35 (2, 128, 28, 28) 8192\n Conv2D-36 (2, 128, 28, 28) 73728\n BatchNorm-37 (2, 128, 28, 28) 512\n Conv2D-38 (2, 128, 28, 28) 147456\n BasicBlockV2-39 (2, 128, 28, 28) 0\n BatchNorm-40 (2, 128, 28, 28) 512\n Conv2D-41 (2, 128, 28, 28) 147456\n BatchNorm-42 (2, 128, 28, 28) 512\n Conv2D-43 (2, 128, 28, 28) 147456\n BasicBlockV2-44 (2, 128, 28, 28) 0\n BatchNorm-45 (2, 128, 28, 28) 512\n Conv2D-46 (2, 256, 14, 14) 32768\n Conv2D-47 (2, 256, 14, 14) 294912\n BatchNorm-48 (2, 256, 14, 14) 1024\n Conv2D-49 (2, 256, 14, 14) 589824\n BasicBlockV2-50 (2, 256, 14, 14) 0\n BatchNorm-51 (2, 256, 14, 14) 1024\n Conv2D-52 (2, 256, 14, 14) 589824\n BatchNorm-53 (2, 256, 14, 14) 1024\n Conv2D-54 (2, 256, 14, 14) 589824\n BasicBlockV2-55 (2, 256, 14, 14) 0\n BatchNorm-56 (2, 256, 14, 14) 1024\n Conv2D-57 (2, 512, 7, 7) 131072\n Conv2D-58 (2, 512, 7, 7) 1179648\n BatchNorm-59 (2, 512, 7, 7) 2048\n Conv2D-60 (2, 512, 7, 7) 2359296\n BasicBlockV2-61 (2, 512, 7, 7) 0\n BatchNorm-62 (2, 512, 7, 7) 2048\n Conv2D-63 (2, 512, 7, 7) 2359296\n BatchNorm-64 (2, 512, 7, 7) 2048\n Conv2D-65 (2, 512, 7, 7) 2359296\n BasicBlockV2-66 (2, 512, 7, 7) 0\n BatchNorm-67 (2, 512, 7, 7) 2048\n Activation-68 (2, 512, 7, 7) 0\n GlobalAvgPool2D-69 (2, 512, 1, 1) 0\n Flatten-70 (2, 512) 0\n Activation-71 <Symbol dssmrecommendernetwork0_dense4_relu_fwd> 0\n Activation-72 (2, 128) 0\n Dense-73 (2, 128) 65664\n Dropout-74 (2, 256) 0\n Activation-75 <Symbol dssmrecommendernetwork0_dense5_relu_fwd> 0\n Activation-76 (2, 128) 0\n Dense-77 (2, 128) 32896\nDSSMRecommenderNetwork-78 (2, 1) 0\n================================================================================\nParameters in forward computation graph, duplicate included\n Total params: 33195468\n Trainable params: 33187520\n Non-trainable params: 7948\nShared params in forward computation graph: 0\nUnique parameters in model: 33195468\n--------------------------------------------------------------------------------\n"
],
[
"network(user, query, title, image)",
"_____no_output_____"
]
],
[
[
"The output is the similarity, if we wanted to train it on real data, we would need to minimize the Cosine loss, 1 - cosine_similarity.",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0cd4468667a5d8451c2b0846654006dfd8b696e | 54,770 | ipynb | Jupyter Notebook | logistic_regression/consistent_vs_inconsistent/plots_wide.ipynb | michaelaerni/interpolation_robustness | be18c37a55b6ae1669391fe21e4aba3584fc9882 | [
"MIT"
] | 1 | 2022-02-16T19:24:36.000Z | 2022-02-16T19:24:36.000Z | logistic_regression/consistent_vs_inconsistent/plots_wide.ipynb | michaelaerni/interpolation_robustness | be18c37a55b6ae1669391fe21e4aba3584fc9882 | [
"MIT"
] | null | null | null | logistic_regression/consistent_vs_inconsistent/plots_wide.ipynb | michaelaerni/interpolation_robustness | be18c37a55b6ae1669391fe21e4aba3584fc9882 | [
"MIT"
] | null | null | null | 160.615836 | 44,548 | 0.892496 | [
[
[
"# Plots for logistic regression, consistent vs inconsistent noiseless AT, increasing epsilon",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport matplotlib.pyplot as plt\nimport matplotlib.patches\nimport dotenv\nimport pandas as pd\nimport mlflow\nimport plotly\nimport plotly.graph_objects as go\nimport plotly.express as px\nimport plotly.subplots\nimport plotly.io as pio\n\nimport typing\nimport os\nimport shutil\nimport sys\nimport warnings",
"_____no_output_____"
],
[
"EXPORT = False\nSHOW_TITLES = not EXPORT\nEXPORT_DIR_NAME = 'eps_increase_separate_legend'\nEXPERIMENT_NAME = 'logistic_regression_inconsistent_consistent_increase_epsilon'",
"_____no_output_____"
],
[
"# Load environment variables\ndotenv.load_dotenv()\n\n# Enable loading of the project module\nMODULE_DIR = os.path.join(os.path.abspath(os.path.join(os.path.curdir, os.path.pardir, os.pardir)), 'src')\nsys.path.append(MODULE_DIR)",
"_____no_output_____"
],
[
"%load_ext autoreload\n%autoreload 2\nimport interpolation_robustness as ir",
"_____no_output_____"
],
[
"FIGURE_SIZE = (2.75, 1.4)\nLEGEND_FIGURE_SIZE = (2.75, 0.7)\nLEGEND_FONT_SIZE = ir.plots.FONT_SIZE_SMALL_PT\n\nir.plots.setup_matplotlib(show_titles=SHOW_TITLES)",
"_____no_output_____"
],
[
"if EXPORT:\n EXPORT_DIR = os.path.join(ir.util.REPO_ROOT_DIR, 'logs', f'export_{EXPORT_DIR_NAME}')\n print('Using export directory', EXPORT_DIR)\n if os.path.exists(EXPORT_DIR):\n shutil.rmtree(EXPORT_DIR)\n os.makedirs(EXPORT_DIR)\n\ndef export_fig(fig: plt.Figure, filename: str):\n # If export is disabled then do nothing\n if EXPORT:\n export_path = os.path.join(EXPORT_DIR, filename)\n fig.savefig(export_path)\n print('Exported figure at', export_path)\n",
"_____no_output_____"
]
],
[
[
"## Load experiment data",
"_____no_output_____"
]
],
[
[
"client = mlflow.tracking.MlflowClient()\nexperiment = client.get_experiment_by_name(EXPERIMENT_NAME)\nruns = mlflow.search_runs(\n experiment.experiment_id\n)\nruns = runs.set_index('run_id', drop=False) # set index, but keep column to not break stuff depending on it\n\n# Convert some parameters to numbers and sort accordingly\nruns['params.data_dim'] = runs['params.data_dim'].astype(int)\nruns['params.data_num_train_samples'] = runs['params.data_num_train_samples'].astype(int)\nruns['params.train_attack_epsilon'] = runs['params.train_attack_epsilon'].astype(np.float)\nruns['params.test_attack_epsilon'] = runs['params.test_attack_epsilon'].astype(np.float)\nruns['params.l2_lambda'] = runs['params.l2_lambda'].astype(np.float)\nruns['params.label_noise'] = runs['params.label_noise'].astype(np.float)\nruns['metrics.train_robust_risk'] = 1.0 - runs['metrics.train_robust_accuracy']\nassert runs['params.l2_lambda'].eq(0).all()\nruns['metrics.train_robust_log_loss'] = runs['metrics.training_loss']\nruns = runs.sort_values(['params.label_noise'], ascending=True)\nprint('Loaded', len(runs), 'runs')\nassert runs['status'].eq('FINISHED').all()\nassert runs['params.label_noise'].eq(0).all()",
"Loaded 140 runs\n"
],
[
"grouping_keys = ['params.data_dim', 'params.l2_lambda', 'params.train_consistent_attacks', 'params.train_attack_epsilon', 'params.data_num_train_samples']\naggregate_metrics = ('metrics.true_robust_risk', 'metrics.train_robust_log_loss')\nruns_agg = runs.groupby(grouping_keys, as_index=False).aggregate({metric: ['mean', 'std'] for metric in aggregate_metrics})",
"_____no_output_____"
]
],
[
[
"## Plots",
"_____no_output_____"
]
],
[
[
"robust_consistent_color_idx = 1\nrobust_inconsistent_color_idx = 2\npopulation_linestyle = ir.plots.LINESTYLE_MAP[0]\ntraining_linestyle = ir.plots.LINESTYLE_MAP[2]\n\nBASELINE_LAMBDA = 0",
"_____no_output_____"
],
[
"warnings.simplefilter(action='ignore', category=pd.errors.PerformanceWarning)",
"_____no_output_____"
],
[
"fig, ax = plt.subplots(figsize=FIGURE_SIZE)\n\ntarget_num_samples = 1000\n\ncurrent_runs = runs_agg[runs_agg['params.data_num_train_samples'] == target_num_samples]\nassert current_runs['params.l2_lambda'].eq(0).all()\n\ndata_dim, = current_runs['params.data_dim'].unique()\n\ncurrent_consistent_runs = current_runs[current_runs['params.train_consistent_attacks'] == 'True']\ncurrent_inconsistent_runs = current_runs[current_runs['params.train_consistent_attacks'] == 'False']\n\nax.errorbar(\n current_consistent_runs['params.train_attack_epsilon'],\n current_consistent_runs[('metrics.true_robust_risk', 'mean')],\n yerr=current_consistent_runs[('metrics.true_robust_risk', 'std')],\n label=fr'Robust risk, cons.',\n c=f'C{robust_consistent_color_idx}',\n ls=population_linestyle,\n zorder=2\n)\nax.errorbar(\n current_inconsistent_runs['params.train_attack_epsilon'],\n current_inconsistent_runs[('metrics.true_robust_risk', 'mean')],\n yerr=current_inconsistent_runs[('metrics.true_robust_risk', 'std')],\n label=fr'Robust risk, incons.',\n c=f'C{robust_inconsistent_color_idx}',\n ls=population_linestyle,\n zorder=2\n)\nax.errorbar(\n current_consistent_runs['params.train_attack_epsilon'],\n current_consistent_runs[('metrics.train_robust_log_loss', 'mean')],\n yerr=current_consistent_runs[('metrics.train_robust_log_loss', 'std')],\n label=fr'Training loss, cons.',\n c=f'C{robust_consistent_color_idx}',\n ls=training_linestyle,\n zorder=2\n)\nax.errorbar(\n current_inconsistent_runs['params.train_attack_epsilon'],\n current_inconsistent_runs[('metrics.train_robust_log_loss', 'mean')],\n yerr=current_inconsistent_runs[('metrics.train_robust_log_loss', 'std')],\n label=fr'Training loss, incons.',\n c=f'C{robust_inconsistent_color_idx}',\n ls=training_linestyle,\n zorder=2\n)\n\nax.set_xlabel('Train and test $\\epsilon$')\nax.set_ylim(bottom=-0.005)\nax.set_xlim(left=-0.001)\n\nif SHOW_TITLES:\n fig.suptitle(f'Consistent vs inconsistent AT, fixed d {data_dim} and n {target_num_samples}')\n\nexport_fig(fig, f'eps_increase.pdf')\n\nplt.show()\n",
"_____no_output_____"
],
[
"# Legend\nlegend_fig = plt.figure(figsize=LEGEND_FIGURE_SIZE)\n\nhandles, labels = ax.get_legend_handles_labels()\nir.plots.errorbar_legend(\n legend_fig,\n handles,\n labels,\n loc='center',\n ncol=2,\n mode='expand',\n frameon=True,\n fontsize=LEGEND_FONT_SIZE,\n borderpad=0.7\n)\n\nexport_fig(legend_fig, f'eps_increase_legend.pdf')",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
]
] |
d0cd522e61317cae80db6d775f8ea941a6ddc60e | 76,333 | ipynb | Jupyter Notebook | 011-RNN-LSTM-Toxic.ipynb | SaketJNU/deep-learning | 292f4dcfd57042e7aada4a626d3ec1f820d496b1 | [
"MIT"
] | 57 | 2017-06-02T04:30:45.000Z | 2022-03-22T05:45:54.000Z | 011-RNN-LSTM-Toxic.ipynb | rohanchikorde/deep-learning-1 | 292f4dcfd57042e7aada4a626d3ec1f820d496b1 | [
"MIT"
] | null | null | null | 011-RNN-LSTM-Toxic.ipynb | rohanchikorde/deep-learning-1 | 292f4dcfd57042e7aada4a626d3ec1f820d496b1 | [
"MIT"
] | 29 | 2018-03-10T09:24:18.000Z | 2021-08-16T16:56:34.000Z | 87.840046 | 48,662 | 0.821938 | [
[
[
"# RNN - LSTM - Toxic Comments\n\nA corpus of manually labeled comments - classifying each comment by its type of toxicity is available on Kaggle. We will aim to do a binary classification of whether a comment is toxic or not.\n\nApproach:\n- Learning Embedding with the Task\n- LSTM\n- BiLSTM",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport pandas as pd\nimport keras\nimport matplotlib.pyplot as plt\n%matplotlib inline\nimport vis",
"Using TensorFlow backend.\n"
]
],
[
[
"### Get the Data",
"_____no_output_____"
],
[
"Uncomment these shell lines to get the data",
"_____no_output_____"
]
],
[
[
"# !wget http://bit.do/deep_toxic_train -P data/\n# !mv data/deep_toxic_train data/train.zip",
"_____no_output_____"
],
[
"df = pd.read_csv(\"data/train.zip\")",
"_____no_output_____"
],
[
"df.head()",
"_____no_output_____"
]
],
[
[
"### Import the required libraries",
"_____no_output_____"
]
],
[
[
"from keras.preprocessing.text import Tokenizer\nfrom keras.preprocessing.sequence import pad_sequences",
"_____no_output_____"
]
],
[
[
"### Create the Input & Output Data",
"_____no_output_____"
]
],
[
[
"train_sentences = df[\"comment_text\"]\ntrain_sentences.head()",
"_____no_output_____"
]
],
[
[
"**Pre-processing the train data**\n- Tokenization: \"This is an apple\" -> [\"This\", \"is\", \"an\", \"apple\"]\n- Indexing: {0: \"This\", 1: \"is\", 2: \"an\", 3: \"apple\"}\n- Index Representation: [0, 1, 2, 3]",
"_____no_output_____"
]
],
[
[
"from keras.preprocessing.text import Tokenizer\nfrom keras.preprocessing.sequence import pad_sequences",
"_____no_output_____"
],
[
"# Tokenizer\nmax_words = 20000\ntokenizer = Tokenizer(num_words=max_words, oov_token='UNK')\ntokenizer.fit_on_texts(list(train_sentences))",
"_____no_output_____"
]
],
[
[
"Tokenizer Fix from https://github.com/keras-team/keras/issues/8092",
"_____no_output_____"
]
],
[
[
"tokenizer.word_index = {e:i for e,i in tokenizer.word_index.items() if i <= max_words} # <= because tokenizer is 1 indexed\ntokenizer.word_index[tokenizer.oov_token] = max_words + 1",
"_____no_output_____"
],
[
"# Index Representation\ntokenized_train = tokenizer.texts_to_sequences(train_sentences)",
"_____no_output_____"
],
[
"# Selecting Padding\n# find length of each sentence and plot the length\nnumber_of_words = [len(comment) for comment in tokenized_train]\nplt.hist(number_of_words, bins = np.arange(0, 500, 10));",
"_____no_output_____"
],
[
"# Padding to make it uniform\nmaxlen = 200\nX = pad_sequences(tokenized_train, maxlen = maxlen)",
"_____no_output_____"
],
[
"labels = df.iloc[:,2].values",
"_____no_output_____"
],
[
"# Baseline Benchmark \n1 - df.iloc[:,2].sum()/df.iloc[:,2].count()",
"_____no_output_____"
],
[
"from keras.utils import to_categorical\ny = to_categorical(labels)",
"_____no_output_____"
],
[
"from sklearn.model_selection import train_test_split",
"_____no_output_____"
],
[
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\nX_train.shape, X_test.shape, y_train.shape, y_test.shape",
"_____no_output_____"
]
],
[
[
"### Step 2: Create the Model Architecture",
"_____no_output_____"
]
],
[
[
"from keras.models import Sequential\nfrom keras.layers import Dense, LSTM, Embedding, Dropout, Bidirectional",
"_____no_output_____"
],
[
"model = Sequential()\nmodel.add(Embedding(max_words, output_dim=128, mask_zero=True))\nmodel.add(LSTM(60))\nmodel.add(Dropout(0.1))\nmodel.add(Dense(2, activation='sigmoid'))",
"_____no_output_____"
]
],
[
[
"### Step 3: Compile the Model & Fit on the Data",
"_____no_output_____"
]
],
[
[
"model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy'])",
"_____no_output_____"
],
[
"output = model.fit(X_train, y_train, batch_size=128, epochs=5, validation_split=0.2)",
"Train on 102124 samples, validate on 25532 samples\nEpoch 1/5\n102124/102124 [==============================] - 398s 4ms/step - loss: 0.1625 - acc: 0.9454 - val_loss: 0.1185 - val_acc: 0.9601\nEpoch 2/5\n102124/102124 [==============================] - 352s 3ms/step - loss: 0.1096 - acc: 0.9618 - val_loss: 0.1050 - val_acc: 0.9629\nEpoch 3/5\n102124/102124 [==============================] - 436s 4ms/step - loss: 0.1006 - acc: 0.9642 - val_loss: 0.1022 - val_acc: 0.9642\nEpoch 4/5\n102124/102124 [==============================] - 333s 3ms/step - loss: 0.0954 - acc: 0.9654 - val_loss: 0.1071 - val_acc: 0.9635\nEpoch 5/5\n102124/102124 [==============================] - 329s 3ms/step - loss: 0.0923 - acc: 0.9665 - val_loss: 0.1026 - val_acc: 0.9640\n"
]
],
[
[
"### Step 4: Evaluate the Model",
"_____no_output_____"
]
],
[
[
"vis.metrics(output.history)",
"_____no_output_____"
],
[
"score = model.evaluate(X_test, y_test, verbose=1)",
"31915/31915 [==============================] - 98s 3ms/step\n"
],
[
"print('Test loss:', score[0])\nprint('Test accuracy:', score[1])",
"Test loss: 0.10434365738769805\nTest accuracy: 0.9634654551151496\n"
]
],
[
[
"### Step 5: Visualise evaluation & Make a prediction",
"_____no_output_____"
]
],
[
[
"predict_classes = model.predict_classes(X_test)",
"_____no_output_____"
],
[
"actual_classes = np.dot(y_test,np.array([[0],[1]])).reshape(-1)",
"_____no_output_____"
],
[
"pd.crosstab(actual_classes, predict_classes)",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
]
] |
d0cd583a7a019fec8cc611c5b4baed4d96a2da55 | 753,116 | ipynb | Jupyter Notebook | Notebook/YOLO_Mask_Adaptivity.ipynb | arpan65/Mask-Adaptivity-Detection-Computer-Vision- | efbf589b255a6b30500645eaa8a1c042b73f7950 | [
"MIT"
] | 6 | 2020-05-31T13:46:22.000Z | 2020-07-14T20:48:35.000Z | Notebook/YOLO_Mask_Adaptivity.ipynb | arpan65/Mask-Adaptivity-Detection-Computer-Vision- | efbf589b255a6b30500645eaa8a1c042b73f7950 | [
"MIT"
] | 1 | 2020-07-24T19:06:08.000Z | 2020-07-25T02:05:41.000Z | Notebook/YOLO_Mask_Adaptivity.ipynb | arpan65/Mask-Adaptivity-Detection-Computer-Vision- | efbf589b255a6b30500645eaa8a1c042b73f7950 | [
"MIT"
] | 3 | 2020-06-01T04:21:33.000Z | 2022-01-20T12:01:56.000Z | 290.778378 | 423,934 | 0.813491 | [
[
[
"## Mask Adaptivity Detection Using YOLO\n\nMask became an essential accessory post COVID-19. Most of the countries are making face masks mandatory to avail services like transport, fuel and any sort of outside activity. It is become utmost necessary to keep track of the adaptivity of the crowd. This notebook contains implementation of a face mask adaptivity tracker using YOLO.\n\n",
"_____no_output_____"
]
],
[
[
"import warnings\nimport numpy as np\nimport argparse\nimport time\nimport cv2\nimport os\nwarnings.filterwarnings(\"ignore\")",
"_____no_output_____"
]
],
[
[
"### Prepare DarkNet Environment",
"_____no_output_____"
]
],
[
[
"# Create DarkNet Environment\ndef prepare_environment():\n os.environ['PATH'] += ':/usr/local/cuda/bin'\n !rm -fr darknet\n !git clone https://github.com/AlexeyAB/darknet/\n !apt install gcc-5 g++-5 -y\n !ln -s /usr/bin/gcc-5 /usr/local/cuda/bin/gcc \n !ln -s /usr/bin/g++-5 /usr/local/cuda/bin/g++\n %cd darknet\n !sed -i 's/GPU=0/GPU=1/g' Makefile\n !sed -i 's/OPENCV=0/OPENCV=1/g' Makefile\n !make\n # get yolov3 weights\n #!wget https://pjreddie.com/media/files/darknet53.conv.74.weights\n !chmod a+x ./darknet\n !apt install ffmpeg libopencv-dev libgtk-3-dev python-numpy python3-numpy libdc1394-22 libdc1394-22-dev libjpeg-dev libtiff5-dev libavcodec-dev libavformat-dev libswscale-dev libxine2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libv4l-dev libtbb-dev qtbase5-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils unzip\n status='Completed'\n return status\nprepare_environment() ",
"Cloning into 'darknet'...\nremote: Enumerating objects: 5, done.\u001b[K\nremote: Counting objects: 100% (5/5), done.\u001b[K\nremote: Compressing objects: 100% (5/5), done.\u001b[K\nremote: Total 13572 (delta 0), reused 2 (delta 0), pack-reused 13567\u001b[K\nReceiving objects: 100% (13572/13572), 12.20 MiB | 11.79 MiB/s, done.\nResolving deltas: 100% (9254/9254), done.\nReading package lists... Done\nBuilding dependency tree \nReading state information... Done\nThe following additional packages will be installed:\n cpp-5 gcc-5-base libasan2 libgcc-5-dev libisl15 libmpx0 libstdc++-5-dev\nSuggested packages:\n gcc-5-locales g++-5-multilib gcc-5-doc libstdc++6-5-dbg gcc-5-multilib\n libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan2-dbg\n liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg libmpx0-dbg\n libquadmath0-dbg libstdc++-5-doc\nThe following NEW packages will be installed:\n cpp-5 g++-5 gcc-5 gcc-5-base libasan2 libgcc-5-dev libisl15 libmpx0\n libstdc++-5-dev\n0 upgraded, 9 newly installed, 0 to remove and 31 not upgraded.\nNeed to get 29.1 MB of archives.\nAfter this operation, 100 MB of additional disk space will be used.\nGet:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 gcc-5-base amd64 5.5.0-12ubuntu1 [17.1 kB]\nGet:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libisl15 amd64 0.18-4 [548 kB]\nGet:3 http://archive.ubuntu.com/ubuntu bionic/universe amd64 cpp-5 amd64 5.5.0-12ubuntu1 [7,785 kB]\nGet:4 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libasan2 amd64 5.5.0-12ubuntu1 [264 kB]\nGet:5 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libmpx0 amd64 5.5.0-12ubuntu1 [9,888 B]\nGet:6 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libgcc-5-dev amd64 5.5.0-12ubuntu1 [2,224 kB]\nGet:7 http://archive.ubuntu.com/ubuntu bionic/universe amd64 gcc-5 amd64 5.5.0-12ubuntu1 [8,357 kB]\nGet:8 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libstdc++-5-dev amd64 5.5.0-12ubuntu1 [1,415 kB]\nGet:9 http://archive.ubuntu.com/ubuntu bionic/universe amd64 g++-5 amd64 5.5.0-12ubuntu1 [8,450 kB]\nFetched 29.1 MB in 0s (61.9 MB/s)\nSelecting previously unselected package gcc-5-base:amd64.\n(Reading database ... 144439 files and directories currently installed.)\nPreparing to unpack .../0-gcc-5-base_5.5.0-12ubuntu1_amd64.deb ...\nUnpacking gcc-5-base:amd64 (5.5.0-12ubuntu1) ...\nSelecting previously unselected package libisl15:amd64.\nPreparing to unpack .../1-libisl15_0.18-4_amd64.deb ...\nUnpacking libisl15:amd64 (0.18-4) ...\nSelecting previously unselected package cpp-5.\nPreparing to unpack .../2-cpp-5_5.5.0-12ubuntu1_amd64.deb ...\nUnpacking cpp-5 (5.5.0-12ubuntu1) ...\nSelecting previously unselected package libasan2:amd64.\nPreparing to unpack .../3-libasan2_5.5.0-12ubuntu1_amd64.deb ...\nUnpacking libasan2:amd64 (5.5.0-12ubuntu1) ...\nSelecting previously unselected package libmpx0:amd64.\nPreparing to unpack .../4-libmpx0_5.5.0-12ubuntu1_amd64.deb ...\nUnpacking libmpx0:amd64 (5.5.0-12ubuntu1) ...\nSelecting previously unselected package libgcc-5-dev:amd64.\nPreparing to unpack .../5-libgcc-5-dev_5.5.0-12ubuntu1_amd64.deb ...\nUnpacking libgcc-5-dev:amd64 (5.5.0-12ubuntu1) ...\nSelecting previously unselected package gcc-5.\nPreparing to unpack .../6-gcc-5_5.5.0-12ubuntu1_amd64.deb ...\nUnpacking gcc-5 (5.5.0-12ubuntu1) ...\nSelecting previously unselected package libstdc++-5-dev:amd64.\nPreparing to unpack .../7-libstdc++-5-dev_5.5.0-12ubuntu1_amd64.deb ...\nUnpacking libstdc++-5-dev:amd64 (5.5.0-12ubuntu1) ...\nSelecting previously unselected package g++-5.\nPreparing to unpack .../8-g++-5_5.5.0-12ubuntu1_amd64.deb ...\nUnpacking g++-5 (5.5.0-12ubuntu1) ...\nSetting up libisl15:amd64 (0.18-4) ...\nSetting up gcc-5-base:amd64 (5.5.0-12ubuntu1) ...\nSetting up libmpx0:amd64 (5.5.0-12ubuntu1) ...\nSetting up libasan2:amd64 (5.5.0-12ubuntu1) ...\nSetting up libgcc-5-dev:amd64 (5.5.0-12ubuntu1) ...\nSetting up cpp-5 (5.5.0-12ubuntu1) ...\nSetting up libstdc++-5-dev:amd64 (5.5.0-12ubuntu1) ...\nSetting up gcc-5 (5.5.0-12ubuntu1) ...\nSetting up g++-5 (5.5.0-12ubuntu1) ...\nProcessing triggers for man-db (2.8.3-2ubuntu0.1) ...\nProcessing triggers for libc-bin (2.27-3ubuntu1) ...\n/sbin/ldconfig.real: /usr/local/lib/python3.6/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link\n\n/content/darknet\nmkdir -p ./obj/\nmkdir -p backup\nchmod +x *.sh\ng++ -std=c++11 -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/image_opencv.cpp -o obj/image_opencv.o\n\u001b[01m\u001b[K./src/image_opencv.cpp:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kvoid draw_detections_cv_v3(void**, detection*, int, float, char**, image**, int, int)\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/image_opencv.cpp:910:23:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kvariable ‘\u001b[01m\u001b[Krgb\u001b[m\u001b[K’ set but not used [-Wunused-but-set-variable]\n float rgb[3];\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/image_opencv.cpp:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kvoid cv_draw_object(image, float*, int, int, int*, float*, int*, int, char**)\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/image_opencv.cpp:1391:14:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kbuff\u001b[m\u001b[K’ [-Wunused-variable]\n char buff[100];\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/image_opencv.cpp:1367:9:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kit_tb_res\u001b[m\u001b[K’ [-Wunused-variable]\n int it_tb_res = cv::createTrackbar(it_trackbar_name, window_name, &it_trackbar_value, 1000);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/image_opencv.cpp:1371:9:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Klr_tb_res\u001b[m\u001b[K’ [-Wunused-variable]\n int lr_tb_res = cv::createTrackbar(lr_trackbar_name, window_name, &lr_trackbar_value, 20);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/image_opencv.cpp:1375:9:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kcl_tb_res\u001b[m\u001b[K’ [-Wunused-variable]\n int cl_tb_res = cv::createTrackbar(cl_trackbar_name, window_name, &cl_trackbar_value, classes-1);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/image_opencv.cpp:1378:9:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kbo_tb_res\u001b[m\u001b[K’ [-Wunused-variable]\n int bo_tb_res = cv::createTrackbar(bo_trackbar_name, window_name, boxonly, 1);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ng++ -std=c++11 -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/http_stream.cpp -o obj/http_stream.o\nIn file included from \u001b[01m\u001b[K./src/http_stream.cpp:580:0\u001b[m\u001b[K:\n\u001b[01m\u001b[K./src/httplib.h:129:0:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"INVALID_SOCKET\" redefined\n #define INVALID_SOCKET (-1)\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/http_stream.cpp:73:0:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kthis is the location of the previous definition\n #define INVALID_SOCKET -1\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/http_stream.cpp:\u001b[m\u001b[K In member function ‘\u001b[01m\u001b[Kbool JSON_sender::write(const char*)\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/http_stream.cpp:249:21:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kn\u001b[m\u001b[K’ [-Wunused-variable]\n int n = _write(client, outputbuf, outlen);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/http_stream.cpp:\u001b[m\u001b[K In member function ‘\u001b[01m\u001b[Kbool MJPG_sender::write(const cv::Mat&)\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/http_stream.cpp:507:113:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat ‘\u001b[01m\u001b[K%zu\u001b[m\u001b[K’ expects argument of type ‘\u001b[01m\u001b[Ksize_t\u001b[m\u001b[K’, but argument 3 has type ‘\u001b[01m\u001b[Kint\u001b[m\u001b[K’ [-Wformat=]\n sprintf(head, \"--mjpegstream\\r\\nContent-Type: image/jpeg\\r\\nContent-Length: %zu\\r\\n\\r\\n\", outlen);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/gemm.c -o obj/gemm.o\n\u001b[01m\u001b[K./src/gemm.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kconvolution_2d\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/gemm.c:2038:15:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kout_w\u001b[m\u001b[K’ [-Wunused-variable]\n const int out_w = (w + 2 * pad - ksize) / stride + 1; // output_width=input_width for stride=1 and pad=1\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/gemm.c:2037:15:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kout_h\u001b[m\u001b[K’ [-Wunused-variable]\n const int out_h = (h + 2 * pad - ksize) / stride + 1; // output_height=input_height for stride=1 and pad=1\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/utils.c -o obj/utils.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/dark_cuda.c -o obj/dark_cuda.o\n\u001b[01m\u001b[K./src/dark_cuda.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kpre_allocate_pinned_memory\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/dark_cuda.c:276:16:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat ‘\u001b[01m\u001b[K%u\u001b[m\u001b[K’ expects argument of type ‘\u001b[01m\u001b[Kunsigned int\u001b[m\u001b[K’, but argument 2 has type ‘\u001b[01m\u001b[Klong unsigned int\u001b[m\u001b[K’ [-Wformat=]\n printf(\"pre_allocate: size = %Iu MB, num_of_blocks = %Iu, block_size = %Iu MB \\n\",\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/dark_cuda.c:276:16:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat ‘\u001b[01m\u001b[K%u\u001b[m\u001b[K’ expects argument of type ‘\u001b[01m\u001b[Kunsigned int\u001b[m\u001b[K’, but argument 3 has type ‘\u001b[01m\u001b[Ksize_t {aka const long unsigned int}\u001b[m\u001b[K’ [-Wformat=]\n\u001b[01m\u001b[K./src/dark_cuda.c:276:16:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat ‘\u001b[01m\u001b[K%u\u001b[m\u001b[K’ expects argument of type ‘\u001b[01m\u001b[Kunsigned int\u001b[m\u001b[K’, but argument 4 has type ‘\u001b[01m\u001b[Klong unsigned int\u001b[m\u001b[K’ [-Wformat=]\n\u001b[01m\u001b[K./src/dark_cuda.c:286:24:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat ‘\u001b[01m\u001b[K%d\u001b[m\u001b[K’ expects argument of type ‘\u001b[01m\u001b[Kint\u001b[m\u001b[K’, but argument 2 has type ‘\u001b[01m\u001b[Ksize_t {aka const long unsigned int}\u001b[m\u001b[K’ [-Wformat=]\n printf(\" Allocated %d pinned block \\n\", pinned_block_size);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/dark_cuda.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kcuda_make_array_pinned_preallocated\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/dark_cuda.c:307:20:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat ‘\u001b[01m\u001b[K%d\u001b[m\u001b[K’ expects argument of type ‘\u001b[01m\u001b[Kint\u001b[m\u001b[K’, but argument 2 has type ‘\u001b[01m\u001b[Ksize_t {aka long unsigned int}\u001b[m\u001b[K’ [-Wformat=]\n printf(\"\\n Pinned block_id = %d, filled = %f %% \\n\", pinned_block_id, filled);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/dark_cuda.c:322:20:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat ‘\u001b[01m\u001b[K%d\u001b[m\u001b[K’ expects argument of type ‘\u001b[01m\u001b[Kint\u001b[m\u001b[K’, but argument 2 has type ‘\u001b[01m\u001b[Klong unsigned int\u001b[m\u001b[K’ [-Wformat=]\n printf(\"Try to allocate new pinned memory, size = %d MB \\n\", size / (1024 * 1024));\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/dark_cuda.c:328:20:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat ‘\u001b[01m\u001b[K%d\u001b[m\u001b[K’ expects argument of type ‘\u001b[01m\u001b[Kint\u001b[m\u001b[K’, but argument 2 has type ‘\u001b[01m\u001b[Klong unsigned int\u001b[m\u001b[K’ [-Wformat=]\n printf(\"Try to allocate new pinned BLOCK, size = %d MB \\n\", size / (1024 * 1024));\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/convolutional_layer.c -o obj/convolutional_layer.o\n\u001b[01m\u001b[K./src/convolutional_layer.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kforward_convolutional_layer\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/convolutional_layer.c:1204:32:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kt_intput_size\u001b[m\u001b[K’ [-Wunused-variable]\n size_t t_intput_size = binary_transpose_align_input(k, n, state.workspace, &l.t_bit_input, ldb_align, l.bit_align);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/list.c -o obj/list.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/image.c -o obj/image.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/activations.c -o obj/activations.o\n\u001b[01m\u001b[K./src/activations.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kactivate\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/activations.c:77:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KRELU6\u001b[m\u001b[K’ not handled in switch [-Wswitch]\n switch(a){\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/activations.c:77:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KSWISH\u001b[m\u001b[K’ not handled in switch [-Wswitch]\n\u001b[01m\u001b[K./src/activations.c:77:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KMISH\u001b[m\u001b[K’ not handled in switch [-Wswitch]\n\u001b[01m\u001b[K./src/activations.c:77:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KNORM_CHAN\u001b[m\u001b[K’ not handled in switch [-Wswitch]\n\u001b[01m\u001b[K./src/activations.c:77:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KNORM_CHAN_SOFTMAX\u001b[m\u001b[K’ not handled in switch [-Wswitch]\n\u001b[01m\u001b[K./src/activations.c:77:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KNORM_CHAN_SOFTMAX_MAXVAL\u001b[m\u001b[K’ not handled in switch [-Wswitch]\n\u001b[01m\u001b[K./src/activations.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kgradient\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/activations.c:287:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KSWISH\u001b[m\u001b[K’ not handled in switch [-Wswitch]\n switch(a){\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/activations.c:287:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KMISH\u001b[m\u001b[K’ not handled in switch [-Wswitch]\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/im2col.c -o obj/im2col.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/col2im.c -o obj/col2im.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/blas.c -o obj/blas.o\n\u001b[01m\u001b[K./src/blas.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kbackward_shortcut_multilayer_cpu\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/blas.c:207:21:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kout_index\u001b[m\u001b[K’ [-Wunused-variable]\n int out_index = id;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/crop_layer.c -o obj/crop_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/dropout_layer.c -o obj/dropout_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/maxpool_layer.c -o obj/maxpool_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/softmax_layer.c -o obj/softmax_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/data.c -o obj/data.o\n\u001b[01m\u001b[K./src/data.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kload_data_detection\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/data.c:1238:24:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kx\u001b[m\u001b[K’ [-Wunused-variable]\n int k, x, y;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/data.c:1038:43:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kvariable ‘\u001b[01m\u001b[Kr_scale\u001b[m\u001b[K’ set but not used [-Wunused-but-set-variable]\n float r1 = 0, r2 = 0, r3 = 0, r4 = 0, r_scale = 0;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/matrix.c -o obj/matrix.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/network.c -o obj/network.o\n\u001b[01m\u001b[K./src/network.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kresize_network\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/network.c:610:42:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess == cudaHostAlloc(&net->input_pinned_cpu, size * sizeof(float), cudaHostRegisterMapped))\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/network.c:1\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/connected_layer.c -o obj/connected_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/cost_layer.c -o obj/cost_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/parser.c -o obj/parser.o\n\u001b[01m\u001b[K./src/parser.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kparse_network_cfg_custom\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/parser.c:1586:42:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess == cudaHostAlloc(&net.input_pinned_cpu, size * sizeof(float), cudaHostRegisterMapped)) net.input_pinned_cpu_flag = 1;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/activations.h:3\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/activation_layer.h:4\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/parser.c:6\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/option_list.c -o obj/option_list.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/darknet.c -o obj/darknet.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/detection_layer.c -o obj/detection_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/captcha.c -o obj/captcha.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/route_layer.c -o obj/route_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/writing.c -o obj/writing.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/box.c -o obj/box.o\n\u001b[01m\u001b[K./src/box.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kbox_iou_kind\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/box.c:154:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kenumeration value ‘\u001b[01m\u001b[KMSE\u001b[m\u001b[K’ not handled in switch [-Wswitch]\n switch(iou_kind) {\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/box.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kdiounms_sort\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/box.c:898:27:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kbeta_prob\u001b[m\u001b[K’ [-Wunused-variable]\n float beta_prob = pow(dets[j].prob[k], 2) / sum_prob;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/box.c:897:27:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kalpha_prob\u001b[m\u001b[K’ [-Wunused-variable]\n float alpha_prob = pow(dets[i].prob[k], 2) / sum_prob;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/nightmare.c -o obj/nightmare.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/normalization_layer.c -o obj/normalization_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/avgpool_layer.c -o obj/avgpool_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/coco.c -o obj/coco.o\n\u001b[01m\u001b[K./src/coco.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kvalidate_coco_recall\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/coco.c:248:11:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kbase\u001b[m\u001b[K’ [-Wunused-variable]\n char *base = \"results/comp4_det_test_\";\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/dice.c -o obj/dice.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/yolo.c -o obj/yolo.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/detector.c -o obj/detector.o\n\u001b[01m\u001b[K./src/detector.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kprint_cocos\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/detector.c:455:29:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kformat not a string literal and no format arguments [-Wformat-security]\n fprintf(fp, buff);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/detector.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Keliminate_bdd\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/detector.c:548:21:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kstatement with no effect [-Wunused-value]\n for (k; buf[k + n] != '\\0'; k++)\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/detector.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kvalidate_detector\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/detector.c:661:13:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kmkd2\u001b[m\u001b[K’ [-Wunused-variable]\n int mkd2 = make_directory(buff2, 0777);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/detector.c:659:13:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kmkd\u001b[m\u001b[K’ [-Wunused-variable]\n int mkd = make_directory(buff, 0777);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/detector.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kvalidate_detector_map\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/detector.c:1280:15:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kclass_recall\u001b[m\u001b[K’ [-Wunused-variable]\n float class_recall = (float)tp_for_thresh_per_class[i] / ((float)tp_for_thresh_per_class[i] + (float)(truth_classes_count[i] - tp_for_thresh_per_class[i]));\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/detector.c:1279:15:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kclass_precision\u001b[m\u001b[K’ [-Wunused-variable]\n float class_precision = (float)tp_for_thresh_per_class[i] / ((float)tp_for_thresh_per_class[i] + (float)fp_for_thresh_per_class[i]);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/detector.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kdraw_object\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/detector.c:1796:19:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kinv_loss\u001b[m\u001b[K’ [-Wunused-variable]\n float inv_loss = 1.0 / max_val_cmp(0.01, avg_loss);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/layer.c -o obj/layer.o\n\u001b[01m\u001b[K./src/layer.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kfree_layer_custom\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/layer.c:196:68:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Ksuggest parentheses around ‘\u001b[01m\u001b[K&&\u001b[m\u001b[K’ within ‘\u001b[01m\u001b[K||\u001b[m\u001b[K’ [-Wparentheses]\n if (l.delta_gpu && (l.optimized_memory < 1 || l.keep_delta_gpu && l.optimized_memory < 3)) cuda_free(l.delta_gpu), l.delta_gpu = NULL;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/compare.c -o obj/compare.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/classifier.c -o obj/classifier.o\n\u001b[01m\u001b[K./src/classifier.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Ktrain_classifier\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/classifier.c:138:9:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kcount\u001b[m\u001b[K’ [-Wunused-variable]\n int count = 0;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/classifier.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kpredict_classifier\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/classifier.c:831:13:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Ktime\u001b[m\u001b[K’ [-Wunused-variable]\n clock_t time;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/classifier.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kdemo_classifier\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/classifier.c:1261:49:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Ktval_result\u001b[m\u001b[K’ [-Wunused-variable]\n struct timeval tval_before, tval_after, tval_result;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/classifier.c:1261:37:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Ktval_after\u001b[m\u001b[K’ [-Wunused-variable]\n struct timeval tval_before, tval_after, tval_result;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/local_layer.c -o obj/local_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/swag.c -o obj/swag.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/shortcut_layer.c -o obj/shortcut_layer.o\n\u001b[01m\u001b[K./src/shortcut_layer.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kmake_shortcut_layer\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/shortcut_layer.c:55:15:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kscale\u001b[m\u001b[K’ [-Wunused-variable]\n float scale = sqrt(2. / l.nweights);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/activation_layer.c -o obj/activation_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/rnn_layer.c -o obj/rnn_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/gru_layer.c -o obj/gru_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/rnn.c -o obj/rnn.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/rnn_vid.c -o obj/rnn_vid.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/crnn_layer.c -o obj/crnn_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/demo.c -o obj/demo.o\n\u001b[01m\u001b[K./src/demo.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kdetect_in_thread\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/demo.c:100:16:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kprediction\u001b[m\u001b[K’ [-Wunused-variable]\n float *prediction = network_predict(net, X);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/demo.c:98:15:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kl\u001b[m\u001b[K’ [-Wunused-variable]\n layer l = net.layers[net.n - 1];\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/tag.c -o obj/tag.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/cifar.c -o obj/cifar.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/go.c -o obj/go.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/batchnorm_layer.c -o obj/batchnorm_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/art.c -o obj/art.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/region_layer.c -o obj/region_layer.o\n\u001b[01m\u001b[K./src/region_layer.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kresize_region_layer\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/region_layer.c:58:9:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kold_h\u001b[m\u001b[K’ [-Wunused-variable]\n int old_h = l->h;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/region_layer.c:57:9:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kunused variable ‘\u001b[01m\u001b[Kold_w\u001b[m\u001b[K’ [-Wunused-variable]\n int old_w = l->w;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/reorg_layer.c -o obj/reorg_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/reorg_old_layer.c -o obj/reorg_old_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/super.c -o obj/super.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/voxel.c -o obj/voxel.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/tree.c -o obj/tree.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/yolo_layer.c -o obj/yolo_layer.o\n\u001b[01m\u001b[K./src/yolo_layer.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kmake_yolo_layer\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/yolo_layer.c:62:38:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess == cudaHostAlloc(&l.output, batch*l.outputs*sizeof(float), cudaHostRegisterMapped)) l.output_pinned = 1;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/activations.h:3\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/layer.h:4\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/yolo_layer.h:5\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/yolo_layer.c:1\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/yolo_layer.c:69:38:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess == cudaHostAlloc(&l.delta, batch*l.outputs*sizeof(float), cudaHostRegisterMapped)) l.delta_pinned = 1;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/activations.h:3\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/layer.h:4\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/yolo_layer.h:5\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/yolo_layer.c:1\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/yolo_layer.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kresize_yolo_layer\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/yolo_layer.c:96:42:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess != cudaHostAlloc(&l->output, l->batch*l->outputs * sizeof(float), cudaHostRegisterMapped)) {\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/activations.h:3\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/layer.h:4\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/yolo_layer.h:5\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/yolo_layer.c:1\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/yolo_layer.c:105:42:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess != cudaHostAlloc(&l->delta, l->batch*l->outputs * sizeof(float), cudaHostRegisterMapped)) {\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/activations.h:3\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/layer.h:4\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/yolo_layer.h:5\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/yolo_layer.c:1\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/gaussian_yolo_layer.c -o obj/gaussian_yolo_layer.o\n\u001b[01m\u001b[K./src/gaussian_yolo_layer.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kmake_gaussian_yolo_layer\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/gaussian_yolo_layer.c:71:38:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess == cudaHostAlloc(&l.output, batch*l.outputs * sizeof(float), cudaHostRegisterMapped)) l.output_pinned = 1;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/gaussian_yolo_layer.h:5\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/gaussian_yolo_layer.c:7\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/gaussian_yolo_layer.c:78:38:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess == cudaHostAlloc(&l.delta, batch*l.outputs * sizeof(float), cudaHostRegisterMapped)) l.delta_pinned = 1;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/gaussian_yolo_layer.h:5\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/gaussian_yolo_layer.c:7\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/gaussian_yolo_layer.c:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kresize_gaussian_yolo_layer\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/gaussian_yolo_layer.c:110:42:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess != cudaHostAlloc(&l->output, l->batch*l->outputs * sizeof(float), cudaHostRegisterMapped)) {\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/gaussian_yolo_layer.h:5\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/gaussian_yolo_layer.c:7\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/gaussian_yolo_layer.c:119:42:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kpassing argument 1 of ‘\u001b[01m\u001b[KcudaHostAlloc\u001b[m\u001b[K’ from incompatible pointer type [-Wincompatible-pointer-types]\n if (cudaSuccess != cudaHostAlloc(&l->delta, l->batch*l->outputs * sizeof(float), cudaHostRegisterMapped)) {\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nIn file included from \u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime.h:96:0\u001b[m\u001b[K,\n from \u001b[01m\u001b[Kinclude/darknet.h:41\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/gaussian_yolo_layer.h:5\u001b[m\u001b[K,\n from \u001b[01m\u001b[K./src/gaussian_yolo_layer.c:7\u001b[m\u001b[K:\n\u001b[01m\u001b[K/usr/local/cuda/include/cuda_runtime_api.h:4391:39:\u001b[m\u001b[K \u001b[01;36m\u001b[Knote: \u001b[m\u001b[Kexpected ‘\u001b[01m\u001b[Kvoid **\u001b[m\u001b[K’ but argument is of type ‘\u001b[01m\u001b[Kfloat **\u001b[m\u001b[K’\n extern __host__ cudaError_t CUDARTAPI cudaHostAlloc(void **pHost, size_t size, unsigned int flags);\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/upsample_layer.c -o obj/upsample_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/lstm_layer.c -o obj/lstm_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/conv_lstm_layer.c -o obj/conv_lstm_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/scale_channels_layer.c -o obj/scale_channels_layer.o\ngcc -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU -c ./src/sam_layer.c -o obj/sam_layer.o\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/convolutional_kernels.cu -o obj/convolutional_kernels.o\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/activation_kernels.cu -o obj/activation_kernels.o\n./src/activation_kernels.cu(253): warning: variable \"MISH_THRESHOLD\" was declared but never referenced\n\n./src/activation_kernels.cu(253): warning: variable \"MISH_THRESHOLD\" was declared but never referenced\n\n./src/activation_kernels.cu(253): warning: variable \"MISH_THRESHOLD\" was declared but never referenced\n\n./src/activation_kernels.cu(253): warning: variable \"MISH_THRESHOLD\" was declared but never referenced\n\n./src/activation_kernels.cu(253): warning: variable \"MISH_THRESHOLD\" was declared but never referenced\n\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/im2col_kernels.cu -o obj/im2col_kernels.o\n\u001b[01m\u001b[K./src/im2col_kernels.cu:125:18:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*data_col_ptr = (h >= 0 && w >= 0 && h < height && w < width) ?\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:1178:6:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*((uint64_t *)(A_s + (local_i*lda + k) / 8)) = *((uint64_t *)(A + (i_cur*lda + k) / 8)); // weights\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:125:18:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*data_col_ptr = (h >= 0 && w >= 0 && h < height && w < width) ?\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:1178:6:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*((uint64_t *)(A_s + (local_i*lda + k) / 8)) = *((uint64_t *)(A + (i_cur*lda + k) / 8)); // weights\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:125:18:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*data_col_ptr = (h >= 0 && w >= 0 && h < height && w < width) ?\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:1178:6:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*((uint64_t *)(A_s + (local_i*lda + k) / 8)) = *((uint64_t *)(A + (i_cur*lda + k) / 8)); // weights\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:125:18:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*data_col_ptr = (h >= 0 && w >= 0 && h < height && w < width) ?\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:1178:6:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*((uint64_t *)(A_s + (local_i*lda + k) / 8)) = *((uint64_t *)(A + (i_cur*lda + k) / 8)); // weights\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:125:18:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*data_col_ptr = (h >= 0 && w >= 0 && h < height && w < width) ?\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:1178:6:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*((uint64_t *)(A_s + (local_i*lda + k) / 8)) = *((uint64_t *)(A + (i_cur*lda + k) / 8)); // weights\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:125:18:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*data_col_ptr = (h >= 0 && w >= 0 && h < height && w < width) ?\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/im2col_kernels.cu:1178:6:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[K\"/*\" within comment [-Wcomment]\n //*((uint64_t *)(A_s + (local_i*lda + k) / 8)) = *((uint64_t *)(A + (i_cur*lda + k) / 8)); // weights\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/col2im_kernels.cu -o obj/col2im_kernels.o\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/blas_kernels.cu -o obj/blas_kernels.o\n./src/blas_kernels.cu(1086): warning: variable \"out_index\" was declared but never referenced\n\n./src/blas_kernels.cu(1130): warning: variable \"step\" was set but never used\n\n./src/blas_kernels.cu(1734): warning: variable \"stage_id\" was declared but never referenced\n\n./src/blas_kernels.cu(1086): warning: variable \"out_index\" was declared but never referenced\n\n./src/blas_kernels.cu(1130): warning: variable \"step\" was set but never used\n\n./src/blas_kernels.cu(1734): warning: variable \"stage_id\" was declared but never referenced\n\n./src/blas_kernels.cu(1086): warning: variable \"out_index\" was declared but never referenced\n\n./src/blas_kernels.cu(1130): warning: variable \"step\" was set but never used\n\n./src/blas_kernels.cu(1734): warning: variable \"stage_id\" was declared but never referenced\n\n./src/blas_kernels.cu(1086): warning: variable \"out_index\" was declared but never referenced\n\n./src/blas_kernels.cu(1130): warning: variable \"step\" was set but never used\n\n./src/blas_kernels.cu(1734): warning: variable \"stage_id\" was declared but never referenced\n\n./src/blas_kernels.cu(1086): warning: variable \"out_index\" was declared but never referenced\n\n./src/blas_kernels.cu(1130): warning: variable \"step\" was set but never used\n\n./src/blas_kernels.cu(1734): warning: variable \"stage_id\" was declared but never referenced\n\n\u001b[01m\u001b[K./src/blas_kernels.cu:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kvoid backward_shortcut_multilayer_gpu(int, int, int, int*, float**, float*, float*, float*, float*, int, float*, float**, WEIGHTS_NORMALIZATION_T)\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/blas_kernels.cu:1130:5:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kvariable ‘\u001b[01m\u001b[Kstep\u001b[m\u001b[K’ set but not used [-Wunused-but-set-variable]\n int step = 0;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/crop_layer_kernels.cu -o obj/crop_layer_kernels.o\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/dropout_layer_kernels.cu -o obj/dropout_layer_kernels.o\n./src/dropout_layer_kernels.cu(140): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(245): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(262): warning: variable \"block_prob\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(140): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(245): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(262): warning: variable \"block_prob\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(140): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(245): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(262): warning: variable \"block_prob\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(140): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(245): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(262): warning: variable \"block_prob\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(140): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(245): warning: variable \"cur_scale\" was declared but never referenced\n\n./src/dropout_layer_kernels.cu(262): warning: variable \"block_prob\" was declared but never referenced\n\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/maxpool_layer_kernels.cu -o obj/maxpool_layer_kernels.o\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/network_kernels.cu -o obj/network_kernels.o\n./src/network_kernels.cu(359): warning: variable \"l\" was declared but never referenced\n\n./src/network_kernels.cu(368): warning: variable \"im\" was set but never used\n\n./src/network_kernels.cu(359): warning: variable \"l\" was declared but never referenced\n\n./src/network_kernels.cu(368): warning: variable \"im\" was set but never used\n\n./src/network_kernels.cu(359): warning: variable \"l\" was declared but never referenced\n\n./src/network_kernels.cu(368): warning: variable \"im\" was set but never used\n\n./src/network_kernels.cu(359): warning: variable \"l\" was declared but never referenced\n\n./src/network_kernels.cu(368): warning: variable \"im\" was set but never used\n\n./src/network_kernels.cu(359): warning: variable \"l\" was declared but never referenced\n\n./src/network_kernels.cu(368): warning: variable \"im\" was set but never used\n\n\u001b[01m\u001b[K./src/network_kernels.cu:\u001b[m\u001b[K In function ‘\u001b[01m\u001b[Kfloat train_network_datum_gpu(network, float*, float*)\u001b[m\u001b[K’:\n\u001b[01m\u001b[K./src/network_kernels.cu:359:7:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kvariable ‘\u001b[01m\u001b[Kl\u001b[m\u001b[K’ set but not used [-Wunused-but-set-variable]\n layer l = net.layers[net.n - 1];\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\n\u001b[01m\u001b[K./src/network_kernels.cu:368:7:\u001b[m\u001b[K \u001b[01;35m\u001b[Kwarning: \u001b[m\u001b[Kvariable ‘\u001b[01m\u001b[Kim\u001b[m\u001b[K’ set but not used [-Wunused-but-set-variable]\n image im;\n\u001b[01;32m\u001b[K ^\u001b[m\u001b[K\nnvcc -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35 -gencode arch=compute_50,code=[sm_50,compute_50] -gencode arch=compute_52,code=[sm_52,compute_52] -gencode arch=compute_61,code=[sm_61,compute_61] -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ --compiler-options \"-Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU\" -c ./src/avgpool_layer_kernels.cu -o obj/avgpool_layer_kernels.o\ng++ -std=c++11 -std=c++11 -Iinclude/ -I3rdparty/stb/include -DOPENCV `pkg-config --cflags opencv4 2> /dev/null || pkg-config --cflags opencv` -DGPU -I/usr/local/cuda/include/ -Wall -Wfatal-errors -Wno-unused-result -Wno-unknown-pragmas -fPIC -Ofast -DOPENCV -DGPU obj/image_opencv.o obj/http_stream.o obj/gemm.o obj/utils.o obj/dark_cuda.o obj/convolutional_layer.o obj/list.o obj/image.o obj/activations.o obj/im2col.o obj/col2im.o obj/blas.o obj/crop_layer.o obj/dropout_layer.o obj/maxpool_layer.o obj/softmax_layer.o obj/data.o obj/matrix.o obj/network.o obj/connected_layer.o obj/cost_layer.o obj/parser.o obj/option_list.o obj/darknet.o obj/detection_layer.o obj/captcha.o obj/route_layer.o obj/writing.o obj/box.o obj/nightmare.o obj/normalization_layer.o obj/avgpool_layer.o obj/coco.o obj/dice.o obj/yolo.o obj/detector.o obj/layer.o obj/compare.o obj/classifier.o obj/local_layer.o obj/swag.o obj/shortcut_layer.o obj/activation_layer.o obj/rnn_layer.o obj/gru_layer.o obj/rnn.o obj/rnn_vid.o obj/crnn_layer.o obj/demo.o obj/tag.o obj/cifar.o obj/go.o obj/batchnorm_layer.o obj/art.o obj/region_layer.o obj/reorg_layer.o obj/reorg_old_layer.o obj/super.o obj/voxel.o obj/tree.o obj/yolo_layer.o obj/gaussian_yolo_layer.o obj/upsample_layer.o obj/lstm_layer.o obj/conv_lstm_layer.o obj/scale_channels_layer.o obj/sam_layer.o obj/convolutional_kernels.o obj/activation_kernels.o obj/im2col_kernels.o obj/col2im_kernels.o obj/blas_kernels.o obj/crop_layer_kernels.o obj/dropout_layer_kernels.o obj/maxpool_layer_kernels.o obj/network_kernels.o obj/avgpool_layer_kernels.o -o darknet -lm -pthread `pkg-config --libs opencv4 2> /dev/null || pkg-config --libs opencv` -L/usr/local/cuda/lib64 -lcuda -lcudart -lcublas -lcurand -lstdc++\nReading package lists... Done\nBuilding dependency tree \nReading state information... Done\nlibjpeg-dev is already the newest version (8c-2ubuntu8).\nlibjpeg-dev set to manually installed.\nlibvorbis-dev is already the newest version (1.3.5-4.2).\nlibvorbis-dev set to manually installed.\npython-numpy is already the newest version (1:1.13.3-2ubuntu1).\npython-numpy set to manually installed.\npython3-numpy is already the newest version (1:1.13.3-2ubuntu1).\npython3-numpy set to manually installed.\nunzip is already the newest version (6.0-21ubuntu1).\nlibdc1394-22 is already the newest version (2.2.5-1).\nlibdc1394-22 set to manually installed.\nlibdc1394-22-dev is already the newest version (2.2.5-1).\nlibdc1394-22-dev set to manually installed.\nlibtbb-dev is already the newest version (2017~U7-8).\nlibtbb-dev set to manually installed.\nlibtiff5-dev is already the newest version (4.0.9-5ubuntu0.3).\nlibtiff5-dev set to manually installed.\nqtbase5-dev is already the newest version (5.9.5+dfsg-0ubuntu2.5).\nqtbase5-dev set to manually installed.\nffmpeg is already the newest version (7:3.4.6-0ubuntu0.18.04.1).\nlibavcodec-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1).\nlibavcodec-dev set to manually installed.\nlibavformat-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1).\nlibavformat-dev set to manually installed.\nlibopencv-dev is already the newest version (3.2.0+dfsg-4ubuntu0.1).\nlibswscale-dev is already the newest version (7:3.4.6-0ubuntu0.18.04.1).\nlibswscale-dev set to manually installed.\nThe following additional packages will be installed:\n autoconf automake autopoint autotools-dev debhelper dh-autoreconf\n dh-strip-nondeterminism file gettext gettext-base gir1.2-atk-1.0\n gir1.2-atspi-2.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0\n gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gtk-3.0\n gir1.2-pango-1.0 gstreamer1.0-gl gstreamer1.0-plugins-base intltool-debian\n libarchive-cpio-perl libarchive-zip-perl libatk-bridge2.0-dev libatk1.0-dev\n libatspi2.0-dev libcairo-script-interpreter2 libcairo2-dev libcap2-bin\n libcdparanoia0 libdbus-1-dev libepoxy-dev libfaac0 libffms2-4\n libfile-stripnondeterminism-perl libgdk-pixbuf2.0-dev libgpac4\n libgraphene-1.0-0 libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0\n libgstreamer1.0-0 libmagic-mgc libmagic1 libmail-sendmail-perl\n libopencore-amrnb0 libopencore-amrwb0 liborc-0.4-0 liborc-0.4-dev\n liborc-0.4-dev-bin libpam-cap libpango1.0-dev libpangoxft-1.0-0\n libpixman-1-dev libsigsegv2 libsys-hostname-long-perl libtimedate-perl\n libtool libv4l-0 libv4l2rds0 libv4lconvert0 libvisual-0.4-0 libxcb-shm0-dev\n libxcomposite-dev libxcursor-dev libxine2-bin libxinerama-dev\n libxkbcommon-dev libxrandr-dev libxtst-dev m4 po-debconf wayland-protocols\n x11proto-composite-dev x11proto-randr-dev x11proto-record-dev\n x11proto-xinerama-dev\nSuggested packages:\n autoconf-archive gnu-standards autoconf-doc dh-make dwz gettext-doc\n libasprintf-dev libgettextpo-dev gvfs libcairo2-doc libvisual-0.4-plugins\n gstreamer1.0-tools gstreamer1.0-doc libgtk-3-doc liborc-0.4-doc imagemagick\n libpango1.0-doc libtool-doc gcj-jdk m4-doc libmail-box-perl\nThe following NEW packages will be installed:\n autoconf automake autopoint autotools-dev debhelper dh-autoreconf\n dh-strip-nondeterminism file gettext gettext-base gir1.2-atk-1.0\n gir1.2-atspi-2.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0\n gir1.2-gst-plugins-base-1.0 gir1.2-gstreamer-1.0 gir1.2-gtk-3.0\n gir1.2-pango-1.0 gstreamer1.0-gl gstreamer1.0-plugins-base intltool-debian\n libarchive-cpio-perl libarchive-zip-perl libatk-bridge2.0-dev libatk1.0-dev\n libatspi2.0-dev libcairo-script-interpreter2 libcairo2-dev libcap2-bin\n libcdparanoia0 libdbus-1-dev libepoxy-dev libfaac-dev libfaac0 libffms2-4\n libfile-stripnondeterminism-perl libgdk-pixbuf2.0-dev libgpac4\n libgraphene-1.0-0 libgstreamer-gl1.0-0 libgstreamer-plugins-base1.0-0\n libgstreamer-plugins-base1.0-dev libgstreamer1.0-0 libgstreamer1.0-dev\n libgtk-3-dev libmagic-mgc libmagic1 libmail-sendmail-perl libmp3lame-dev\n libopencore-amrnb-dev libopencore-amrnb0 libopencore-amrwb-dev\n libopencore-amrwb0 liborc-0.4-0 liborc-0.4-dev liborc-0.4-dev-bin libpam-cap\n libpango1.0-dev libpangoxft-1.0-0 libpixman-1-dev libsigsegv2\n libsys-hostname-long-perl libtheora-dev libtimedate-perl libtool libv4l-0\n libv4l-dev libv4l2rds0 libv4lconvert0 libvisual-0.4-0 libxcb-shm0-dev\n libxcomposite-dev libxcursor-dev libxine2-bin libxine2-dev libxinerama-dev\n libxkbcommon-dev libxrandr-dev libxtst-dev libxvidcore-dev m4 po-debconf\n v4l-utils wayland-protocols x11proto-composite-dev x11proto-randr-dev\n x11proto-record-dev x11proto-xinerama-dev x264\n0 upgraded, 89 newly installed, 0 to remove and 31 not upgraded.\nNeed to get 16.9 MB of archives.\nAfter this operation, 86.6 MB of additional disk space will be used.\nGet:1 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopencore-amrnb0 amd64 0.1.3-2.1 [92.0 kB]\nGet:2 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopencore-amrwb0 amd64 0.1.3-2.1 [45.8 kB]\nGet:3 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic-mgc amd64 1:5.32-2ubuntu0.4 [184 kB]\nGet:4 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libmagic1 amd64 1:5.32-2ubuntu0.4 [68.6 kB]\nGet:5 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 file amd64 1:5.32-2ubuntu0.4 [22.1 kB]\nGet:6 http://archive.ubuntu.com/ubuntu bionic/main amd64 libcap2-bin amd64 1:2.25-1.2 [20.6 kB]\nGet:7 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpam-cap amd64 1:2.25-1.2 [7,268 B]\nGet:8 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext-base amd64 0.19.8.1-6ubuntu0.3 [113 kB]\nGet:9 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsigsegv2 amd64 2.12-1 [14.7 kB]\nGet:10 http://archive.ubuntu.com/ubuntu bionic/main amd64 m4 amd64 1.4.18-1 [197 kB]\nGet:11 http://archive.ubuntu.com/ubuntu bionic/main amd64 autoconf all 2.69-11 [322 kB]\nGet:12 http://archive.ubuntu.com/ubuntu bionic/main amd64 autotools-dev all 20180224.1 [39.6 kB]\nGet:13 http://archive.ubuntu.com/ubuntu bionic/main amd64 automake all 1:1.15.1-3ubuntu2 [509 kB]\nGet:14 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 autopoint all 0.19.8.1-6ubuntu0.3 [426 kB]\nGet:15 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtool all 2.4.6-2 [194 kB]\nGet:16 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-autoreconf all 17 [15.8 kB]\nGet:17 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libarchive-zip-perl all 1.60-1ubuntu0.1 [84.6 kB]\nGet:18 http://archive.ubuntu.com/ubuntu bionic/main amd64 libfile-stripnondeterminism-perl all 0.040-1.1~build1 [13.8 kB]\nGet:19 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtimedate-perl all 2.3000-2 [37.5 kB]\nGet:20 http://archive.ubuntu.com/ubuntu bionic/main amd64 dh-strip-nondeterminism all 0.040-1.1~build1 [5,208 B]\nGet:21 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gettext amd64 0.19.8.1-6ubuntu0.3 [1,293 kB]\nGet:22 http://archive.ubuntu.com/ubuntu bionic/main amd64 intltool-debian all 0.35.0+20060710.4 [24.9 kB]\nGet:23 http://archive.ubuntu.com/ubuntu bionic/main amd64 po-debconf all 1.0.20 [232 kB]\nGet:24 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 debhelper all 11.1.6ubuntu2 [902 kB]\nGet:25 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-atk-1.0 amd64 2.28.1-1 [17.8 kB]\nGet:26 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-freedesktop amd64 1.56.1-1 [9,080 B]\nGet:27 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-atspi-2.0 amd64 2.28.0-1 [14.6 kB]\nGet:28 http://archive.ubuntu.com/ubuntu bionic/main amd64 gir1.2-gdkpixbuf-2.0 amd64 2.36.11-2 [7,748 B]\nGet:29 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgstreamer1.0-0 amd64 1.14.5-0ubuntu1~18.04.1 [865 kB]\nGet:30 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-gstreamer-1.0 amd64 1.14.5-0ubuntu1~18.04.1 [71.5 kB]\nGet:31 http://archive.ubuntu.com/ubuntu bionic/main amd64 liborc-0.4-0 amd64 1:0.4.28-1 [137 kB]\nGet:32 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgstreamer-plugins-base1.0-0 amd64 1.14.5-0ubuntu1~18.04.1 [688 kB]\nGet:33 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgstreamer-gl1.0-0 amd64 1.14.5-0ubuntu1~18.04.1 [147 kB]\nGet:34 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-gst-plugins-base-1.0 amd64 1.14.5-0ubuntu1~18.04.1 [82.7 kB]\nGet:35 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpangoxft-1.0-0 amd64 1.40.14-1ubuntu0.1 [15.0 kB]\nGet:36 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-pango-1.0 amd64 1.40.14-1ubuntu0.1 [21.6 kB]\nGet:37 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gir1.2-gtk-3.0 amd64 3.22.30-1ubuntu4 [194 kB]\nGet:38 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgraphene-1.0-0 amd64 1.8.0-1 [37.4 kB]\nGet:39 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gstreamer1.0-gl amd64 1.14.5-0ubuntu1~18.04.1 [84.0 kB]\nGet:40 http://archive.ubuntu.com/ubuntu bionic/main amd64 libcdparanoia0 amd64 3.10.2+debian-13 [46.7 kB]\nGet:41 http://archive.ubuntu.com/ubuntu bionic/main amd64 libvisual-0.4-0 amd64 0.4.0-11 [99.2 kB]\nGet:42 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 gstreamer1.0-plugins-base amd64 1.14.5-0ubuntu1~18.04.1 [587 kB]\nGet:43 http://archive.ubuntu.com/ubuntu bionic/main amd64 libarchive-cpio-perl all 0.10-1 [9,644 B]\nGet:44 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libdbus-1-dev amd64 1.12.2-1ubuntu1.1 [165 kB]\nGet:45 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-record-dev all 2018.4-4 [2,620 B]\nGet:46 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxtst-dev amd64 2:1.2.3-1 [15.2 kB]\nGet:47 http://archive.ubuntu.com/ubuntu bionic/main amd64 libatspi2.0-dev amd64 2.28.0-1 [57.3 kB]\nGet:48 http://archive.ubuntu.com/ubuntu bionic/main amd64 libatk-bridge2.0-dev amd64 2.26.2-1 [3,816 B]\nGet:49 http://archive.ubuntu.com/ubuntu bionic/main amd64 libatk1.0-dev amd64 2.28.1-1 [79.9 kB]\nGet:50 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo-script-interpreter2 amd64 1.15.10-2ubuntu0.1 [53.5 kB]\nGet:51 http://archive.ubuntu.com/ubuntu bionic/main amd64 libpixman-1-dev amd64 0.34.0-2 [244 kB]\nGet:52 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxcb-shm0-dev amd64 1.13-2~ubuntu18.04 [6,684 B]\nGet:53 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libcairo2-dev amd64 1.15.10-2ubuntu0.1 [626 kB]\nGet:54 http://archive.ubuntu.com/ubuntu bionic/main amd64 libepoxy-dev amd64 1.4.3-1 [119 kB]\nGet:55 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 libfaac0 amd64 1.29.7.7-1 [44.4 kB]\nGet:56 http://archive.ubuntu.com/ubuntu bionic/multiverse amd64 libfaac-dev amd64 1.29.7.7-1 [46.5 kB]\nGet:57 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libffms2-4 amd64 2.23-2 [57.3 kB]\nGet:58 http://archive.ubuntu.com/ubuntu bionic/main amd64 libgdk-pixbuf2.0-dev amd64 2.36.11-2 [46.8 kB]\nGet:59 http://archive.ubuntu.com/ubuntu bionic-updates/universe amd64 libgpac4 amd64 0.5.2-426-gc5ad4e4+dfsg5-3ubuntu0.1 [1,526 kB]\nGet:60 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgstreamer1.0-dev amd64 1.14.5-0ubuntu1~18.04.1 [398 kB]\nGet:61 http://archive.ubuntu.com/ubuntu bionic/main amd64 liborc-0.4-dev-bin amd64 1:0.4.28-1 [175 kB]\nGet:62 http://archive.ubuntu.com/ubuntu bionic/main amd64 liborc-0.4-dev amd64 1:0.4.28-1 [174 kB]\nGet:63 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgstreamer-plugins-base1.0-dev amd64 1.14.5-0ubuntu1~18.04.1 [312 kB]\nGet:64 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libpango1.0-dev amd64 1.40.14-1ubuntu0.1 [288 kB]\nGet:65 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-xinerama-dev all 2018.4-4 [2,628 B]\nGet:66 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxinerama-dev amd64 2:1.1.3-1 [8,404 B]\nGet:67 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-randr-dev all 2018.4-4 [2,620 B]\nGet:68 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxrandr-dev amd64 2:1.5.1-1 [24.0 kB]\nGet:69 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcursor-dev amd64 1:1.1.15-1 [26.5 kB]\nGet:70 http://archive.ubuntu.com/ubuntu bionic/main amd64 x11proto-composite-dev all 1:2018.4-4 [2,620 B]\nGet:71 http://archive.ubuntu.com/ubuntu bionic/main amd64 libxcomposite-dev amd64 1:0.4.4-2 [9,136 B]\nGet:72 http://archive.ubuntu.com/ubuntu bionic/main amd64 wayland-protocols all 1.13-1 [50.5 kB]\nGet:73 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libxkbcommon-dev amd64 0.8.2-1~ubuntu18.04.1 [150 kB]\nGet:74 http://archive.ubuntu.com/ubuntu bionic-updates/main amd64 libgtk-3-dev amd64 3.22.30-1ubuntu4 [897 kB]\nGet:75 http://archive.ubuntu.com/ubuntu bionic/main amd64 libsys-hostname-long-perl all 1.5-1 [11.7 kB]\nGet:76 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmail-sendmail-perl all 0.80-1 [22.6 kB]\nGet:77 http://archive.ubuntu.com/ubuntu bionic/main amd64 libmp3lame-dev amd64 3.100-2 [156 kB]\nGet:78 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopencore-amrnb-dev amd64 0.1.3-2.1 [332 kB]\nGet:79 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libopencore-amrwb-dev amd64 0.1.3-2.1 [132 kB]\nGet:80 http://archive.ubuntu.com/ubuntu bionic/main amd64 libtheora-dev amd64 1.1.1+dfsg.1-14 [186 kB]\nGet:81 http://archive.ubuntu.com/ubuntu bionic/main amd64 libv4lconvert0 amd64 1.14.2-1 [76.1 kB]\nGet:82 http://archive.ubuntu.com/ubuntu bionic/main amd64 libv4l-0 amd64 1.14.2-1 [41.7 kB]\nGet:83 http://archive.ubuntu.com/ubuntu bionic/main amd64 libv4l2rds0 amd64 1.14.2-1 [15.6 kB]\nGet:84 http://archive.ubuntu.com/ubuntu bionic/main amd64 libv4l-dev amd64 1.14.2-1 [107 kB]\nGet:85 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libxine2-bin amd64 1.2.8-2build2 [1,427 kB]\nGet:86 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libxine2-dev amd64 1.2.8-2build2 [71.7 kB]\nGet:87 http://archive.ubuntu.com/ubuntu bionic/universe amd64 libxvidcore-dev amd64 2:1.3.5-1 [226 kB]\nGet:88 http://archive.ubuntu.com/ubuntu bionic/universe amd64 v4l-utils amd64 1.14.2-1 [407 kB]\nGet:89 http://archive.ubuntu.com/ubuntu bionic/universe amd64 x264 amd64 2:0.152.2854+gite9a5903-2 [78.5 kB]\nFetched 16.9 MB in 0s (49.2 MB/s)\nExtracting templates from packages: 100%\nSelecting previously unselected package libopencore-amrnb0:amd64.\n(Reading database ... 145439 files and directories currently installed.)\nPreparing to unpack .../00-libopencore-amrnb0_0.1.3-2.1_amd64.deb ...\nUnpacking libopencore-amrnb0:amd64 (0.1.3-2.1) ...\nSelecting previously unselected package libopencore-amrwb0:amd64.\nPreparing to unpack .../01-libopencore-amrwb0_0.1.3-2.1_amd64.deb ...\nUnpacking libopencore-amrwb0:amd64 (0.1.3-2.1) ...\nSelecting previously unselected package libmagic-mgc.\nPreparing to unpack .../02-libmagic-mgc_1%3a5.32-2ubuntu0.4_amd64.deb ...\nUnpacking libmagic-mgc (1:5.32-2ubuntu0.4) ...\nSelecting previously unselected package libmagic1:amd64.\nPreparing to unpack .../03-libmagic1_1%3a5.32-2ubuntu0.4_amd64.deb ...\nUnpacking libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\nSelecting previously unselected package file.\nPreparing to unpack .../04-file_1%3a5.32-2ubuntu0.4_amd64.deb ...\nUnpacking file (1:5.32-2ubuntu0.4) ...\nSelecting previously unselected package libcap2-bin.\nPreparing to unpack .../05-libcap2-bin_1%3a2.25-1.2_amd64.deb ...\nUnpacking libcap2-bin (1:2.25-1.2) ...\nSelecting previously unselected package libpam-cap:amd64.\nPreparing to unpack .../06-libpam-cap_1%3a2.25-1.2_amd64.deb ...\nUnpacking libpam-cap:amd64 (1:2.25-1.2) ...\nSelecting previously unselected package gettext-base.\nPreparing to unpack .../07-gettext-base_0.19.8.1-6ubuntu0.3_amd64.deb ...\nUnpacking gettext-base (0.19.8.1-6ubuntu0.3) ...\nSelecting previously unselected package libsigsegv2:amd64.\nPreparing to unpack .../08-libsigsegv2_2.12-1_amd64.deb ...\nUnpacking libsigsegv2:amd64 (2.12-1) ...\nSelecting previously unselected package m4.\nPreparing to unpack .../09-m4_1.4.18-1_amd64.deb ...\nUnpacking m4 (1.4.18-1) ...\nSelecting previously unselected package autoconf.\nPreparing to unpack .../10-autoconf_2.69-11_all.deb ...\nUnpacking autoconf (2.69-11) ...\nSelecting previously unselected package autotools-dev.\nPreparing to unpack .../11-autotools-dev_20180224.1_all.deb ...\nUnpacking autotools-dev (20180224.1) ...\nSelecting previously unselected package automake.\nPreparing to unpack .../12-automake_1%3a1.15.1-3ubuntu2_all.deb ...\nUnpacking automake (1:1.15.1-3ubuntu2) ...\nSelecting previously unselected package autopoint.\nPreparing to unpack .../13-autopoint_0.19.8.1-6ubuntu0.3_all.deb ...\nUnpacking autopoint (0.19.8.1-6ubuntu0.3) ...\nSelecting previously unselected package libtool.\nPreparing to unpack .../14-libtool_2.4.6-2_all.deb ...\nUnpacking libtool (2.4.6-2) ...\nSelecting previously unselected package dh-autoreconf.\nPreparing to unpack .../15-dh-autoreconf_17_all.deb ...\nUnpacking dh-autoreconf (17) ...\nSelecting previously unselected package libarchive-zip-perl.\nPreparing to unpack .../16-libarchive-zip-perl_1.60-1ubuntu0.1_all.deb ...\nUnpacking libarchive-zip-perl (1.60-1ubuntu0.1) ...\nSelecting previously unselected package libfile-stripnondeterminism-perl.\nPreparing to unpack .../17-libfile-stripnondeterminism-perl_0.040-1.1~build1_all.deb ...\nUnpacking libfile-stripnondeterminism-perl (0.040-1.1~build1) ...\nSelecting previously unselected package libtimedate-perl.\nPreparing to unpack .../18-libtimedate-perl_2.3000-2_all.deb ...\nUnpacking libtimedate-perl (2.3000-2) ...\nSelecting previously unselected package dh-strip-nondeterminism.\nPreparing to unpack .../19-dh-strip-nondeterminism_0.040-1.1~build1_all.deb ...\nUnpacking dh-strip-nondeterminism (0.040-1.1~build1) ...\nSelecting previously unselected package gettext.\nPreparing to unpack .../20-gettext_0.19.8.1-6ubuntu0.3_amd64.deb ...\nUnpacking gettext (0.19.8.1-6ubuntu0.3) ...\nSelecting previously unselected package intltool-debian.\nPreparing to unpack .../21-intltool-debian_0.35.0+20060710.4_all.deb ...\nUnpacking intltool-debian (0.35.0+20060710.4) ...\nSelecting previously unselected package po-debconf.\nPreparing to unpack .../22-po-debconf_1.0.20_all.deb ...\nUnpacking po-debconf (1.0.20) ...\nSelecting previously unselected package debhelper.\nPreparing to unpack .../23-debhelper_11.1.6ubuntu2_all.deb ...\nUnpacking debhelper (11.1.6ubuntu2) ...\nSelecting previously unselected package gir1.2-atk-1.0:amd64.\nPreparing to unpack .../24-gir1.2-atk-1.0_2.28.1-1_amd64.deb ...\nUnpacking gir1.2-atk-1.0:amd64 (2.28.1-1) ...\nSelecting previously unselected package gir1.2-freedesktop:amd64.\nPreparing to unpack .../25-gir1.2-freedesktop_1.56.1-1_amd64.deb ...\nUnpacking gir1.2-freedesktop:amd64 (1.56.1-1) ...\nSelecting previously unselected package gir1.2-atspi-2.0:amd64.\nPreparing to unpack .../26-gir1.2-atspi-2.0_2.28.0-1_amd64.deb ...\nUnpacking gir1.2-atspi-2.0:amd64 (2.28.0-1) ...\nSelecting previously unselected package gir1.2-gdkpixbuf-2.0:amd64.\nPreparing to unpack .../27-gir1.2-gdkpixbuf-2.0_2.36.11-2_amd64.deb ...\nUnpacking gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...\nSelecting previously unselected package libgstreamer1.0-0:amd64.\nPreparing to unpack .../28-libgstreamer1.0-0_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nUnpacking libgstreamer1.0-0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package gir1.2-gstreamer-1.0:amd64.\nPreparing to unpack .../29-gir1.2-gstreamer-1.0_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nUnpacking gir1.2-gstreamer-1.0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package liborc-0.4-0:amd64.\nPreparing to unpack .../30-liborc-0.4-0_1%3a0.4.28-1_amd64.deb ...\nUnpacking liborc-0.4-0:amd64 (1:0.4.28-1) ...\nSelecting previously unselected package libgstreamer-plugins-base1.0-0:amd64.\nPreparing to unpack .../31-libgstreamer-plugins-base1.0-0_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nUnpacking libgstreamer-plugins-base1.0-0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package libgstreamer-gl1.0-0:amd64.\nPreparing to unpack .../32-libgstreamer-gl1.0-0_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nUnpacking libgstreamer-gl1.0-0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package gir1.2-gst-plugins-base-1.0:amd64.\nPreparing to unpack .../33-gir1.2-gst-plugins-base-1.0_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nUnpacking gir1.2-gst-plugins-base-1.0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package libpangoxft-1.0-0:amd64.\nPreparing to unpack .../34-libpangoxft-1.0-0_1.40.14-1ubuntu0.1_amd64.deb ...\nUnpacking libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...\nSelecting previously unselected package gir1.2-pango-1.0:amd64.\nPreparing to unpack .../35-gir1.2-pango-1.0_1.40.14-1ubuntu0.1_amd64.deb ...\nUnpacking gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...\nSelecting previously unselected package gir1.2-gtk-3.0:amd64.\nPreparing to unpack .../36-gir1.2-gtk-3.0_3.22.30-1ubuntu4_amd64.deb ...\nUnpacking gir1.2-gtk-3.0:amd64 (3.22.30-1ubuntu4) ...\nSelecting previously unselected package libgraphene-1.0-0:amd64.\nPreparing to unpack .../37-libgraphene-1.0-0_1.8.0-1_amd64.deb ...\nUnpacking libgraphene-1.0-0:amd64 (1.8.0-1) ...\nSelecting previously unselected package gstreamer1.0-gl:amd64.\nPreparing to unpack .../38-gstreamer1.0-gl_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nUnpacking gstreamer1.0-gl:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package libcdparanoia0:amd64.\nPreparing to unpack .../39-libcdparanoia0_3.10.2+debian-13_amd64.deb ...\nUnpacking libcdparanoia0:amd64 (3.10.2+debian-13) ...\nSelecting previously unselected package libvisual-0.4-0:amd64.\nPreparing to unpack .../40-libvisual-0.4-0_0.4.0-11_amd64.deb ...\nUnpacking libvisual-0.4-0:amd64 (0.4.0-11) ...\nSelecting previously unselected package gstreamer1.0-plugins-base:amd64.\nPreparing to unpack .../41-gstreamer1.0-plugins-base_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nUnpacking gstreamer1.0-plugins-base:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package libarchive-cpio-perl.\nPreparing to unpack .../42-libarchive-cpio-perl_0.10-1_all.deb ...\nUnpacking libarchive-cpio-perl (0.10-1) ...\nSelecting previously unselected package libdbus-1-dev:amd64.\nPreparing to unpack .../43-libdbus-1-dev_1.12.2-1ubuntu1.1_amd64.deb ...\nUnpacking libdbus-1-dev:amd64 (1.12.2-1ubuntu1.1) ...\nSelecting previously unselected package x11proto-record-dev.\nPreparing to unpack .../44-x11proto-record-dev_2018.4-4_all.deb ...\nUnpacking x11proto-record-dev (2018.4-4) ...\nSelecting previously unselected package libxtst-dev:amd64.\nPreparing to unpack .../45-libxtst-dev_2%3a1.2.3-1_amd64.deb ...\nUnpacking libxtst-dev:amd64 (2:1.2.3-1) ...\nSelecting previously unselected package libatspi2.0-dev:amd64.\nPreparing to unpack .../46-libatspi2.0-dev_2.28.0-1_amd64.deb ...\nUnpacking libatspi2.0-dev:amd64 (2.28.0-1) ...\nSelecting previously unselected package libatk-bridge2.0-dev:amd64.\nPreparing to unpack .../47-libatk-bridge2.0-dev_2.26.2-1_amd64.deb ...\nUnpacking libatk-bridge2.0-dev:amd64 (2.26.2-1) ...\nSelecting previously unselected package libatk1.0-dev:amd64.\nPreparing to unpack .../48-libatk1.0-dev_2.28.1-1_amd64.deb ...\nUnpacking libatk1.0-dev:amd64 (2.28.1-1) ...\nSelecting previously unselected package libcairo-script-interpreter2:amd64.\nPreparing to unpack .../49-libcairo-script-interpreter2_1.15.10-2ubuntu0.1_amd64.deb ...\nUnpacking libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...\nSelecting previously unselected package libpixman-1-dev:amd64.\nPreparing to unpack .../50-libpixman-1-dev_0.34.0-2_amd64.deb ...\nUnpacking libpixman-1-dev:amd64 (0.34.0-2) ...\nSelecting previously unselected package libxcb-shm0-dev:amd64.\nPreparing to unpack .../51-libxcb-shm0-dev_1.13-2~ubuntu18.04_amd64.deb ...\nUnpacking libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...\nSelecting previously unselected package libcairo2-dev:amd64.\nPreparing to unpack .../52-libcairo2-dev_1.15.10-2ubuntu0.1_amd64.deb ...\nUnpacking libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...\nSelecting previously unselected package libepoxy-dev:amd64.\nPreparing to unpack .../53-libepoxy-dev_1.4.3-1_amd64.deb ...\nUnpacking libepoxy-dev:amd64 (1.4.3-1) ...\nSelecting previously unselected package libfaac0:amd64.\nPreparing to unpack .../54-libfaac0_1.29.7.7-1_amd64.deb ...\nUnpacking libfaac0:amd64 (1.29.7.7-1) ...\nSelecting previously unselected package libfaac-dev:amd64.\nPreparing to unpack .../55-libfaac-dev_1.29.7.7-1_amd64.deb ...\nUnpacking libfaac-dev:amd64 (1.29.7.7-1) ...\nSelecting previously unselected package libffms2-4:amd64.\nPreparing to unpack .../56-libffms2-4_2.23-2_amd64.deb ...\nUnpacking libffms2-4:amd64 (2.23-2) ...\nSelecting previously unselected package libgdk-pixbuf2.0-dev.\nPreparing to unpack .../57-libgdk-pixbuf2.0-dev_2.36.11-2_amd64.deb ...\nUnpacking libgdk-pixbuf2.0-dev (2.36.11-2) ...\nSelecting previously unselected package libgpac4:amd64.\nPreparing to unpack .../58-libgpac4_0.5.2-426-gc5ad4e4+dfsg5-3ubuntu0.1_amd64.deb ...\nUnpacking libgpac4:amd64 (0.5.2-426-gc5ad4e4+dfsg5-3ubuntu0.1) ...\nSelecting previously unselected package libgstreamer1.0-dev:amd64.\nPreparing to unpack .../59-libgstreamer1.0-dev_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nAdding 'diversion of /usr/bin/dh_gstscancodecs to /usr/bin/dh_gstscancodecs-gst0.10 by libgstreamer1.0-dev'\nAdding 'diversion of /usr/share/man/man1/dh_gstscancodecs.1.gz to /usr/share/man/man1/dh_gstscancodecs.1.gz-gst0.10 by libgstreamer1.0-dev'\nUnpacking libgstreamer1.0-dev:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package liborc-0.4-dev-bin.\nPreparing to unpack .../60-liborc-0.4-dev-bin_1%3a0.4.28-1_amd64.deb ...\nUnpacking liborc-0.4-dev-bin (1:0.4.28-1) ...\nSelecting previously unselected package liborc-0.4-dev.\nPreparing to unpack .../61-liborc-0.4-dev_1%3a0.4.28-1_amd64.deb ...\nUnpacking liborc-0.4-dev (1:0.4.28-1) ...\nSelecting previously unselected package libgstreamer-plugins-base1.0-dev:amd64.\nPreparing to unpack .../62-libgstreamer-plugins-base1.0-dev_1.14.5-0ubuntu1~18.04.1_amd64.deb ...\nUnpacking libgstreamer-plugins-base1.0-dev:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSelecting previously unselected package libpango1.0-dev.\nPreparing to unpack .../63-libpango1.0-dev_1.40.14-1ubuntu0.1_amd64.deb ...\nUnpacking libpango1.0-dev (1.40.14-1ubuntu0.1) ...\nSelecting previously unselected package x11proto-xinerama-dev.\nPreparing to unpack .../64-x11proto-xinerama-dev_2018.4-4_all.deb ...\nUnpacking x11proto-xinerama-dev (2018.4-4) ...\nSelecting previously unselected package libxinerama-dev:amd64.\nPreparing to unpack .../65-libxinerama-dev_2%3a1.1.3-1_amd64.deb ...\nUnpacking libxinerama-dev:amd64 (2:1.1.3-1) ...\nSelecting previously unselected package x11proto-randr-dev.\nPreparing to unpack .../66-x11proto-randr-dev_2018.4-4_all.deb ...\nUnpacking x11proto-randr-dev (2018.4-4) ...\nSelecting previously unselected package libxrandr-dev:amd64.\nPreparing to unpack .../67-libxrandr-dev_2%3a1.5.1-1_amd64.deb ...\nUnpacking libxrandr-dev:amd64 (2:1.5.1-1) ...\nSelecting previously unselected package libxcursor-dev:amd64.\nPreparing to unpack .../68-libxcursor-dev_1%3a1.1.15-1_amd64.deb ...\nUnpacking libxcursor-dev:amd64 (1:1.1.15-1) ...\nSelecting previously unselected package x11proto-composite-dev.\nPreparing to unpack .../69-x11proto-composite-dev_1%3a2018.4-4_all.deb ...\nUnpacking x11proto-composite-dev (1:2018.4-4) ...\nSelecting previously unselected package libxcomposite-dev:amd64.\nPreparing to unpack .../70-libxcomposite-dev_1%3a0.4.4-2_amd64.deb ...\nUnpacking libxcomposite-dev:amd64 (1:0.4.4-2) ...\nSelecting previously unselected package wayland-protocols.\nPreparing to unpack .../71-wayland-protocols_1.13-1_all.deb ...\nUnpacking wayland-protocols (1.13-1) ...\nSelecting previously unselected package libxkbcommon-dev:amd64.\nPreparing to unpack .../72-libxkbcommon-dev_0.8.2-1~ubuntu18.04.1_amd64.deb ...\nUnpacking libxkbcommon-dev:amd64 (0.8.2-1~ubuntu18.04.1) ...\nSelecting previously unselected package libgtk-3-dev:amd64.\nPreparing to unpack .../73-libgtk-3-dev_3.22.30-1ubuntu4_amd64.deb ...\nUnpacking libgtk-3-dev:amd64 (3.22.30-1ubuntu4) ...\nSelecting previously unselected package libsys-hostname-long-perl.\nPreparing to unpack .../74-libsys-hostname-long-perl_1.5-1_all.deb ...\nUnpacking libsys-hostname-long-perl (1.5-1) ...\nSelecting previously unselected package libmail-sendmail-perl.\nPreparing to unpack .../75-libmail-sendmail-perl_0.80-1_all.deb ...\nUnpacking libmail-sendmail-perl (0.80-1) ...\nSelecting previously unselected package libmp3lame-dev:amd64.\nPreparing to unpack .../76-libmp3lame-dev_3.100-2_amd64.deb ...\nUnpacking libmp3lame-dev:amd64 (3.100-2) ...\nSelecting previously unselected package libopencore-amrnb-dev:amd64.\nPreparing to unpack .../77-libopencore-amrnb-dev_0.1.3-2.1_amd64.deb ...\nUnpacking libopencore-amrnb-dev:amd64 (0.1.3-2.1) ...\nSelecting previously unselected package libopencore-amrwb-dev:amd64.\nPreparing to unpack .../78-libopencore-amrwb-dev_0.1.3-2.1_amd64.deb ...\nUnpacking libopencore-amrwb-dev:amd64 (0.1.3-2.1) ...\nSelecting previously unselected package libtheora-dev:amd64.\nPreparing to unpack .../79-libtheora-dev_1.1.1+dfsg.1-14_amd64.deb ...\nUnpacking libtheora-dev:amd64 (1.1.1+dfsg.1-14) ...\nSelecting previously unselected package libv4lconvert0:amd64.\nPreparing to unpack .../80-libv4lconvert0_1.14.2-1_amd64.deb ...\nUnpacking libv4lconvert0:amd64 (1.14.2-1) ...\nSelecting previously unselected package libv4l-0:amd64.\nPreparing to unpack .../81-libv4l-0_1.14.2-1_amd64.deb ...\nUnpacking libv4l-0:amd64 (1.14.2-1) ...\nSelecting previously unselected package libv4l2rds0:amd64.\nPreparing to unpack .../82-libv4l2rds0_1.14.2-1_amd64.deb ...\nUnpacking libv4l2rds0:amd64 (1.14.2-1) ...\nSelecting previously unselected package libv4l-dev:amd64.\nPreparing to unpack .../83-libv4l-dev_1.14.2-1_amd64.deb ...\nUnpacking libv4l-dev:amd64 (1.14.2-1) ...\nSelecting previously unselected package libxine2-bin.\nPreparing to unpack .../84-libxine2-bin_1.2.8-2build2_amd64.deb ...\nUnpacking libxine2-bin (1.2.8-2build2) ...\nSelecting previously unselected package libxine2-dev.\nPreparing to unpack .../85-libxine2-dev_1.2.8-2build2_amd64.deb ...\nUnpacking libxine2-dev (1.2.8-2build2) ...\nSelecting previously unselected package libxvidcore-dev:amd64.\nPreparing to unpack .../86-libxvidcore-dev_2%3a1.3.5-1_amd64.deb ...\nUnpacking libxvidcore-dev:amd64 (2:1.3.5-1) ...\nSelecting previously unselected package v4l-utils.\nPreparing to unpack .../87-v4l-utils_1.14.2-1_amd64.deb ...\nUnpacking v4l-utils (1.14.2-1) ...\nSelecting previously unselected package x264.\nPreparing to unpack .../88-x264_2%3a0.152.2854+gite9a5903-2_amd64.deb ...\nUnpacking x264 (2:0.152.2854+gite9a5903-2) ...\nSetting up libdbus-1-dev:amd64 (1.12.2-1ubuntu1.1) ...\nSetting up libfaac0:amd64 (1.29.7.7-1) ...\nSetting up libxcursor-dev:amd64 (1:1.1.15-1) ...\nSetting up gir1.2-atk-1.0:amd64 (2.28.1-1) ...\nSetting up libv4l2rds0:amd64 (1.14.2-1) ...\nSetting up libxkbcommon-dev:amd64 (0.8.2-1~ubuntu18.04.1) ...\nSetting up libpam-cap:amd64 (1:2.25-1.2) ...\nSetting up libarchive-zip-perl (1.60-1ubuntu0.1) ...\nSetting up libtimedate-perl (2.3000-2) ...\nSetting up libcairo-script-interpreter2:amd64 (1.15.10-2ubuntu0.1) ...\nSetting up libsigsegv2:amd64 (2.12-1) ...\nSetting up libtheora-dev:amd64 (1.1.1+dfsg.1-14) ...\nSetting up libcap2-bin (1:2.25-1.2) ...\nSetting up gir1.2-freedesktop:amd64 (1.56.1-1) ...\nSetting up libv4lconvert0:amd64 (1.14.2-1) ...\nSetting up libxcb-shm0-dev:amd64 (1.13-2~ubuntu18.04) ...\nSetting up libpangoxft-1.0-0:amd64 (1.40.14-1ubuntu0.1) ...\nSetting up libarchive-cpio-perl (0.10-1) ...\nSetting up gir1.2-gdkpixbuf-2.0:amd64 (2.36.11-2) ...\nSetting up libatk1.0-dev:amd64 (2.28.1-1) ...\nSetting up gettext-base (0.19.8.1-6ubuntu0.3) ...\nSetting up libffms2-4:amd64 (2.23-2) ...\nSetting up m4 (1.4.18-1) ...\nSetting up libcdparanoia0:amd64 (3.10.2+debian-13) ...\nSetting up x11proto-record-dev (2018.4-4) ...\nSetting up libxine2-bin (1.2.8-2build2) ...\nSetting up libmagic-mgc (1:5.32-2ubuntu0.4) ...\nSetting up gir1.2-pango-1.0:amd64 (1.40.14-1ubuntu0.1) ...\nSetting up libmagic1:amd64 (1:5.32-2ubuntu0.4) ...\nSetting up libxtst-dev:amd64 (2:1.2.3-1) ...\nSetting up liborc-0.4-dev-bin (1:0.4.28-1) ...\nSetting up libsys-hostname-long-perl (1.5-1) ...\nSetting up libgdk-pixbuf2.0-dev (2.36.11-2) ...\nSetting up libmail-sendmail-perl (0.80-1) ...\nSetting up libxvidcore-dev:amd64 (2:1.3.5-1) ...\nSetting up x11proto-xinerama-dev (2018.4-4) ...\nSetting up autotools-dev (20180224.1) ...\nSetting up libpixman-1-dev:amd64 (0.34.0-2) ...\nSetting up libfaac-dev:amd64 (1.29.7.7-1) ...\nSetting up x11proto-randr-dev (2018.4-4) ...\nSetting up libxinerama-dev:amd64 (2:1.1.3-1) ...\nSetting up libxine2-dev (1.2.8-2build2) ...\nSetting up libvisual-0.4-0:amd64 (0.4.0-11) ...\nSetting up libopencore-amrnb0:amd64 (0.1.3-2.1) ...\nSetting up libgraphene-1.0-0:amd64 (1.8.0-1) ...\nSetting up liborc-0.4-0:amd64 (1:0.4.28-1) ...\nSetting up libmp3lame-dev:amd64 (3.100-2) ...\nSetting up libgpac4:amd64 (0.5.2-426-gc5ad4e4+dfsg5-3ubuntu0.1) ...\nSetting up libopencore-amrwb0:amd64 (0.1.3-2.1) ...\nSetting up wayland-protocols (1.13-1) ...\nSetting up x11proto-composite-dev (1:2018.4-4) ...\nSetting up autopoint (0.19.8.1-6ubuntu0.3) ...\nSetting up libepoxy-dev:amd64 (1.4.3-1) ...\nSetting up libfile-stripnondeterminism-perl (0.040-1.1~build1) ...\nSetting up gir1.2-atspi-2.0:amd64 (2.28.0-1) ...\nSetting up libgstreamer1.0-0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetcap worked! gst-ptp-helper is not suid!\nSetting up gir1.2-gtk-3.0:amd64 (3.22.30-1ubuntu4) ...\nSetting up libxrandr-dev:amd64 (2:1.5.1-1) ...\nSetting up libcairo2-dev:amd64 (1.15.10-2ubuntu0.1) ...\nSetting up gettext (0.19.8.1-6ubuntu0.3) ...\nSetting up libv4l-0:amd64 (1.14.2-1) ...\nSetting up libxcomposite-dev:amd64 (1:0.4.4-2) ...\nSetting up x264 (2:0.152.2854+gite9a5903-2) ...\nSetting up v4l-utils (1.14.2-1) ...\nSetting up libopencore-amrnb-dev:amd64 (0.1.3-2.1) ...\nSetting up autoconf (2.69-11) ...\nSetting up file (1:5.32-2ubuntu0.4) ...\nSetting up libatspi2.0-dev:amd64 (2.28.0-1) ...\nSetting up intltool-debian (0.35.0+20060710.4) ...\nSetting up libatk-bridge2.0-dev:amd64 (2.26.2-1) ...\nSetting up automake (1:1.15.1-3ubuntu2) ...\nupdate-alternatives: using /usr/bin/automake-1.15 to provide /usr/bin/automake (automake) in auto mode\nSetting up liborc-0.4-dev (1:0.4.28-1) ...\nSetting up libv4l-dev:amd64 (1.14.2-1) ...\nSetting up libpango1.0-dev (1.40.14-1ubuntu0.1) ...\nSetting up libopencore-amrwb-dev:amd64 (0.1.3-2.1) ...\nSetting up gir1.2-gstreamer-1.0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetting up libtool (2.4.6-2) ...\nSetting up libgstreamer-plugins-base1.0-0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetting up gstreamer1.0-plugins-base:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetting up libgtk-3-dev:amd64 (3.22.30-1ubuntu4) ...\nSetting up po-debconf (1.0.20) ...\nSetting up libgstreamer-gl1.0-0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetting up gstreamer1.0-gl:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetting up gir1.2-gst-plugins-base-1.0:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetting up libgstreamer1.0-dev:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetting up libgstreamer-plugins-base1.0-dev:amd64 (1.14.5-0ubuntu1~18.04.1) ...\nSetting up debhelper (11.1.6ubuntu2) ...\nSetting up dh-autoreconf (17) ...\nSetting up dh-strip-nondeterminism (0.040-1.1~build1) ...\nProcessing triggers for libc-bin (2.27-3ubuntu1) ...\n/sbin/ldconfig.real: /usr/local/lib/python3.6/dist-packages/ideep4py/lib/libmkldnn.so.0 is not a symbolic link\n\nProcessing triggers for man-db (2.8.3-2ubuntu0.1) ...\nProcessing triggers for libglib2.0-0:amd64 (2.56.4-0ubuntu0.18.04.6) ...\n"
],
[
"from google.colab import drive\ndrive.mount('/content/drive')",
"Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&response_type=code&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly\n\nEnter your authorization code:\n··········\nMounted at /content/drive\n"
],
[
"os.listdir('/content/drive/My Drive/darknet/YOLO_Custom')",
"_____no_output_____"
]
],
[
[
"### Get Tiny YOLO Weight (Skip if Resuming Training)",
"_____no_output_____"
]
],
[
[
"!wget --header=\"Host: pjreddie.com\" --header=\"User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36\" --header=\"Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9\" --header=\"Accept-Language: en-US,en;q=0.9\" --header=\"Referer: https://github.com/AlexeyAB/darknet\" --header=\"Cookie: __utma=134107727.1364647705.1589636782.1589689587.1589901067.3; __utmz=134107727.1589901067.3.3.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided)\" --header=\"Connection: keep-alive\" \"https://pjreddie.com/media/files/yolov3-tiny.weights\" -c -O 'yolov3-tiny.weights'",
"--2020-05-30 17:59:03-- https://pjreddie.com/media/files/yolov3-tiny.weights\nResolving pjreddie.com (pjreddie.com)... 128.208.4.108\nConnecting to pjreddie.com (pjreddie.com)|128.208.4.108|:443... connected.\nHTTP request sent, awaiting response... 200 OK\nLength: 35434956 (34M) [application/octet-stream]\nSaving to: ‘yolov3-tiny.weights’\n\nyolov3-tiny.weights 100%[===================>] 33.79M 899KB/s in 55s \n\n2020-05-30 18:00:00 (625 KB/s) - ‘yolov3-tiny.weights’ saved [35434956/35434956]\n\n"
],
[
"!./darknet partial cfg/yolov3-tiny.cfg yolov3-tiny.weights yolov3-tiny.conv.15 15",
" CUDA-version: 10010 (10010), GPU count: 1 \n OpenCV version: 3.2.0\n GPU isn't used \nnet.optimized_memory = 0 \nmini_batch = 1, batch = 1, time_steps = 1, train = 0 \n layer filters size/strd(dil) input output\n 0 conv 16 3 x 3/ 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BF\n 1 max 2x 2/ 2 416 x 416 x 16 -> 208 x 208 x 16 0.003 BF\n 2 conv 32 3 x 3/ 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BF\n 3 max 2x 2/ 2 208 x 208 x 32 -> 104 x 104 x 32 0.001 BF\n 4 conv 64 3 x 3/ 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BF\n 5 max 2x 2/ 2 104 x 104 x 64 -> 52 x 52 x 64 0.001 BF\n 6 conv 128 3 x 3/ 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BF\n 7 max 2x 2/ 2 52 x 52 x 128 -> 26 x 26 x 128 0.000 BF\n 8 conv 256 3 x 3/ 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BF\n 9 max 2x 2/ 2 26 x 26 x 256 -> 13 x 13 x 256 0.000 BF\n 10 conv 512 3 x 3/ 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BF\n 11 max 2x 2/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.000 BF\n 12 conv 1024 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF\n 13 conv 256 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 256 0.089 BF\n 14 conv 512 3 x 3/ 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BF\n 15 conv 255 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 255 0.044 BF\n 16 yolo\n[yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00\n 17 route 13 \t\t -> 13 x 13 x 256 \n 18 conv 128 1 x 1/ 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BF\n 19 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128\n 20 route 19 8 \t -> 26 x 26 x 384 \n 21 conv 256 3 x 3/ 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BF\n 22 conv 255 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 255 0.088 BF\n 23 yolo\n[yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00\nTotal BFLOPS 5.571 \navg_outputs = 341534 \nLoading weights from yolov3-tiny.weights...\n seen 64, trained: 32013 K-images (500 Kilo-batches_64) \nDone! Loaded 15 layers from weights-file \nSaving weights to yolov3-tiny.conv.15\n"
]
],
[
[
"",
"_____no_output_____"
],
[
"### Copy Required Files from Drive",
"_____no_output_____"
]
],
[
[
"# Copy fils from Google Drive to the VM local filesystem\n!cp -r \"/content/drive/My Drive/darknet/YOLO_Custom\" /content/darknet/YOLO_Custom\n",
"_____no_output_____"
]
],
[
[
"### Train",
"_____no_output_____"
],
[
"Use the below command to train yolo: \n \n!./darknet detector train data_file_path config_file_path training_weights_path log_path",
"_____no_output_____"
],
[
"To train yolov3 instead of tiny yolo, replace the following files:\n\nuse ***yolov3_train_cfg*** instead of ***yolov3-tiny_obj_train.cfg***\nuse ***yolov3_test_cfg*** instead of ***yolov3-tiny_obj_test.cfg*** for testing purpose.\nReplace the yolov3 weight link with the tiny yolo weight link",
"_____no_output_____"
]
],
[
[
"!./darknet detector train \"/content/darknet/YOLO_Custom/obj.data\" \"/content/darknet/YOLO_Custom/yolov3-tiny_obj_train.cfg\" \"/content/darknet/yolov3-tiny.conv.15\" \"train.log\" -dont_show ",
" CUDA-version: 10010 (10010), GPU count: 1 \n OpenCV version: 3.2.0\nyolov3-tiny_obj_train\n 0 : compute_capability = 600, cudnn_half = 0, GPU: Tesla P100-PCIE-16GB \nnet.optimized_memory = 0 \nmini_batch = 4, batch = 64, time_steps = 1, train = 1 \n layer filters size/strd(dil) input output\n 0 conv 16 3 x 3/ 1 416 x 416 x 3 -> 416 x 416 x 16 0.150 BF\n 1 max 2x 2/ 2 416 x 416 x 16 -> 208 x 208 x 16 0.003 BF\n 2 conv 32 3 x 3/ 1 208 x 208 x 16 -> 208 x 208 x 32 0.399 BF\n 3 max 2x 2/ 2 208 x 208 x 32 -> 104 x 104 x 32 0.001 BF\n 4 conv 64 3 x 3/ 1 104 x 104 x 32 -> 104 x 104 x 64 0.399 BF\n 5 max 2x 2/ 2 104 x 104 x 64 -> 52 x 52 x 64 0.001 BF\n 6 conv 128 3 x 3/ 1 52 x 52 x 64 -> 52 x 52 x 128 0.399 BF\n 7 max 2x 2/ 2 52 x 52 x 128 -> 26 x 26 x 128 0.000 BF\n 8 conv 256 3 x 3/ 1 26 x 26 x 128 -> 26 x 26 x 256 0.399 BF\n 9 max 2x 2/ 2 26 x 26 x 256 -> 13 x 13 x 256 0.000 BF\n 10 conv 512 3 x 3/ 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BF\n 11 max 2x 2/ 1 13 x 13 x 512 -> 13 x 13 x 512 0.000 BF\n 12 conv 1024 3 x 3/ 1 13 x 13 x 512 -> 13 x 13 x1024 1.595 BF\n 13 conv 256 1 x 1/ 1 13 x 13 x1024 -> 13 x 13 x 256 0.089 BF\n 14 conv 512 3 x 3/ 1 13 x 13 x 256 -> 13 x 13 x 512 0.399 BF\n 15 conv 21 1 x 1/ 1 13 x 13 x 512 -> 13 x 13 x 21 0.004 BF\n 16 yolo\n[yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00\n 17 route 13 \t\t -> 13 x 13 x 256 \n 18 conv 128 1 x 1/ 1 13 x 13 x 256 -> 13 x 13 x 128 0.011 BF\n 19 upsample 2x 13 x 13 x 128 -> 26 x 26 x 128\n 20 route 19 8 \t -> 26 x 26 x 384 \n 21 conv 256 3 x 3/ 1 26 x 26 x 384 -> 26 x 26 x 256 1.196 BF\n 22 conv 21 1 x 1/ 1 26 x 26 x 256 -> 26 x 26 x 21 0.007 BF\n 23 yolo\n[yolo] params: iou loss: mse (2), iou_norm: 0.75, cls_norm: 1.00, scale_x_y: 1.00\nTotal BFLOPS 5.449 \navg_outputs = 325057 \n Allocate additional workspace_size = 24.92 MB \nLoading weights from /content/darknet/yolov3-tiny.conv.15...\n seen 64, trained: 0 K-images (0 Kilo-batches_64) \nDone! Loaded 15 layers from weights-file \nLearning Rate: 0.001, Momentum: 0.9, Decay: 0.0005\nResizing, random_coef = 1.40 \n\n 608 x 608 \n Create 6 permanent cpu-threads \n try to allocate additional workspace_size = 53.23 MB \n CUDA allocate done! \nLoaded: 0.000044 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.442824, GIOU: 0.337422), Class: 0.452568, Obj: 0.528166, No Obj: 0.544673, .5R: 0.333333, .75R: 0.333333, count: 3, class_loss = 345.996552, iou_loss = 2.515594, total_loss = 348.512146 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.368584, GIOU: 0.227452), Class: 0.465912, Obj: 0.410383, No Obj: 0.490674, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 1106.909424, iou_loss = 4.178223, total_loss = 1111.087646 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.427519, GIOU: 0.267198), Class: 0.536629, Obj: 0.725670, No Obj: 0.544037, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 343.933014, iou_loss = 1.806366, total_loss = 345.739380 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.380921, GIOU: 0.216591), Class: 0.459022, Obj: 0.372369, No Obj: 0.490364, .5R: 0.375000, .75R: 0.000000, count: 8, class_loss = 1107.191162, iou_loss = 6.857788, total_loss = 1114.048950 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.552251, GIOU: 0.552252), Class: 0.545831, Obj: 0.523669, No Obj: 0.539552, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 344.152283, iou_loss = 0.174957, total_loss = 344.327240 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.408620, GIOU: 0.345692), Class: 0.568284, Obj: 0.519827, No Obj: 0.490244, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 1107.518188, iou_loss = 1.841553, total_loss = 1109.359741 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.387366, GIOU: 0.292942), Class: 0.513173, Obj: 0.584304, No Obj: 0.544198, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 345.173309, iou_loss = 5.012756, total_loss = 350.186066 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.248667, GIOU: -0.034143), Class: 0.651891, Obj: 0.486397, No Obj: 0.490516, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 1108.090820, iou_loss = 5.207642, total_loss = 1113.298462 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.342230, GIOU: 0.321858), Class: 0.585571, Obj: 0.642370, No Obj: 0.542592, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 343.634460, iou_loss = 2.551208, total_loss = 346.185669 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.404722, GIOU: 0.327569), Class: 0.571983, Obj: 0.441413, No Obj: 0.490314, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 1107.031738, iou_loss = 1.284912, total_loss = 1108.316650 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.302139, GIOU: 0.157104), Class: 0.473573, Obj: 0.491978, No Obj: 0.542160, .5R: 0.000000, .75R: 0.000000, count: 10, class_loss = 346.021759, iou_loss = 7.999847, total_loss = 354.021606 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.491053, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1108.813965, iou_loss = 0.000000, total_loss = 1108.813965 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.300653, GIOU: 0.101791), Class: 0.584209, Obj: 0.662142, No Obj: 0.545807, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 351.668945, iou_loss = 5.536438, total_loss = 357.205383 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.505076, GIOU: 0.440729), Class: 0.555630, Obj: 0.609440, No Obj: 0.489676, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 1103.015503, iou_loss = 0.369263, total_loss = 1103.384766 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.177670, GIOU: -0.101837), Class: 0.267690, Obj: 0.622789, No Obj: 0.543574, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 344.233612, iou_loss = 3.827606, total_loss = 348.061218 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.331091, GIOU: 0.241785), Class: 0.604304, Obj: 0.382100, No Obj: 0.490547, .5R: 0.125000, .75R: 0.000000, count: 8, class_loss = 1108.987549, iou_loss = 8.154053, total_loss = 1117.141602 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.352335, GIOU: 0.315270), Class: 0.556140, Obj: 0.461095, No Obj: 0.543943, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 345.388794, iou_loss = 2.744873, total_loss = 348.133667 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.272727, GIOU: 0.135506), Class: 0.627669, Obj: 0.462829, No Obj: 0.490587, .5R: 0.000000, .75R: 0.000000, count: 15, class_loss = 1107.281372, iou_loss = 8.311646, total_loss = 1115.593018 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.252790, GIOU: 0.055166), Class: 0.666034, Obj: 0.722876, No Obj: 0.543296, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 346.124207, iou_loss = 7.469971, total_loss = 353.594177 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.321050, GIOU: 0.218349), Class: 0.511328, Obj: 0.456756, No Obj: 0.489957, .5R: 0.117647, .75R: 0.000000, count: 17, class_loss = 1103.925903, iou_loss = 14.151245, total_loss = 1118.077148 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.209118, GIOU: -0.047984), Class: 0.482066, Obj: 0.579208, No Obj: 0.543545, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 345.391846, iou_loss = 6.047211, total_loss = 351.439056 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.489608, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1106.028809, iou_loss = 0.000000, total_loss = 1106.028809 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.184081, GIOU: -0.155477), Class: 0.574989, Obj: 0.564268, No Obj: 0.544512, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 346.245728, iou_loss = 10.178894, total_loss = 356.424622 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.359064, GIOU: 0.238429), Class: 0.528581, Obj: 0.447462, No Obj: 0.490394, .5R: 0.083333, .75R: 0.000000, count: 12, class_loss = 1108.336914, iou_loss = 8.349731, total_loss = 1116.686646 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.220432, GIOU: -0.018497), Class: 0.582284, Obj: 0.536850, No Obj: 0.543472, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 344.356262, iou_loss = 7.082367, total_loss = 351.438629 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.609039, GIOU: 0.594978), Class: 0.436628, Obj: 0.455480, No Obj: 0.490555, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 1108.371948, iou_loss = 0.123535, total_loss = 1108.495483 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.358001, GIOU: 0.292902), Class: 0.535175, Obj: 0.582985, No Obj: 0.542034, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 345.205780, iou_loss = 3.201965, total_loss = 348.407745 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.327742, GIOU: 0.209359), Class: 0.541750, Obj: 0.618322, No Obj: 0.489717, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 1108.968262, iou_loss = 3.211426, total_loss = 1112.179688 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.397052, GIOU: 0.238748), Class: 0.565154, Obj: 0.451286, No Obj: 0.543877, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 347.846191, iou_loss = 1.149963, total_loss = 348.996155 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.248438, GIOU: 0.048073), Class: 0.597929, Obj: 0.345383, No Obj: 0.490680, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 1110.804077, iou_loss = 3.894653, total_loss = 1114.698730 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.256848, GIOU: 0.057191), Class: 0.554492, Obj: 0.410775, No Obj: 0.542799, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 342.991974, iou_loss = 3.478455, total_loss = 346.470428 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.347936, GIOU: 0.176799), Class: 0.450325, Obj: 0.439905, No Obj: 0.490117, .5R: 0.214286, .75R: 0.000000, count: 14, class_loss = 1108.466187, iou_loss = 11.515381, total_loss = 1119.981567 \n\n 1: 731.135498, 731.135498 avg loss, 0.000000 rate, 2.420743 seconds, 64 images, -1.000000 hours left\nLoaded: 0.000069 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.427559, GIOU: 0.320692), Class: 0.632394, Obj: 0.554080, No Obj: 0.543863, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 345.837128, iou_loss = 1.814911, total_loss = 347.652039 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.233158, GIOU: 0.142741), Class: 0.491247, Obj: 0.571445, No Obj: 0.489062, .5R: 0.062500, .75R: 0.000000, count: 16, class_loss = 1101.292480, iou_loss = 18.482544, total_loss = 1119.775024 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.236849, GIOU: 0.044740), Class: 0.661192, Obj: 0.626124, No Obj: 0.543437, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 344.475647, iou_loss = 4.971954, total_loss = 349.447601 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.286589, GIOU: 0.140604), Class: 0.724944, Obj: 0.541838, No Obj: 0.490607, .5R: 0.181818, .75R: 0.000000, count: 11, class_loss = 1109.230103, iou_loss = 7.181763, total_loss = 1116.411865 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.226682, GIOU: 0.078901), Class: 0.441021, Obj: 0.655567, No Obj: 0.545844, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 349.758301, iou_loss = 5.758453, total_loss = 355.516754 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.328464, GIOU: 0.237807), Class: 0.600489, Obj: 0.538137, No Obj: 0.490234, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 1106.001709, iou_loss = 3.784790, total_loss = 1109.786499 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.391167, GIOU: 0.284544), Class: 0.474262, Obj: 0.442078, No Obj: 0.542771, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 344.351105, iou_loss = 2.723907, total_loss = 347.075012 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.490765, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1107.547852, iou_loss = 0.000000, total_loss = 1107.547852 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.410423, GIOU: 0.309945), Class: 0.629147, Obj: 0.632697, No Obj: 0.544070, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 345.601379, iou_loss = 1.836548, total_loss = 347.437927 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.348033, GIOU: 0.217935), Class: 0.532972, Obj: 0.473754, No Obj: 0.490486, .5R: 0.117647, .75R: 0.000000, count: 17, class_loss = 1110.967651, iou_loss = 10.354004, total_loss = 1121.321655 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.321858, GIOU: 0.037733), Class: 0.496939, Obj: 0.622972, No Obj: 0.544704, .5R: 0.200000, .75R: 0.100000, count: 10, class_loss = 344.020264, iou_loss = 11.435150, total_loss = 355.455414 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.368595, GIOU: 0.280087), Class: 0.558781, Obj: 0.458334, No Obj: 0.488598, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 1097.955688, iou_loss = 1.312378, total_loss = 1099.268066 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.421125, GIOU: 0.363949), Class: 0.571660, Obj: 0.573686, No Obj: 0.545282, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 348.476898, iou_loss = 3.860565, total_loss = 352.337463 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.437063, GIOU: 0.354276), Class: 0.590941, Obj: 0.502916, No Obj: 0.489927, .5R: 0.300000, .75R: 0.100000, count: 20, class_loss = 1107.989990, iou_loss = 8.275513, total_loss = 1116.265503 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.328520, GIOU: 0.170504), Class: 0.599467, Obj: 0.586638, No Obj: 0.542824, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 344.429474, iou_loss = 4.617340, total_loss = 349.046814 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.285888, GIOU: 0.131607), Class: 0.693967, Obj: 0.486218, No Obj: 0.490257, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1107.949585, iou_loss = 0.291870, total_loss = 1108.241455 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.429217, GIOU: 0.274509), Class: 0.439325, Obj: 0.548706, No Obj: 0.544917, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 344.929688, iou_loss = 1.908875, total_loss = 346.838562 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.382339, GIOU: 0.300938), Class: 0.525810, Obj: 0.446831, No Obj: 0.491325, .5R: 0.285714, .75R: 0.000000, count: 7, class_loss = 1112.353149, iou_loss = 4.850098, total_loss = 1117.203247 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.633393, GIOU: 0.606369), Class: 0.453845, Obj: 0.552716, No Obj: 0.543454, .5R: 1.000000, .75R: 0.000000, count: 3, class_loss = 347.945709, iou_loss = 0.495850, total_loss = 348.441559 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.282271, GIOU: 0.097983), Class: 0.574369, Obj: 0.537148, No Obj: 0.489913, .5R: 0.190476, .75R: 0.000000, count: 21, class_loss = 1108.910278, iou_loss = 22.356689, total_loss = 1131.266968 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.372499, GIOU: 0.372499), Class: 0.468751, Obj: 0.381142, No Obj: 0.542029, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 346.079590, iou_loss = 0.440674, total_loss = 346.520264 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.334930, GIOU: 0.226298), Class: 0.587058, Obj: 0.535809, No Obj: 0.490771, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 1108.348633, iou_loss = 4.367188, total_loss = 1112.715820 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.383426, GIOU: 0.256098), Class: 0.567357, Obj: 0.631776, No Obj: 0.544122, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 346.133789, iou_loss = 2.538971, total_loss = 348.672760 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.246084, GIOU: 0.112669), Class: 0.490358, Obj: 0.539138, No Obj: 0.490619, .5R: 0.000000, .75R: 0.000000, count: 9, class_loss = 1111.475220, iou_loss = 9.242310, total_loss = 1120.717529 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.312887, GIOU: 0.120599), Class: 0.425151, Obj: 0.564151, No Obj: 0.543639, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 343.460022, iou_loss = 4.757782, total_loss = 348.217804 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.491490, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1110.358643, iou_loss = 0.000000, total_loss = 1110.358643 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.404538, GIOU: 0.384970), Class: 0.528528, Obj: 0.548856, No Obj: 0.544095, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 345.040649, iou_loss = 1.883789, total_loss = 346.924438 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.308682, GIOU: 0.232978), Class: 0.438492, Obj: 0.459589, No Obj: 0.490126, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 1107.467651, iou_loss = 2.042603, total_loss = 1109.510254 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.367284, GIOU: 0.226710), Class: 0.523596, Obj: 0.494742, No Obj: 0.541159, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 343.001221, iou_loss = 2.833923, total_loss = 345.835144 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.359361, GIOU: 0.306157), Class: 0.489972, Obj: 0.554616, No Obj: 0.489915, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 1109.133545, iou_loss = 2.558716, total_loss = 1111.692261 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.558220, GIOU: 0.543180), Class: 0.602770, Obj: 0.404271, No Obj: 0.543454, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 343.701935, iou_loss = 0.556152, total_loss = 344.258087 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.495851, GIOU: 0.425006), Class: 0.519990, Obj: 0.469438, No Obj: 0.490638, .5R: 0.500000, .75R: 0.055556, count: 18, class_loss = 1110.455200, iou_loss = 7.092896, total_loss = 1117.548096 \n\n 2: 731.540955, 731.176025 avg loss, 0.000000 rate, 1.565657 seconds, 128 images, 3363.577330 hours left\nLoaded: 0.000029 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.330879, GIOU: 0.167899), Class: 0.625779, Obj: 0.548145, No Obj: 0.545478, .5R: 0.125000, .75R: 0.000000, count: 8, class_loss = 345.329315, iou_loss = 7.108551, total_loss = 352.437866 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.364367, GIOU: 0.284109), Class: 0.528485, Obj: 0.461592, No Obj: 0.491038, .5R: 0.181818, .75R: 0.000000, count: 11, class_loss = 1110.283081, iou_loss = 6.460693, total_loss = 1116.743774 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.538074, GIOU: 0.394041), Class: 0.410132, Obj: 0.542896, No Obj: 0.543154, .5R: 0.666667, .75R: 0.333333, count: 3, class_loss = 344.995789, iou_loss = 1.628174, total_loss = 346.623962 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.251011, GIOU: 0.218663), Class: 0.498442, Obj: 0.399087, No Obj: 0.490406, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1106.207153, iou_loss = 1.020142, total_loss = 1107.227295 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.422265, GIOU: 0.375335), Class: 0.422774, Obj: 0.548074, No Obj: 0.538694, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 339.957520, iou_loss = 1.459167, total_loss = 341.416687 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.293164, GIOU: 0.090620), Class: 0.500718, Obj: 0.540322, No Obj: 0.490341, .5R: 0.055556, .75R: 0.000000, count: 18, class_loss = 1107.060669, iou_loss = 17.001099, total_loss = 1124.061768 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.346202, GIOU: 0.267669), Class: 0.544055, Obj: 0.520373, No Obj: 0.542079, .5R: 0.500000, .75R: 0.000000, count: 4, class_loss = 343.272217, iou_loss = 4.173248, total_loss = 347.445465 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.685970, GIOU: 0.654605), Class: 0.390344, Obj: 0.268818, No Obj: 0.491575, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 1112.629272, iou_loss = 0.082520, total_loss = 1112.711792 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.462359, GIOU: 0.441029), Class: 0.439280, Obj: 0.674646, No Obj: 0.543807, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 347.212128, iou_loss = 1.238983, total_loss = 348.451111 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.359293, GIOU: 0.260835), Class: 0.371409, Obj: 0.413167, No Obj: 0.491112, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 1115.218628, iou_loss = 3.249146, total_loss = 1118.467773 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.257245, GIOU: 0.126471), Class: 0.499327, Obj: 0.547769, No Obj: 0.543001, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 343.033569, iou_loss = 4.296844, total_loss = 347.330414 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.514840, GIOU: 0.392218), Class: 0.521778, Obj: 0.436299, No Obj: 0.490935, .5R: 0.500000, .75R: 0.250000, count: 4, class_loss = 1105.989014, iou_loss = 3.731567, total_loss = 1109.720581 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.333764, GIOU: 0.116894), Class: 0.517595, Obj: 0.503826, No Obj: 0.543386, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 342.839172, iou_loss = 3.995667, total_loss = 346.834839 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.490800, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1108.781738, iou_loss = 0.000000, total_loss = 1108.781738 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.303184, GIOU: 0.044512), Class: 0.543652, Obj: 0.558992, No Obj: 0.542796, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 344.760681, iou_loss = 7.410553, total_loss = 352.171234 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.490400, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1107.723145, iou_loss = 0.000000, total_loss = 1107.723145 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.250908, GIOU: 0.189358), Class: 0.438775, Obj: 0.654284, No Obj: 0.545129, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 346.685181, iou_loss = 3.647644, total_loss = 350.332825 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.425102, GIOU: 0.380351), Class: 0.601269, Obj: 0.434293, No Obj: 0.489903, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 1102.229614, iou_loss = 2.920898, total_loss = 1105.150513 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.608902, GIOU: 0.584289), Class: 0.454964, Obj: 0.393692, No Obj: 0.543625, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 345.925659, iou_loss = 0.217499, total_loss = 346.143158 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.310354, GIOU: 0.103101), Class: 0.535706, Obj: 0.508632, No Obj: 0.490532, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 1110.641846, iou_loss = 6.392090, total_loss = 1117.033936 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.323574, GIOU: 0.211488), Class: 0.509371, Obj: 0.671770, No Obj: 0.544499, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 346.140625, iou_loss = 7.597809, total_loss = 353.738434 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.477324, GIOU: 0.417566), Class: 0.481193, Obj: 0.446357, No Obj: 0.491219, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1109.811401, iou_loss = 0.268311, total_loss = 1110.079712 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.367609, GIOU: 0.224256), Class: 0.438858, Obj: 0.464084, No Obj: 0.542865, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 344.137512, iou_loss = 2.979004, total_loss = 347.116516 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.412812, GIOU: 0.347717), Class: 0.397077, Obj: 0.524688, No Obj: 0.490608, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 1107.304199, iou_loss = 2.569458, total_loss = 1109.873657 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.512629, GIOU: 0.397261), Class: 0.574217, Obj: 0.401110, No Obj: 0.545977, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 347.884521, iou_loss = 0.631256, total_loss = 348.515778 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.498916, GIOU: 0.416225), Class: 0.532127, Obj: 0.430441, No Obj: 0.490014, .5R: 0.555556, .75R: 0.111111, count: 9, class_loss = 1107.451660, iou_loss = 4.163208, total_loss = 1111.614868 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.270550, GIOU: 0.070871), Class: 0.495452, Obj: 0.575793, No Obj: 0.544278, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 345.592773, iou_loss = 6.626343, total_loss = 352.219116 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.425227, GIOU: 0.292403), Class: 0.553604, Obj: 0.492078, No Obj: 0.489682, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1102.359863, iou_loss = 0.387085, total_loss = 1102.746948 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.177771, GIOU: -0.071538), Class: 0.465306, Obj: 0.674680, No Obj: 0.544007, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 344.695007, iou_loss = 8.138000, total_loss = 352.833008 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.378031, GIOU: 0.295859), Class: 0.696561, Obj: 0.528425, No Obj: 0.490969, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 1110.324585, iou_loss = 0.785645, total_loss = 1111.110229 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.219195, GIOU: 0.002272), Class: 0.401776, Obj: 0.464877, No Obj: 0.544252, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 348.339752, iou_loss = 9.554321, total_loss = 357.894073 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.299162, GIOU: 0.041121), Class: 0.580211, Obj: 0.441899, No Obj: 0.489736, .5R: 0.111111, .75R: 0.000000, count: 9, class_loss = 1102.035156, iou_loss = 12.979492, total_loss = 1115.014648 \n\n 3: 730.611450, 731.119568 avg loss, 0.000000 rate, 1.584648 seconds, 192 images, 3351.696882 hours left\nLoaded: 0.000041 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.306904, GIOU: 0.139213), Class: 0.494525, Obj: 0.508520, No Obj: 0.544512, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 345.489746, iou_loss = 7.205048, total_loss = 352.694794 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.498336, GIOU: 0.368918), Class: 0.439963, Obj: 0.494349, No Obj: 0.490706, .5R: 0.500000, .75R: 0.000000, count: 4, class_loss = 1107.803589, iou_loss = 1.785156, total_loss = 1109.588745 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.358552, GIOU: 0.195788), Class: 0.558618, Obj: 0.458714, No Obj: 0.543355, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 343.124878, iou_loss = 3.201630, total_loss = 346.326508 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.490582, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1108.180176, iou_loss = 0.000000, total_loss = 1108.180176 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.269917, GIOU: 0.145957), Class: 0.491818, Obj: 0.522146, No Obj: 0.542669, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 346.155304, iou_loss = 5.748749, total_loss = 351.904053 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.426236, GIOU: 0.321487), Class: 0.647247, Obj: 0.570473, No Obj: 0.490467, .5R: 0.500000, .75R: 0.000000, count: 4, class_loss = 1109.334106, iou_loss = 1.411255, total_loss = 1110.745361 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.422658, GIOU: 0.334172), Class: 0.582444, Obj: 0.599572, No Obj: 0.544369, .5R: 0.250000, .75R: 0.000000, count: 8, class_loss = 348.243927, iou_loss = 4.527954, total_loss = 352.771881 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.440458, GIOU: 0.394496), Class: 0.517572, Obj: 0.488999, No Obj: 0.490434, .5R: 0.250000, .75R: 0.000000, count: 12, class_loss = 1109.029175, iou_loss = 8.182251, total_loss = 1117.211426 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.269340, GIOU: 0.269340), Class: 0.167744, Obj: 0.932441, No Obj: 0.544000, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 347.005890, iou_loss = 0.403717, total_loss = 347.409607 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.426343, GIOU: 0.300323), Class: 0.571963, Obj: 0.452040, No Obj: 0.490203, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 1108.729858, iou_loss = 1.657715, total_loss = 1110.387573 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.261113, GIOU: 0.212370), Class: 0.649615, Obj: 0.752296, No Obj: 0.541816, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 342.466614, iou_loss = 1.740875, total_loss = 344.207489 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.378011, GIOU: 0.258239), Class: 0.558253, Obj: 0.418949, No Obj: 0.489875, .5R: 0.400000, .75R: 0.200000, count: 5, class_loss = 1105.881958, iou_loss = 6.401245, total_loss = 1112.283203 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.262428, GIOU: 0.212592), Class: 0.536818, Obj: 0.676931, No Obj: 0.542055, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 344.387421, iou_loss = 4.125580, total_loss = 348.513000 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.410520, GIOU: 0.305348), Class: 0.648754, Obj: 0.501845, No Obj: 0.490178, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 1108.354736, iou_loss = 2.580566, total_loss = 1110.935303 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.350452, GIOU: 0.221636), Class: 0.561209, Obj: 0.483287, No Obj: 0.543794, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 342.998413, iou_loss = 2.900452, total_loss = 345.898865 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.435177, GIOU: 0.267457), Class: 0.440654, Obj: 0.479897, No Obj: 0.490668, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 1107.531616, iou_loss = 1.444214, total_loss = 1108.975830 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.294500, GIOU: 0.186289), Class: 0.540425, Obj: 0.544238, No Obj: 0.543980, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 346.184845, iou_loss = 2.962677, total_loss = 349.147522 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.524966, GIOU: 0.482020), Class: 0.507498, Obj: 0.649440, No Obj: 0.489504, .5R: 1.000000, .75R: 0.000000, count: 2, class_loss = 1099.687500, iou_loss = 0.439331, total_loss = 1100.126831 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.400620, GIOU: 0.261323), Class: 0.424187, Obj: 0.537415, No Obj: 0.543772, .5R: 0.428571, .75R: 0.000000, count: 7, class_loss = 344.930267, iou_loss = 5.650085, total_loss = 350.580353 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.376731, GIOU: 0.318492), Class: 0.512139, Obj: 0.441481, No Obj: 0.490834, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 1109.337646, iou_loss = 1.718506, total_loss = 1111.056152 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.336396, GIOU: 0.273126), Class: 0.585253, Obj: 0.525135, No Obj: 0.544189, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 344.885895, iou_loss = 2.662598, total_loss = 347.548492 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.431163, GIOU: 0.388477), Class: 0.688623, Obj: 0.575713, No Obj: 0.490159, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 1108.151733, iou_loss = 2.157349, total_loss = 1110.309082 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.305223, GIOU: 0.115721), Class: 0.546464, Obj: 0.423193, No Obj: 0.543840, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 343.914917, iou_loss = 3.068573, total_loss = 346.983490 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.385053, GIOU: 0.247714), Class: 0.567572, Obj: 0.457765, No Obj: 0.490418, .5R: 0.312500, .75R: 0.000000, count: 16, class_loss = 1107.134644, iou_loss = 10.820068, total_loss = 1117.954712 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.181373, GIOU: -0.142938), Class: 0.520181, Obj: 0.668848, No Obj: 0.542552, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 345.060211, iou_loss = 7.177307, total_loss = 352.237518 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.450950, GIOU: 0.407670), Class: 0.528955, Obj: 0.442722, No Obj: 0.490125, .5R: 0.428571, .75R: 0.000000, count: 14, class_loss = 1106.867798, iou_loss = 5.623291, total_loss = 1112.491089 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.141757, GIOU: -0.159420), Class: 0.384977, Obj: 0.329396, No Obj: 0.543432, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 345.960144, iou_loss = 4.306641, total_loss = 350.266785 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.405561, GIOU: 0.354677), Class: 0.443986, Obj: 0.497091, No Obj: 0.490136, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 1109.633179, iou_loss = 2.978760, total_loss = 1112.611938 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.428633, GIOU: 0.304825), Class: 0.507837, Obj: 0.530486, No Obj: 0.542768, .5R: 0.400000, .75R: 0.000000, count: 5, class_loss = 347.392120, iou_loss = 3.784821, total_loss = 351.176941 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.307708, GIOU: 0.252523), Class: 0.600345, Obj: 0.534458, No Obj: 0.490278, .5R: 0.000000, .75R: 0.000000, count: 9, class_loss = 1107.165283, iou_loss = 5.242310, total_loss = 1112.407593 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.262485, GIOU: 0.153972), Class: 0.431315, Obj: 0.559627, No Obj: 0.542892, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 345.534637, iou_loss = 9.539276, total_loss = 355.073914 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.452634, GIOU: 0.409966), Class: 0.559847, Obj: 0.469812, No Obj: 0.490373, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 1110.620483, iou_loss = 1.718994, total_loss = 1112.339478 \n\n 4: 730.323303, 731.039917 avg loss, 0.000000 rate, 1.486503 seconds, 256 images, 3340.198398 hours left\nLoaded: 0.000031 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.223507, GIOU: -0.054825), Class: 0.486100, Obj: 0.557069, No Obj: 0.543348, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 345.445496, iou_loss = 4.474640, total_loss = 349.920135 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.286499, GIOU: 0.239628), Class: 0.536082, Obj: 0.586295, No Obj: 0.489967, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 1102.692261, iou_loss = 2.626465, total_loss = 1105.318726 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.362617, GIOU: 0.223738), Class: 0.433864, Obj: 0.473380, No Obj: 0.543860, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 344.183350, iou_loss = 3.488251, total_loss = 347.671600 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.489782, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1105.693359, iou_loss = 0.000000, total_loss = 1105.693359 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.328777, GIOU: 0.299207), Class: 0.528411, Obj: 0.447202, No Obj: 0.543244, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 344.474487, iou_loss = 4.420471, total_loss = 348.894958 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.241484, GIOU: 0.130369), Class: 0.627398, Obj: 0.531720, No Obj: 0.490088, .5R: 0.000000, .75R: 0.000000, count: 7, class_loss = 1108.383911, iou_loss = 6.919067, total_loss = 1115.302979 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.334709, GIOU: 0.205890), Class: 0.474257, Obj: 0.398593, No Obj: 0.543507, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 347.587891, iou_loss = 1.332489, total_loss = 348.920380 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.292590, GIOU: 0.062823), Class: 0.494392, Obj: 0.428101, No Obj: 0.490710, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 1108.763428, iou_loss = 8.000488, total_loss = 1116.763916 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.207835, GIOU: -0.086474), Class: 0.482825, Obj: 0.589205, No Obj: 0.543931, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 347.480225, iou_loss = 6.041351, total_loss = 353.521576 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.386485, GIOU: 0.279626), Class: 0.489964, Obj: 0.510965, No Obj: 0.490584, .5R: 0.100000, .75R: 0.000000, count: 10, class_loss = 1110.121460, iou_loss = 4.435425, total_loss = 1114.556885 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.330513, GIOU: 0.165207), Class: 0.535174, Obj: 0.439832, No Obj: 0.543656, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 344.988647, iou_loss = 3.038635, total_loss = 348.027283 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.460466, GIOU: 0.386834), Class: 0.553579, Obj: 0.462680, No Obj: 0.490149, .5R: 0.476190, .75R: 0.000000, count: 21, class_loss = 1110.566406, iou_loss = 9.889893, total_loss = 1120.456299 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.325633, GIOU: 0.193708), Class: 0.567264, Obj: 0.487777, No Obj: 0.543510, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 344.289154, iou_loss = 4.036499, total_loss = 348.325653 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.435723, GIOU: 0.392132), Class: 0.404027, Obj: 0.447432, No Obj: 0.489550, .5R: 0.500000, .75R: 0.000000, count: 6, class_loss = 1105.115356, iou_loss = 3.093262, total_loss = 1108.208618 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.183875, GIOU: -0.118803), Class: 0.441110, Obj: 0.714751, No Obj: 0.545165, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 345.928864, iou_loss = 4.997986, total_loss = 350.926849 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.408485, GIOU: 0.311149), Class: 0.730368, Obj: 0.487489, No Obj: 0.490352, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 1106.537598, iou_loss = 1.173340, total_loss = 1107.710938 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.440873, GIOU: 0.331036), Class: 0.490798, Obj: 0.522571, No Obj: 0.544266, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 347.394104, iou_loss = 3.274689, total_loss = 350.668793 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.317514, GIOU: 0.126534), Class: 0.527753, Obj: 0.449196, No Obj: 0.490856, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 1115.629883, iou_loss = 5.516235, total_loss = 1121.146118 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.366521, GIOU: 0.317553), Class: 0.458836, Obj: 0.527682, No Obj: 0.544538, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 346.990875, iou_loss = 3.991791, total_loss = 350.982666 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.438755, GIOU: 0.342261), Class: 0.530188, Obj: 0.418827, No Obj: 0.490759, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 1110.260254, iou_loss = 2.849243, total_loss = 1113.109497 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.291838, GIOU: 0.201839), Class: 0.285895, Obj: 0.334871, No Obj: 0.541463, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 345.622009, iou_loss = 2.318665, total_loss = 347.940674 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.464297, GIOU: 0.434764), Class: 0.391964, Obj: 0.420575, No Obj: 0.491218, .5R: 0.428571, .75R: 0.000000, count: 7, class_loss = 1112.740723, iou_loss = 3.123657, total_loss = 1115.864380 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.442149, GIOU: 0.356381), Class: 0.455207, Obj: 0.469900, No Obj: 0.544776, .5R: 0.400000, .75R: 0.000000, count: 5, class_loss = 346.093292, iou_loss = 1.958954, total_loss = 348.052246 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.316724, GIOU: 0.316723), Class: 0.670223, Obj: 0.649867, No Obj: 0.489951, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1104.022217, iou_loss = 0.739258, total_loss = 1104.761475 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.395730, GIOU: 0.267374), Class: 0.503142, Obj: 0.525537, No Obj: 0.543949, .5R: 0.333333, .75R: 0.000000, count: 9, class_loss = 345.512939, iou_loss = 6.755432, total_loss = 352.268372 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.431493, GIOU: 0.396230), Class: 0.572115, Obj: 0.517949, No Obj: 0.490939, .5R: 0.400000, .75R: 0.000000, count: 5, class_loss = 1109.350586, iou_loss = 1.903076, total_loss = 1111.253662 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.298096, GIOU: 0.298096), Class: 0.349437, Obj: 0.282553, No Obj: 0.544499, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 349.318909, iou_loss = 0.734680, total_loss = 350.053589 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.277876, GIOU: 0.120906), Class: 0.499197, Obj: 0.515643, No Obj: 0.490303, .5R: 0.020408, .75R: 0.000000, count: 49, class_loss = 1115.716553, iou_loss = 42.474121, total_loss = 1158.190674 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.238142, GIOU: 0.108125), Class: 0.542698, Obj: 0.647872, No Obj: 0.542459, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 343.112579, iou_loss = 6.178589, total_loss = 349.291168 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.369355, GIOU: 0.261336), Class: 0.518357, Obj: 0.524151, No Obj: 0.490137, .5R: 0.200000, .75R: 0.066667, count: 15, class_loss = 1107.517212, iou_loss = 8.592651, total_loss = 1116.109863 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.389054, GIOU: 0.195988), Class: 0.447583, Obj: 0.610127, No Obj: 0.546018, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 345.997681, iou_loss = 3.643402, total_loss = 349.641083 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.529498, GIOU: 0.529307), Class: 0.443703, Obj: 0.717258, No Obj: 0.490764, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 1108.659546, iou_loss = 0.150391, total_loss = 1108.809937 \n\n 5: 732.448853, 731.180786 avg loss, 0.000000 rate, 1.569576 seconds, 320 images, 3327.451390 hours left\nLoaded: 0.000050 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.184659, GIOU: -0.017825), Class: 0.701347, Obj: 0.620759, No Obj: 0.545545, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 346.605133, iou_loss = 8.633698, total_loss = 355.238831 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.406641, GIOU: 0.373434), Class: 0.575216, Obj: 0.489748, No Obj: 0.490133, .5R: 0.312500, .75R: 0.000000, count: 16, class_loss = 1107.630981, iou_loss = 8.088135, total_loss = 1115.719116 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.349096, GIOU: 0.211380), Class: 0.455324, Obj: 0.317656, No Obj: 0.543723, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 347.220154, iou_loss = 2.847687, total_loss = 350.067841 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.297551, GIOU: 0.198229), Class: 0.456908, Obj: 0.515856, No Obj: 0.490211, .5R: 0.222222, .75R: 0.000000, count: 9, class_loss = 1108.531006, iou_loss = 9.961426, total_loss = 1118.492432 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.370387, GIOU: 0.136462), Class: 0.542050, Obj: 0.536595, No Obj: 0.543860, .5R: 0.500000, .75R: 0.000000, count: 4, class_loss = 346.424561, iou_loss = 3.537872, total_loss = 349.962433 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.243276, GIOU: 0.055873), Class: 0.640994, Obj: 0.523859, No Obj: 0.490287, .5R: 0.125000, .75R: 0.000000, count: 8, class_loss = 1107.254395, iou_loss = 9.399414, total_loss = 1116.653809 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.270242, GIOU: 0.035729), Class: 0.549209, Obj: 0.592510, No Obj: 0.543987, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 345.419006, iou_loss = 6.257660, total_loss = 351.676666 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.398545, GIOU: 0.332713), Class: 0.581646, Obj: 0.414286, No Obj: 0.491200, .5R: 0.375000, .75R: 0.000000, count: 8, class_loss = 1112.009644, iou_loss = 7.348511, total_loss = 1119.358154 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.326031, GIOU: 0.169682), Class: 0.533300, Obj: 0.593278, No Obj: 0.544021, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 346.101654, iou_loss = 4.171509, total_loss = 350.273163 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.575710, GIOU: 0.525745), Class: 0.602648, Obj: 0.504780, No Obj: 0.490560, .5R: 1.000000, .75R: 0.000000, count: 2, class_loss = 1107.954956, iou_loss = 0.511475, total_loss = 1108.466431 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.453636, GIOU: 0.305896), Class: 0.750609, Obj: 0.457453, No Obj: 0.545020, .5R: 0.333333, .75R: 0.333333, count: 3, class_loss = 348.036957, iou_loss = 2.261047, total_loss = 350.298004 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.417374, GIOU: 0.338985), Class: 0.510830, Obj: 0.468010, No Obj: 0.489806, .5R: 0.307692, .75R: 0.038462, count: 26, class_loss = 1107.682251, iou_loss = 12.981934, total_loss = 1120.664185 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.365198, GIOU: 0.241827), Class: 0.593827, Obj: 0.486502, No Obj: 0.544121, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 345.651306, iou_loss = 5.210510, total_loss = 350.861816 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.207650, GIOU: -0.047022), Class: 0.548409, Obj: 0.584275, No Obj: 0.489739, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 1105.051392, iou_loss = 6.326172, total_loss = 1111.377563 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.388160, GIOU: 0.365699), Class: 0.476051, Obj: 0.445263, No Obj: 0.542390, .5R: 0.400000, .75R: 0.000000, count: 5, class_loss = 344.229858, iou_loss = 3.636810, total_loss = 347.866669 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.381523, GIOU: 0.355747), Class: 0.498685, Obj: 0.465393, No Obj: 0.491136, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 1114.539795, iou_loss = 2.106934, total_loss = 1116.646729 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.328899, GIOU: 0.256984), Class: 0.671688, Obj: 0.587229, No Obj: 0.541134, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 344.602386, iou_loss = 2.097076, total_loss = 346.699463 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.369141, GIOU: 0.311670), Class: 0.508596, Obj: 0.499496, No Obj: 0.490341, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 1110.375977, iou_loss = 3.671021, total_loss = 1114.046997 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.448957, GIOU: 0.224356), Class: 0.393239, Obj: 0.721992, No Obj: 0.544340, .5R: 0.400000, .75R: 0.200000, count: 5, class_loss = 349.050079, iou_loss = 5.835236, total_loss = 354.885315 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.439571, GIOU: 0.386553), Class: 0.600760, Obj: 0.322627, No Obj: 0.489267, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1104.683472, iou_loss = 0.289307, total_loss = 1104.972778 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.264388, GIOU: 0.040499), Class: 0.601081, Obj: 0.621687, No Obj: 0.545110, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 348.831116, iou_loss = 6.160858, total_loss = 354.991974 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.479070, GIOU: 0.428772), Class: 0.528832, Obj: 0.513649, No Obj: 0.490976, .5R: 0.571429, .75R: 0.000000, count: 14, class_loss = 1112.807373, iou_loss = 4.742188, total_loss = 1117.549561 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.661822, GIOU: 0.661822), Class: 0.761477, Obj: 0.452364, No Obj: 0.540598, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 342.655121, iou_loss = 0.069061, total_loss = 342.724182 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.373938, GIOU: 0.245269), Class: 0.575946, Obj: 0.486076, No Obj: 0.490955, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 1111.590942, iou_loss = 2.634033, total_loss = 1114.224976 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.368984, GIOU: 0.094902), Class: 0.530136, Obj: 0.563629, No Obj: 0.543105, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 348.081512, iou_loss = 3.337677, total_loss = 351.419189 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.286786, GIOU: 0.183427), Class: 0.511394, Obj: 0.381294, No Obj: 0.490761, .5R: 0.100000, .75R: 0.000000, count: 10, class_loss = 1109.121460, iou_loss = 10.870850, total_loss = 1119.992310 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.370172, GIOU: 0.261266), Class: 0.522136, Obj: 0.508618, No Obj: 0.542923, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 346.073334, iou_loss = 3.488647, total_loss = 349.561981 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.321877, GIOU: 0.212067), Class: 0.583840, Obj: 0.489854, No Obj: 0.490529, .5R: 0.103448, .75R: 0.000000, count: 29, class_loss = 1111.692505, iou_loss = 18.549438, total_loss = 1130.241943 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.293442, GIOU: 0.144108), Class: 0.572798, Obj: 0.576171, No Obj: 0.543362, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 344.742676, iou_loss = 3.919250, total_loss = 348.661926 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.457369, GIOU: 0.411319), Class: 0.498220, Obj: 0.391429, No Obj: 0.490417, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 1109.066528, iou_loss = 1.077026, total_loss = 1110.143555 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.330041, GIOU: 0.330041), Class: 0.516460, Obj: 0.221852, No Obj: 0.543256, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 342.808960, iou_loss = 0.430756, total_loss = 343.239716 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.296755, GIOU: 0.248553), Class: 0.584113, Obj: 0.575963, No Obj: 0.490457, .5R: 0.000000, .75R: 0.000000, count: 8, class_loss = 1109.135132, iou_loss = 6.633911, total_loss = 1115.769043 \n\n 6: 732.898438, 731.352539 avg loss, 0.000000 rate, 1.528879 seconds, 384 images, 3315.986007 hours left\nLoaded: 0.000057 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.188130, GIOU: -0.205904), Class: 0.437719, Obj: 0.566027, No Obj: 0.545353, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 346.157166, iou_loss = 6.733093, total_loss = 352.890259 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.372951, GIOU: 0.259771), Class: 0.554726, Obj: 0.499940, No Obj: 0.490149, .5R: 0.100000, .75R: 0.000000, count: 10, class_loss = 1106.787598, iou_loss = 5.066406, total_loss = 1111.854004 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.270021, GIOU: 0.005463), Class: 0.611323, Obj: 0.698953, No Obj: 0.543792, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 343.628876, iou_loss = 2.968597, total_loss = 346.597473 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.305300, GIOU: 0.265879), Class: 0.600729, Obj: 0.573976, No Obj: 0.490407, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 1107.113770, iou_loss = 1.751343, total_loss = 1108.865112 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.421217, GIOU: 0.310914), Class: 0.433072, Obj: 0.565050, No Obj: 0.544193, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 344.819458, iou_loss = 1.603455, total_loss = 346.422913 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.334777, GIOU: 0.126512), Class: 0.448996, Obj: 0.441384, No Obj: 0.490459, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 1108.131714, iou_loss = 4.465820, total_loss = 1112.597534 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.385415, GIOU: 0.248098), Class: 0.531527, Obj: 0.461987, No Obj: 0.544218, .5R: 0.200000, .75R: 0.000000, count: 10, class_loss = 344.978577, iou_loss = 7.515167, total_loss = 352.493744 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.229424, GIOU: -0.162641), Class: 0.365954, Obj: 0.613781, No Obj: 0.490195, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 1104.421753, iou_loss = 4.352661, total_loss = 1108.774414 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.237627, GIOU: 0.009587), Class: 0.493529, Obj: 0.613042, No Obj: 0.542673, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 342.443817, iou_loss = 4.225525, total_loss = 346.669342 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.491280, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1112.857544, iou_loss = 0.000000, total_loss = 1112.857544 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.424012, GIOU: 0.337306), Class: 0.427902, Obj: 0.387785, No Obj: 0.546930, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 349.881592, iou_loss = 2.012878, total_loss = 351.894470 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.490608, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1106.088379, iou_loss = 0.000000, total_loss = 1106.088379 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.244731, GIOU: -0.136835), Class: 0.428297, Obj: 0.612762, No Obj: 0.545252, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 346.551392, iou_loss = 5.372833, total_loss = 351.924225 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.229151, GIOU: 0.195360), Class: 0.649678, Obj: 0.386377, No Obj: 0.490103, .5R: 0.000000, .75R: 0.000000, count: 7, class_loss = 1108.629272, iou_loss = 6.655640, total_loss = 1115.284912 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.257348, GIOU: 0.240446), Class: 0.637156, Obj: 0.591864, No Obj: 0.542535, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 343.251526, iou_loss = 4.318298, total_loss = 347.569824 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.418837, GIOU: 0.352800), Class: 0.677804, Obj: 0.385074, No Obj: 0.490824, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 1108.792358, iou_loss = 1.203735, total_loss = 1109.996094 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.491874, GIOU: 0.380539), Class: 0.571960, Obj: 0.575547, No Obj: 0.543722, .5R: 0.666667, .75R: 0.000000, count: 3, class_loss = 346.307617, iou_loss = 1.168060, total_loss = 347.475677 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.306891, GIOU: 0.144811), Class: 0.500822, Obj: 0.466478, No Obj: 0.489885, .5R: 0.125000, .75R: 0.000000, count: 8, class_loss = 1105.868164, iou_loss = 6.334839, total_loss = 1112.203003 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.523212, GIOU: 0.503668), Class: 0.368828, Obj: 0.585991, No Obj: 0.542457, .5R: 0.750000, .75R: 0.000000, count: 4, class_loss = 344.514069, iou_loss = 1.414093, total_loss = 345.928162 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.491817, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1115.973511, iou_loss = 0.000000, total_loss = 1115.973511 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.241594, GIOU: 0.085676), Class: 0.565528, Obj: 0.627898, No Obj: 0.545290, .5R: 0.000000, .75R: 0.000000, count: 10, class_loss = 347.715271, iou_loss = 11.847809, total_loss = 359.563080 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.342212, GIOU: 0.254972), Class: 0.605917, Obj: 0.489980, No Obj: 0.490054, .5R: 0.222222, .75R: 0.000000, count: 18, class_loss = 1108.819092, iou_loss = 12.831177, total_loss = 1121.650269 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.483222, GIOU: 0.419995), Class: 0.583954, Obj: 0.394614, No Obj: 0.544888, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 347.763580, iou_loss = 0.846710, total_loss = 348.610291 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.326731, GIOU: 0.274500), Class: 0.535724, Obj: 0.439939, No Obj: 0.490063, .5R: 0.142857, .75R: 0.000000, count: 21, class_loss = 1108.463623, iou_loss = 15.672363, total_loss = 1124.135986 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.359014, GIOU: 0.239289), Class: 0.686947, Obj: 0.433249, No Obj: 0.543508, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 344.629425, iou_loss = 2.614410, total_loss = 347.243835 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.497730, GIOU: 0.465888), Class: 0.559099, Obj: 0.682712, No Obj: 0.490327, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 1108.170776, iou_loss = 0.623413, total_loss = 1108.794189 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.222367, GIOU: -0.056346), Class: 0.499040, Obj: 0.577289, No Obj: 0.544761, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 347.328491, iou_loss = 9.295349, total_loss = 356.623840 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.015088, GIOU: -0.098404), Class: 0.689101, Obj: 0.419230, No Obj: 0.490104, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1106.929443, iou_loss = 0.275269, total_loss = 1107.204712 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.434937, GIOU: 0.320289), Class: 0.636126, Obj: 0.729559, No Obj: 0.543249, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 345.219788, iou_loss = 0.851624, total_loss = 346.071411 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.458889, GIOU: 0.388928), Class: 0.540403, Obj: 0.520414, No Obj: 0.491288, .5R: 0.411765, .75R: 0.058824, count: 17, class_loss = 1112.468262, iou_loss = 6.118164, total_loss = 1118.586426 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.343812, GIOU: 0.207924), Class: 0.537980, Obj: 0.461221, No Obj: 0.543873, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 345.516205, iou_loss = 3.867432, total_loss = 349.383636 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.419927, GIOU: 0.250199), Class: 0.697107, Obj: 0.413299, No Obj: 0.490702, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 1109.825562, iou_loss = 1.831787, total_loss = 1111.657349 \n\n 7: 731.371460, 731.354431 avg loss, 0.000000 rate, 1.523806 seconds, 448 images, 3304.070028 hours left\nLoaded: 0.000053 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.284791, GIOU: 0.182205), Class: 0.520734, Obj: 0.472527, No Obj: 0.544891, .5R: 0.125000, .75R: 0.000000, count: 8, class_loss = 345.532501, iou_loss = 7.704834, total_loss = 353.237335 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.340842, GIOU: 0.284682), Class: 0.498854, Obj: 0.250583, No Obj: 0.490202, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 1108.273926, iou_loss = 1.225586, total_loss = 1109.499512 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.311401, GIOU: 0.262611), Class: 0.787767, Obj: 0.505830, No Obj: 0.543146, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 346.286621, iou_loss = 0.560181, total_loss = 346.846802 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.381668, GIOU: 0.289804), Class: 0.559079, Obj: 0.402018, No Obj: 0.489002, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 1104.070679, iou_loss = 3.644531, total_loss = 1107.715210 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.324703, GIOU: 0.154837), Class: 0.556038, Obj: 0.420025, No Obj: 0.544053, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 348.339111, iou_loss = 1.213745, total_loss = 349.552856 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.285239, GIOU: 0.137824), Class: 0.438439, Obj: 0.592648, No Obj: 0.489681, .5R: 0.100000, .75R: 0.000000, count: 10, class_loss = 1104.603271, iou_loss = 9.094604, total_loss = 1113.697876 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.341609, GIOU: 0.282202), Class: 0.501217, Obj: 0.492929, No Obj: 0.542419, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 344.160065, iou_loss = 3.269379, total_loss = 347.429443 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.619625, GIOU: 0.601224), Class: 0.662522, Obj: 0.419302, No Obj: 0.491868, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 1113.727905, iou_loss = 0.151733, total_loss = 1113.879639 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.376399, GIOU: 0.289772), Class: 0.569357, Obj: 0.448479, No Obj: 0.544963, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 347.013763, iou_loss = 0.971802, total_loss = 347.985565 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.333162, GIOU: 0.275621), Class: 0.645249, Obj: 0.262088, No Obj: 0.490898, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 1111.688843, iou_loss = 2.513428, total_loss = 1114.202271 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.208283, GIOU: 0.193588), Class: 0.252772, Obj: 0.616910, No Obj: 0.543691, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 346.866028, iou_loss = 2.034973, total_loss = 348.901001 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.448856, GIOU: 0.439027), Class: 0.516587, Obj: 0.497546, No Obj: 0.489928, .5R: 0.666667, .75R: 0.000000, count: 3, class_loss = 1106.673096, iou_loss = 1.949341, total_loss = 1108.622437 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.369201, GIOU: 0.278910), Class: 0.586387, Obj: 0.469085, No Obj: 0.545008, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 347.392548, iou_loss = 3.145874, total_loss = 350.538422 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.382738, GIOU: 0.338731), Class: 0.569613, Obj: 0.456674, No Obj: 0.490296, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 1105.755249, iou_loss = 1.423218, total_loss = 1107.178467 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.371595, GIOU: 0.184067), Class: 0.586068, Obj: 0.510793, No Obj: 0.543522, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 347.180145, iou_loss = 3.198456, total_loss = 350.378601 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.352827, GIOU: 0.260444), Class: 0.574691, Obj: 0.499669, No Obj: 0.490104, .5R: 0.133333, .75R: 0.000000, count: 30, class_loss = 1108.672729, iou_loss = 17.328857, total_loss = 1126.001587 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.421957, GIOU: 0.350343), Class: 0.366722, Obj: 0.686252, No Obj: 0.543356, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 345.067291, iou_loss = 1.522797, total_loss = 346.590088 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.367289, GIOU: 0.355503), Class: 0.478254, Obj: 0.419592, No Obj: 0.489890, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 1105.521606, iou_loss = 2.542236, total_loss = 1108.063843 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.315667, GIOU: 0.231999), Class: 0.496441, Obj: 0.545818, No Obj: 0.542954, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 343.966553, iou_loss = 6.340637, total_loss = 350.307190 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.365098, GIOU: 0.240626), Class: 0.598754, Obj: 0.529570, No Obj: 0.490439, .5R: 0.190476, .75R: 0.047619, count: 21, class_loss = 1106.648560, iou_loss = 15.596313, total_loss = 1122.244873 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.379858, GIOU: 0.139014), Class: 0.635066, Obj: 0.437077, No Obj: 0.542751, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 341.800873, iou_loss = 3.493134, total_loss = 345.294006 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.267219, GIOU: 0.115989), Class: 0.444629, Obj: 0.528989, No Obj: 0.490864, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 1107.829956, iou_loss = 4.451416, total_loss = 1112.281372 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.276951, GIOU: 0.045616), Class: 0.449526, Obj: 0.668059, No Obj: 0.542805, .5R: 0.100000, .75R: 0.000000, count: 10, class_loss = 343.201111, iou_loss = 11.355713, total_loss = 354.556824 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.326185, GIOU: 0.146455), Class: 0.427167, Obj: 0.456502, No Obj: 0.490751, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 1110.416382, iou_loss = 6.945068, total_loss = 1117.361450 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.473641, GIOU: 0.436873), Class: 0.579669, Obj: 0.685047, No Obj: 0.540235, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 342.930511, iou_loss = 0.985809, total_loss = 343.916321 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.359347, GIOU: 0.241289), Class: 0.549338, Obj: 0.497893, No Obj: 0.490726, .5R: 0.187500, .75R: 0.000000, count: 16, class_loss = 1110.146118, iou_loss = 8.992798, total_loss = 1119.138916 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.205020, GIOU: -0.016470), Class: 0.462123, Obj: 0.609526, No Obj: 0.543525, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 348.587921, iou_loss = 9.540527, total_loss = 358.128448 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.341023, GIOU: 0.155856), Class: 0.534167, Obj: 0.588961, No Obj: 0.490546, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 1107.801880, iou_loss = 2.982910, total_loss = 1110.784790 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.346046, GIOU: 0.265175), Class: 0.262696, Obj: 0.551643, No Obj: 0.545323, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 345.455872, iou_loss = 0.982391, total_loss = 346.438263 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.266071, GIOU: 0.077596), Class: 0.556194, Obj: 0.554441, No Obj: 0.490216, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 1107.363525, iou_loss = 4.748657, total_loss = 1112.112183 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.243105, GIOU: -0.013128), Class: 0.531280, Obj: 0.688471, No Obj: 0.544596, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 347.092499, iou_loss = 8.029572, total_loss = 355.122070 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.514341, GIOU: 0.445062), Class: 0.486029, Obj: 0.393690, No Obj: 0.489713, .5R: 0.666667, .75R: 0.000000, count: 3, class_loss = 1102.780396, iou_loss = 1.179443, total_loss = 1103.959839 \n\n 8: 731.311523, 731.350159 avg loss, 0.000000 rate, 1.503859 seconds, 512 images, 3292.202821 hours left\nLoaded: 0.000046 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.410574, GIOU: 0.255626), Class: 0.518504, Obj: 0.572912, No Obj: 0.543535, .5R: 0.300000, .75R: 0.100000, count: 10, class_loss = 344.835327, iou_loss = 7.194244, total_loss = 352.029572 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.263202, GIOU: 0.134866), Class: 0.536617, Obj: 0.489711, No Obj: 0.490839, .5R: 0.000000, .75R: 0.000000, count: 8, class_loss = 1111.350098, iou_loss = 7.095947, total_loss = 1118.446045 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.416583, GIOU: 0.391014), Class: 0.564436, Obj: 0.454680, No Obj: 0.543986, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 345.368011, iou_loss = 2.006134, total_loss = 347.374146 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.382755, GIOU: 0.342453), Class: 0.661764, Obj: 0.365760, No Obj: 0.489828, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 1102.343872, iou_loss = 1.419800, total_loss = 1103.763672 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.537796, GIOU: 0.531641), Class: 0.535918, Obj: 0.482331, No Obj: 0.542981, .5R: 0.500000, .75R: 0.250000, count: 4, class_loss = 343.330658, iou_loss = 0.983215, total_loss = 344.313873 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.244344, GIOU: 0.023957), Class: 0.468152, Obj: 0.610839, No Obj: 0.490607, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 1108.289429, iou_loss = 5.904785, total_loss = 1114.194214 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.423117, GIOU: 0.284435), Class: 0.619000, Obj: 0.538336, No Obj: 0.544002, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 347.789337, iou_loss = 2.534637, total_loss = 350.323975 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.257241, GIOU: 0.101643), Class: 0.505425, Obj: 0.561722, No Obj: 0.490596, .5R: 0.083333, .75R: 0.000000, count: 12, class_loss = 1108.765747, iou_loss = 10.643188, total_loss = 1119.408936 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.319367, GIOU: 0.014660), Class: 0.420445, Obj: 0.479042, No Obj: 0.543662, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 345.671936, iou_loss = 4.681335, total_loss = 350.353271 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.420322, GIOU: 0.323516), Class: 0.550988, Obj: 0.461281, No Obj: 0.490712, .5R: 0.250000, .75R: 0.125000, count: 8, class_loss = 1110.674927, iou_loss = 3.243652, total_loss = 1113.918579 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.357665, GIOU: 0.156340), Class: 0.491650, Obj: 0.624717, No Obj: 0.544072, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 346.085693, iou_loss = 4.057098, total_loss = 350.142792 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.421796, GIOU: 0.301655), Class: 0.571766, Obj: 0.422114, No Obj: 0.490278, .5R: 0.300000, .75R: 0.000000, count: 10, class_loss = 1105.055176, iou_loss = 4.692383, total_loss = 1109.747559 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.457783, GIOU: 0.326188), Class: 0.504499, Obj: 0.438141, No Obj: 0.543937, .5R: 0.500000, .75R: 0.000000, count: 4, class_loss = 346.445374, iou_loss = 1.836914, total_loss = 348.282288 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.272835, GIOU: 0.194906), Class: 0.531837, Obj: 0.506672, No Obj: 0.490278, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1107.758179, iou_loss = 1.026123, total_loss = 1108.784302 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.273548, GIOU: 0.102461), Class: 0.545585, Obj: 0.629448, No Obj: 0.543746, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 346.519287, iou_loss = 7.965515, total_loss = 354.484802 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.396516, GIOU: 0.307963), Class: 0.527446, Obj: 0.488624, No Obj: 0.489839, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 1104.086060, iou_loss = 1.929810, total_loss = 1106.015869 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.317601, GIOU: 0.239016), Class: 0.511248, Obj: 0.546437, No Obj: 0.543766, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 347.889221, iou_loss = 6.696777, total_loss = 354.585999 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.301479, GIOU: 0.301479), Class: 0.528498, Obj: 0.508003, No Obj: 0.490463, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1109.482544, iou_loss = 0.739868, total_loss = 1110.222412 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.330556, GIOU: 0.194234), Class: 0.479086, Obj: 0.495516, No Obj: 0.545144, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 345.206757, iou_loss = 2.475739, total_loss = 347.682495 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.472463, GIOU: 0.434309), Class: 0.498299, Obj: 0.457959, No Obj: 0.490687, .5R: 0.666667, .75R: 0.000000, count: 3, class_loss = 1106.400269, iou_loss = 3.570923, total_loss = 1109.971191 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.480577, GIOU: 0.409818), Class: 0.512679, Obj: 0.457506, No Obj: 0.543377, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 344.474365, iou_loss = 1.051971, total_loss = 345.526337 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.523515, GIOU: 0.489866), Class: 0.731440, Obj: 0.418679, No Obj: 0.490199, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 1108.021973, iou_loss = 0.234985, total_loss = 1108.256958 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.305391, GIOU: 0.071963), Class: 0.565526, Obj: 0.671167, No Obj: 0.543679, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 343.785522, iou_loss = 4.829315, total_loss = 348.614838 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.444924, GIOU: 0.409373), Class: 0.605685, Obj: 0.449547, No Obj: 0.490694, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1109.490845, iou_loss = 0.229980, total_loss = 1109.720825 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.230264, GIOU: -0.042676), Class: 0.568751, Obj: 0.390263, No Obj: 0.543908, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 343.570953, iou_loss = 4.713776, total_loss = 348.284729 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.425931, GIOU: 0.279699), Class: 0.667392, Obj: 0.357930, No Obj: 0.490494, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 1109.719849, iou_loss = 0.934937, total_loss = 1110.654785 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.309787, GIOU: 0.071089), Class: 0.489634, Obj: 0.443979, No Obj: 0.543419, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 346.223022, iou_loss = 5.625214, total_loss = 351.848236 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.303640, GIOU: 0.262273), Class: 0.514814, Obj: 0.489406, No Obj: 0.490839, .5R: 0.090909, .75R: 0.000000, count: 11, class_loss = 1111.672607, iou_loss = 7.988281, total_loss = 1119.660889 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.433234, GIOU: 0.358947), Class: 0.597321, Obj: 0.513464, No Obj: 0.545487, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 347.070557, iou_loss = 2.278717, total_loss = 349.349274 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.269454, GIOU: 0.269454), Class: 0.492028, Obj: 0.737262, No Obj: 0.490429, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 1106.731201, iou_loss = 1.322021, total_loss = 1108.053223 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.487174, GIOU: 0.437546), Class: 0.614719, Obj: 0.478642, No Obj: 0.543095, .5R: 0.500000, .75R: 0.250000, count: 4, class_loss = 344.605072, iou_loss = 2.894196, total_loss = 347.499268 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.314864, GIOU: 0.261906), Class: 0.604452, Obj: 0.504743, No Obj: 0.490121, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 1107.841187, iou_loss = 4.040283, total_loss = 1111.881470 \n\n 9: 730.418640, 731.257019 avg loss, 0.000000 rate, 1.469138 seconds, 576 images, 3280.177075 hours left\nLoaded: 0.000038 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.345742, GIOU: 0.224233), Class: 0.558380, Obj: 0.548553, No Obj: 0.544088, .5R: 0.428571, .75R: 0.000000, count: 7, class_loss = 345.710510, iou_loss = 9.233582, total_loss = 354.944092 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.490537, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1107.046021, iou_loss = 0.000000, total_loss = 1107.046021 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.410091, GIOU: 0.351471), Class: 0.546848, Obj: 0.528383, No Obj: 0.541319, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 342.897949, iou_loss = 3.093353, total_loss = 345.991302 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.359122, GIOU: 0.303491), Class: 0.524482, Obj: 0.490804, No Obj: 0.490599, .5R: 0.133333, .75R: 0.000000, count: 30, class_loss = 1110.381836, iou_loss = 16.347900, total_loss = 1126.729736 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.435609, GIOU: 0.385545), Class: 0.567186, Obj: 0.652823, No Obj: 0.543233, .5R: 0.333333, .75R: 0.333333, count: 3, class_loss = 344.120728, iou_loss = 1.978668, total_loss = 346.099396 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.180829, GIOU: 0.118883), Class: 0.572551, Obj: 0.392451, No Obj: 0.490725, .5R: 0.000000, .75R: 0.000000, count: 11, class_loss = 1110.672607, iou_loss = 13.586914, total_loss = 1124.259521 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.400037, GIOU: 0.341442), Class: 0.522804, Obj: 0.643279, No Obj: 0.543141, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 342.271301, iou_loss = 1.579224, total_loss = 343.850525 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.491063, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1111.916016, iou_loss = 0.000000, total_loss = 1111.916016 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.331807, GIOU: 0.143712), Class: 0.524305, Obj: 0.650216, No Obj: 0.541858, .5R: 0.000000, .75R: 0.000000, count: 7, class_loss = 343.432617, iou_loss = 5.296539, total_loss = 348.729156 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.269179, GIOU: 0.148649), Class: 0.494695, Obj: 0.517303, No Obj: 0.490345, .5R: 0.083333, .75R: 0.000000, count: 12, class_loss = 1109.280762, iou_loss = 12.000488, total_loss = 1121.281250 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.288284, GIOU: 0.165174), Class: 0.573968, Obj: 0.550604, No Obj: 0.543162, .5R: 0.000000, .75R: 0.000000, count: 11, class_loss = 343.318726, iou_loss = 8.869324, total_loss = 352.188049 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.440130, GIOU: 0.406537), Class: 0.578813, Obj: 0.435349, No Obj: 0.489752, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 1104.019653, iou_loss = 1.115723, total_loss = 1105.135376 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.194272, GIOU: 0.047119), Class: 0.514741, Obj: 0.727159, No Obj: 0.544657, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 346.956635, iou_loss = 4.589783, total_loss = 351.546417 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.271359, GIOU: 0.144573), Class: 0.508272, Obj: 0.370714, No Obj: 0.490484, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 1111.856567, iou_loss = 2.953003, total_loss = 1114.809570 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.190161, GIOU: -0.036380), Class: 0.514352, Obj: 0.524906, No Obj: 0.544279, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 344.008148, iou_loss = 7.420532, total_loss = 351.428680 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.490346, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1107.327515, iou_loss = 0.000000, total_loss = 1107.327515 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.434193, GIOU: 0.285752), Class: 0.606274, Obj: 0.607948, No Obj: 0.544607, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 346.516724, iou_loss = 1.292450, total_loss = 347.809174 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.383902, GIOU: 0.301768), Class: 0.526005, Obj: 0.474168, No Obj: 0.490376, .5R: 0.181818, .75R: 0.000000, count: 11, class_loss = 1105.513794, iou_loss = 6.402222, total_loss = 1111.916016 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.250535, GIOU: 0.085135), Class: 0.465821, Obj: 0.529702, No Obj: 0.544352, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 345.261414, iou_loss = 4.492523, total_loss = 349.753937 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.558377, GIOU: 0.527283), Class: 0.561320, Obj: 0.447476, No Obj: 0.490666, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 1106.982788, iou_loss = 0.153320, total_loss = 1107.136108 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.184902, GIOU: 0.184902), Class: 0.549106, Obj: 0.360136, No Obj: 0.541797, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 347.494934, iou_loss = 1.607269, total_loss = 349.102203 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.277067, GIOU: 0.202010), Class: 0.546416, Obj: 0.436175, No Obj: 0.489791, .5R: 0.100000, .75R: 0.000000, count: 10, class_loss = 1106.853394, iou_loss = 8.504639, total_loss = 1115.358032 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.344643, GIOU: 0.344643), Class: 0.480104, Obj: 0.376477, No Obj: 0.541274, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 343.461517, iou_loss = 0.387939, total_loss = 343.849457 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.374385, GIOU: 0.257098), Class: 0.493089, Obj: 0.410293, No Obj: 0.490767, .5R: 0.333333, .75R: 0.000000, count: 9, class_loss = 1113.164551, iou_loss = 7.038086, total_loss = 1120.202637 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.376360, GIOU: 0.296050), Class: 0.414643, Obj: 0.507355, No Obj: 0.544234, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 347.185394, iou_loss = 3.408112, total_loss = 350.593506 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.287442, GIOU: 0.077851), Class: 0.733407, Obj: 0.379774, No Obj: 0.490630, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 1108.432495, iou_loss = 0.996826, total_loss = 1109.429321 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.302850, GIOU: 0.132064), Class: 0.555208, Obj: 0.619923, No Obj: 0.543088, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 343.817139, iou_loss = 6.021210, total_loss = 349.838348 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.488891, GIOU: 0.434190), Class: 0.490112, Obj: 0.417110, No Obj: 0.490621, .5R: 0.500000, .75R: 0.125000, count: 8, class_loss = 1108.795654, iou_loss = 3.069336, total_loss = 1111.864990 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.321440, GIOU: 0.132987), Class: 0.573832, Obj: 0.477344, No Obj: 0.543765, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 346.647186, iou_loss = 4.234222, total_loss = 350.881409 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.485725, GIOU: 0.481529), Class: 0.560653, Obj: 0.349007, No Obj: 0.490561, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 1108.788330, iou_loss = 1.196167, total_loss = 1109.984497 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.263680, GIOU: 0.055739), Class: 0.633178, Obj: 0.538125, No Obj: 0.542653, .5R: 0.000000, .75R: 0.000000, count: 8, class_loss = 343.655609, iou_loss = 10.121094, total_loss = 353.776703 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.458952, GIOU: 0.367248), Class: 0.595385, Obj: 0.496427, No Obj: 0.490448, .5R: 0.400000, .75R: 0.000000, count: 5, class_loss = 1109.674683, iou_loss = 1.694702, total_loss = 1111.369385 \n\n 10: 731.442139, 731.275513 avg loss, 0.000000 rate, 1.544281 seconds, 640 images, 3267.789044 hours left\nResizing, random_coef = 1.40 \n\n 416 x 416 \n try to allocate additional workspace_size = 24.92 MB \n CUDA allocate done! \nLoaded: 0.000039 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.362193, GIOU: 0.252794), Class: 0.549747, Obj: 0.642603, No Obj: 0.543082, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 160.660980, iou_loss = 2.540054, total_loss = 163.201035 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.464081, GIOU: 0.385902), Class: 0.602115, Obj: 0.477492, No Obj: 0.489744, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 518.085693, iou_loss = 2.055054, total_loss = 520.140747 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.501916, GIOU: 0.451029), Class: 0.515520, Obj: 0.587941, No Obj: 0.542622, .5R: 0.750000, .75R: 0.000000, count: 4, class_loss = 163.516510, iou_loss = 1.073181, total_loss = 164.589691 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.266012, GIOU: 0.115430), Class: 0.565336, Obj: 0.540658, No Obj: 0.490109, .5R: 0.037037, .75R: 0.000000, count: 27, class_loss = 520.280090, iou_loss = 25.146423, total_loss = 545.426514 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.460280, GIOU: 0.369957), Class: 0.543062, Obj: 0.482017, No Obj: 0.543165, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 162.565460, iou_loss = 1.206390, total_loss = 163.771851 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.221379, GIOU: 0.105877), Class: 0.509444, Obj: 0.513569, No Obj: 0.490595, .5R: 0.000000, .75R: 0.000000, count: 16, class_loss = 521.349792, iou_loss = 14.583435, total_loss = 535.933228 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.353976, GIOU: 0.318678), Class: 0.627222, Obj: 0.557505, No Obj: 0.542867, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.177078, iou_loss = 1.178391, total_loss = 163.355469 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.318440, GIOU: 0.206192), Class: 0.495352, Obj: 0.513605, No Obj: 0.490234, .5R: 0.125000, .75R: 0.000000, count: 8, class_loss = 519.817627, iou_loss = 6.685486, total_loss = 526.503113 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.541819, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.943130, iou_loss = 0.000000, total_loss = 161.943130 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.365259, GIOU: 0.329845), Class: 0.593552, Obj: 0.436834, No Obj: 0.490254, .5R: 0.250000, .75R: 0.250000, count: 4, class_loss = 517.090698, iou_loss = 3.178955, total_loss = 520.269653 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.280895, GIOU: 0.038575), Class: 0.621151, Obj: 0.606903, No Obj: 0.543563, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 160.325012, iou_loss = 4.902313, total_loss = 165.227325 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.414131, GIOU: 0.336089), Class: 0.523229, Obj: 0.493372, No Obj: 0.490283, .5R: 0.250000, .75R: 0.000000, count: 16, class_loss = 520.030640, iou_loss = 5.911621, total_loss = 525.942261 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.332957, GIOU: 0.110684), Class: 0.572688, Obj: 0.432341, No Obj: 0.544286, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 161.756729, iou_loss = 2.941422, total_loss = 164.698151 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.622152, GIOU: 0.607716), Class: 0.684981, Obj: 0.375436, No Obj: 0.490139, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 518.342224, iou_loss = 0.112427, total_loss = 518.454651 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.203988, GIOU: -0.175154), Class: 0.524866, Obj: 0.668047, No Obj: 0.543902, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 162.587967, iou_loss = 8.758957, total_loss = 171.346924 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.239011, GIOU: -0.007346), Class: 0.369257, Obj: 0.445343, No Obj: 0.490650, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 519.033569, iou_loss = 2.591064, total_loss = 521.624634 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.195292, GIOU: -0.008243), Class: 0.763679, Obj: 0.338179, No Obj: 0.541323, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.727203, iou_loss = 1.446213, total_loss = 163.173416 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.272923, GIOU: 0.174134), Class: 0.479828, Obj: 0.493257, No Obj: 0.489384, .5R: 0.153846, .75R: 0.000000, count: 26, class_loss = 520.767944, iou_loss = 17.077209, total_loss = 537.845154 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.324126, GIOU: 0.103790), Class: 0.381596, Obj: 0.494140, No Obj: 0.543079, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 161.709167, iou_loss = 3.258423, total_loss = 164.967590 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.341052, GIOU: 0.203502), Class: 0.484697, Obj: 0.518907, No Obj: 0.490046, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 519.055237, iou_loss = 4.507141, total_loss = 523.562378 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.140794, GIOU: -0.270427), Class: 0.600821, Obj: 0.657174, No Obj: 0.545144, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.919128, iou_loss = 5.122894, total_loss = 167.042023 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.287440, GIOU: 0.185759), Class: 0.594833, Obj: 0.468255, No Obj: 0.490492, .5R: 0.111111, .75R: 0.000000, count: 9, class_loss = 518.425476, iou_loss = 7.602722, total_loss = 526.028198 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.458064, GIOU: 0.365797), Class: 0.447841, Obj: 0.384840, No Obj: 0.543989, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 163.120758, iou_loss = 0.749329, total_loss = 163.870087 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.339878, GIOU: 0.339878), Class: 0.401668, Obj: 0.465984, No Obj: 0.490892, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 520.016724, iou_loss = 1.835693, total_loss = 521.852417 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.267971, GIOU: 0.120809), Class: 0.471533, Obj: 0.383352, No Obj: 0.546234, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 163.377640, iou_loss = 3.269089, total_loss = 166.646729 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.397589, GIOU: 0.345897), Class: 0.492527, Obj: 0.530234, No Obj: 0.490652, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 519.122925, iou_loss = 1.593079, total_loss = 520.716003 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.264906, GIOU: 0.060675), Class: 0.683333, Obj: 0.531646, No Obj: 0.543475, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 162.517639, iou_loss = 5.066788, total_loss = 167.584427 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.495978, GIOU: 0.465022), Class: 0.493689, Obj: 0.558307, No Obj: 0.489237, .5R: 0.666667, .75R: 0.000000, count: 6, class_loss = 517.273438, iou_loss = 1.906433, total_loss = 519.179871 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.471002, GIOU: 0.308637), Class: 0.654564, Obj: 0.534650, No Obj: 0.543246, .5R: 0.500000, .75R: 0.000000, count: 4, class_loss = 161.394775, iou_loss = 2.536011, total_loss = 163.930786 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.335219, GIOU: 0.213986), Class: 0.543148, Obj: 0.422321, No Obj: 0.490879, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 520.366821, iou_loss = 2.683960, total_loss = 523.050781 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.275833, GIOU: 0.112842), Class: 0.589311, Obj: 0.433506, No Obj: 0.545104, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 163.292374, iou_loss = 2.879669, total_loss = 166.172043 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.454297, GIOU: 0.411427), Class: 0.420770, Obj: 0.438926, No Obj: 0.490986, .5R: 0.333333, .75R: 0.000000, count: 12, class_loss = 521.269226, iou_loss = 3.841675, total_loss = 525.110901 \n\n 11: 345.411285, 692.689087 avg loss, 0.000000 rate, 0.872608 seconds, 704 images, 3256.568885 hours left\nLoaded: 0.000036 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.355731, GIOU: 0.125788), Class: 0.518008, Obj: 0.565128, No Obj: 0.544964, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 162.308716, iou_loss = 2.746719, total_loss = 165.055435 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.302376, GIOU: 0.205349), Class: 0.552525, Obj: 0.466713, No Obj: 0.490272, .5R: 0.083333, .75R: 0.000000, count: 24, class_loss = 522.134521, iou_loss = 15.648132, total_loss = 537.782654 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.277758, GIOU: 0.054676), Class: 0.586672, Obj: 0.619453, No Obj: 0.543682, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.090210, iou_loss = 0.870117, total_loss = 162.960327 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.483270, GIOU: 0.452252), Class: 0.494829, Obj: 0.580101, No Obj: 0.489646, .5R: 0.333333, .75R: 0.000000, count: 12, class_loss = 517.337830, iou_loss = 2.942261, total_loss = 520.280090 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.166872, GIOU: 0.166872), Class: 0.647250, Obj: 0.585389, No Obj: 0.543872, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.377182, iou_loss = 1.067001, total_loss = 162.444183 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.239536, GIOU: -0.022124), Class: 0.560611, Obj: 0.469370, No Obj: 0.490222, .5R: 0.125000, .75R: 0.000000, count: 8, class_loss = 517.433228, iou_loss = 10.146973, total_loss = 527.580200 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.329790, GIOU: 0.185551), Class: 0.681540, Obj: 0.608175, No Obj: 0.541068, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 161.187637, iou_loss = 4.393646, total_loss = 165.581284 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.244131, GIOU: 0.035488), Class: 0.474303, Obj: 0.484994, No Obj: 0.490235, .5R: 0.066667, .75R: 0.000000, count: 15, class_loss = 521.002014, iou_loss = 12.910278, total_loss = 533.912292 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.302064, GIOU: 0.119315), Class: 0.585827, Obj: 0.665744, No Obj: 0.543336, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 161.869278, iou_loss = 4.844864, total_loss = 166.714142 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.395980, GIOU: 0.266195), Class: 0.633495, Obj: 0.523680, No Obj: 0.490513, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 517.449097, iou_loss = 2.667236, total_loss = 520.116333 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.169459, GIOU: -0.043689), Class: 0.520668, Obj: 0.422016, No Obj: 0.546192, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 163.401474, iou_loss = 3.867447, total_loss = 167.268921 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.330732, GIOU: 0.175148), Class: 0.534812, Obj: 0.466478, No Obj: 0.491523, .5R: 0.111111, .75R: 0.000000, count: 9, class_loss = 521.690430, iou_loss = 7.919556, total_loss = 529.609985 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.542230, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.053452, iou_loss = 0.000000, total_loss = 162.053452 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.260682, GIOU: 0.129217), Class: 0.534569, Obj: 0.518200, No Obj: 0.489340, .5R: 0.062500, .75R: 0.000000, count: 32, class_loss = 521.112488, iou_loss = 26.110779, total_loss = 547.223267 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.380585, GIOU: 0.272996), Class: 0.609967, Obj: 0.634558, No Obj: 0.545401, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 162.804337, iou_loss = 2.118942, total_loss = 164.923279 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.330073, GIOU: 0.228072), Class: 0.550675, Obj: 0.525376, No Obj: 0.489886, .5R: 0.250000, .75R: 0.000000, count: 20, class_loss = 519.866821, iou_loss = 15.857666, total_loss = 535.724487 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.568603, GIOU: 0.510449), Class: 0.378080, Obj: 0.328649, No Obj: 0.542581, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 161.954208, iou_loss = 0.313095, total_loss = 162.267303 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.219541, GIOU: -0.012815), Class: 0.470221, Obj: 0.506157, No Obj: 0.490748, .5R: 0.000000, .75R: 0.000000, count: 16, class_loss = 521.616272, iou_loss = 18.245056, total_loss = 539.861328 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.467300, GIOU: 0.362807), Class: 0.552195, Obj: 0.478425, No Obj: 0.540321, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 160.468994, iou_loss = 0.239532, total_loss = 160.708527 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.290977, GIOU: 0.070244), Class: 0.465519, Obj: 0.524896, No Obj: 0.490493, .5R: 0.125000, .75R: 0.000000, count: 8, class_loss = 520.214355, iou_loss = 7.480408, total_loss = 527.694763 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.206578, GIOU: 0.082032), Class: 0.590048, Obj: 0.449923, No Obj: 0.542607, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 160.813324, iou_loss = 3.285522, total_loss = 164.098846 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.421537, GIOU: 0.421537), Class: 0.676496, Obj: 0.266281, No Obj: 0.491286, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 519.619324, iou_loss = 0.214905, total_loss = 519.834229 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.382529, GIOU: 0.382350), Class: 0.497459, Obj: 0.432795, No Obj: 0.542127, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 161.798584, iou_loss = 1.556717, total_loss = 163.355301 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.306071, GIOU: 0.282186), Class: 0.452763, Obj: 0.380233, No Obj: 0.490236, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 518.914124, iou_loss = 2.118286, total_loss = 521.032410 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.370039, GIOU: 0.260112), Class: 0.467830, Obj: 0.608880, No Obj: 0.545587, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 161.838715, iou_loss = 2.829636, total_loss = 164.668350 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.437870, GIOU: 0.380557), Class: 0.438325, Obj: 0.410143, No Obj: 0.490583, .5R: 0.222222, .75R: 0.000000, count: 9, class_loss = 519.834412, iou_loss = 3.832336, total_loss = 523.666748 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.416101, GIOU: 0.390925), Class: 0.331037, Obj: 0.390118, No Obj: 0.543970, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 163.921188, iou_loss = 0.811218, total_loss = 164.732407 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.225661, GIOU: 0.070294), Class: 0.498912, Obj: 0.478866, No Obj: 0.490219, .5R: 0.041667, .75R: 0.000000, count: 24, class_loss = 520.947815, iou_loss = 25.808838, total_loss = 546.756653 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.141300, GIOU: -0.395512), Class: 0.504331, Obj: 0.672229, No Obj: 0.543675, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.654755, iou_loss = 2.362289, total_loss = 165.017044 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.395000, GIOU: 0.314285), Class: 0.548106, Obj: 0.538439, No Obj: 0.489823, .5R: 0.190476, .75R: 0.047619, count: 21, class_loss = 518.922241, iou_loss = 9.628784, total_loss = 528.551025 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.296106, GIOU: 0.139665), Class: 0.561958, Obj: 0.570117, No Obj: 0.544937, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 162.333115, iou_loss = 5.122375, total_loss = 167.455490 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.446003, GIOU: 0.392663), Class: 0.574177, Obj: 0.559366, No Obj: 0.489269, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 515.828979, iou_loss = 1.943665, total_loss = 517.772644 \n\n 12: 347.084534, 658.128662 avg loss, 0.000000 rate, 0.859461 seconds, 768 images, 3236.128404 hours left\nLoaded: 0.000036 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.275992, GIOU: -0.004339), Class: 0.780049, Obj: 0.700031, No Obj: 0.541895, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.944901, iou_loss = 0.944733, total_loss = 162.889633 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.268033, GIOU: 0.116302), Class: 0.561033, Obj: 0.467246, No Obj: 0.490284, .5R: 0.090909, .75R: 0.000000, count: 11, class_loss = 519.121887, iou_loss = 11.175781, total_loss = 530.297668 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.401900, GIOU: 0.314825), Class: 0.552362, Obj: 0.464956, No Obj: 0.542475, .5R: 0.250000, .75R: 0.250000, count: 4, class_loss = 162.697250, iou_loss = 3.130463, total_loss = 165.827713 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.296364, GIOU: 0.048658), Class: 0.430927, Obj: 0.476927, No Obj: 0.489354, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 516.568176, iou_loss = 4.425781, total_loss = 520.993958 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.245158, GIOU: -0.030755), Class: 0.583048, Obj: 0.384218, No Obj: 0.542953, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.983047, iou_loss = 2.021378, total_loss = 164.004425 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.293732, GIOU: 0.082538), Class: 0.613163, Obj: 0.420185, No Obj: 0.490929, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 519.574829, iou_loss = 3.633484, total_loss = 523.208313 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.353970, GIOU: 0.353970), Class: 0.557906, Obj: 0.890373, No Obj: 0.542059, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.411133, iou_loss = 0.256409, total_loss = 161.667542 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.254093, GIOU: 0.106967), Class: 0.558756, Obj: 0.537529, No Obj: 0.490258, .5R: 0.045455, .75R: 0.000000, count: 22, class_loss = 520.532410, iou_loss = 17.623718, total_loss = 538.156128 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.392694, GIOU: 0.249760), Class: 0.465651, Obj: 0.509044, No Obj: 0.544717, .5R: 0.285714, .75R: 0.142857, count: 7, class_loss = 163.255157, iou_loss = 4.967377, total_loss = 168.222534 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.465885, GIOU: 0.407577), Class: 0.491338, Obj: 0.455900, No Obj: 0.490194, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 517.491455, iou_loss = 0.917358, total_loss = 518.408813 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.554377, GIOU: 0.428143), Class: 0.514571, Obj: 0.727222, No Obj: 0.544033, .5R: 0.666667, .75R: 0.333333, count: 3, class_loss = 162.276978, iou_loss = 1.377991, total_loss = 163.654968 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.207574, GIOU: 0.150218), Class: 0.638571, Obj: 0.538143, No Obj: 0.490096, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 517.942627, iou_loss = 3.260498, total_loss = 521.203125 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.166057, GIOU: -0.321387), Class: 0.208207, Obj: 0.315427, No Obj: 0.544341, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.653702, iou_loss = 1.743835, total_loss = 164.397537 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.326807, GIOU: 0.187594), Class: 0.573100, Obj: 0.516046, No Obj: 0.489718, .5R: 0.145161, .75R: 0.016129, count: 62, class_loss = 522.915771, iou_loss = 48.492920, total_loss = 571.408691 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.184605, GIOU: -0.163579), Class: 0.495445, Obj: 0.679474, No Obj: 0.541322, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 161.584763, iou_loss = 5.785278, total_loss = 167.370041 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.369436, GIOU: 0.234294), Class: 0.647571, Obj: 0.509754, No Obj: 0.490394, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 519.635681, iou_loss = 2.178955, total_loss = 521.814636 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.251357, GIOU: 0.003324), Class: 0.499597, Obj: 0.603172, No Obj: 0.543529, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 161.746948, iou_loss = 3.282043, total_loss = 165.028992 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.290535, GIOU: 0.228968), Class: 0.683242, Obj: 0.455903, No Obj: 0.490484, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 518.608765, iou_loss = 1.847351, total_loss = 520.456116 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.422532, GIOU: 0.386308), Class: 0.528073, Obj: 0.350468, No Obj: 0.544318, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 162.537628, iou_loss = 0.901520, total_loss = 163.439148 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.268087, GIOU: 0.093713), Class: 0.510577, Obj: 0.478886, No Obj: 0.489654, .5R: 0.028571, .75R: 0.000000, count: 35, class_loss = 521.726013, iou_loss = 29.236511, total_loss = 550.962524 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.423103, GIOU: 0.368396), Class: 0.461750, Obj: 0.440549, No Obj: 0.542530, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.139114, iou_loss = 0.766357, total_loss = 162.905472 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.392277, GIOU: 0.256444), Class: 0.608930, Obj: 0.597601, No Obj: 0.490276, .5R: 0.285714, .75R: 0.000000, count: 7, class_loss = 518.600464, iou_loss = 2.879028, total_loss = 521.479492 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.327405, GIOU: 0.326849), Class: 0.622878, Obj: 0.554208, No Obj: 0.543419, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.120529, iou_loss = 1.581833, total_loss = 162.702362 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.449244, GIOU: 0.400444), Class: 0.547768, Obj: 0.393851, No Obj: 0.490495, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 519.216125, iou_loss = 1.376648, total_loss = 520.592773 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.319803, GIOU: 0.082671), Class: 0.604245, Obj: 0.544518, No Obj: 0.542660, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 160.756210, iou_loss = 3.029526, total_loss = 163.785736 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.368188, GIOU: 0.301678), Class: 0.457441, Obj: 0.459531, No Obj: 0.489913, .5R: 0.230769, .75R: 0.000000, count: 13, class_loss = 520.942810, iou_loss = 8.730896, total_loss = 529.673706 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.398152, GIOU: 0.341624), Class: 0.633229, Obj: 0.566929, No Obj: 0.540045, .5R: 0.142857, .75R: 0.000000, count: 7, class_loss = 160.972900, iou_loss = 3.107086, total_loss = 164.079987 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.266201, GIOU: 0.188616), Class: 0.410802, Obj: 0.509429, No Obj: 0.490990, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 519.440796, iou_loss = 1.021545, total_loss = 520.462341 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.201892, GIOU: 0.057762), Class: 0.467290, Obj: 0.575508, No Obj: 0.542767, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 163.908661, iou_loss = 2.875870, total_loss = 166.784531 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.171794, GIOU: -0.012964), Class: 0.490841, Obj: 0.544490, No Obj: 0.489865, .5R: 0.100000, .75R: 0.000000, count: 20, class_loss = 519.383911, iou_loss = 31.327393, total_loss = 550.711304 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.308607, GIOU: 0.291206), Class: 0.552292, Obj: 0.550580, No Obj: 0.547280, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.703705, iou_loss = 0.788116, total_loss = 163.491821 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.398346, GIOU: 0.314334), Class: 0.577457, Obj: 0.560836, No Obj: 0.491263, .5R: 0.083333, .75R: 0.000000, count: 12, class_loss = 521.627380, iou_loss = 5.099731, total_loss = 526.727112 \n\n 13: 347.400299, 627.055847 avg loss, 0.000000 rate, 0.842231 seconds, 832 images, 3215.709660 hours left\nLoaded: 0.000039 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.370494, GIOU: 0.221522), Class: 0.618865, Obj: 0.578199, No Obj: 0.542552, .5R: 0.222222, .75R: 0.000000, count: 9, class_loss = 161.213913, iou_loss = 6.478683, total_loss = 167.692596 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.325322, GIOU: 0.259410), Class: 0.510955, Obj: 0.437300, No Obj: 0.490799, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 519.626831, iou_loss = 2.872742, total_loss = 522.499573 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.375377, GIOU: 0.361088), Class: 0.566535, Obj: 0.434246, No Obj: 0.542652, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 161.395050, iou_loss = 1.213318, total_loss = 162.608368 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.470776, GIOU: 0.340769), Class: 0.520555, Obj: 0.416311, No Obj: 0.490333, .5R: 0.600000, .75R: 0.000000, count: 5, class_loss = 520.398560, iou_loss = 3.863831, total_loss = 524.262390 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.390430, GIOU: 0.286981), Class: 0.588104, Obj: 0.635804, No Obj: 0.544506, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 161.957581, iou_loss = 4.072510, total_loss = 166.030090 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.327926, GIOU: 0.114341), Class: 0.509875, Obj: 0.560960, No Obj: 0.490725, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 519.513794, iou_loss = 6.403198, total_loss = 525.916992 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.364522, GIOU: 0.364522), Class: 0.512226, Obj: 0.623870, No Obj: 0.542755, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 163.096619, iou_loss = 0.299225, total_loss = 163.395844 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.350589, GIOU: 0.270516), Class: 0.440173, Obj: 0.427565, No Obj: 0.489956, .5R: 0.266667, .75R: 0.000000, count: 15, class_loss = 520.041138, iou_loss = 8.581055, total_loss = 528.622192 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.531357, GIOU: 0.502450), Class: 0.546631, Obj: 0.475498, No Obj: 0.544774, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 162.183838, iou_loss = 0.517715, total_loss = 162.701553 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.465629, GIOU: 0.389782), Class: 0.588531, Obj: 0.326358, No Obj: 0.490706, .5R: 0.500000, .75R: 0.000000, count: 4, class_loss = 518.993591, iou_loss = 1.495422, total_loss = 520.489014 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.450008, GIOU: 0.449105), Class: 0.559474, Obj: 0.378282, No Obj: 0.544379, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 162.104568, iou_loss = 0.961182, total_loss = 163.065750 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.262597, GIOU: 0.013939), Class: 0.525568, Obj: 0.603193, No Obj: 0.490145, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 519.923828, iou_loss = 8.116028, total_loss = 528.039856 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.239365, GIOU: -0.073375), Class: 0.610554, Obj: 0.816037, No Obj: 0.543059, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.065033, iou_loss = 3.073563, total_loss = 165.138596 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.326573, GIOU: 0.131948), Class: 0.607962, Obj: 0.555231, No Obj: 0.490874, .5R: 0.400000, .75R: 0.000000, count: 5, class_loss = 519.531311, iou_loss = 5.200439, total_loss = 524.731750 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.270147, GIOU: 0.127315), Class: 0.466414, Obj: 0.649934, No Obj: 0.542582, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 161.671173, iou_loss = 2.942322, total_loss = 164.613495 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.376388, GIOU: 0.276240), Class: 0.539564, Obj: 0.342892, No Obj: 0.490527, .5R: 0.428571, .75R: 0.000000, count: 7, class_loss = 520.082886, iou_loss = 4.140320, total_loss = 524.223206 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.222051, GIOU: -0.019745), Class: 0.597126, Obj: 0.456016, No Obj: 0.544104, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 163.255173, iou_loss = 3.630966, total_loss = 166.886139 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.413218, GIOU: 0.320358), Class: 0.451850, Obj: 0.422901, No Obj: 0.490010, .5R: 0.181818, .75R: 0.000000, count: 11, class_loss = 518.587341, iou_loss = 5.806458, total_loss = 524.393799 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.261828, GIOU: 0.125389), Class: 0.593247, Obj: 0.402168, No Obj: 0.543477, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 161.304596, iou_loss = 4.189926, total_loss = 165.494522 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.405973, GIOU: 0.292900), Class: 0.447114, Obj: 0.396917, No Obj: 0.489350, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 517.663635, iou_loss = 1.834900, total_loss = 519.498535 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.513423, GIOU: 0.505821), Class: 0.664643, Obj: 0.513199, No Obj: 0.543767, .5R: 0.500000, .75R: 0.500000, count: 2, class_loss = 162.904770, iou_loss = 0.647415, total_loss = 163.552185 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.143278, GIOU: -0.097378), Class: 0.683384, Obj: 0.619013, No Obj: 0.489629, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 516.907837, iou_loss = 10.635986, total_loss = 527.543823 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.309201, GIOU: 0.309201), Class: 0.757750, Obj: 0.377576, No Obj: 0.543381, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 163.115753, iou_loss = 0.350204, total_loss = 163.465958 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.293913, GIOU: 0.088817), Class: 0.561663, Obj: 0.513037, No Obj: 0.489880, .5R: 0.187500, .75R: 0.000000, count: 16, class_loss = 520.291870, iou_loss = 20.299927, total_loss = 540.591797 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.231786, GIOU: -0.065286), Class: 0.366032, Obj: 0.733454, No Obj: 0.541150, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.929001, iou_loss = 1.117294, total_loss = 163.046295 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.197336, GIOU: 0.026998), Class: 0.629108, Obj: 0.733727, No Obj: 0.490298, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 517.583130, iou_loss = 2.662537, total_loss = 520.245667 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.182161, GIOU: 0.047891), Class: 0.472821, Obj: 0.607924, No Obj: 0.543627, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 163.477371, iou_loss = 3.400864, total_loss = 166.878235 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.365633, GIOU: 0.256906), Class: 0.525960, Obj: 0.447552, No Obj: 0.489445, .5R: 0.172414, .75R: 0.000000, count: 29, class_loss = 521.406372, iou_loss = 15.707214, total_loss = 537.113586 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.292203, GIOU: 0.153747), Class: 0.468030, Obj: 0.598082, No Obj: 0.543543, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 163.345215, iou_loss = 6.569244, total_loss = 169.914459 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.403932, GIOU: 0.403933), Class: 0.525327, Obj: 0.380256, No Obj: 0.490546, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 519.039429, iou_loss = 0.372070, total_loss = 519.411499 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.540574, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 160.508850, iou_loss = 0.000000, total_loss = 160.508850 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.243160, GIOU: 0.088303), Class: 0.461499, Obj: 0.550151, No Obj: 0.490352, .5R: 0.117647, .75R: 0.000000, count: 17, class_loss = 521.031189, iou_loss = 12.165161, total_loss = 533.196350 \n\n 14: 345.492920, 598.899536 avg loss, 0.000000 rate, 0.837938 seconds, 896 images, 3195.255627 hours left\nLoaded: 0.000057 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.348937, GIOU: 0.172324), Class: 0.579520, Obj: 0.536918, No Obj: 0.544793, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 162.152695, iou_loss = 3.060593, total_loss = 165.213287 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.381852, GIOU: 0.279613), Class: 0.548399, Obj: 0.528776, No Obj: 0.489749, .5R: 0.230769, .75R: 0.000000, count: 26, class_loss = 520.613525, iou_loss = 13.068481, total_loss = 533.682007 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.240914, GIOU: -0.010090), Class: 0.491467, Obj: 0.571249, No Obj: 0.542555, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 162.378235, iou_loss = 6.726547, total_loss = 169.104782 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.321971, GIOU: 0.164222), Class: 0.536792, Obj: 0.473448, No Obj: 0.490154, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 519.862854, iou_loss = 2.338928, total_loss = 522.201782 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.208344, GIOU: -0.127353), Class: 0.720029, Obj: 0.651771, No Obj: 0.542290, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 163.365860, iou_loss = 1.235519, total_loss = 164.601379 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.238847, GIOU: 0.139614), Class: 0.610232, Obj: 0.542235, No Obj: 0.491445, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 520.227417, iou_loss = 5.396484, total_loss = 525.623901 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.487911, GIOU: 0.378003), Class: 0.454511, Obj: 0.552772, No Obj: 0.540729, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.870544, iou_loss = 0.408020, total_loss = 162.278564 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.238103, GIOU: 0.098883), Class: 0.577750, Obj: 0.529095, No Obj: 0.490693, .5R: 0.071429, .75R: 0.000000, count: 14, class_loss = 520.177551, iou_loss = 12.895630, total_loss = 533.073181 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.370331, GIOU: 0.309266), Class: 0.525079, Obj: 0.585018, No Obj: 0.544561, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.212448, iou_loss = 0.831604, total_loss = 163.044052 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.459539, GIOU: 0.432084), Class: 0.708754, Obj: 0.524561, No Obj: 0.490400, .5R: 0.428571, .75R: 0.000000, count: 7, class_loss = 518.401978, iou_loss = 3.668579, total_loss = 522.070557 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.351689, GIOU: 0.194077), Class: 0.467682, Obj: 0.629157, No Obj: 0.543880, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 161.281342, iou_loss = 2.976501, total_loss = 164.257843 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.363472, GIOU: 0.148461), Class: 0.486631, Obj: 0.433773, No Obj: 0.489351, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 517.417297, iou_loss = 1.885193, total_loss = 519.302490 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.286236, GIOU: 0.286236), Class: 0.476282, Obj: 0.578512, No Obj: 0.546367, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.336700, iou_loss = 0.668900, total_loss = 163.005600 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.403714, GIOU: 0.317914), Class: 0.549443, Obj: 0.426878, No Obj: 0.489556, .5R: 0.272727, .75R: 0.000000, count: 11, class_loss = 518.117737, iou_loss = 4.691101, total_loss = 522.808838 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.258988, GIOU: -0.046419), Class: 0.550385, Obj: 0.354290, No Obj: 0.541058, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 160.845230, iou_loss = 0.893555, total_loss = 161.738785 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.258290, GIOU: 0.147042), Class: 0.601301, Obj: 0.579039, No Obj: 0.490295, .5R: 0.052632, .75R: 0.000000, count: 19, class_loss = 518.693237, iou_loss = 16.844604, total_loss = 535.537842 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.443540, GIOU: 0.443540), Class: 0.477521, Obj: 0.430247, No Obj: 0.538911, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 161.504272, iou_loss = 0.455826, total_loss = 161.960098 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.273203, GIOU: 0.047494), Class: 0.554806, Obj: 0.606227, No Obj: 0.490052, .5R: 0.000000, .75R: 0.000000, count: 10, class_loss = 519.316650, iou_loss = 9.816895, total_loss = 529.133545 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.326812, GIOU: 0.262119), Class: 0.423370, Obj: 0.345488, No Obj: 0.542183, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 162.152145, iou_loss = 1.530991, total_loss = 163.683136 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.263570, GIOU: 0.129103), Class: 0.614880, Obj: 0.530397, No Obj: 0.490781, .5R: 0.115385, .75R: 0.000000, count: 26, class_loss = 522.232971, iou_loss = 28.148865, total_loss = 550.381836 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.348819, GIOU: 0.103176), Class: 0.507858, Obj: 0.580886, No Obj: 0.543745, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 162.138336, iou_loss = 2.589859, total_loss = 164.728195 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.449999, GIOU: 0.447031), Class: 0.674438, Obj: 0.329266, No Obj: 0.490992, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 519.347961, iou_loss = 0.708313, total_loss = 520.056274 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.275711, GIOU: -0.027125), Class: 0.441198, Obj: 0.488709, No Obj: 0.543812, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 162.913361, iou_loss = 3.695572, total_loss = 166.608932 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.322486, GIOU: 0.223042), Class: 0.548370, Obj: 0.545378, No Obj: 0.489953, .5R: 0.200000, .75R: 0.000000, count: 10, class_loss = 518.864014, iou_loss = 6.345032, total_loss = 525.209045 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.417479, GIOU: 0.224303), Class: 0.552959, Obj: 0.387959, No Obj: 0.544011, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 160.819458, iou_loss = 1.216537, total_loss = 162.035995 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.352650, GIOU: 0.230595), Class: 0.545058, Obj: 0.430751, No Obj: 0.490287, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 517.054260, iou_loss = 1.784241, total_loss = 518.838501 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.253829, GIOU: 0.007192), Class: 0.576110, Obj: 0.623378, No Obj: 0.544336, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.564758, iou_loss = 2.079208, total_loss = 164.643967 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.310807, GIOU: 0.073462), Class: 0.460505, Obj: 0.416440, No Obj: 0.490082, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 519.016541, iou_loss = 9.382874, total_loss = 528.399414 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.540889, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.813370, iou_loss = 0.000000, total_loss = 161.813370 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.404900, GIOU: 0.262078), Class: 0.547138, Obj: 0.512726, No Obj: 0.490379, .5R: 0.285714, .75R: 0.000000, count: 14, class_loss = 520.827271, iou_loss = 9.797852, total_loss = 530.625122 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.295925, GIOU: 0.055151), Class: 0.637128, Obj: 0.617523, No Obj: 0.543683, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.771240, iou_loss = 0.727173, total_loss = 163.498413 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.343027, GIOU: 0.269813), Class: 0.522374, Obj: 0.398233, No Obj: 0.489909, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 517.702515, iou_loss = 4.417480, total_loss = 522.119995 \n\n 15: 345.665039, 573.576111 avg loss, 0.000000 rate, 0.854867 seconds, 960 images, 3174.946567 hours left\nLoaded: 0.000035 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.348922, GIOU: 0.312242), Class: 0.444135, Obj: 0.666642, No Obj: 0.545629, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 163.823776, iou_loss = 0.564926, total_loss = 164.388702 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.368395, GIOU: 0.237311), Class: 0.560006, Obj: 0.495113, No Obj: 0.489889, .5R: 0.250000, .75R: 0.000000, count: 20, class_loss = 519.400024, iou_loss = 12.752686, total_loss = 532.152710 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.173016, GIOU: -0.285101), Class: 0.665104, Obj: 0.381906, No Obj: 0.543343, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.400452, iou_loss = 1.729416, total_loss = 163.129868 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.379026, GIOU: 0.263264), Class: 0.563751, Obj: 0.489468, No Obj: 0.490306, .5R: 0.333333, .75R: 0.000000, count: 18, class_loss = 521.587952, iou_loss = 19.878540, total_loss = 541.466492 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.315247, GIOU: 0.289802), Class: 0.671979, Obj: 0.435481, No Obj: 0.541907, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 160.558212, iou_loss = 1.301697, total_loss = 161.859909 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.302069, GIOU: 0.201592), Class: 0.505019, Obj: 0.389037, No Obj: 0.490163, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 519.024048, iou_loss = 3.406616, total_loss = 522.430664 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.345138, GIOU: 0.250979), Class: 0.666576, Obj: 0.297749, No Obj: 0.545411, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 164.318741, iou_loss = 1.087494, total_loss = 165.406235 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.375529, GIOU: 0.225934), Class: 0.490331, Obj: 0.339305, No Obj: 0.489906, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 517.822510, iou_loss = 2.000427, total_loss = 519.822937 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.163714, GIOU: 0.136726), Class: 0.491556, Obj: 0.645655, No Obj: 0.545134, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 162.374405, iou_loss = 5.044876, total_loss = 167.419281 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.270852, GIOU: 0.116967), Class: 0.613811, Obj: 0.442962, No Obj: 0.490343, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 519.823608, iou_loss = 3.382446, total_loss = 523.206055 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.201892, GIOU: -0.028218), Class: 0.455760, Obj: 0.544164, No Obj: 0.543834, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 161.922775, iou_loss = 5.732010, total_loss = 167.654785 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.383070, GIOU: 0.205178), Class: 0.471301, Obj: 0.515147, No Obj: 0.490129, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 518.740479, iou_loss = 2.513794, total_loss = 521.254272 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.375625, GIOU: 0.221624), Class: 0.406465, Obj: 0.391155, No Obj: 0.543603, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.261261, iou_loss = 1.502472, total_loss = 162.763733 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.343431, GIOU: 0.288911), Class: 0.451909, Obj: 0.476597, No Obj: 0.490391, .5R: 0.076923, .75R: 0.000000, count: 13, class_loss = 518.857727, iou_loss = 7.547424, total_loss = 526.405151 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.185932, GIOU: 0.185932), Class: 0.369204, Obj: 0.342417, No Obj: 0.541560, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.898636, iou_loss = 0.862717, total_loss = 163.761353 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.292010, GIOU: 0.227717), Class: 0.641852, Obj: 0.460198, No Obj: 0.489973, .5R: 0.200000, .75R: 0.000000, count: 10, class_loss = 517.556396, iou_loss = 9.920715, total_loss = 527.477112 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.226142, GIOU: 0.030143), Class: 0.334788, Obj: 0.382443, No Obj: 0.543688, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.727570, iou_loss = 1.867386, total_loss = 164.594955 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.316100, GIOU: 0.256178), Class: 0.605926, Obj: 0.491788, No Obj: 0.490354, .5R: 0.000000, .75R: 0.000000, count: 9, class_loss = 520.553223, iou_loss = 6.602295, total_loss = 527.155518 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.255674, GIOU: 0.068340), Class: 0.378422, Obj: 0.604562, No Obj: 0.542453, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 161.422760, iou_loss = 4.171005, total_loss = 165.593765 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.273151, GIOU: 0.112914), Class: 0.586439, Obj: 0.439180, No Obj: 0.489650, .5R: 0.111111, .75R: 0.000000, count: 18, class_loss = 520.053223, iou_loss = 18.708008, total_loss = 538.761230 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.210043, GIOU: 0.084200), Class: 0.363732, Obj: 0.610545, No Obj: 0.543007, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 160.262695, iou_loss = 2.171494, total_loss = 162.434189 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.378055, GIOU: 0.291721), Class: 0.615111, Obj: 0.468345, No Obj: 0.489846, .5R: 0.571429, .75R: 0.000000, count: 7, class_loss = 518.569580, iou_loss = 3.787292, total_loss = 522.356873 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.446511, GIOU: 0.444566), Class: 0.485088, Obj: 0.573850, No Obj: 0.543994, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 160.780106, iou_loss = 0.441635, total_loss = 161.221741 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.329544, GIOU: 0.162158), Class: 0.545460, Obj: 0.469242, No Obj: 0.490027, .5R: 0.200000, .75R: 0.040000, count: 25, class_loss = 520.567139, iou_loss = 21.365784, total_loss = 541.932922 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.394121, GIOU: 0.371695), Class: 0.594146, Obj: 0.521219, No Obj: 0.543672, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 161.928375, iou_loss = 1.309967, total_loss = 163.238342 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.386536, GIOU: 0.343201), Class: 0.458730, Obj: 0.406024, No Obj: 0.490095, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 517.726807, iou_loss = 1.680908, total_loss = 519.407715 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.294352, GIOU: 0.122676), Class: 0.565336, Obj: 0.637727, No Obj: 0.544205, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 163.227158, iou_loss = 4.719620, total_loss = 167.946777 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.339515, GIOU: 0.211425), Class: 0.545373, Obj: 0.478243, No Obj: 0.490098, .5R: 0.090909, .75R: 0.000000, count: 11, class_loss = 517.657166, iou_loss = 10.242493, total_loss = 527.899658 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.324083, GIOU: 0.156047), Class: 0.517530, Obj: 0.432980, No Obj: 0.542086, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 161.498581, iou_loss = 2.845154, total_loss = 164.343735 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.217391, GIOU: -0.076024), Class: 0.442540, Obj: 0.497726, No Obj: 0.490103, .5R: 0.000000, .75R: 0.000000, count: 15, class_loss = 521.640625, iou_loss = 20.117554, total_loss = 541.758179 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.232894, GIOU: 0.002313), Class: 0.378734, Obj: 0.416389, No Obj: 0.542403, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.463364, iou_loss = 2.360840, total_loss = 163.824203 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.419235, GIOU: 0.340625), Class: 0.525488, Obj: 0.301026, No Obj: 0.490470, .5R: 0.333333, .75R: 0.000000, count: 6, class_loss = 521.033630, iou_loss = 2.723389, total_loss = 523.757019 \n\n 16: 346.463318, 550.864807 avg loss, 0.000000 rate, 0.845436 seconds, 1024 images, 3155.076037 hours left\nLoaded: 0.000057 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.344128, GIOU: 0.232473), Class: 0.490449, Obj: 0.462352, No Obj: 0.541921, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.370499, iou_loss = 1.428253, total_loss = 162.798752 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.254933, GIOU: 0.091643), Class: 0.572607, Obj: 0.580589, No Obj: 0.490626, .5R: 0.083333, .75R: 0.000000, count: 12, class_loss = 520.830627, iou_loss = 13.478333, total_loss = 534.308960 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.236403, GIOU: 0.114764), Class: 0.397167, Obj: 0.417342, No Obj: 0.546440, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 162.866379, iou_loss = 3.628860, total_loss = 166.495239 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.490507, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 518.883362, iou_loss = 0.000000, total_loss = 518.883362 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.334924, GIOU: 0.123567), Class: 0.552111, Obj: 0.533019, No Obj: 0.544003, .5R: 0.000000, .75R: 0.000000, count: 9, class_loss = 162.009888, iou_loss = 8.351288, total_loss = 170.361176 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.327172, GIOU: 0.073569), Class: 0.569910, Obj: 0.434442, No Obj: 0.490228, .5R: 0.333333, .75R: 0.000000, count: 9, class_loss = 519.879700, iou_loss = 9.916199, total_loss = 529.795898 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.192400, GIOU: -0.146728), Class: 0.569161, Obj: 0.586953, No Obj: 0.544764, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.854050, iou_loss = 4.959702, total_loss = 166.813751 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.348681, GIOU: 0.246820), Class: 0.581291, Obj: 0.539578, No Obj: 0.490516, .5R: 0.166667, .75R: 0.000000, count: 6, class_loss = 519.588745, iou_loss = 3.906921, total_loss = 523.495667 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.285612, GIOU: 0.111871), Class: 0.469814, Obj: 0.612770, No Obj: 0.544563, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 161.472595, iou_loss = 2.303375, total_loss = 163.775970 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.348793, GIOU: 0.267142), Class: 0.531015, Obj: 0.405013, No Obj: 0.490112, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 518.864929, iou_loss = 1.823364, total_loss = 520.688293 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.543460, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.909515, iou_loss = 0.000000, total_loss = 162.909515 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.291138, GIOU: 0.184680), Class: 0.590068, Obj: 0.535058, No Obj: 0.490059, .5R: 0.052632, .75R: 0.000000, count: 19, class_loss = 520.492676, iou_loss = 14.194702, total_loss = 534.687378 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.332139, GIOU: 0.194080), Class: 0.473186, Obj: 0.548269, No Obj: 0.542593, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.106949, iou_loss = 1.472229, total_loss = 163.579178 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.477205, GIOU: 0.421563), Class: 0.624401, Obj: 0.237929, No Obj: 0.490471, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 519.261597, iou_loss = 0.692078, total_loss = 519.953674 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.509478, GIOU: 0.438859), Class: 0.343146, Obj: 0.471396, No Obj: 0.541820, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 161.425049, iou_loss = 0.201096, total_loss = 161.626144 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.319178, GIOU: 0.188413), Class: 0.478720, Obj: 0.455776, No Obj: 0.490687, .5R: 0.000000, .75R: 0.000000, count: 7, class_loss = 519.489014, iou_loss = 4.164795, total_loss = 523.653809 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.430208, GIOU: 0.296444), Class: 0.785529, Obj: 0.427787, No Obj: 0.542323, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.201172, iou_loss = 0.402069, total_loss = 162.603241 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.319477, GIOU: 0.212596), Class: 0.480046, Obj: 0.548460, No Obj: 0.490045, .5R: 0.142857, .75R: 0.000000, count: 14, class_loss = 519.074097, iou_loss = 8.334229, total_loss = 527.408325 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.245628, GIOU: -0.095609), Class: 0.604670, Obj: 0.546103, No Obj: 0.543601, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 162.788284, iou_loss = 3.863113, total_loss = 166.651398 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.468058, GIOU: 0.397238), Class: 0.516640, Obj: 0.453239, No Obj: 0.489822, .5R: 0.285714, .75R: 0.000000, count: 7, class_loss = 517.296387, iou_loss = 2.553589, total_loss = 519.849976 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.187348, GIOU: 0.108455), Class: 0.729552, Obj: 0.390008, No Obj: 0.540430, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.645111, iou_loss = 1.447281, total_loss = 163.092392 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.225502, GIOU: 0.080768), Class: 0.584300, Obj: 0.446032, No Obj: 0.489688, .5R: 0.095238, .75R: 0.000000, count: 21, class_loss = 520.488159, iou_loss = 20.796204, total_loss = 541.284363 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.317185, GIOU: 0.040961), Class: 0.687722, Obj: 0.702912, No Obj: 0.543663, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.670258, iou_loss = 1.455444, total_loss = 163.125702 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.291155, GIOU: 0.162379), Class: 0.474105, Obj: 0.271991, No Obj: 0.490311, .5R: 0.500000, .75R: 0.000000, count: 2, class_loss = 518.577087, iou_loss = 4.562195, total_loss = 523.139282 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.379343, GIOU: 0.167090), Class: 0.393257, Obj: 0.652934, No Obj: 0.542741, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 162.042007, iou_loss = 4.229507, total_loss = 166.271515 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.262230, GIOU: 0.157551), Class: 0.419423, Obj: 0.494977, No Obj: 0.490463, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 518.550232, iou_loss = 1.904663, total_loss = 520.454895 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.252794, GIOU: 0.026819), Class: 0.439405, Obj: 0.601063, No Obj: 0.542211, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.725922, iou_loss = 1.095901, total_loss = 163.821823 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.263063, GIOU: 0.143211), Class: 0.646242, Obj: 0.507822, No Obj: 0.489841, .5R: 0.100000, .75R: 0.000000, count: 10, class_loss = 516.301270, iou_loss = 9.749268, total_loss = 526.050537 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.364418, GIOU: 0.214417), Class: 0.544902, Obj: 0.421454, No Obj: 0.543519, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 162.999359, iou_loss = 2.639435, total_loss = 165.638794 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.344286, GIOU: 0.240472), Class: 0.561721, Obj: 0.686353, No Obj: 0.490600, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 517.741699, iou_loss = 2.442078, total_loss = 520.183777 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.235180, GIOU: 0.017799), Class: 0.508020, Obj: 0.476300, No Obj: 0.543636, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 161.403351, iou_loss = 4.394547, total_loss = 165.797897 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.476239, GIOU: 0.359752), Class: 0.373563, Obj: 0.550374, No Obj: 0.490432, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 519.463318, iou_loss = 0.391724, total_loss = 519.855042 \n\n 17: 344.970520, 530.275391 avg loss, 0.000000 rate, 0.787812 seconds, 1088 images, 3135.272870 hours left\nLoaded: 0.000037 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.324304, GIOU: 0.324304), Class: 0.635818, Obj: 0.420247, No Obj: 0.541439, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 159.815750, iou_loss = 0.867874, total_loss = 160.683624 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.319735, GIOU: 0.182160), Class: 0.586507, Obj: 0.442840, No Obj: 0.490214, .5R: 0.111111, .75R: 0.111111, count: 9, class_loss = 519.372986, iou_loss = 6.878601, total_loss = 526.251587 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.307572, GIOU: 0.076243), Class: 0.560874, Obj: 0.449079, No Obj: 0.542737, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 162.086197, iou_loss = 2.594559, total_loss = 164.680756 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.361739, GIOU: 0.288860), Class: 0.590751, Obj: 0.515226, No Obj: 0.490104, .5R: 0.272727, .75R: 0.000000, count: 11, class_loss = 518.754761, iou_loss = 6.875366, total_loss = 525.630127 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.228129, GIOU: 0.087845), Class: 0.536238, Obj: 0.596103, No Obj: 0.543360, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.563232, iou_loss = 2.341064, total_loss = 163.904297 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.265376, GIOU: 0.097615), Class: 0.540137, Obj: 0.432268, No Obj: 0.490277, .5R: 0.000000, .75R: 0.000000, count: 9, class_loss = 519.032043, iou_loss = 7.732239, total_loss = 526.764282 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.453922, GIOU: 0.453922), Class: 0.752914, Obj: 0.746194, No Obj: 0.543650, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.907043, iou_loss = 0.244736, total_loss = 162.151779 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.265748, GIOU: 0.136139), Class: 0.677079, Obj: 0.520251, No Obj: 0.489555, .5R: 0.000000, .75R: 0.000000, count: 8, class_loss = 518.156372, iou_loss = 6.829346, total_loss = 524.985718 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.133155, GIOU: 0.123660), Class: 0.456427, Obj: 0.588735, No Obj: 0.541918, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 161.694046, iou_loss = 3.650650, total_loss = 165.344696 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.424556, GIOU: 0.273571), Class: 0.523902, Obj: 0.601062, No Obj: 0.490903, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 518.766357, iou_loss = 1.926758, total_loss = 520.693115 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.193392, GIOU: -0.252059), Class: 0.632022, Obj: 0.560125, No Obj: 0.543093, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.753311, iou_loss = 1.496216, total_loss = 163.249527 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.287727, GIOU: 0.057840), Class: 0.565216, Obj: 0.445630, No Obj: 0.490158, .5R: 0.200000, .75R: 0.000000, count: 10, class_loss = 519.454468, iou_loss = 11.661499, total_loss = 531.115967 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.227138, GIOU: 0.102886), Class: 0.509831, Obj: 0.529626, No Obj: 0.541741, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 160.162659, iou_loss = 3.549805, total_loss = 163.712463 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.344709, GIOU: 0.240163), Class: 0.556865, Obj: 0.473315, No Obj: 0.489883, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 516.971130, iou_loss = 2.266418, total_loss = 519.237549 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.177138, GIOU: -0.196731), Class: 0.616374, Obj: 0.608488, No Obj: 0.543323, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 163.242676, iou_loss = 1.704865, total_loss = 164.947540 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.217494, GIOU: 0.034681), Class: 0.537393, Obj: 0.529324, No Obj: 0.489636, .5R: 0.095238, .75R: 0.000000, count: 21, class_loss = 517.328186, iou_loss = 25.654297, total_loss = 542.982483 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.543563, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.811646, iou_loss = 0.000000, total_loss = 162.811646 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.431969, GIOU: 0.391702), Class: 0.581762, Obj: 0.479762, No Obj: 0.489708, .5R: 0.363636, .75R: 0.000000, count: 11, class_loss = 517.512878, iou_loss = 3.815063, total_loss = 521.327942 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.279022, GIOU: 0.023683), Class: 0.615350, Obj: 0.486632, No Obj: 0.541601, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 161.153809, iou_loss = 4.840149, total_loss = 165.993958 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.141203, GIOU: 0.141203), Class: 0.582398, Obj: 0.440489, No Obj: 0.490749, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 520.808472, iou_loss = 1.716125, total_loss = 522.524597 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.387340, GIOU: 0.283222), Class: 0.504903, Obj: 0.615426, No Obj: 0.544758, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 161.522095, iou_loss = 2.241669, total_loss = 163.763763 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.572156, GIOU: 0.572157), Class: 0.725439, Obj: 0.520152, No Obj: 0.490241, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 517.225281, iou_loss = 0.213013, total_loss = 517.438293 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.643806, GIOU: 0.629795), Class: 0.568526, Obj: 0.519218, No Obj: 0.543907, .5R: 1.000000, .75R: 0.000000, count: 2, class_loss = 163.454391, iou_loss = 0.343277, total_loss = 163.797668 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.301598, GIOU: 0.152114), Class: 0.612216, Obj: 0.527293, No Obj: 0.490150, .5R: 0.100000, .75R: 0.100000, count: 10, class_loss = 518.064575, iou_loss = 6.979431, total_loss = 525.044006 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.364001, GIOU: 0.161287), Class: 0.708329, Obj: 0.630357, No Obj: 0.543985, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 162.323318, iou_loss = 2.184647, total_loss = 164.507965 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.255864, GIOU: 0.105008), Class: 0.399580, Obj: 0.475005, No Obj: 0.489660, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 518.407715, iou_loss = 3.685059, total_loss = 522.092773 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.428263, GIOU: 0.285540), Class: 0.674378, Obj: 0.570347, No Obj: 0.544460, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.393280, iou_loss = 0.327164, total_loss = 161.720444 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.281887, GIOU: 0.157829), Class: 0.536528, Obj: 0.600420, No Obj: 0.489824, .5R: 0.090909, .75R: 0.000000, count: 11, class_loss = 516.534973, iou_loss = 8.706299, total_loss = 525.241272 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.112250, GIOU: -0.355997), Class: 0.438944, Obj: 0.576134, No Obj: 0.541171, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.457474, iou_loss = 2.714828, total_loss = 164.172302 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.377063, GIOU: 0.327301), Class: 0.489161, Obj: 0.477069, No Obj: 0.489998, .5R: 0.230769, .75R: 0.000000, count: 13, class_loss = 518.683777, iou_loss = 6.663269, total_loss = 525.347046 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.357765, GIOU: 0.308831), Class: 0.590218, Obj: 0.635996, No Obj: 0.543360, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 162.030823, iou_loss = 2.749695, total_loss = 164.780518 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.220356, GIOU: 0.157253), Class: 0.609595, Obj: 0.604966, No Obj: 0.489964, .5R: 0.000000, .75R: 0.000000, count: 9, class_loss = 518.248169, iou_loss = 8.839355, total_loss = 527.087524 \n\n 18: 344.499603, 511.697815 avg loss, 0.000000 rate, 0.796175 seconds, 1152 images, 3114.867397 hours left\nLoaded: 0.000069 seconds\nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.248166, GIOU: -0.059664), Class: 0.504230, Obj: 0.618428, No Obj: 0.542293, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 162.528778, iou_loss = 3.564285, total_loss = 166.093063 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.217656, GIOU: 0.041216), Class: 0.536012, Obj: 0.537305, No Obj: 0.490164, .5R: 0.000000, .75R: 0.000000, count: 8, class_loss = 519.641235, iou_loss = 9.395020, total_loss = 529.036255 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.424148, GIOU: 0.394233), Class: 0.495983, Obj: 0.418750, No Obj: 0.543021, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 162.858673, iou_loss = 1.027313, total_loss = 163.885986 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.492340, GIOU: 0.483841), Class: 0.265841, Obj: 0.779960, No Obj: 0.491042, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 520.154053, iou_loss = 0.231934, total_loss = 520.385986 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.329564, GIOU: 0.089572), Class: 0.522870, Obj: 0.309203, No Obj: 0.543026, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.176178, iou_loss = 2.101822, total_loss = 164.278000 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.274464, GIOU: 0.086344), Class: 0.521419, Obj: 0.508139, No Obj: 0.490178, .5R: 0.000000, .75R: 0.000000, count: 3, class_loss = 518.796204, iou_loss = 3.933838, total_loss = 522.730042 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.259217, GIOU: 0.026322), Class: 0.520406, Obj: 0.532032, No Obj: 0.544417, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 162.431747, iou_loss = 2.135208, total_loss = 164.566956 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.366330, GIOU: 0.172862), Class: 0.553755, Obj: 0.439192, No Obj: 0.490819, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 517.840942, iou_loss = 2.605957, total_loss = 520.446899 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.542413, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.851227, iou_loss = 0.000000, total_loss = 161.851227 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.405678, GIOU: 0.330218), Class: 0.563324, Obj: 0.378359, No Obj: 0.490325, .5R: 0.200000, .75R: 0.000000, count: 5, class_loss = 520.023865, iou_loss = 1.966187, total_loss = 521.990051 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.227735, GIOU: 0.079322), Class: 0.524956, Obj: 0.521267, No Obj: 0.544678, .5R: 0.000000, .75R: 0.000000, count: 6, class_loss = 162.520584, iou_loss = 6.934814, total_loss = 169.455399 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.318874, GIOU: 0.234071), Class: 0.530617, Obj: 0.608646, No Obj: 0.489945, .5R: 0.000000, .75R: 0.000000, count: 7, class_loss = 517.225586, iou_loss = 4.015991, total_loss = 521.241577 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.393795, GIOU: 0.238323), Class: 0.557659, Obj: 0.534182, No Obj: 0.544712, .5R: 0.285714, .75R: 0.000000, count: 7, class_loss = 160.810730, iou_loss = 4.503494, total_loss = 165.314224 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.272426, GIOU: 0.055094), Class: 0.523682, Obj: 0.527869, No Obj: 0.490624, .5R: 0.142857, .75R: 0.000000, count: 14, class_loss = 521.049622, iou_loss = 24.650635, total_loss = 545.700256 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.264676, GIOU: 0.011719), Class: 0.507100, Obj: 0.485248, No Obj: 0.543292, .5R: 0.000000, .75R: 0.000000, count: 4, class_loss = 161.797607, iou_loss = 5.266312, total_loss = 167.063919 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.194012, GIOU: 0.152232), Class: 0.506034, Obj: 0.604312, No Obj: 0.490532, .5R: 0.000000, .75R: 0.000000, count: 5, class_loss = 519.362061, iou_loss = 6.025635, total_loss = 525.387695 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.536436, GIOU: 0.445978), Class: 0.827170, Obj: 0.694893, No Obj: 0.543890, .5R: 1.000000, .75R: 0.000000, count: 1, class_loss = 162.419617, iou_loss = 0.258133, total_loss = 162.677750 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.383511, GIOU: 0.320949), Class: 0.594264, Obj: 0.530483, No Obj: 0.490248, .5R: 0.222222, .75R: 0.000000, count: 9, class_loss = 516.628784, iou_loss = 3.755249, total_loss = 520.384033 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.430968, GIOU: 0.293860), Class: 0.484167, Obj: 0.652712, No Obj: 0.541001, .5R: 0.000000, .75R: 0.000000, count: 2, class_loss = 160.631714, iou_loss = 0.816498, total_loss = 161.448212 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.283343, GIOU: 0.048019), Class: 0.597518, Obj: 0.524577, No Obj: 0.491027, .5R: 0.111111, .75R: 0.000000, count: 9, class_loss = 520.379639, iou_loss = 9.162964, total_loss = 529.542603 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.000000, GIOU: 0.000000), Class: 0.000000, Obj: 0.000000, No Obj: 0.545581, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 162.795319, iou_loss = 0.000000, total_loss = 162.795319 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.293736, GIOU: 0.155273), Class: 0.440403, Obj: 0.458165, No Obj: 0.489479, .5R: 0.153846, .75R: 0.038462, count: 26, class_loss = 521.523315, iou_loss = 21.264526, total_loss = 542.787842 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.146655, GIOU: 0.146655), Class: 0.778260, Obj: 0.288142, No Obj: 0.542837, .5R: 0.000000, .75R: 0.000000, count: 1, class_loss = 161.952209, iou_loss = 1.038406, total_loss = 162.990616 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.176529, GIOU: -0.136436), Class: 0.529987, Obj: 0.540694, No Obj: 0.490173, .5R: 0.000000, .75R: 0.000000, count: 11, class_loss = 518.150024, iou_loss = 15.371887, total_loss = 533.521912 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 16 Avg (IOU: 0.363306, GIOU: 0.080216), Class: 0.340327, Obj: 0.423435, No Obj: 0.543940, .5R: 0.333333, .75R: 0.000000, count: 3, class_loss = 161.355408, iou_loss = 2.583618, total_loss = 163.939026 \nv3 (mse loss, Normalizer: (iou: 0.75, cls: 1.00) Region 23 Avg (IOU: 0.335894, GIOU: 0.184357), Class: 0.552993, Obj: 0.415356, No Obj: 0.489875, .5R: 0.250000, .75R: 0.000000, count: 4, class_loss = 517.287354, iou_loss = 3.726562, total_loss = 521.013916 \n^C\n"
]
],
[
[
"### Utility Functions",
"_____no_output_____"
]
],
[
[
"# Define threshold for confidence score and Non max supression here\nconfthres=0.2\nnmsthres=0.1\npath=\"./\"\ndef get_labels(label_dir):\n return open(label_dir).read().split('\\n')\n \ndef get_colors(LABELS):\n # initialize a list of colors to represent each possible class label\n np.random.seed(42)\n COLORS = np.random.randint(0, 255, size=(len(LABELS), 3),dtype=\"uint8\")\n return COLORS\n\ndef get_weights(weights_path):\n # derive the paths to the YOLO weights and model configuration\n weightsPath = os.path.sep.join([yolo_path, weights_path])\n return weightsPath\n\ndef get_config(config_path):\n configPath = os.path.sep.join([yolo_path, config_path])\n return configPath\n\ndef load_model(configpath,weightspath):\n # load our YOLO object detector trained on COCO dataset (80 classes)\n print(\"[INFO] loading YOLO from disk...\")\n net = cv2.dnn.readNetFromDarknet(configpath, weightspath)\n return net",
"_____no_output_____"
],
[
"#https://medium.com/analytics-vidhya/object-detection-using-yolo-v3-and-deploying-it-on-docker-and-minikube-c1192e81ae7a\ndef get_predection(image,net,LABELS,COLORS):\n (H, W) = image.shape[:2]\n\n # determine only the *output* layer names that we need from YOLO\n ln = net.getLayerNames()\n ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()]\n\n # construct a blob from the input image and then perform a forward\n # pass of the YOLO object detector, giving us our bounding boxes and\n # associated probabilities\n blob = cv2.dnn.blobFromImage(image, 1 / 255.0, (416, 416),\n swapRB=True, crop=False)\n net.setInput(blob)\n start = time.time()\n layerOutputs = net.forward(ln)\n #print(layerOutputs[0])\n end = time.time()\n\n # show timing information on YOLO\n #print(\"[INFO] YOLO took {:.6f} seconds\".format(end - start))\n\n # initialize our lists of detected bounding boxes, confidences, and\n # class IDs, respectively\n boxes = []\n confidences = []\n classIDs = []\n num_class_0 = 0\n num_class_1 = 0\n\n # loop over each of the layer outputs\n for output in layerOutputs:\n # loop over each of the detections\n for detection in output:\n # extract the class ID and confidence (i.e., probability) of\n # the current object detection\n scores = detection[5:]\n #print(detection)\n classID = np.argmax(scores)\n # print(classID)\n confidence = scores[classID]\n\n # filter out weak predictions by ensuring the detected\n # probability is greater than the minimum probability\n if confidence > confthres:\n # scale the bounding box coordinates back relative to the\n # size of the image, keeping in mind that YOLO actually\n # returns the center (x, y)-coordinates of the bounding\n # box followed by the boxes' width and height\n box = detection[0:4] * np.array([W, H, W, H])\n (centerX, centerY, width, height) = box.astype(\"int\")\n\n # use the center (x, y)-coordinates to derive the top and\n # and left corner of the bounding box\n x = int(centerX - (width / 2))\n y = int(centerY - (height / 2))\n\n # update our list of bounding box coordinates, confidences,\n # and class IDs\n boxes.append([x, y, int(width), int(height)])\n confidences.append(float(confidence))\n classIDs.append(classID)\n if(classID==0):\n num_class_0 +=1\n elif(classID==1):\n num_class_1 +=1 \n\n # apply non-maxima suppression to suppress weak, overlapping bounding\n # boxes\n idxs = cv2.dnn.NMSBoxes(boxes, confidences, confthres,\n nmsthres)\n if(num_class_0>0 or num_class_1>0):\n index= num_class_0/(num_class_0+num_class_1)\n else:\n index=-1 \n #print(index,) \n # ensure at least one detection exists\n if len(idxs) > 0:\n # loop over the indexes we are keeping\n for i in idxs.flatten():\n # extract the bounding box coordinates\n (x, y) = (boxes[i][0], boxes[i][1])\n (w, h) = (boxes[i][2], boxes[i][3])\n\n # draw a bounding box rectangle and label on the image\n color = [int(c) for c in COLORS[classIDs[i]]]\n cv2.rectangle(image, (x, y), (x + w, y + h), color, 2)\n text = \"{}\".format(LABELS[classIDs[i]])\n #print(boxes)\n #print(classIDs) \n #cv2.putText(image, text, (x, y - 5), cv2.FONT_HERSHEY_SIMPLEX,0.5, color=(69, 60, 90), thickness=2)\n cv2.rectangle(image, (x, y-5), (x+62, y-15), color, cv2.FILLED)\n cv2.putText(image, text, (x, y - 5), cv2.FONT_HERSHEY_SIMPLEX,0.5, (0,0,0), 1)\n if(index!=-1 and index<.50):\n cv2.rectangle(image, (40, 46), (220, 16), (0,0,255), cv2.FILLED)\n cv2.putText(image,'Mask Adaptivity: POOR',(40,40),cv2.FONT_HERSHEY_SIMPLEX,0.5, (0,255,255), 1)\n elif(index>=.50 and index<.70):\n cv2.rectangle(image, (40, 46), (255, 16), (0, 165, 255), cv2.FILLED)\n cv2.putText(image,'Mask Adaptivity: MODERATE',(40,40),cv2.FONT_HERSHEY_SIMPLEX,0.5, (0,0,0), 1) \n elif(index>=0.70):\n cv2.rectangle(image, (40, 46), (220, 16), (42,236,42), cv2.FILLED)\n cv2.putText(image,'Mask Adaptivity: HIGH',(40,40),cv2.FONT_HERSHEY_SIMPLEX,0.5, (0,0,0), 1) \n return image",
"_____no_output_____"
],
[
"# Method to predict Image\ndef predict_image(img_path):\n image = cv2.imread(img_path)\n nets=load_model(CFG,Weights)\n #Colors=get_colors(Lables)\n Colors=[(42,236,42),(0,0,255)]\n res=get_predection(image,nets,Lables,Colors)\n # image=cv2.cvtColor(image,cv2.COLOR_BGR2RGB)\n # show the output image\n cv2_imshow(res)\n cv2.waitKey()",
"_____no_output_____"
],
[
"# Method to predict Video\ndef predict_video(input_path,output_path):\n vid = cv2.VideoCapture(input_path)\n op=output_path\n height, width = None, None\n writer = None\n print('[Info] processing Video (It may take several minutes to Run)..')\n while True:\n grabbed, frame = vid.read()\n\t\t # Checking if the complete video is read\n if not grabbed:\n\t\t break\n if width is None or height is None:\n\t\t height, width = frame.shape[:2]\n frame=get_predection(frame,nets,Lables,Colors)\n if writer is None:\n fourcc = cv2.VideoWriter_fourcc(*\"mp4v\")\n writer = cv2.VideoWriter(op, fourcc, 27,(frame.shape[1], frame.shape[0]), True)\n writer.write(frame)\n print (\"[INFO] Cleaning up...\")\n writer.release()\n vid.release()\n print (\"[INFO] Prediction Completed.\")\n",
"_____no_output_____"
],
[
"# This will not work in colab, as colab can't access local hardware\nimport time\ndef predict_web_cam():\n #stream = cv2.VideoCapture(0)\n sess = K.get_session()\n while True:\n # Capture frame-by-frame\n grabbed, frame = stream.read()\n if not grabbed:\n break\n # Run detection\n start = time.time()\n image = Image.fromarray(frame)\n output_image = get_predection(image,nets,Lables,Colors)\n end = time.time()\n print(\"Inference time: {:.2f}s\".format(end - start))\n # Display the resulting frame\n cv2.imshow('Web Cam',np.asarray(output_image))\n if cv2.waitKey(1) & 0xFF == ord('q'):\n break\n stream.release() \n cv2.destroyAllWindows() ",
"_____no_output_____"
]
],
[
[
"### Set the Variables (Must before Prediction)",
"_____no_output_____"
]
],
[
[
"# Set the pah for test config file, label directory and weights\nCFG='/content/darknet/YOLO_Custom/yolov3-tiny_obj_test.cfg' \nlabel_dir='/content/darknet/YOLO_Custom/obj.names'\n#cfgpath=test_config_path\nWeights='/content/darknet/YOLO_Custom/yolov3-tiny_obj_train_tiny8.weights'\nLables=get_labels(label_dir)\n",
"_____no_output_____"
]
],
[
[
"### Predict Image",
"_____no_output_____"
]
],
[
[
" from google.colab.patches import cv2_imshow\n img_path='/content/buckey.jpg' \n predict_image(img_path) ",
"[INFO] loading YOLO from disk...\n"
]
],
[
[
"### Predict Video",
"_____no_output_____"
]
],
[
[
"input_path='/content/in.mp4'\noutput_path='/content/out.mp4'\npredict_video(input_path,output_path)",
"processing..\n[INFO] Cleaning up...\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
]
] |
d0cd5e9e41124f43187303350e0cb535e4c9d3c7 | 1,845 | ipynb | Jupyter Notebook | .ipynb_checkpoints/EX091 - Jogo de Dados em Python-checkpoint.ipynb | vithep/Python-Hello-World | f28f887de61d9afc12c083d0a26a247a9e67b32c | [
"MIT"
] | null | null | null | .ipynb_checkpoints/EX091 - Jogo de Dados em Python-checkpoint.ipynb | vithep/Python-Hello-World | f28f887de61d9afc12c083d0a26a247a9e67b32c | [
"MIT"
] | null | null | null | .ipynb_checkpoints/EX091 - Jogo de Dados em Python-checkpoint.ipynb | vithep/Python-Hello-World | f28f887de61d9afc12c083d0a26a247a9e67b32c | [
"MIT"
] | null | null | null | 23.0625 | 120 | 0.505149 | [
[
[
"from random import randint\nfrom time import sleep\nfrom operator import itemgetter",
"_____no_output_____"
],
[
"jogo = {'jogador 1':randint(1,6), 'jogador 2':randint(1,6), 'jogador 3':randint(1,6), 'jogador 4':randint(1,6)}\nprint('Valores sorteados: ')\nranking = []\nfor k,v in jogo.items():\n print(f'{k} tirou {v} no dado.')\n sleep(1)\nranking = sorted(jogo.items(), key=itemgetter(1), reverse = True)\nprint('-='*10)\nfor i,v in enumerate(ranking):\n print(f'{i+1}º lugar: {v[0]} com {v[1]}.')\n sleep(1)",
"Valores sorteados: \njogador 1 tirou 1 no dado.\njogador 2 tirou 2 no dado.\njogador 3 tirou 4 no dado.\njogador 4 tirou 4 no dado.\n-=-=-=-=-=-=-=-=-=-=\n1º lugar: jogador 3 com 4.\n2º lugar: jogador 4 com 4.\n3º lugar: jogador 2 com 2.\n4º lugar: jogador 1 com 1.\n"
]
]
] | [
"code"
] | [
[
"code",
"code"
]
] |
d0cd6af1991228467fda12f19d4aa14884eec059 | 2,206 | ipynb | Jupyter Notebook | Untitled1.ipynb | naymaraq/Text2Table | 3a6fcc82efce017341e06138f43fbf6b541c5660 | [
"MIT"
] | 2 | 2021-06-11T10:01:42.000Z | 2021-06-23T05:40:36.000Z | Untitled1.ipynb | naymaraq/Text2Table | 3a6fcc82efce017341e06138f43fbf6b541c5660 | [
"MIT"
] | null | null | null | Untitled1.ipynb | naymaraq/Text2Table | 3a6fcc82efce017341e06138f43fbf6b541c5660 | [
"MIT"
] | 1 | 2021-02-02T16:06:19.000Z | 2021-02-02T16:06:19.000Z | 24.241758 | 111 | 0.552584 | [
[
[
"from one_shot_infer import SpertClinet, process_config\nfrom text2table_service import prettify",
"_____no_output_____"
],
[
"config_path = \"configs/example_eval.conf\"\nrun_args, run_config = process_config(config_path)\nspert = SpertClinet(run_args)",
"_____no_output_____"
],
[
"text1 = \"Apple Inc. is an American multinational technology company headquartered in California\"\ntext2 = \"London is a capital of Great Britiain\"\ntext3 = \"Alice worked at Starbucks\"\n\nresult = spert([text1, text2, text3])\nprettify(result)",
"Evaluate epoch 0: 100%|██████████| 1/1 [00:00<00:00, 7.53it/s]\n"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code"
]
] |
d0cd6c363e642dd4c60ec1d51c5cbb0a961e2ca4 | 262,693 | ipynb | Jupyter Notebook | Section-03-Metrics/03-11-Precision-Recall-Curves-Multiclass.ipynb | Bhaskar-JR/machine-learning-imbalanced-data | 09928aba5003c2ff68ddf0071b0234aa5dae31a9 | [
"BSD-3-Clause"
] | 1 | 2022-01-23T11:19:15.000Z | 2022-01-23T11:19:15.000Z | Section-03-Metrics/03-11-Precision-Recall-Curves-Multiclass.ipynb | Bhaskar-JR/machine-learning-imbalanced-data | 09928aba5003c2ff68ddf0071b0234aa5dae31a9 | [
"BSD-3-Clause"
] | null | null | null | Section-03-Metrics/03-11-Precision-Recall-Curves-Multiclass.ipynb | Bhaskar-JR/machine-learning-imbalanced-data | 09928aba5003c2ff68ddf0071b0234aa5dae31a9 | [
"BSD-3-Clause"
] | null | null | null | 209.81869 | 30,456 | 0.895745 | [
[
[
"## Precision-Recall Curves in Multiclass\n\nFor multiclass classification, we have 2 options:\n\n- determine a PR curve for each class.\n- determine the overall PR curve as the micro-average of all classes\n\nLet's see how to do both.",
"_____no_output_____"
]
],
[
[
"import numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\n\nfrom sklearn.datasets import load_wine\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn.model_selection import train_test_split\nfrom sklearn.multiclass import OneVsRestClassifier\n\n# to convert the 1-D target vector in to a matrix\nfrom sklearn.preprocessing import label_binarize\n\nfrom sklearn.metrics import precision_recall_curve\n\nfrom yellowbrick.classifier import PrecisionRecallCurve",
"_____no_output_____"
]
],
[
[
"## Load data (multiclass)",
"_____no_output_____"
]
],
[
[
"# load data\ndata = load_wine()\n\ndata = pd.concat([\n pd.DataFrame(data.data, columns=data.feature_names),\n pd.DataFrame(data.target, columns=['target']),\n ], axis=1)\n\ndata.head()",
"_____no_output_____"
],
[
"# target distribution:\n# multiclass and (fairly) balanced\n\ndata.target.value_counts(normalize=True)",
"_____no_output_____"
],
[
"# separate dataset into train and test\n\nX_train, X_test, y_train, y_test = train_test_split(\n data.drop(labels=['target'], axis=1), # drop the target\n data['target'], # just the target\n test_size=0.3,\n random_state=0)\n\nX_train.shape, X_test.shape",
"_____no_output_____"
],
[
"# the target is a vector with the 3 classes\n\ny_test[0:10]",
"_____no_output_____"
]
],
[
[
"## Train ML models\n\nThe dataset we are using is very, extremely simple, so I am creating dumb models intentionally, that is few trees and very shallow for the random forests and few iterations for the logit. This is, so that we can get the most out of the PR curves by inspecting them visually.\n\n\n### Random Forests\n\nThe Random Forests in sklearn are not trained as a 1 vs Rest. So in order to produce a 1 vs rest probability vector for each class, we need to wrap this estimator with another one from sklearn:\n\n- [OneVsRestClassifier](https://scikit-learn.org/stable/modules/generated/sklearn.multiclass.OneVsRestClassifier.html)",
"_____no_output_____"
]
],
[
[
"# set up the model, wrapped by the OneVsRestClassifier\nrf = OneVsRestClassifier(\n RandomForestClassifier(\n n_estimators=10, random_state=39, max_depth=1, n_jobs=4,\n )\n)\n\n# train the model\nrf.fit(X_train, y_train)\n\n# produce the predictions (as probabilities)\ny_train_rf = rf.predict_proba(X_train)\ny_test_rf = rf.predict_proba(X_test)\n\n# note that the predictions are an array of 3 columns\n\n# first column: the probability of an observation of being of class 0\n# second column: the probability of an observation of being of class 1\n# third column: the probability of an observation of being of class 2\n\ny_test_rf[0:10, :]",
"_____no_output_____"
],
[
"pd.DataFrame(y_test_rf).sum(axis=1)[0:10]",
"_____no_output_____"
],
[
"# The final prediction is that of the biggest probabiity\n\nrf.predict(X_test)[0:10]",
"_____no_output_____"
]
],
[
[
"### Logistic Regression\n\nThe Logistic regression supports 1 vs rest automatically though its multi_class parameter:",
"_____no_output_____"
]
],
[
[
"# set up the model\nlogit = LogisticRegression(\n random_state=0, multi_class='ovr', max_iter=10,\n)\n\n# train\nlogit.fit(X_train, y_train)\n\n# obtain the probabilities\ny_train_logit = logit.predict_proba(X_train)\ny_test_logit = logit.predict_proba(X_test)\n\n# note that the predictions are an array of 3 columns\n\n# first column: the probability of an observation of being of class 0\n# second column: the probability of an observation of being of class 1\n# third column: the probability of an observation of being of class 2\n\ny_test_logit[0:10, :]",
"C:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\nC:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\nC:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\n"
],
[
"# The final prediction is that of the biggest probabiity\n\nlogit.predict(X_test)[0:10]",
"_____no_output_____"
]
],
[
[
"## Precision-Recall Curve\n\n### Per class with Sklearn",
"_____no_output_____"
]
],
[
[
"# with label_binarize we transform the target vector\n# into a multi-label matrix, so that it matches the \n# outputs of the models\n\n# then we have 1 class per column\n\ny_test = label_binarize(y_test, classes=[0, 1, 2])\n\ny_test[0:10, :]",
"_____no_output_____"
],
[
"# now we determine the precision and recall at different thresholds\n# considering only the probability vector for class 2 and the true\n# target for class 2\n\n# so we treat the problem as class 2 vs rest\n\np, r, thresholds = precision_recall_curve(y_test[:, 2], y_test_rf[:, 2])\n\n# precision values\np",
"_____no_output_____"
],
[
"# recall values\nr",
"_____no_output_____"
],
[
"# threhsolds examined\nthresholds",
"_____no_output_____"
]
],
[
[
"Go ahead and examine the precision and recall for the other classes see how these values change.",
"_____no_output_____"
]
],
[
[
"# now let's do these for all classes and capture the results in\n# dictionaries, so we can plot the values afterwards\n\n# determine the Precision and recall\n# at various thresholds of probability\n# in a 1 vs all fashion, for each class\n\nprecision_rf = dict()\nrecall_rf = dict()\n\n# for each class\nfor i in range(3):\n \n # determine precision and recall at various thresholds\n # in a 1 vs all fashion\n precision_rf[i], recall_rf[i], _ = precision_recall_curve(\n y_test[:, i], y_test_rf[:, i])\n \nprecision_rf",
"_____no_output_____"
],
[
"# plot the curves for each class\n\nfor i in range(3):\n \n plt.plot(recall_rf[i], precision_rf[i], label='class {}'.format(i))\n \nplt.xlabel(\"recall\")\nplt.ylabel(\"precision\")\nplt.legend(loc=\"best\")\nplt.title(\"precision vs. recall curve\")\nplt.show()",
"_____no_output_____"
],
[
"# and now for the logistic regression\n\nprecision_lg = dict()\nrecall_lg = dict()\n\n# for each class\nfor i in range(3):\n \n # determine precision and recall at various thresholds\n # in a 1 vs all fashion\n precision_lg[i], recall_lg[i], _ = precision_recall_curve(\n y_test[:, i], y_test_logit[:, i])\n \n plt.plot(recall_lg[i], precision_lg[i], label='class {}'.format(i))\n \nplt.xlabel(\"recall\")\nplt.ylabel(\"precision\")\nplt.legend(loc=\"best\")\nplt.title(\"precision vs. recall curve\")\nplt.show()",
"_____no_output_____"
],
[
"# and now, just because it is a bit difficult to compare\n# between models, we plot the PR curves class by class, \n# but the 2 models in the same plot\n\n\n# for each class\nfor i in range(3):\n \n plt.plot(recall_lg[i], precision_lg[i], label='logit class {}'.format(i))\n plt.plot(recall_rf[i], precision_rf[i], label='rf class {}'.format(i))\n \n plt.xlabel(\"recall\")\n plt.ylabel(\"precision\")\n plt.legend(loc=\"best\")\n plt.title(\"precision vs. recall curve for class{}\".format(i))\n plt.show()",
"_____no_output_____"
]
],
[
[
"We see that the Random Forest does a better job for all classes.\n\n### Micro-average with sklearn\n\nIn order to do this, we concatenate all the probability vectors 1 after the other, and so we do with the real values.",
"_____no_output_____"
]
],
[
[
"# probability vectors for all classes in 1-d vector\ny_test_rf.ravel()",
"_____no_output_____"
],
[
"# see that the unravelled prediction vector has 3 times the size\n# of the origina target\n\nlen(y_test), len(y_test_rf.ravel())",
"_____no_output_____"
],
[
"# A \"micro-average\": quantifying score on all classes jointly\n\n# for random forests\nprecision_rf[\"micro\"], recall_rf[\"micro\"], _ = precision_recall_curve(\n y_test.ravel(), y_test_rf.ravel(),\n)\n\n# for logistic regression\nprecision_lg[\"micro\"], recall_lg[\"micro\"], _ = precision_recall_curve(\n y_test.ravel(), y_test_logit.ravel(),\n)",
"_____no_output_____"
],
[
"# now we plot them next to each other\n\ni = \"micro\"\n\nplt.plot(recall_lg[i], precision_lg[i], label='logit micro {}')\nplt.plot(recall_rf[i], precision_rf[i], label='rf micro {}')\n\nplt.xlabel(\"recall\")\nplt.ylabel(\"precision\")\nplt.legend(loc=\"best\")\nplt.title(\"precision vs. recall curve for class{}\".format(i))\nplt.show()",
"_____no_output_____"
]
],
[
[
"## Yellowbrick\n\n### Per class with Yellobrick\n\nhttps://www.scikit-yb.org/en/latest/api/classifier/prcurve.html\n\n**Note:**\n\nIn the cells below, we are passing to Yellobrick classes a model that is already fit. When we fit() the Yellobrick class, it will check if the model is fit, in which case it will do nothing.\n\nIf we pass a model that is not fit, and a multiclass target, Yellowbrick will wrap the model automatically with a 1 vs Rest classifier. \n\nCheck Yellobrick's documentation for more details.",
"_____no_output_____"
]
],
[
[
"visualizer = PrecisionRecallCurve(\n rf, per_class=True, cmap=\"cool\", micro=False,\n)\n\nvisualizer.fit(X_train, y_train) # Fit the training data to the visualizer\nvisualizer.score(X_test, y_test) # Evaluate the model on the test data\nvisualizer.show() # Finalize and show the figure",
"_____no_output_____"
],
[
"visualizer = PrecisionRecallCurve(\n logit, per_class=True, cmap=\"cool\", micro=False,\n)\n\nvisualizer.fit(X_train, y_train) # Fit the training data to the visualizer\nvisualizer.score(X_test, y_test) # Evaluate the model on the test data\nvisualizer.show() # Finalize and show the figure",
"C:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\nC:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\nC:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\n"
]
],
[
[
"### Micro yellowbrick",
"_____no_output_____"
]
],
[
[
"visualizer = PrecisionRecallCurve(\n rf, cmap=\"cool\", micro=True,\n)\n\nvisualizer.fit(X_train, y_train) # Fit the training data to the visualizer\nvisualizer.score(X_test, y_test) # Evaluate the model on the test data\nvisualizer.show() # Finalize and show the figure",
"_____no_output_____"
],
[
"visualizer = PrecisionRecallCurve(\n logit, cmap=\"cool\", micro=True,\n)\n\nvisualizer.fit(X_train, y_train) # Fit the training data to the visualizer\nvisualizer.score(X_test, y_test) # Evaluate the model on the test data\nvisualizer.show() # Finalize and show the figure",
"C:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\nC:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\nC:\\Users\\Sole\\Documents\\Repositories\\envs\\imbalanced\\lib\\site-packages\\sklearn\\linear_model\\_logistic.py:814: ConvergenceWarning: lbfgs failed to converge (status=1):\nSTOP: TOTAL NO. of ITERATIONS REACHED LIMIT.\n\nIncrease the number of iterations (max_iter) or scale the data as shown in:\n https://scikit-learn.org/stable/modules/preprocessing.html\nPlease also refer to the documentation for alternative solver options:\n https://scikit-learn.org/stable/modules/linear_model.html#logistic-regression\n n_iter_i = _check_optimize_result(\n"
]
],
[
[
"That's all for PR curves",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
]
] |
d0cd6db78d3e92e9c427ef5588c03a3957ceebe0 | 6,018 | ipynb | Jupyter Notebook | Section 3/Monte Carlo R.ipynb | PacktPublishing/Practical-Reinforcement-Learning-Agents-and-Environments | 6d1d776a81eca71030d9c8ca943979afda40d2ba | [
"MIT"
] | 2 | 2018-07-06T14:11:13.000Z | 2019-05-01T04:03:50.000Z | Section 3 Monte Carlo/Monte Carlo R.ipynb | PacktPublishing/Practical-Reinforcement-Learning---Agents-and-Environments | c92b42ecd564924234ed91f491497cc736c9009f | [
"MIT"
] | null | null | null | Section 3 Monte Carlo/Monte Carlo R.ipynb | PacktPublishing/Practical-Reinforcement-Learning---Agents-and-Environments | c92b42ecd564924234ed91f491497cc736c9009f | [
"MIT"
] | 1 | 2019-10-20T15:11:59.000Z | 2019-10-20T15:11:59.000Z | 20.539249 | 336 | 0.417414 | [
[
[
"**Goal of Environment:** \"A car is on a one-dimensional track, positioned between two \"mountains\". The goal is to drive up the mountain on the right; however, the car's engine is not strong enough to scale the mountain in a single pass. Therefore, the only way to succeed is to drive back and forth to build up momentum.\" \n**Reference:** https://gym.openai.com/envs/MountainCar-v0/",
"_____no_output_____"
]
],
[
[
"#start server in terminal with $python gym_http_server.py\n#install.packages(\"gym\")\nlibrary(gym)",
"_____no_output_____"
],
[
"#start server in terminal with $python gym_http_server.py\nremote_base <- \"http://127.0.0.1:5000\"\nclient <- create_GymClient(remote_base)\nprint(client)",
"<GymClient: http://127.0.0.1:5000>\n"
],
[
"#create environment \nenv_name <- \"MountainCar-v0\"",
"_____no_output_____"
],
[
"#create instance\ninstance_id <- env_create(client, env_name)\nprint(instance_id)",
"[1] \"75fdd292\"\n"
],
[
"#list the environments\nlist_envs <- env_list_all(client)\nprint(list_envs)",
"$`75fdd292`\n[1] \"MountainCar-v0\"\n\n$`9e841f1d`\n[1] \"MountainCar-v0\"\n\n"
],
[
"#set up your agent\naction_space_info <- env_action_space_info(client, instance_id)\nprint(action_space_info)\nagent <- random_discrete_agent(action_space_info)\nagent <- random_discrete_agent(action_space_info[[\"n\"]])",
"$n\n[1] 3\n\n$name\n[1] \"Discrete\"\n\n"
],
[
"episode_range <- 20\nmax_steps <- 200\nreward <- 0\ndone <- FALSE\n\nfor (i in 1:episode_range){\n observation <- env_reset(client, instance_id)\n for(i in max_steps){\n action <- env_action_space_sample(client, instance_id)\n results <- env_step(client, instance_id, action, render = TRUE)\n print(results$observation)\n if (results[[\"done\"]]) break\n }\n}",
"[[1]]\n[1] -0.4617028\n\n[[2]]\n[1] -0.001472405\n\n[[1]]\n[1] -0.4941456\n\n[[2]]\n[1] 0.0007852553\n\n[[1]]\n[1] -0.5091516\n\n[[2]]\n[1] 0.0008984122\n\n[[1]]\n[1] -0.4069091\n\n[[2]]\n[1] -0.001870572\n\n[[1]]\n[1] -0.5272334\n\n[[2]]\n[1] 0.001035021\n\n[[1]]\n[1] -0.555347\n\n[[2]]\n[1] 0.00124706\n\n[[1]]\n[1] -0.4683965\n\n[[2]]\n[1] 0.0005922543\n\n[[1]]\n[1] -0.4048588\n\n[[2]]\n[1] -0.0008780037\n\n[[1]]\n[1] -0.5292721\n\n[[2]]\n[1] 4.286929e-05\n\n[[1]]\n[1] -0.4935049\n\n[[2]]\n[1] -0.001234618\n\n[[1]]\n[1] -0.5283975\n\n[[2]]\n[1] -0.0009712953\n\n[[1]]\n[1] -0.5539533\n\n[[2]]\n[1] -0.0007784704\n\n[[1]]\n[1] -0.4370462\n\n[[2]]\n[1] 0.0003607406\n\n[[1]]\n[1] -0.5774706\n\n[[2]]\n[1] 0.001412736\n\n[[1]]\n[1] -0.4300468\n\n[[2]]\n[1] -0.0006974898\n\n[[1]]\n[1] -0.5730237\n\n[[2]]\n[1] 0.0003720898\n\n[[1]]\n[1] -0.4909376\n\n[[2]]\n[1] -0.001253925\n\n[[1]]\n[1] -0.577002\n\n[[2]]\n[1] -0.0006056722\n\n[[1]]\n[1] -0.4218426\n\n[[2]]\n[1] 0.0002504181\n\n[[1]]\n[1] -0.598202\n\n[[2]]\n[1] 0.0005589518\n\n"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cd74624bd5045c4e29925fa8777852e39d38b1 | 4,137 | ipynb | Jupyter Notebook | Data Science and Machine Learning/Machine-Learning-In-Python-THOROUGH/EXAMPLES/FINITE_ELEMENTS/INTRO/SRC/04_BOREHOLE_FENICS.ipynb | okara83/Becoming-a-Data-Scientist | f09a15f7f239b96b77a2f080c403b2f3e95c9650 | [
"MIT"
] | null | null | null | Data Science and Machine Learning/Machine-Learning-In-Python-THOROUGH/EXAMPLES/FINITE_ELEMENTS/INTRO/SRC/04_BOREHOLE_FENICS.ipynb | okara83/Becoming-a-Data-Scientist | f09a15f7f239b96b77a2f080c403b2f3e95c9650 | [
"MIT"
] | null | null | null | Data Science and Machine Learning/Machine-Learning-In-Python-THOROUGH/EXAMPLES/FINITE_ELEMENTS/INTRO/SRC/04_BOREHOLE_FENICS.ipynb | okara83/Becoming-a-Data-Scientist | f09a15f7f239b96b77a2f080c403b2f3e95c9650 | [
"MIT"
] | 2 | 2022-02-09T15:41:33.000Z | 2022-02-11T07:47:40.000Z | 30.644444 | 83 | 0.476916 | [
[
[
"\"\"\"Flow around a hole in a porous medium.\"\"\"\nfrom fenics import *\nimport numpy as np\n\ndef make_mesh(Theta, a, b, nr, nt, s):\n mesh = RectangleMesh(Point(a, 0), Point(b, 1),\n nr, nt, 'crossed')\n\n # Define markers for Dirichket boundaries\n tol = 1E-14\n\n # x=a becomes the inner borehole boundary\n class Inner(SubDomain):\n def inside(self, x, on_boundary):\n return on_boundary and abs(x[0] - a) < tol\n\n # x=b becomes the outer borehole boundary\n class Outer(SubDomain):\n def inside(self, x, on_boundary):\n return on_boundary and abs(x[0] - b) < tol\n\n inner = Inner(); outer = Outer();\n markers = MeshFunction('size_t', mesh, mesh.topology().dim() - 1)\n markers.set_all(0)\n inner.mark(markers, 1)\n outer.mark(markers, 2)\n\n # --- Deform mesh ---\n\n # First make a denser mesh towards r=a\n x = mesh.coordinates()[:,0]\n y = mesh.coordinates()[:,1]\n\n def denser(x, y):\n return [a + (b-a)*((x-a)/(b-a))**s, y]\n\n x_bar, y_bar = denser(x, y)\n xy_bar_coor = np.array([x_bar, y_bar]).transpose()\n mesh.coordinates()[:] = xy_bar_coor\n\n # Then map onto to a \"piece of cake\"\n\n def cylinder(r, s):\n return [r*np.cos(Theta*s), r*np.sin(Theta*s)]\n\n x_hat, y_hat = cylinder(x_bar, y_bar)\n xy_hat_coor = np.array([x_hat, y_hat]).transpose()\n mesh.coordinates()[:] = xy_hat_coor\n return mesh, markers\n\ndef solver(\n mesh,\n markers, # MeshFunctions for Dirichlet conditions\n alpha, # Diffusion coefficient\n u_a, # Inner pressure\n u_b, # Outer pressure\n degree, # Element polynomial degree\n filename, # Name of VTK file\n ):\n V = FunctionSpace(mesh, 'P', degree)\n bc_inner = DirichletBC(V, u_a, markers, 1)\n bc_outer = DirichletBC(V, u_b, markers, 2)\n bcs = [bc_inner, bc_outer]\n\n # Define variational problem\n u = TrialFunction(V)\n v = TestFunction(V)\n a = alpha*dot(grad(u), grad(v))*dx\n L = Constant(0)*v*dx # L = 0*v*dx = 0 does not work...\n\n # Compute solution\n u = Function(V)\n solve(a == L, u, bcs)\n\n f = File(\"mesh.xml\")\n f << mesh\n\n # Save solution to file in VTK format\n vtkfile = File(filename + '.pvd')\n vtkfile << u\n\n u.rename('u', 'u'); plot(u); plot(mesh)\n import matplotlib.pyplot as plt\n plt.show()\n return u\n\ndef problem():\n mesh, markers = make_mesh(Theta=25*pi/180, a=1, b=2,\n nr=20, nt=20, s=1.9)\n beta = 5\n solver(mesh, markers, alpha=1, u_a=1, u_b=0, degree=1, filename='tmp')\n\nif __name__ == '__main__':\n problem()\n",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code"
]
] |
d0cd7f235cb1f03c0ba1b7fdaa6159760c3b0169 | 206,787 | ipynb | Jupyter Notebook | Fertility Rate Per Woman and Schooling Year Model 2013.ipynb | kaiicheng/Fertility-Rate-and-Male-Years-of-schooling | 15cf5de8bfd8d58a9a8eaa9c1d0f484012257c11 | [
"MIT"
] | null | null | null | Fertility Rate Per Woman and Schooling Year Model 2013.ipynb | kaiicheng/Fertility-Rate-and-Male-Years-of-schooling | 15cf5de8bfd8d58a9a8eaa9c1d0f484012257c11 | [
"MIT"
] | null | null | null | Fertility Rate Per Woman and Schooling Year Model 2013.ipynb | kaiicheng/Fertility-Rate-and-Male-Years-of-schooling | 15cf5de8bfd8d58a9a8eaa9c1d0f484012257c11 | [
"MIT"
] | null | null | null | 213.843847 | 172,676 | 0.853298 | [
[
[
"import statsmodels.api as sm\nimport pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt",
"_____no_output_____"
],
[
"df = pd.read_excel(\"Fertility Rate and Education Relationship Data 2013.xlsx\")\ndf.head(15)",
"_____no_output_____"
],
[
"df",
"_____no_output_____"
],
[
"print(df['Fertility rate, total (births per woman) 2013'])",
"0 5.359\n1 1.690\n2 2.990\n3 2.322\n4 1.728\n ... \n159 1.978\n160 4.326\n161 5.132\n162 4.030\n163 1.070\nName: Fertility rate, total (births per woman) 2013, Length: 164, dtype: float64\n"
],
[
"print(df['Mean years of schooling (males aged 25 years and above) (years) 2013'])",
"0 5.1\n1 9.5\n2 7.8\n3 9.6\n4 10.8\n ... \n159 5.7\n160 3.8\n161 7.2\n162 7.8\n163 12.1\nName: Mean years of schooling (males aged 25 years and above) (years) 2013, Length: 164, dtype: float64\n"
],
[
"X = df['Mean years of schooling (males aged 25 years and above) (years) 2013']\ny = df['Fertility rate, total (births per woman) 2013']",
"_____no_output_____"
],
[
"X",
"_____no_output_____"
],
[
"y",
"_____no_output_____"
],
[
"length = len(df['Country Name'])",
"_____no_output_____"
],
[
"country_name = df['Country Name']",
"_____no_output_____"
],
[
"# Create a plot.\nplt.figure(figsize = (20, 20))\n\nplt.scatter(X, y)\nplt.title(\"2013\")\nplt.xlabel(\"Mean years of schooling\")\nplt.ylabel(\"Birth rate, crude (per 1,000 people)\")\n\n# Add country name tag.\nfor i in range(length):\n if country_name[i] == \"Taiwan\":\n plt.text(X[i], y[i]*1.02, country_name[i], fontsize=10, color = \"green\", style = \"italic\", weight = \"light\", verticalalignment='center', horizontalalignment='right',rotation=0)\n else:\n plt.text(X[i], y[i]*1.02, country_name[i], fontsize=10, color = \"r\", style = \"italic\", weight = \"light\", verticalalignment='center', horizontalalignment='right',rotation=0)\n\nplt.show()",
"_____no_output_____"
],
[
"X = sm.add_constant(X, prepend=False)",
"_____no_output_____"
],
[
"X",
"_____no_output_____"
],
[
"y",
"_____no_output_____"
],
[
"# Ordinary least square method.\nmod = sm.OLS(y, X)",
"_____no_output_____"
],
[
"res = mod.fit()",
"_____no_output_____"
],
[
"print(res.summary())",
" OLS Regression Results \n=========================================================================================================\nDep. Variable: Fertility rate, total (births per woman) 2013 R-squared: 0.595\nModel: OLS Adj. R-squared: 0.593\nMethod: Least Squares F-statistic: 238.2\nDate: Tue, 01 Sep 2020 Prob (F-statistic): 1.25e-33\nTime: 23:34:40 Log-Likelihood: -214.60\nNo. Observations: 164 AIC: 433.2\nDf Residuals: 162 BIC: 439.4\nDf Model: 1 \nCovariance Type: nonrobust \n========================================================================================================================================\n coef std err t P>|t| [0.025 0.975]\n----------------------------------------------------------------------------------------------------------------------------------------\nMean years of schooling (males aged 25 years and above) (years) 2013 -0.3812 0.025 -15.432 0.000 -0.430 -0.332\nconst 6.0098 0.220 27.362 0.000 5.576 6.444\n==============================================================================\nOmnibus: 0.486 Durbin-Watson: 1.951\nProb(Omnibus): 0.784 Jarque-Bera (JB): 0.552\nSkew: 0.127 Prob(JB): 0.759\nKurtosis: 2.871 Cond. No. 28.1\n==============================================================================\n\nWarnings:\n[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.\n"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cd8cbcf69c56ca5408413dbacd86e7337513cd | 335,009 | ipynb | Jupyter Notebook | Receiving16.ipynb | L0rdM0rd/NFL-Scoring | 7a8c7cd2e17908436e9e0b369484c880fd573ab9 | [
"MIT"
] | null | null | null | Receiving16.ipynb | L0rdM0rd/NFL-Scoring | 7a8c7cd2e17908436e9e0b369484c880fd573ab9 | [
"MIT"
] | null | null | null | Receiving16.ipynb | L0rdM0rd/NFL-Scoring | 7a8c7cd2e17908436e9e0b369484c880fd573ab9 | [
"MIT"
] | null | null | null | 108.804482 | 52,168 | 0.798214 | [
[
[
"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nfrom sklearn import preprocessing\nfrom sklearn.model_selection import StratifiedShuffleSplit, cross_val_score, cross_val_predict, GridSearchCV\nfrom sklearn.decomposition import PCA\nfrom sklearn.linear_model import LogisticRegression\nfrom sklearn import svm\nfrom sklearn.ensemble import RandomForestClassifier\nfrom sklearn.neighbors import KNeighborsClassifier\nfrom sklearn.naive_bayes import GaussianNB\nfrom sklearn.tree import DecisionTreeClassifier\nfrom sklearn import metrics",
"_____no_output_____"
],
[
"#skill position and matchup data for 2016-2017 nfl season\n\nreceivers = pd.read_csv('WKReceiving2016.csv')\nrz_receiving = pd.read_csv('RZReceiving2016.csv')\nteam_off = pd.read_csv('TeamOff2016.csv')\ntight_ends = pd.read_csv('WKTE2016.csv')\nrunning_backs = pd.read_csv('WKRB2016.csv')\npass_def = pd.read_csv('PassD16.csv')\nrun_def = pd.read_csv('RunD16.csv')",
"_____no_output_____"
],
[
"#Concat positional data\n\nframes = [receivers, tight_ends, running_backs]\nrec = pd.concat(frames)\nrec[rec['Pos'] =='TE'].head(10)",
"_____no_output_____"
],
[
"#data cleaning\n#replace missing data with zero\n\nmask = rec['YAC'] == '-'\ncolumn_name = 'YAC'\nrec.loc[mask, column_name] = 0\n\nmask = rec['YPT'] == '-'\ncolumn_name = 'YPT'\nrec.loc[mask, column_name] = 0\n\nmask = rec['YPR'] == '-'\ncolumn_name = 'YPR'\nrec.loc[mask, column_name] = 0\n\nmask = rec['C %'] == '-'\ncolumn_name = 'C %'\nrec.loc[mask, column_name] = 0\n\nmask = rec['aDOT'] == '-'\ncolumn_name = 'aDOT'\nrec.loc[mask, column_name] = 0\n\nrec[rec['Pos'] =='TE'].head(10)",
"_____no_output_____"
],
[
"#convert column data to floats\n\nrec['YAC'] = rec['YAC'].astype(float)\nrec['YPT'] = rec['YPT'].astype(float)\nrec['YPR'] = rec['YPR'].astype(float)\nrec['C %'] = rec['C %'].astype(float)\nrec['aDOT'] = rec['aDOT'].astype(float)\n\nrec[rec['Pos'] =='TE'].head(10)",
"_____no_output_____"
],
[
"#merge matchup and positional data\n#run defense\n\nrec = pd.merge(rec, run_def, on=['Opp'], how='inner')\nrec.tail(10)",
"_____no_output_____"
],
[
"#pass defense\n\nrec = pd.merge(rec, pass_def, on=['Opp'], how='inner')\nrec.head(10)",
"_____no_output_____"
],
[
"#exploration\n#17.8% of samples scored a passing touchdown\n#massive effect on fantasy points accured\n#more than half of all tds by wide receivers\n\nprint('Total: ', rec['TD'].sum())\nprint('Score: ', rec['Score'].mean())\nprint('FPTS: ', rec.FPTS.mean())\nprint('TD0 ', rec[rec['TD']==0].FPTS.mean())\nprint('TD1 ', rec[rec['TD']==1].FPTS.mean())\nprint('WR TDs: ', rec[rec['Pos']=='WR'].TD.sum())\nprint('TE TDs: ', rec[rec['Pos']=='TE'].TD.sum())\nprint('RB TDs: ', rec[rec['Pos']=='RB'].TD.sum())",
"Total: 753\nScore: 0.17838541666666666\nFPTS: 7.505390624999989\nTD0 5.305071315372412\nTD1 16.497106109324747\nWR TDs: 485\nTE TDs: 177\nRB TDs: 91\n"
],
[
"#data reflects skill players with atleast one snap, rb waters down frequencies\n\nrec['Pos'].value_counts().to_frame()",
"_____no_output_____"
],
[
"#filter for skill players with at least 1 target\n\nrec = rec[rec['Tgt']>0]\nrec['Pos'].value_counts().to_frame()",
"_____no_output_____"
],
[
"#fantasy points by position\n\nprint('WR FPTS: ', rec[rec['Pos']=='WR'].FPTS.mean())\nprint('TE FPTS: ', rec[rec['Pos']=='TE'].FPTS.mean())\nprint('RB FPTS: ', rec[rec['Pos']=='RB'].FPTS.mean())",
"WR FPTS: 9.74720700985759\nTE FPTS: 7.2085280373831715\nRB FPTS: 5.0382139148494325\n"
],
[
"# visual of positional scoring frequency\n\nplt.style.use('seaborn')\nf,ax=plt.subplots(figsize=(8,4))\nrec['Score'].groupby(rec['Pos']).sum().plot.pie(autopct='%1.1f%%', shadow=True)\nax.set_title('Positional Scoring')\nax.set_ylabel('')\nplt.show()",
"_____no_output_____"
],
[
"#visual of positional frequency\n\nf,ax=plt.subplots(figsize=(8,4))\nsns.countplot('Pos', data=rec)\nax.set_title('Positional Sample')\nplt.show()",
"_____no_output_____"
],
[
"#length of dataset -- skill players receiving at least one target in a game\n\nprint(len(rec))",
"3645\n"
],
[
"#WR outpreformed positional frequency relative to scoring frequency -- 63.6% > 50.1%\n\nprint('WR frequency: ', 1826/3645)\nprint('TE frequency: ', 856/3645)\nprint('RB frequency: ', 963/3645)",
"WR frequency: 0.500960219478738\nTE frequency: 0.23484224965706446\nRB frequency: 0.2641975308641975\n"
],
[
"#scoring efficiency\n#wr ~33% success rate\n#te ~25% success rate\n#rb ~10% success rate\n\nf,ax=plt.subplots(1,2, figsize=(18,8))\nrec['Score'].groupby(rec['Pos']).value_counts().plot.pie(autopct='%1.1f%%', ax=ax[0], shadow=True)\nax[0].set_title('Touchdown Success by Position')\nax[0].set_ylabel('')\nsns.countplot('Pos', hue='Score', data=rec, ax=ax[1])\nax[1].set_title('TD Success by Position')\nplt.show()",
"_____no_output_____"
],
[
"#opportunity as a measure of touchdowns is significant across all positions\n#this implies scoring requires more than just a positional component\n\nf,ax=plt.subplots(figsize=(9,5))\nsns.barplot('Pos','Tgt', data=rec, hue='Score')\nax.set_title('Expected Targets')\nplt.show()",
"_____no_output_____"
],
[
"#target distance as a weighted measure of opportunity is significant for wr and te in scoring touchdowns\n#rb routes are generally shorter patterns, so this is to be expected\n\nf,ax=plt.subplots(figsize=(9,5))\nsns.barplot('Pos','aDOT', data=rec, hue='Score')\nax.set_title('Expected aDOT')\nplt.show()",
"_____no_output_____"
],
[
"#rb average target distance less than one yard\n#46.2% increase in target distance observed for scoring outcomes\n\nprint('Score=0: ', rec[rec['Score']==0].aDOT.mean())\nprint('Score=1: ', rec[rec['Score']==1].aDOT.mean())\nprint('Score=1: ', rec[rec['Pos']=='RB'].aDOT.mean())\nprint((10.704-7.32)/7.32)",
"Score=0: 7.318040540540519\nScore=1: 10.703503649635051\nScore=1: 0.7762201453790248\n0.46229508196721314\n"
],
[
"#receiving yards as a function of touchdowns is significant across positions\n\nf,ax=plt.subplots(figsize=(9,5))\nsns.barplot('Pos','Yds', data=rec, hue='Score')\nax.set_title('Expected Yards')\nplt.show()",
"_____no_output_____"
],
[
"#110% average increase in receiving yards for scoring events\n\nprint('Score=0: ', rec[rec['Score']==0].Yds.mean())\nprint('Score=1: ', rec[rec['Score']==1].Yds.mean())\nprint((60.37-28.76)/28.76)",
"Score=0: 28.761824324324323\nScore=1: 60.36788321167883\n1.0990959666203057\n"
],
[
"#receptions as a function of touchdowns is significant across positions\n\nf,ax=plt.subplots(figsize=(9,5))\nsns.barplot('Pos','Rec', data=rec, hue='Score')\nax.set_title('Expected Rec')\nplt.show()",
"_____no_output_____"
],
[
"#68.1% expected increase in receptions for scoring events\n\nprint('Score=0: ', rec[rec['Score']==0].Rec.mean())\nprint('Score=1: ', rec[rec['Score']==1].Rec.mean())\nprint((4.54-2.7)/2.7)",
"Score=0: 2.6983108108108107\nScore=1: 4.543065693430657\n0.6814814814814814\n"
],
[
"#opportunity has huge role in touchdown expectation\n#average targets for player who scores a touchdown ~ 6\n#touchdown expectation for players receiving at least 6 targets = 33%\n#this will be the baseline for model evaluation\n\nprint('Score=0: ', rec[rec['Score']==0].Tgt.mean())\nprint('Score=1: ', rec[rec['Score']==1].Tgt.mean())\nprint((6.32-3.8)/3.8)\nprint('Targets>=10: ', rec[rec['Tgt']>=6].Score.mean())",
"Score=0: 4.0496621621621625\nScore=1: 6.338686131386861\n0.6631578947368423\nTargets>=10: 0.3304867634500427\n"
],
[
"#more data cleaning\n#convert team names to ordinal rank based on matchup data\n#convert position names to arbitrary values for processing\n\nrec['Opp'].replace(['DEN','HST', 'MIN', 'ARZ', 'JAX', 'BUF', 'CHI', 'SEA', 'BLT',\n 'LA', 'CIN', 'NE', 'PHI', 'SF', 'MIA', 'PIT', 'NYJ', 'KC', 'DET',\n 'SD', 'CLV', 'TB', 'NYG', 'OAK', 'WAS', 'DAL', 'IND', 'ATL', 'CAR',\n 'TEN', 'GB', 'NO'], [1, 2, 3 , 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,\n 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,\n 27, 28, 29, 30, 31, 32], inplace=True)\n\nrec['Team'].replace(['ATL', 'NO', 'NE', 'GB', 'DAL', 'ARZ', 'OAK', 'IND', 'SD',\n 'PIT', 'BUF', 'WAS', 'KC', 'TEN', 'CAR', 'PHI', 'MIA', 'SEA',\n 'TB', 'DET', 'BLT', 'DEN', 'MIN', 'CIN', 'JAX', 'NYG', 'SF',\n 'CHI', 'HST', 'NYJ', 'CLV', 'LA'], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10,\n 11, 12, 13, 14, 15, 16, 17, 18, 19,\n 20, 21, 22, 23, 24, 25, 26, 27, 28,\n 29, 30, 31, 32], inplace=True)\n\nrec['Pos'].replace(['WR', 'TE', 'RB'], [0, 1, 2], inplace=True)\nprint(rec.info())",
"<class 'pandas.core.frame.DataFrame'>\nInt64Index: 3645 entries, 0 to 3839\nData columns (total 19 columns):\nPlayer 3645 non-null object\nTeam 3645 non-null int64\nOpp 3645 non-null int64\nPos 3645 non-null int64\nG 3645 non-null int64\nTgt 3645 non-null int64\nRec 3645 non-null int64\nYds 3645 non-null int64\nTD 3645 non-null int64\nScore 3645 non-null int64\nC % 3645 non-null float64\naDOT 3645 non-null float64\nYPR 3645 non-null float64\nYPT 3645 non-null float64\nYAC 3645 non-null float64\nFPTS 3645 non-null float64\nRXP 3645 non-null float64\nQBR 3645 non-null float64\nSk 3645 non-null float64\ndtypes: float64(9), int64(9), object(1)\nmemory usage: 729.5+ KB\nNone\n"
],
[
"#convert matchup ranking to a range for better interpretation\n\nrec['Opp_range'] = 0\nrec.loc[rec['Opp']<=6, 'Opp_range'] = 0\nrec.loc[(rec['Opp']>6) & (rec['Opp']<=12), 'Opp_range'] = 1\nrec.loc[(rec['Opp']>12) & (rec['Opp']<=18), 'Opp_range'] = 2\nrec.loc[(rec['Opp']>18) & (rec['Opp']<=24), 'Opp_range'] = 3\nrec.loc[rec['Opp']>24, 'Opp_range'] = 4",
"_____no_output_____"
],
[
"#Reorder features for convenience\ndata = rec[['Score','Opp_range','Pos', 'Tgt','aDOT','Yds']]\n\n#ready for processing\nX=data[['Opp_range','Pos', 'Tgt','aDOT','Yds']] #features\n#X=np.c_[X,X.values[:,0]*X.values[:,1]]\ny=data['Score'] #label\ndata.tail(10)",
"_____no_output_____"
],
[
"#skill positional scoring less about matchup and more about volume\n\nf,ax = plt.subplots(figsize=(10,10))\ncorr = data.corr()\ncmap = sns.diverging_palette(150,275, as_cmap=True)\nsns.heatmap(corr,cmap=cmap, square=True,annot=True)\nplt.show()",
"_____no_output_____"
],
[
"#how predictive are receivers fantasy output relative to TE in terms of mkt share, etc.\n#use groupby week and filter for target threshold in relation to fantasy output rank\n#examine fantasy output rank in relation to TD for week - how big is impact of TD on fantasy output rank\n#examine variation in volume by position\n#examine significance of snaps for TE\n#filter volume for TE by week\n#filter TD scored relative to volume by week for each position\n#examine avg volume per week by position\n#examine weekly production of >25 touches for rb",
"_____no_output_____"
],
[
"#split into train and test sets\n\nX_train, X_test, y_train, y_test = train_test_split(X,y,test_size=0.2, random_state=0)\nprint(len(X_train))\nprint(len(X_test))\nprint(len(y_train))\nprint(len(y_test))",
"2916\n729\n2916\n729\n"
],
[
"#train model using accuracy as evaluation metric\n\naccuracy_train=[]\nstd_dev=[]\nclassifiers=['Linear Svm','Radial Svm','Logistic Regression','KNN','Decision Tree','Naive Bayes','Random Forest']\nm=[svm.SVC(kernel='linear'),svm.SVC(kernel='rbf'),LogisticRegression(),KNeighborsClassifier(),\n DecisionTreeClassifier(),GaussianNB(),RandomForestClassifier()]\n\nfor i in m:\n score = cross_val_score(i, X_train, y_train, cv=3, scoring='accuracy')\n accuracy_train.append(score.mean())\n std_dev.append(score.std())\nmods = pd.DataFrame({'Acc': acc_results, 'Std': std_results}, index=classifiers)\nmods\n\n#little variation wrt accuracy for models likely due to skew of dataset towards non-scoring outcomes ~80% of dataset",
"_____no_output_____"
],
[
"#train model using f1 score as evaluation metric\n#visual of confusion matrix for each classifier\n\nf,ax=plt.subplots(2,4,figsize=(13,7))\npred = cross_val_predict(svm.SVC(kernel='rbf'),X_train,y_train,cv=3)\nsns.heatmap(metrics.confusion_matrix(y_train,pred),ax=ax[0,0],annot=True,fmt='2.0f')\nax[0,0].set_title('Matrix for rbf-SVM')\npred = cross_val_predict(svm.SVC(kernel='linear'),X_train,y_train,cv=3)\nsns.heatmap(metrics.confusion_matrix(y_train,pred),ax=ax[0,1],annot=True,fmt='2.0f')\nax[0,1].set_title('Matrix for Linear-SVM')\npred = cross_val_predict(KNeighborsClassifier(),X_train,y_train,cv=3)\nsns.heatmap(metrics.confusion_matrix(y_train,pred),ax=ax[0,2],annot=True,fmt='2.0f')\nax[0,2].set_title('Matrix for KNN')\npred = cross_val_predict(RandomForestClassifier(),X_train,y_train,cv=3)\nsns.heatmap(metrics.confusion_matrix(y_train,pred),ax=ax[0,3],annot=True,fmt='2.0f')\nax[0,3].set_title('Matrix for Random-Forests')\npred = cross_val_predict(LogisticRegression(),X_train,y_train,cv=3)\nsns.heatmap(metrics.confusion_matrix(y_train,pred),ax=ax[1,0],annot=True,fmt='2.0f')\nax[1,0].set_title('Matrix for Logistic Regression')\npred = cross_val_predict(DecisionTreeClassifier(),X_train,y_train,cv=3)\nsns.heatmap(metrics.confusion_matrix(y_train,pred),ax=ax[1,1],annot=True,fmt='2.0f')\nax[1,1].set_title('Matrix for Decision Tree')\npred = cross_val_predict(GaussianNB(),X_train,y_train,cv=3)\nsns.heatmap(metrics.confusion_matrix(y_train,pred),ax=ax[1,2],annot=True,fmt='2.0f')\nax[1,2].set_title('Matrix for Naive Bayes')\nplt.subplots_adjust(hspace=0.2,wspace=0.2)\nplt.show()",
"_____no_output_____"
],
[
"#f-scores for training set\n\nf_scores=[]\nclassifiers=['Linear Svm','Radial Svm','Logistic Regression','KNN','Decision Tree','Naive Bayes','Random Forest']\nm=[svm.SVC(kernel='linear'),svm.SVC(kernel='rbf'),LogisticRegression(),KNeighborsClassifier(),\n DecisionTreeClassifier(),GaussianNB(),RandomForestClassifier()]\n\nfor i in m:\n pred = cross_val_predict(i, X_train, y_train, cv=3)\n f_scores.append(metrics.f1_score(y_train, pred))\nf_ones = pd.DataFrame({'Models': classifiers ,'F': f_scores})\nf_ones",
"C:\\Users\\bryho\\Anaconda3\\lib\\site-packages\\sklearn\\metrics\\classification.py:1135: UndefinedMetricWarning: F-score is ill-defined and being set to 0.0 due to no predicted samples.\n 'precision', 'predicted', average, warn_for)\n"
],
[
"f,ax=plt.subplots(figsize=(12,5))\nsns.barplot('Models', 'F', data=f_ones, ci=None)\nax.set_title('F1 Scores')\nplt.show()",
"_____no_output_____"
],
[
"#hyperparameter tuning and test set evaluation\n\naccuracy = []\nf1_scores = []\nmodels = []\naccuracy.append(0.33)\nf1_scores.append(0.33)\nmodels.append('Baseline')",
"_____no_output_____"
],
[
"#logistic reg\n\nmodel = LogisticRegression()\nmodel.fit(X_train, y_train)\np1 = model.predict(X_test)\nprint('Logistic Regression accuracy: ', metrics.accuracy_score(p1, y_test))\nprint('Logistic Regression f1-score: ', metrics.f1_score(y_test, p1))",
"Logistic Regression accuracy: 0.831275720165\nLogistic Regression f1-score: 0.28901734104\n"
],
[
"accuracy.append(0.811197916667)\nf1_scores.append(metrics.f1_score(y_test, p1))\nmodels.append('LR')",
"_____no_output_____"
],
[
"#SVM hyperparameter tuning\nCs = [0.01 ,0.1, 0.25, 1, 5, 7, 10]\ngammas = [0.01, 0.1, 0.25, 0.5, 0.75, 1]\nkernels = ['linear', 'rbf']\nparam_grid = {'C': Cs, 'gamma': gammas, 'kernel': kernels}\ngrid_search = GridSearchCV(svm.SVC(), param_grid, cv=3)\ngrid_search.fit(X,y)\nprint(grid_search.best_params_)",
"_____no_output_____"
],
[
"#rbf svm\nmodel = svm.SVC(kernel='rbf', C=5, gamma=0.1)\nmodel.fit(X_train, y_train)\np2 = model.predict(X_test)\nprint('RBF SVM accuracy: ', metrics.accuracy_score(p2, y_test))\nprint('RBF SVM f1-score: ', metrics.f1_score(y_test, p2))",
"RBF SVM accuracy: 0.807291666667\n"
],
[
"accuracy.append(0.807291666667)\nf1_scores.append(metrics.f1_score(y_test, p2))\nmodels.append('RBF-SVM')",
"_____no_output_____"
],
[
"#Decision Tree hyperparameter tuning\nmodel = DecisionTreeClassifier()\ndepth = [2, 4, 6, 8, 10]\nparam_grid = {\"max_depth\": depth}\ngrid_search = GridSearchCV(model, param_grid, cv=3)\ngrid_search.fit(X,y)\nprint(grid_search.best_params_)",
"{'max_depth': 4}\n"
],
[
"#decision tree\nmodel = DecisionTreeClassifier(max_depth=4)\nmodel.fit(X_train, y_train)\np3 = model.predict(X_test)\nprint('Decision Tree accuracy: ', metrics.accuracy_score(p3, y_test))\nprint('Decision Tree f1-score: ', metrics.f1_score(y_test, p3))",
"Decision Tree Classifier: 0.791666666667\n"
],
[
"accuracy.append(0.791666666667)\nf1_scores.append(metrics.f1_score(y_test, p3))\nmodels.append('Decision Tree')",
"_____no_output_____"
],
[
"#knn hyperparameter tuning\nmodel = KNeighborsClassifier()\nneighbors = list(range(1,21,1))\nparam_grid = {\"n_neighbors\": neighbors}\ngrid_search = GridSearchCV(model, param_grid, cv=3)\ngrid_search.fit(X,y)\nprint(grid_search.best_params_)",
"{'n_neighbors': 10}\n"
],
[
"#knn\n\nmodel = KNeighborsClassifier(n_neighbors=10)\nmodel.fit(X_train, y_train)\np4 = model.predict(X_test)\nprint('KNeighbors accuracy: ', metrics.accuracy_score(p4, y_test))\nprint('KNeighbors f1-score: ', metrics.f1_score(y_test, p4))",
"KNeighbors Classifier: 0.802083333333\n"
],
[
"accuracy.append(0.802083333333)\nf1_scores.append(metrics.f1_score(y_test, p4))\nmodels.append('KNN')",
"_____no_output_____"
],
[
"#naive bayes\n\nmodel = GaussianNB()\nmodel.fit(X_train, y_train)\np5 = model.predict(X_test)\nprint('GaussianNB accuracy: ', metrics.accuracy_score(p5, y_test))\nprint('GaussianNB f1-score: ', metrics.f1_score(y_test, p5))",
"GaussianNB: 0.813443072702\n"
],
[
"accuracy.append(0.813443072702)\nf1_scores.append(metrics.f1_score(y_test, p5))\nmodels.append('GaussianNB')",
"_____no_output_____"
],
[
"#random forest\n\nmodel = RandomForestClassifier()\nmodel.fit(X_train, y_train)\np6 = model.predict(X_test)\nprint('Random Forest accuracy: ', metrics.accuracy_score(p6, y_test))\nprint('Random Forest f1-score: ', metrics.f1_score(y_test, p6))",
"Random Forest Classifier: 0.810699588477\n"
],
[
"accuracy.append(0.810699588477)\nf1_scores.append(metrics.f1_score(y_test, p6))\nmodels.append('Random Forest')",
"_____no_output_____"
],
[
"ml_acc_results = pd.DataFrame({'Models': models, 'Results': accuracy})\nml_f1_results = pd.DataFrame({'Models': models, 'Results': f1_scores})",
"_____no_output_____"
],
[
"print(models)\nprint(accuracy)\nprint(f1_scores)",
"['Baseline', 'LR', 'RBF-SVM', 'Decision Tree', 'KNN', 'GaussianNB', 'Random Forest', 'Voting', 'AdaBoost']\n[0.33, 0.811197916667, 0.807291666667, 0.791666666667, 0.802083333333, 0.813443072702, 0.810699588477, 0.816186556927, 0.823593964335]\n"
],
[
"f,ax=plt.subplots(figsize=(12,5))\nsns.barplot('Models','Results', data=ml_acc_results, ci=None)\nax.set_title('Test Set Accuracy')\nplt.show()",
"_____no_output_____"
],
[
"f,ax=plt.subplots(figsize=(12,5))\nsns.barplot('Models','Results', data=ml_f1_results, ci=None)\nax.set_title('Test Set F1 Scores')\nplt.show()",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cdaf990b78a281a4bd843fec7b6dde3d487fd2 | 21,795 | ipynb | Jupyter Notebook | ml/cc/exercises/synthetic_features_and_outliers.ipynb | direkshan-digital/eng-edu | 52e5e914d8dd6e25b3fb14191610cff7a22a7984 | [
"Apache-2.0"
] | null | null | null | ml/cc/exercises/synthetic_features_and_outliers.ipynb | direkshan-digital/eng-edu | 52e5e914d8dd6e25b3fb14191610cff7a22a7984 | [
"Apache-2.0"
] | null | null | null | ml/cc/exercises/synthetic_features_and_outliers.ipynb | direkshan-digital/eng-edu | 52e5e914d8dd6e25b3fb14191610cff7a22a7984 | [
"Apache-2.0"
] | null | null | null | 33.1231 | 254 | 0.511815 | [
[
[
"#### Copyright 2017 Google LLC.",
"_____no_output_____"
]
],
[
[
"# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# https://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.",
"_____no_output_____"
]
],
[
[
"# Synthetic Features and Outliers",
"_____no_output_____"
],
[
"**Learning Objectives:**\n * Create a synthetic feature that is the ratio of two other features\n * Use this new feature as an input to a linear regression model\n * Improve the effectiveness of the model by identifying and clipping (removing) outliers out of the input data",
"_____no_output_____"
],
[
"Let's revisit our model from the previous First Steps with TensorFlow exercise. \n\nFirst, we'll import the California housing data into a *pandas* `DataFrame`:",
"_____no_output_____"
],
[
"## Setup",
"_____no_output_____"
]
],
[
[
"from __future__ import print_function\n\nimport math\n\nfrom IPython import display\nfrom matplotlib import cm\nfrom matplotlib import gridspec\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport pandas as pd\nimport sklearn.metrics as metrics\nimport tensorflow as tf\nfrom tensorflow.python.data import Dataset\n\ntf.logging.set_verbosity(tf.logging.ERROR)\npd.options.display.max_rows = 10\npd.options.display.float_format = '{:.1f}'.format\n\ncalifornia_housing_dataframe = pd.read_csv(\"https://storage.googleapis.com/mledu-datasets/california_housing_train.csv\", sep=\",\")\n\ncalifornia_housing_dataframe = california_housing_dataframe.reindex(\n np.random.permutation(california_housing_dataframe.index))\ncalifornia_housing_dataframe[\"median_house_value\"] /= 1000.0\ncalifornia_housing_dataframe",
"_____no_output_____"
]
],
[
[
"Next, we'll set up our input function, and define the function for model training:",
"_____no_output_____"
]
],
[
[
"def my_input_fn(features, targets, batch_size=1, shuffle=True, num_epochs=None):\n \"\"\"Trains a linear regression model of one feature.\n \n Args:\n features: pandas DataFrame of features\n targets: pandas DataFrame of targets\n batch_size: Size of batches to be passed to the model\n shuffle: True or False. Whether to shuffle the data.\n num_epochs: Number of epochs for which data should be repeated. None = repeat indefinitely\n Returns:\n Tuple of (features, labels) for next data batch\n \"\"\"\n \n # Convert pandas data into a dict of np arrays.\n features = {key:np.array(value) for key,value in dict(features).items()} \n \n # Construct a dataset, and configure batching/repeating.\n ds = Dataset.from_tensor_slices((features,targets)) # warning: 2GB limit\n ds = ds.batch(batch_size).repeat(num_epochs)\n \n # Shuffle the data, if specified.\n if shuffle:\n ds = ds.shuffle(buffer_size=10000)\n \n # Return the next batch of data.\n features, labels = ds.make_one_shot_iterator().get_next()\n return features, labels",
"_____no_output_____"
],
[
"def train_model(learning_rate, steps, batch_size, input_feature):\n \"\"\"Trains a linear regression model.\n \n Args:\n learning_rate: A `float`, the learning rate.\n steps: A non-zero `int`, the total number of training steps. A training step\n consists of a forward and backward pass using a single batch.\n batch_size: A non-zero `int`, the batch size.\n input_feature: A `string` specifying a column from `california_housing_dataframe`\n to use as input feature.\n \n Returns:\n A Pandas `DataFrame` containing targets and the corresponding predictions done\n after training the model.\n \"\"\"\n \n periods = 10\n steps_per_period = steps / periods\n\n my_feature = input_feature\n my_feature_data = california_housing_dataframe[[my_feature]].astype('float32')\n my_label = \"median_house_value\"\n targets = california_housing_dataframe[my_label].astype('float32')\n\n # Create input functions.\n training_input_fn = lambda: my_input_fn(my_feature_data, targets, batch_size=batch_size)\n predict_training_input_fn = lambda: my_input_fn(my_feature_data, targets, num_epochs=1, shuffle=False)\n \n # Create feature columns.\n feature_columns = [tf.feature_column.numeric_column(my_feature)]\n \n # Create a linear regressor object.\n my_optimizer = tf.train.GradientDescentOptimizer(learning_rate=learning_rate)\n my_optimizer = tf.contrib.estimator.clip_gradients_by_norm(my_optimizer, 5.0)\n linear_regressor = tf.estimator.LinearRegressor(\n feature_columns=feature_columns,\n optimizer=my_optimizer\n )\n\n # Set up to plot the state of our model's line each period.\n plt.figure(figsize=(15, 6))\n plt.subplot(1, 2, 1)\n plt.title(\"Learned Line by Period\")\n plt.ylabel(my_label)\n plt.xlabel(my_feature)\n sample = california_housing_dataframe.sample(n=300)\n plt.scatter(sample[my_feature], sample[my_label])\n colors = [cm.coolwarm(x) for x in np.linspace(-1, 1, periods)]\n\n # Train the model, but do so inside a loop so that we can periodically assess\n # loss metrics.\n print(\"Training model...\")\n print(\"RMSE (on training data):\")\n root_mean_squared_errors = []\n for period in range (0, periods):\n # Train the model, starting from the prior state.\n linear_regressor.train(\n input_fn=training_input_fn,\n steps=steps_per_period,\n )\n # Take a break and compute predictions.\n predictions = linear_regressor.predict(input_fn=predict_training_input_fn)\n predictions = np.array([item['predictions'][0] for item in predictions])\n \n # Compute loss.\n root_mean_squared_error = math.sqrt(\n metrics.mean_squared_error(predictions, targets))\n # Occasionally print the current loss.\n print(\" period %02d : %0.2f\" % (period, root_mean_squared_error))\n # Add the loss metrics from this period to our list.\n root_mean_squared_errors.append(root_mean_squared_error)\n # Finally, track the weights and biases over time.\n # Apply some math to ensure that the data and line are plotted neatly.\n y_extents = np.array([0, sample[my_label].max()])\n \n weight = linear_regressor.get_variable_value('linear/linear_model/%s/weights' % input_feature)[0]\n bias = linear_regressor.get_variable_value('linear/linear_model/bias_weights')\n \n x_extents = (y_extents - bias) / weight\n x_extents = np.maximum(np.minimum(x_extents,\n sample[my_feature].max()),\n sample[my_feature].min())\n y_extents = weight * x_extents + bias\n plt.plot(x_extents, y_extents, color=colors[period]) \n print(\"Model training finished.\")\n\n # Output a graph of loss metrics over periods.\n plt.subplot(1, 2, 2)\n plt.ylabel('RMSE')\n plt.xlabel('Periods')\n plt.title(\"Root Mean Squared Error vs. Periods\")\n plt.tight_layout()\n plt.plot(root_mean_squared_errors)\n\n # Create a table with calibration data.\n calibration_data = pd.DataFrame()\n calibration_data[\"predictions\"] = pd.Series(predictions)\n calibration_data[\"targets\"] = pd.Series(targets)\n display.display(calibration_data.describe())\n\n print(\"Final RMSE (on training data): %0.2f\" % root_mean_squared_error)\n \n return calibration_data",
"_____no_output_____"
]
],
[
[
"## Task 1: Try a Synthetic Feature\n\nBoth the `total_rooms` and `population` features count totals for a given city block.\n\nBut what if one city block were more densely populated than another? We can explore how block density relates to median house value by creating a synthetic feature that's a ratio of `total_rooms` and `population`.\n\nIn the cell below, create a feature called `rooms_per_person`, and use that as the `input_feature` to `train_model()`.\n\nWhat's the best performance you can get with this single feature by tweaking the learning rate? (The better the performance, the better your regression line should fit the data, and the lower\nthe final RMSE should be.)",
"_____no_output_____"
],
[
"**NOTE**: You may find it helpful to add a few code cells below so you can try out several different learning rates and compare the results. To add a new code cell, hover your cursor directly below the center of this cell, and click **CODE**.",
"_____no_output_____"
]
],
[
[
"#\n# YOUR CODE HERE\n#\ncalifornia_housing_dataframe[\"rooms_per_person\"] =\n\ncalibration_data = train_model(\n learning_rate=0.00005,\n steps=500,\n batch_size=5,\n input_feature=\"rooms_per_person\"\n)",
"_____no_output_____"
]
],
[
[
"### Solution\n\nClick below for a solution.",
"_____no_output_____"
]
],
[
[
"california_housing_dataframe[\"rooms_per_person\"] = (\n california_housing_dataframe[\"total_rooms\"] / california_housing_dataframe[\"population\"])\n\ncalibration_data = train_model(\n learning_rate=0.05,\n steps=500,\n batch_size=5,\n input_feature=\"rooms_per_person\")",
"_____no_output_____"
]
],
[
[
"## Task 2: Identify Outliers\n\nWe can visualize the performance of our model by creating a scatter plot of predictions vs. target values. Ideally, these would lie on a perfectly correlated diagonal line.\n\nUse Pyplot's [`scatter()`](https://matplotlib.org/gallery/shapes_and_collections/scatter.html) to create a scatter plot of predictions vs. targets, using the rooms-per-person model you trained in Task 1.\n\nDo you see any oddities? Trace these back to the source data by looking at the distribution of values in `rooms_per_person`.",
"_____no_output_____"
]
],
[
[
"# YOUR CODE HERE",
"_____no_output_____"
]
],
[
[
"### Solution\n\nClick below for the solution.",
"_____no_output_____"
]
],
[
[
"plt.figure(figsize=(15, 6))\nplt.subplot(1, 2, 1)\nplt.scatter(calibration_data[\"predictions\"], calibration_data[\"targets\"])",
"_____no_output_____"
]
],
[
[
"The calibration data shows most scatter points aligned to a line. The line is almost vertical, but we'll come back to that later. Right now let's focus on the ones that deviate from the line. We notice that they are relatively few in number.\n\nIf we plot a histogram of `rooms_per_person`, we find that we have a few outliers in our input data:",
"_____no_output_____"
]
],
[
[
"plt.subplot(1, 2, 2)\n_ = california_housing_dataframe[\"rooms_per_person\"].hist()",
"_____no_output_____"
]
],
[
[
"## Task 3: Clip Outliers\n\nSee if you can further improve the model fit by setting the outlier values of `rooms_per_person` to some reasonable minimum or maximum.\n\nFor reference, here's a quick example of how to apply a function to a Pandas `Series`:\n\n clipped_feature = my_dataframe[\"my_feature_name\"].apply(lambda x: max(x, 0))\n\nThe above `clipped_feature` will have no values less than `0`.",
"_____no_output_____"
]
],
[
[
"# YOUR CODE HERE",
"_____no_output_____"
]
],
[
[
"### Solution\n\nClick below for the solution.",
"_____no_output_____"
],
[
"The histogram we created in Task 2 shows that the majority of values are less than `5`. Let's clip `rooms_per_person` to 5, and plot a histogram to double-check the results.",
"_____no_output_____"
]
],
[
[
"california_housing_dataframe[\"rooms_per_person\"] = (\n california_housing_dataframe[\"rooms_per_person\"]).apply(lambda x: min(x, 5))\n\n_ = california_housing_dataframe[\"rooms_per_person\"].hist()",
"_____no_output_____"
]
],
[
[
"To verify that clipping worked, let's train again and print the calibration data once more:",
"_____no_output_____"
]
],
[
[
"calibration_data = train_model(\n learning_rate=0.05,\n steps=500,\n batch_size=5,\n input_feature=\"rooms_per_person\")",
"_____no_output_____"
],
[
"_ = plt.scatter(calibration_data[\"predictions\"], calibration_data[\"targets\"])",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
] |
d0cdb04da9fef14fb83657e108f57800c04bba0a | 154,440 | ipynb | Jupyter Notebook | test2.ipynb | AgingCurve/new-repository1 | 4cffb598810641ab435112ff872c378862e2bdb9 | [
"MIT"
] | null | null | null | test2.ipynb | AgingCurve/new-repository1 | 4cffb598810641ab435112ff872c378862e2bdb9 | [
"MIT"
] | null | null | null | test2.ipynb | AgingCurve/new-repository1 | 4cffb598810641ab435112ff872c378862e2bdb9 | [
"MIT"
] | null | null | null | 190.666667 | 73,753 | 0.826787 | [
[
[
"<a href=\"https://colab.research.google.com/github/AgingCurve/new-repository1/blob/main/test2.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
]
],
[
[
"import pandas as pd\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n",
"_____no_output_____"
],
[
"train = pd.read_csv('/content/sample_data/california_housing_test.csv')\ntest = pd.read_csv('/content/sample_data/california_housing_test.csv')\ntrain.head()",
"_____no_output_____"
],
[
"test.head()",
"_____no_output_____"
],
[
"train.describe()",
"_____no_output_____"
],
[
"train.hist(figsize=(15,13) , grid=False , bins=50)\nplt.show()",
"_____no_output_____"
],
[
"correlation = train.corr()",
"_____no_output_____"
],
[
"plt.figure(figsize=(10,10))\nsns.heatmap(correlation , annot=True)\nplt.show()",
"_____no_output_____"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
d0cdba391fb122b801810a1b8179d7e20812155f | 1,725 | ipynb | Jupyter Notebook | Example_workflows/QCORR_processing_QM_outputs/QCORR_Analysis_with_isomerization_check.ipynb | shreesowndarya/aqme | 2cb45c5068b15b94e658bfdc53b60db82ec3502a | [
"MIT"
] | 7 | 2022-01-20T22:18:57.000Z | 2022-03-11T05:47:55.000Z | Example_workflows/QCORR_processing_QM_outputs/QCORR_Analysis_with_isomerization_check.ipynb | shreesowndarya/aqme | 2cb45c5068b15b94e658bfdc53b60db82ec3502a | [
"MIT"
] | 13 | 2022-01-21T19:11:02.000Z | 2022-02-07T18:02:18.000Z | Example_workflows/QCORR_processing_QM_outputs/QCORR_Analysis_with_isomerization_check.ipynb | shreesowndarya/aqme | 2cb45c5068b15b94e658bfdc53b60db82ec3502a | [
"MIT"
] | 4 | 2022-01-21T19:03:37.000Z | 2022-03-11T05:45:49.000Z | 26.538462 | 158 | 0.593043 | [
[
[
"# Analysis of QM files",
"_____no_output_____"
],
[
"##### QCORR analysis including isomerization filter",
"_____no_output_____"
]
],
[
[
"# QCORR analysis of Gaussian 16 output files including isomerization check and generation of json files\nimport os\nfrom aqme.qcorr import qcorr\n\nw_dir_main=os.getcwd()+'/QCORR_2'\n\n# run the QCORR analyzer, with:\n# 1) Working directory (w_dir_main=w_dir_main)\n# 2) Names of the QM output files (files='*.log')\n# 3) Detect and fix calcs that converged during geometry optimization but didn't converge during frequency calcs (freq_conv='opt=(calcfc,maxstep=5)')\n# 4) Type of initial input files where the LOG files come from (isom_type='com')\n# 5) Folder with the initial input files (isom_inputs=w_dir_main)\nqcorr(w_dir_main=w_dir_main,files='*.log',freq_conv='opt=(calcfc,maxstep=5)',\n isom_type='com',isom_inputs=w_dir_main)",
"_____no_output_____"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code"
]
] |
d0cdbbc86a4f470bcb64600f239b05e4dbcedad6 | 453,190 | ipynb | Jupyter Notebook | scripts/.ipynb_checkpoints/motivating_example-checkpoint.ipynb | luckystarufo/multiscale_HiTS | d1bb69114b384994a4493bede0d38deb9f4740ec | [
"MIT"
] | 57 | 2020-09-09T05:38:21.000Z | 2022-03-12T04:07:42.000Z | scripts/.ipynb_checkpoints/motivating_example-checkpoint.ipynb | luckystarufo/multiscale_HiTS | d1bb69114b384994a4493bede0d38deb9f4740ec | [
"MIT"
] | null | null | null | scripts/.ipynb_checkpoints/motivating_example-checkpoint.ipynb | luckystarufo/multiscale_HiTS | d1bb69114b384994a4493bede0d38deb9f4740ec | [
"MIT"
] | 15 | 2021-01-19T08:52:02.000Z | 2021-11-15T19:30:36.000Z | 782.711572 | 239,204 | 0.947263 | [
[
[
"## A motivating example: harmonic oscillator",
"_____no_output_____"
],
[
"### created by Yuying Liu, 11/02/2019",
"_____no_output_____"
]
],
[
[
"# imports\nimport os\nimport sys\nimport torch\nimport numpy as np\nimport scipy as sp\nfrom scipy import integrate\nfrom tqdm.notebook import tqdm\nimport matplotlib.pyplot as plt\nimport matplotlib.gridspec as gridspec\nfrom mpl_toolkits.mplot3d import Axes3D\n\nimport warnings\nwarnings.filterwarnings('ignore')\n\nmodule_path = os.path.abspath(os.path.join('../../src/'))\nif module_path not in sys.path:\n sys.path.append(module_path)\n \nimport VaryingStepRKNN as net",
"_____no_output_____"
],
[
"# # # # # # # # # # # # # # # # # #\n# global constants, paths, etc. #\n# # # # # # # # # # # # # # # # # #\nload_data = False\nload_model = False\ndata_dir = '../data/VaryingStep/Linear/'\nmodel_dir = '../../model/VaryingStep/Linear/'",
"_____no_output_____"
]
],
[
[
"### simulation",
"_____no_output_____"
]
],
[
[
"np.random.seed(2)\ntrain_steps = 10000\ntest_steps = 2**15\nn_train = 500\nn_test = 50\nn_steps = 5\ndt = 0.002;\nn = 2\n\n\nA = np.array([[0, -1], [1, 0]])\ndef harmonic_oscillator_rhs(x):\n # rhs of harmonic oscillator\n return A.dot(x)\n\nif load_data:\n # # # # # # # # # # # # # # # # # # # #\n # load simulated data from directory #\n # # # # # # # # # # # # # # # # # # # #\n \n train_data = np.load(os.path.join(data_dir, 'trainBig.npy'))\n test_data = np.load(os.path.join(data_dir, 'testBig.npy'))\n n_train = train_data.shape[0]\n n_test = test_data.shape[0]\nelse:\n # # # # # # # # # # # # # # # # #\n # simulate harmonic oscillator #\n # # # # # # # # # # # # # # # # # \n\n # simulate training trials \n train_data = np.zeros((n_train, train_steps, n))\n print('generating training trials ...')\n for i in tqdm(range(n_train)):\n x_init = np.random.uniform(-1, 1, n)\n t = np.linspace(0, (train_steps-1)*dt, train_steps)\n sol = sp.integrate.solve_ivp(lambda _, x: harmonic_oscillator_rhs(x), [0, (train_steps-1)*dt], x_init, t_eval=t)\n train_data[i, :, :] = sol.y.T\n\n # simulate test trials\n test_data = np.zeros((n_test, test_steps, n))\n print('generating testing trials ...')\n for i in tqdm(range(n_test)):\n x_init = np.random.uniform(-1, 1, n)\n t = np.linspace(0, (test_steps-1)*dt, test_steps)\n sol = sp.integrate.solve_ivp(lambda _, x: harmonic_oscillator_rhs(x), [0, (test_steps-1)*dt], x_init, t_eval=t)\n test_data[i, :, :] = sol.y.T\n \n # save data\n np.save(os.path.join(data_dir, 'trainBig.npy'), train_data)\n np.save(os.path.join(data_dir, 'testBig.npy'), test_data)",
"_____no_output_____"
]
],
[
[
"### visualize & load data",
"_____no_output_____"
]
],
[
[
"# load the data to dataset object\ndatasets = list()\nstep_sizes = list()\nprint('Dt\\'s: ')\nfor i in range(2, 10):\n step_size = 2**i\n print(step_size * dt)\n step_sizes.append(step_size)\n datasets.append(net.VaryingStepDataSet(train_data, test_data, dt, n_steps=n_steps, step_size=step_size))",
"Dt's: \n0.008\n0.016\n0.032\n0.064\n0.128\n0.256\n0.512\n1.024\n"
],
[
"# # # # # # # # # \n# visualization #\n# # # # # # # # #\n\n# visualize time series & samples\nt = np.linspace(0, (test_steps-1)*dt, test_steps)\nfig = plt.figure(figsize=(12, 8))\ngs = gridspec.GridSpec(nrows=3, ncols=2, hspace=0.5)\nax0 = fig.add_subplot(gs[0, :])\nax0.plot(t, test_data[0, :, :], linewidth=2.0)\nax0.set_title('sampled trajectory', fontsize=20)\nax0.tick_params(axis='both', which='major', labelsize=15)\n\nax1 = fig.add_subplot(gs[1:, 0])\nax2 = fig.add_subplot(gs[1:, 1])\nfor i in range(n_train):\n ax1.scatter(datasets[0].train_ys[i, 0:100, 0], datasets[0].train_ys[i, 0:100, 1], marker='.', s=30)\n ax2.scatter(datasets[-1].train_ys[i, 0:100, 0], datasets[-1].train_ys[i, 0:100, 1], marker='.', s=30)\nax1.set_title('high res samples', fontsize=20)\nax1.tick_params(axis='both', which='major', labelsize=15)\nax2.set_title('low res samples', fontsize=20)\nax2.tick_params(axis='both', which='major', labelsize=15)",
"_____no_output_____"
]
],
[
[
"### RKNN with varying timesteps",
"_____no_output_____"
]
],
[
[
"models = list()\nmax_epoch=10000\n\nif load_model:\n # load the model\n for step_size in step_sizes:\n models.append(torch.load(os.path.join(model_dir, 'model_D{}.pt'.format(step_size)), map_location='cpu'))\n # fix model consistencies trained on gpus (optional)\n for model in models:\n model.device = 'cpu'\n model._modules['vector_field']._modules['activation'] = torch.nn.ReLU()\nelse:\n for (step_size, dataset) in zip(step_sizes, datasets):\n # set up the network\n model = net.VaryingTimeStepper(arch=[2, 20, 40, 40, 20, 2], dt=dt)\n # training\n print('training model_D{} ...'.format(step_size))\n model.train_net(dataset, max_epoch=max_epoch, batch_size=n_train, lr=1e-3, \n model_path=os.path.join(model_dir, 'model_D{}.pt'.format(step_size)))\n models.append(model)",
"_____no_output_____"
],
[
"# uniscale forecast\nn_steps = 1000\npreds_mse = list()\ncriterion = torch.nn.MSELoss(reduction='none')\n\nfor (model, dataset) in tqdm(zip(models, datasets)):\n y_preds, _ = model.forecast(dataset.test_x, n_steps=n_steps)\n preds_mse.append(criterion(dataset.test_ys[:, 0:n_steps, :], y_preds).mean(-1))\n \n# visualize forecasting error at each time step \nfig = plt.figure(figsize=(20, 6))\nt = [dt*step for step in range(n_steps)]\ncolors=iter(plt.cm.rainbow(np.linspace(0, 1, 8)))\nfor k in range(len(preds_mse)):\n err = preds_mse[k]\n mean = err.mean(0).detach().numpy()\n rgb = next(colors)\n plt.plot(t, np.log(mean), linestyle='-', color=rgb, linewidth=3.0, label='$\\Delta\\ t$={}'.format(step_sizes[k]*dt))\nplt.legend(fontsize=20, loc='upper right')\nplt.xticks(fontsize=20)\nplt.yticks(fontsize=20)",
"_____no_output_____"
],
[
"# multiscale forecast\nn_steps = 1000\ncriterion = torch.nn.MSELoss(reduction='none')\ny_preds, _ = net.multiscale_forecast(datasets[0].test_x, n_steps=n_steps, models=models[3:])\nmultiscale_preds_mse = criterion(datasets[0].test_ys[:, 0:n_steps, :], y_preds).mean(-1)",
"_____no_output_____"
],
[
"# visualize multiscale forecasting error at each time step \nfig = plt.figure(figsize=(20, 6))\nt = [dt*step for step in range(n_steps)]\n\n\n# visualize forecasting error at each time step \nfig = plt.figure(figsize=(20, 6))\nt = [dt*step for step in range(n_steps)]\ncolors=iter(plt.cm.rainbow(np.linspace(0, 1, 8)))\nmultiscale_err = multiscale_preds_mse.mean(0).detach().numpy()\nfor k in range(len(preds_mse)):\n err = preds_mse[k]\n mean = err.mean(0).detach().numpy()\n rgb = next(colors)\n plt.plot(t, np.log(mean), linestyle='-', color=rgb, linewidth=3.0, alpha=0.5, label='$\\Delta\\ t$={}'.format(step_sizes[k]*dt))\nplt.plot(t, np.log(multiscale_err), linestyle='-', color='k', linewidth=3.0, label='multiscale'.format(step_sizes[0]))\nplt.legend(fontsize=20, loc='upper right')\nplt.xticks(fontsize=20)\nplt.yticks(fontsize=20)",
"_____no_output_____"
]
],
[
[
"### Table 1",
"_____no_output_____"
]
],
[
[
"diff_scale_mse = torch.zeros(len(models)+1, len(step_sizes))\nfor i in range(len(models)):\n for j in range(len(step_sizes)):\n step_size = step_sizes[j]\n diff_scale_mse[i, j] = preds_mse[i][:, 0:5*step_size:step_size].mean()\n \nfor j in range(len(step_sizes)):\n diff_scale_mse[-1, j] = multiscale_preds_mse[:, 0:5*step_size:step_size].mean()\n\nnp.set_printoptions(precision=2, suppress=False)\nprint(diff_scale_mse.detach().numpy())",
"_____no_output_____"
]
],
[
[
"### Flow maps",
"_____no_output_____"
]
],
[
[
"xvalues, yvalues = np.meshgrid(np.arange(-1.0,1.0,0.02), np.arange(-1.0,1.0,0.02))\ninits = np.stack([xvalues, yvalues], 2)\nt = [0.] + [10 * dt * step_size for step_size in step_sizes]\nflow = np.zeros((inits.shape[0], inits.shape[1], len(t), 2))\nfor i in range(inits.shape[0]):\n for j in range(inits.shape[1]):\n init = inits[i, j]\n sol = sp.integrate.solve_ivp(lambda _, x: harmonic_oscillator_rhs(x), [0, 10*step_sizes[-1]*dt], init, t_eval=t)\n flow[i, j, :] = sol.y.T\n \nto_plots = list()\nvmin = float('inf')\nvmax = float('-inf')\nfor i in range(1, len(t)):\n vmin = min(np.min(flow[:, :, i, 1] - flow[:, :, 0, 1]), vmin)\n vmax = max(np.max(flow[:, :, i, 1] - flow[:, :, 0, 1]), vmax)\n to_plots.append((flow[:, :, i, 1] - flow[:, :, 0, 1]))\nfor im in to_plots:\n plt.figure(figsize=(10, 8))\n plt.imshow(im, extent=[-1,1,-1,1], vmin=vmin, vmax=vmax)\n plt.xticks(fontsize=20)\n plt.yticks(fontsize=20)",
"_____no_output_____"
],
[
"# plt.figure(figsize=(10, 8))\n# plt.imshow(im, extent=[-1,1,-1,1], vmin=vmin, vmax=vmax)\n# plt.xticks(fontsize=20)\n# plt.yticks(fontsize=20)\n# cbar = plt.colorbar()\n# cbar.ax.tick_params(labelsize=20) ",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
]
] |
d0cdd6c3bf8f97484e0f3bed77f63ca85ba4c733 | 656,324 | ipynb | Jupyter Notebook | notebooks/supervised_airfoils_normalized.ipynb | gmshashank/Deep_Flow_Prediction | 9b4c388b70a458cddac20258242a6a36965524bc | [
"MIT"
] | null | null | null | notebooks/supervised_airfoils_normalized.ipynb | gmshashank/Deep_Flow_Prediction | 9b4c388b70a458cddac20258242a6a36965524bc | [
"MIT"
] | null | null | null | notebooks/supervised_airfoils_normalized.ipynb | gmshashank/Deep_Flow_Prediction | 9b4c388b70a458cddac20258242a6a36965524bc | [
"MIT"
] | null | null | null | 89.089724 | 85,262 | 0.75163 | [
[
[
"<a href=\"https://colab.research.google.com/github/gmshashank/Deep_Flow_Prediction/blob/main/supervised_airfoils_normalized.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>",
"_____no_output_____"
],
[
"# Supervised training for RANS flows around airfoils\n\n## Overview \n\nFor this example of supervised training\nwe have a turbulent airflow around wing profiles, and we'd like to know the average motion\nand pressure distribution around this airfoil for different Reynolds numbers and angles of attack.\nThus, given an airfoil shape, Reynolds numbers, and angle of attack, we'd like to obtain\na velocity field and a pressure field around the airfoil.\n\nThis is classically approximated with _Reynolds-Averaged Navier Stokes_ (RANS) models, and this\nsetting is still one of the most widely used applications of Navier-Stokes solver in industry.\nHowever, instead of relying on traditional numerical methods to solve the RANS equations,\nwe now aim for training a surrogate model via a neural network that completely bypasses the numerical solver,\nand produces the solution in terms of velocity and pressure.\n[[run in colab]](https://colab.research.google.com/github/tum-pbs/pbdl-book/blob/main/supervised-airfoils.ipynb)\n",
"_____no_output_____"
],
[
"## Formulation\n\n\nWith the supervised formulation from {doc}`supervised`, our learning task is pretty straight-forward, and can be written as \n\n$$\\begin{aligned}\n\\text{arg min}_{\\theta} \\sum_i ( f(x_i ; \\theta)-y^*_i )^2 ,\n\\end{aligned}$$\n\nwhere $x$ and $y^*$ each consist of a set of physical fields,\nand the index $i$ evaluates the difference across all discretization points in our data sets.\n\nThe goal is to infer velocity $\\mathbf{u} = u_x,u_y$ and a pressure field $p$ in a computational domain $\\Omega$\naround the airfoil in the center of $\\Omega$. \n$u_x,u_y$ and $p$ each have a dimension of $128^2$.\nAs inputs we have the Reynolds number $\\text{Re} \\in \\mathbb{R}$, the angle of attack\n$\\alpha \\in \\mathbb{R}$, and the airfoil shape $\\mathbf{s}$ encoded as a rasterized grid with $128^2$.\nBoth constant, scalar inputs $\\text{Re}$ and $\\alpha$ are likewise extended to a size of $128^2$.\nThus, put together, both input and output have the same dimensions: $x,y^* \\in \\mathbb{R}^{3\\times128\\times128}$.\nThis is exactly what we'll specify as input and output dimensions for the NN below.\n\nA point to keep in mind here is that our quantities of interest in $y^*$ contain three different physical fields. While the two velocity components are quite similar in spirit, the pressure field typically has a different behavior with an approximately squared scaling with respect to the velocity (cf. [Bernoulli](https://en.wikipedia.org/wiki/Bernoulli%27s_principle)). This implies that we need to be careful with simple summations (as in the minimization problem above), and that we should take care to normalize the data.\n",
"_____no_output_____"
],
[
"## Code coming up...\n\nLet's get started with the implementation. Note that we'll skip the data generation process here. The code below is adapted from {cite}`thuerey2020dfp` and [this codebase](https://github.com/thunil/Deep-Flow-Prediction), which you can check out for details. Here, we'll simply download a small set of training data generated with a Spalart-Almaras RANS simulation in [OpenFOAM](https://openfoam.org/).",
"_____no_output_____"
]
],
[
[
"# import numpy as np\n# import os.path, random\n# import torch\n# from torch.utils.data import Dataset\n# print(\"Torch version {}\".format(torch.__version__))\n\n# # get training data\n# dir = \"./\"\n# if True:\n# # download\n# if not os.path.isfile('data-airfoils.npz'):\n# import requests\n# print(\"Downloading training data (300MB), this can take a few minutes the first time...\")\n# with open(\"data-airfoils.npz\", 'wb') as datafile:\n# resp = requests.get('https://dataserv.ub.tum.de/s/m1615239/download?path=%2F&files=dfp-data-400.npz', verify=False)\n# datafile.write(resp.content)\n# else: \n# # alternative: load from google drive (upload there beforehand):\n# from google.colab import drive\n# drive.mount('/content/gdrive')\n# dir = \"./gdrive/My Drive/\"\n\n# npfile=np.load(dir+'data-airfoils.npz')\n \n# print(\"Loaded data, {} training, {} validation samples\".format(len(npfile[\"inputs\"]),len(npfile[\"vinputs\"])))\n\n# print(\"Size of the inputs array: \"+format(npfile[\"inputs\"].shape))",
"_____no_output_____"
]
],
[
[
"If you run this notebook in colab, the `else` statement above (which is deactivated by default) might be interesting for you: instead of downloading the training data anew every time, you can manually download it once and store it in your google drive. We assume it's stored in the root directory as `data-airfoils.npz`. Afterwards, you can use the code above to load the file from your google drive, which is typically much faster. This is highly recommended if you want to experiment more extensively via colab.",
"_____no_output_____"
]
],
[
[
"!git clone https://github.com/thunil/Deep-Flow-Prediction.git",
"Cloning into 'Deep-Flow-Prediction'...\nremote: Enumerating objects: 139, done.\u001b[K\nremote: Counting objects: 100% (33/33), done.\u001b[K\nremote: Compressing objects: 100% (19/19), done.\u001b[K\nremote: Total 139 (delta 19), reused 27 (delta 14), pack-reused 106\u001b[K\nReceiving objects: 100% (139/139), 1.56 MiB | 10.74 MiB/s, done.\nResolving deltas: 100% (69/69), done.\n"
],
[
"%cd /content/Deep-Flow-Prediction",
"/content/Deep-Flow-Prediction\n"
],
[
"# Reduced data set with 6.4k samples plus test data (1.2GB)\n# https://dataserv.ub.tum.de/s/m1470791/download?path=%2F&files=data_6k.tar.gz\n\nimport requests\nwith open(\"data_6k.tar.gz\", 'wb') as datafile:\n resp = requests.get('https://dataserv.ub.tum.de/s/m1470791/download?path=%2F&files=data_6k.tar.gz', verify=False)\n datafile.write(resp.content)",
"/usr/local/lib/python3.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n InsecureRequestWarning)\n"
],
[
"!tar -xvf data_6k.tar.gz",
"\u001b[1;30;43mStreaming output truncated to the last 5000 lines.\u001b[0m\ndata/train/ag45ct02r_5187_1033.npz\ndata/train/fg1_3181_49.npz\ndata/train/goe711_3244_346.npz\ndata/train/n63210_9280_-772.npz\ndata/train/naca652415a05_7917_1124.npz\ndata/train/hq1010_8548_-2238.npz\ndata/train/usa35a_5306_-1040.npz\ndata/train/goe746_4306_-1210.npz\ndata/train/goe442_6635_-694.npz\ndata/train/e337_2352_-320.npz\ndata/train/raf26_8345_3438.npz\ndata/train/e748_3099_-429.npz\ndata/train/n63210_8259_-2718.npz\ndata/train/mh91_4416_1082.npz\ndata/train/mh26_6165_143.npz\ndata/train/ec863914_7366_1955.npz\ndata/train/raf25_6030_2049.npz\ndata/train/raf89_6522_888.npz\ndata/train/s8037_3371_1267.npz\ndata/train/mrc-16_1216_500.npz\ndata/train/c141a_6075_-1043.npz\ndata/train/goe222_1791_653.npz\ndata/train/goe514_3341_-1089.npz\ndata/train/e471_4898_1896.npz\ndata/train/fx84w140_3996_-1131.npz\ndata/train/ec863914_8951_1144.npz\ndata/train/goe723_8837_-1257.npz\ndata/train/goe440_7643_1154.npz\ndata/train/e341_3271_378.npz\ndata/train/goe655_8980_-2816.npz\ndata/train/ah83150q_9745_1078.npz\ndata/train/goe547_1199_203.npz\ndata/train/lwk80120k25_5036_-1285.npz\ndata/train/df101_4409_1608.npz\ndata/train/naca66206_1725_-468.npz\ndata/train/e341_4980_817.npz\ndata/train/ah93k130_8413_2931.npz\ndata/train/hq208_8769_977.npz\ndata/train/ls417mod_6300_-343.npz\ndata/train/rhodesg34_7205_-713.npz\ndata/train/e852_8466_1072.npz\ndata/train/fx66196v_8128_-2737.npz\ndata/train/e168_1847_-543.npz\ndata/train/mh64_4269_1337.npz\ndata/train/hq359_2546_-690.npz\ndata/train/goe233_5933_381.npz\ndata/train/goe617_1984_-20.npz\ndata/train/e874_4804_-422.npz\ndata/train/as5048_1032_-130.npz\ndata/train/usa45m_7779_808.npz\ndata/train/nacacyh_4876_1632.npz\ndata/train/goe795_3998_526.npz\ndata/train/npl9627_4779_1015.npz\ndata/train/goe376_3887_-1064.npz\ndata/train/goe310_8098_2828.npz\ndata/train/e587_4418_-1406.npz\ndata/train/sd6060_7433_2027.npz\ndata/train/goe437_2512_-69.npz\ndata/train/fxs21158_2135_497.npz\ndata/train/goe504_8338_-32.npz\ndata/train/ls413mod_1379_-267.npz\ndata/train/goe400_1347_-126.npz\ndata/train/ag03_8082_164.npz\ndata/train/goe401_8905_758.npz\ndata/train/fx79k144_4774_-824.npz\ndata/train/sc20010_6756_79.npz\ndata/train/rae5215_6673_-738.npz\ndata/train/mh121_8822_933.npz\ndata/train/goe547_4292_937.npz\ndata/train/s9032_1093_-174.npz\ndata/train/goe677_1310_103.npz\ndata/train/goe16k_8562_232.npz\ndata/train/fx84w140_7960_-2065.npz\ndata/train/goe423_9127_3518.npz\ndata/train/sd7003_8992_-1749.npz\ndata/train/hq309_5992_-1923.npz\ndata/train/k1_5415_-1771.npz\ndata/train/hq308_5079_-521.npz\ndata/train/goe14k_9055_119.npz\ndata/train/goe479_6200_-246.npz\ndata/train/dae51_1392_510.npz\ndata/train/e343_1252_254.npz\ndata/train/naca6412_6027_-2126.npz\ndata/train/naca634421_5927_-1577.npz\ndata/train/hq3514_6844_-1968.npz\ndata/train/e230_4115_1168.npz\ndata/train/vr9_9038_-593.npz\ndata/train/goe143_7895_-174.npz\ndata/train/coanda2_2148_859.npz\ndata/train/goe464_5622_-1096.npz\ndata/train/eh0009_1085_-337.npz\ndata/train/nasasc2-0714_8030_1350.npz\ndata/train/n64110_1424_425.npz\ndata/train/fx66a175_7494_-2593.npz\ndata/train/goe450_1120_-401.npz\ndata/train/sc20414_9044_3042.npz\ndata/train/fx60126_3632_370.npz\ndata/train/goe611_8646_-1274.npz\ndata/train/goe195_2231_-522.npz\ndata/train/naca652215_955_-322.npz\ndata/train/e603_2654_-767.npz\ndata/train/e344_1241_121.npz\ndata/train/goe407_6415_1949.npz\ndata/train/goe448_6655_-2096.npz\ndata/train/goe121_8164_1753.npz\ndata/train/sd7090_6923_-1774.npz\ndata/train/goe370_4146_85.npz\ndata/train/mh18_5557_729.npz\ndata/train/ag19_8721_2383.npz\ndata/train/ht12_2766_-67.npz\ndata/train/e201_4590_-547.npz\ndata/train/fxlv152_1895_143.npz\ndata/train/a18_8951_3316.npz\ndata/train/e207_6210_-1704.npz\ndata/train/e862_7013_1903.npz\ndata/train/du8608418_5804_-1279.npz\ndata/train/naca23012_7958_-1442.npz\ndata/train/goe529_3087_937.npz\ndata/train/raf26_1110_306.npz\ndata/train/fx61184_5161_858.npz\ndata/train/rg8_5169_393.npz\ndata/train/goe498_4003_155.npz\ndata/train/e542_6800_-2533.npz\ndata/train/s9027_8522_-1209.npz\ndata/train/raf31_5810_-9.npz\ndata/train/naca001066_6275_26.npz\ndata/train/m12_5108_1078.npz\ndata/train/sg6051_4727_640.npz\ndata/train/mh26_9386_-13.npz\ndata/train/goe279_2578_-26.npz\ndata/train/sa7036_7260_166.npz\ndata/train/sc20710_2683_-606.npz\ndata/train/goe142_7686_-249.npz\ndata/train/us1000root_6564_-2197.npz\ndata/train/ames01_5170_-849.npz\ndata/train/drgnfly_1158_-346.npz\ndata/train/naca001066_3307_392.npz\ndata/train/naca651412_6770_-716.npz\ndata/train/rg15_6273_-1351.npz\ndata/train/naca63206_1325_-100.npz\ndata/train/e582_4991_1753.npz\ndata/train/goe199_2815_-996.npz\ndata/train/goe528_4911_1527.npz\ndata/train/usa49_8499_251.npz\ndata/train/e625_5728_2354.npz\ndata/train/fx61147_1623_21.npz\ndata/train/e211_1307_-94.npz\ndata/train/vr13_7529_-1137.npz\ndata/train/goe381_2185_-609.npz\ndata/train/n64110_5899_-1838.npz\ndata/train/goe226_7257_-2582.npz\ndata/train/goe460_7470_-2071.npz\ndata/train/ag37_1590_-180.npz\ndata/train/p51hroot_3820_-227.npz\ndata/train/goe10k_5877_1895.npz\ndata/train/mrc-16_9038_3281.npz\ndata/train/goe507_5460_823.npz\ndata/train/naca654421_5759_-1288.npz\ndata/train/goe413_8761_1315.npz\ndata/train/goe803h_5538_1992.npz\ndata/train/a63a108c_1485_506.npz\ndata/train/raf25_6290_603.npz\ndata/train/n64212_6295_-828.npz\ndata/train/trainer60_3717_-647.npz\ndata/train/e472_8679_-1872.npz\ndata/train/n64212mb_5108_1123.npz\ndata/train/e207_2718_19.npz\ndata/train/kc135c_5916_-1254.npz\ndata/train/ah94w301_6700_407.npz\ndata/train/goe304_1363_-395.npz\ndata/train/goe490_5979_-724.npz\ndata/train/s4180_1838_-325.npz\ndata/train/fx77w258_3329_-1024.npz\ndata/train/e485_1105_-343.npz\ndata/train/drgnfly_1112_30.npz\ndata/train/e560_5612_1049.npz\ndata/train/ah80136_7666_3026.npz\ndata/train/fx61163_9754_-1626.npz\ndata/train/hh02_4958_1856.npz\ndata/train/rc510_9164_-1387.npz\ndata/train/clarkyh_8668_1226.npz\ndata/train/dsma523b_6252_2564.npz\ndata/train/e222_5194_-280.npz\ndata/train/fx74080_1727_485.npz\ndata/train/goe797_7703_-2496.npz\ndata/train/goe328_1852_-652.npz\ndata/train/n2415_6921_910.npz\ndata/train/e591_6433_1864.npz\ndata/train/e325_1774_147.npz\ndata/train/ames02_1027_307.npz\ndata/train/fx057816_1651_-681.npz\ndata/train/goe601_6937_-1342.npz\ndata/train/psu-90-125wl_4394_-173.npz\ndata/train/rg15_1687_565.npz\ndata/train/e542_3818_241.npz\ndata/train/n64012_3580_877.npz\ndata/train/goe217_7451_-2815.npz\ndata/train/e479_2373_852.npz\ndata/train/tsagi8_6465_-1891.npz\ndata/train/goe435_7567_734.npz\ndata/train/goe29b_5045_-928.npz\ndata/train/goe269_3333_-227.npz\ndata/train/e426_5376_548.npz\ndata/train/e662_988_222.npz\ndata/train/usa45_2009_-652.npz\ndata/train/rc12b3_3477_-548.npz\ndata/train/naca663218_8941_-78.npz\ndata/train/ah95160_6969_-590.npz\ndata/train/goe525_4639_-1410.npz\ndata/train/goe275_9225_-2669.npz\ndata/train/arad13_5990_2014.npz\ndata/train/naca662215_6928_-753.npz\ndata/train/hq3514_6252_2519.npz\ndata/train/goe612_5013_-1721.npz\ndata/train/goe424_6643_-649.npz\ndata/train/e662_6293_296.npz\ndata/train/goe442_4919_-1077.npz\ndata/train/gs1_9002_-65.npz\ndata/train/e331_8340_208.npz\ndata/train/goe620_7312_404.npz\ndata/train/defcnd2_1344_149.npz\ndata/train/sd7062_8553_-87.npz\ndata/train/naca0015_8162_1778.npz\ndata/train/goe482_5697_-1523.npz\ndata/train/goe553_3301_-646.npz\ndata/train/dae31_4882_874.npz\ndata/train/fx057816_5457_128.npz\ndata/train/fx67k150_1152_447.npz\ndata/train/goe801_6215_430.npz\ndata/train/glennmartin2_9160_-498.npz\ndata/train/ag10_9499_1273.npz\ndata/train/e655_3947_16.npz\ndata/train/goe804_9317_2400.npz\ndata/train/goe178_4042_-476.npz\ndata/train/sd8040_6709_67.npz\ndata/train/ms313_4030_-1036.npz\ndata/train/rg12a189_4745_-547.npz\ndata/train/nlf416_7986_1138.npz\ndata/train/e554_5517_1668.npz\ndata/train/arad20_7605_1456.npz\ndata/train/goe598_1886_-188.npz\ndata/train/b737c_7315_2590.npz\ndata/train/vr1_5788_-175.npz\ndata/train/e587_7079_-1107.npz\ndata/train/m23_3670_-1406.npz\ndata/train/npl9626_5770_2059.npz\ndata/train/goe367_4750_1827.npz\ndata/train/e862_4148_-635.npz\ndata/train/goe314_2184_-260.npz\ndata/train/e421_2304_-942.npz\ndata/train/du8608418_5035_1444.npz\ndata/train/goe422_3303_779.npz\ndata/train/k3311sm_9219_391.npz\ndata/train/goe79_3235_58.npz\ndata/train/vr7b_7294_1665.npz\ndata/train/n64015_6978_1840.npz\ndata/train/nlf0115_6040_-406.npz\ndata/train/goe741_8933_2898.npz\ndata/train/saratov_1772_-292.npz\ndata/train/ah93k131_3865_-1541.npz\ndata/train/mh91_6562_1416.npz\ndata/train/sd7080_9289_2047.npz\ndata/train/goe411_1821_-437.npz\ndata/train/fx711520_8807_473.npz\ndata/train/sd6080_4568_1549.npz\ndata/train/goe346_3664_932.npz\ndata/train/naca664221_3611_668.npz\ndata/train/gu255118_6988_1199.npz\ndata/train/fx79k144_2529_-639.npz\ndata/train/vr1_7450_804.npz\ndata/train/goe703_1012_322.npz\ndata/train/goe676_7082_356.npz\ndata/train/goe324_5629_1306.npz\ndata/train/usa32_3582_-1213.npz\ndata/train/s4180_3720_814.npz\ndata/train/e478_8449_-777.npz\ndata/train/naca651212a06_4014_420.npz\ndata/train/goe770_7644_-2448.npz\ndata/train/goe286_8483_3101.npz\ndata/train/marsden_4780_924.npz\ndata/train/n0012_8918_1375.npz\ndata/train/b29root_9750_1762.npz\ndata/train/e379_4127_631.npz\ndata/train/s7055_3301_-241.npz\ndata/train/s4320_3474_-808.npz\ndata/train/eh1590_8894_2712.npz\ndata/train/e176_5121_-1546.npz\ndata/train/ah80136_7415_-157.npz\ndata/train/npl9510_9728_578.npz\ndata/train/rc08b3_4817_1875.npz\ndata/train/usa35b_4800_1000.npz\ndata/train/sd8000_8294_240.npz\ndata/train/goe711_2057_102.npz\ndata/train/hq2512_8812_-942.npz\ndata/train/clarky_8061_2888.npz\ndata/train/goe780_3232_476.npz\ndata/train/goe685_4282_-1580.npz\ndata/train/e431_2751_78.npz\ndata/train/mh61_4210_750.npz\ndata/train/e636_6775_-2777.npz\ndata/train/ebambino7_2011_-217.npz\ndata/train/sg6042_2446_-940.npz\ndata/train/naca0008_1015_-280.npz\ndata/train/e230_8192_3105.npz\ndata/train/fx601001_1183_71.npz\ndata/train/sc20706_7040_2078.npz\ndata/train/fx60157_3148_-1256.npz\ndata/train/df102_7048_-1009.npz\ndata/train/goe601_8650_-1790.npz\ndata/train/goe92_7566_-2076.npz\ndata/train/clarkz_5741_1826.npz\ndata/train/sc1012r8_8037_1735.npz\ndata/train/fx69274_8442_2325.npz\ndata/train/naca16018_9082_2981.npz\ndata/train/goe137_3146_1092.npz\ndata/train/e326_7930_1683.npz\ndata/train/sg6040_2845_-703.npz\ndata/train/dae51_7291_-141.npz\ndata/train/fx77w153_1990_-316.npz\ndata/train/fx76120_5520_1226.npz\ndata/train/s3016_5877_-1225.npz\ndata/train/goe390_4052_469.npz\ndata/train/ag44ct02r_7473_-2813.npz\ndata/train/ag19_2116_-736.npz\ndata/train/p51droot_6878_145.npz\ndata/train/goe393_3897_-866.npz\ndata/train/e553_8135_670.npz\ndata/train/e715_5606_538.npz\ndata/train/ag45ct02r_2689_267.npz\ndata/train/e694_5806_-577.npz\ndata/train/e585_9493_-1706.npz\ndata/train/fx76mp120_6749_-1988.npz\ndata/train/goe693_8600_752.npz\ndata/train/ah83150q_1649_-587.npz\ndata/train/e547_2177_629.npz\ndata/train/ag13_1181_265.npz\ndata/train/e471_7032_-2123.npz\ndata/train/goe647_1175_-364.npz\ndata/train/rae102_5179_-1234.npz\ndata/train/hq359_8014_-3069.npz\ndata/train/goe142_9671_-2538.npz\ndata/train/goe384_4982_1515.npz\ndata/train/s5010_2003_-424.npz\ndata/train/goe389_4181_1534.npz\ndata/train/dh4009sm_2770_-1041.npz\ndata/train/raf32_1891_-227.npz\ndata/train/spicasm_7649_2466.npz\ndata/train/apex16_5044_1265.npz\ndata/train/goe369_6640_1773.npz\ndata/train/goe386_5848_-1141.npz\ndata/train/e266_7287_-2539.npz\ndata/train/goe692_2971_-885.npz\ndata/train/e638_3124_979.npz\ndata/train/e561_4189_89.npz\ndata/train/naca001066_7088_1824.npz\ndata/train/s3021_4245_37.npz\ndata/train/goe369_7627_1060.npz\ndata/train/fx78pk188_2553_605.npz\ndata/train/raf89_2648_1026.npz\ndata/train/ea61009_3150_-248.npz\ndata/train/s8038_4171_1662.npz\ndata/train/jn153_5184_396.npz\ndata/train/e211_1840_411.npz\ndata/train/davis_corrected_3707_-914.npz\ndata/train/raf38_2379_921.npz\ndata/train/tsagi8_4476_1514.npz\ndata/train/goe255_3897_452.npz\ndata/train/be50_7194_2042.npz\ndata/train/e266_2849_-78.npz\ndata/train/s1012_4113_603.npz\ndata/train/goe173_8084_1410.npz\ndata/train/npl9615_7139_288.npz\ndata/train/e428_3420_682.npz\ndata/train/ah79k132_3620_270.npz\ndata/train/hq1012_5167_1967.npz\ndata/train/goe417a_8309_2661.npz\ndata/train/apex16_7094_2211.npz\ndata/train/npl9510_7770_2818.npz\ndata/train/raf89_8206_2254.npz\ndata/train/e541_2485_-645.npz\ndata/train/goe173_1282_-241.npz\ndata/train/goe407_2988_757.npz\ndata/train/e551_6688_-1256.npz\ndata/train/n11h9_6420_1781.npz\ndata/train/goe09k_4628_-1637.npz\ndata/train/hq258_3476_1263.npz\ndata/train/mh102_7223_-2378.npz\ndata/train/s3021_4732_-1500.npz\ndata/train/naca644421_8946_850.npz\ndata/train/fx69274_7952_-1099.npz\ndata/train/hh02_6710_2114.npz\ndata/train/ma409_5457_-1629.npz\ndata/train/usa41_1948_-75.npz\ndata/train/usa41_3484_694.npz\ndata/train/mh116_1749_-628.npz\ndata/train/goe223_5934_1435.npz\ndata/train/mh60_7857_77.npz\ndata/train/e228_5985_636.npz\ndata/train/ag08_8992_1457.npz\ndata/train/goe121_1558_-524.npz\ndata/train/naca001064_8362_-635.npz\ndata/train/goe369_3737_-1407.npz\ndata/train/p51dtip_6063_-1986.npz\ndata/train/ag37_5761_-721.npz\ndata/train/lwk80100_6757_1730.npz\ndata/train/m5_7699_627.npz\ndata/train/r1080_8817_2604.npz\ndata/train/drgnfly_3217_568.npz\ndata/train/m14_8877_2406.npz\ndata/train/m22_1681_-68.npz\ndata/train/npl9660_4497_1162.npz\ndata/train/goe225_8240_2548.npz\ndata/train/sc20406_5473_462.npz\ndata/train/oa212_9130_2277.npz\ndata/train/kc135b_9322_3319.npz\ndata/train/n64110_9081_-2862.npz\ndata/train/usa35b_8053_-2513.npz\ndata/train/n63012a_5835_1736.npz\ndata/train/goe324_7731_-1911.npz\ndata/train/goe477_7647_1484.npz\ndata/train/goe282_5668_1408.npz\ndata/train/v13006_1412_-461.npz\ndata/train/sd7043_7561_-142.npz\ndata/train/e556_8895_47.npz\ndata/train/goe422_2638_11.npz\ndata/train/goe319_2425_-442.npz\ndata/train/pfcm_1561_-328.npz\ndata/train/goe596_1170_-75.npz\ndata/train/ah7476_8803_2233.npz\ndata/train/goe517_3464_601.npz\ndata/train/goe319_3496_586.npz\ndata/train/goe279_1755_-436.npz\ndata/train/amsoil1_5521_2132.npz\ndata/train/oaf139_8020_840.npz\ndata/train/naca0018_5149_967.npz\ndata/train/goe436_5448_1353.npz\ndata/train/mh95_8926_-1966.npz\ndata/train/s2091_8235_-48.npz\ndata/train/ah93w145_6449_991.npz\ndata/train/sg6051_5226_888.npz\ndata/train/naca2408_4952_-1608.npz\ndata/train/fx74080_7006_-1622.npz\ndata/train/kc135a_6018_973.npz\ndata/train/e654_4540_1648.npz\ndata/train/rg8_6316_1121.npz\ndata/train/rae5212_1994_306.npz\ndata/train/m18_4661_-538.npz\ndata/train/s2055_4008_-250.npz\ndata/train/goe370_4232_415.npz\ndata/train/s8037_2709_175.npz\ndata/train/fx78k140_4996_1833.npz\ndata/train/e336_8639_2919.npz\ndata/train/e428_9083_-539.npz\ndata/train/sc20414_7780_2555.npz\ndata/train/psu-90-125wl_1038_-368.npz\ndata/train/hsnlf213_1493_147.npz\ndata/train/nplx_8155_1888.npz\ndata/train/mh32_6266_78.npz\ndata/train/e874_7049_-1095.npz\ndata/train/goe380_8189_1711.npz\ndata/train/goe681_4184_1048.npz\ndata/train/naca651212a06_6048_-182.npz\ndata/train/goe431_7666_2885.npz\ndata/train/naca0015_8923_2138.npz\ndata/train/e558_4017_-554.npz\ndata/train/m10_9438_-2040.npz\ndata/train/goe57_5224_-1425.npz\ndata/train/goe624_7541_-3046.npz\ndata/train/sd7043_3731_-1226.npz\ndata/train/fx71120_4701_728.npz\ndata/train/e361_3908_-1096.npz\ndata/train/goe114_7202_1085.npz\ndata/train/v13006_4453_-679.npz\ndata/train/e201_4261_-621.npz\ndata/train/fx73cl1152_7359_2775.npz\ndata/train/goe449_1965_-768.npz\ndata/train/goe484_4374_118.npz\ndata/train/goe512_2275_-531.npz\ndata/train/b29root_7249_2393.npz\ndata/train/goe477_4561_-401.npz\ndata/train/ua79sfm_2634_-742.npz\ndata/train/sd7003_3632_1423.npz\ndata/train/goe512_6233_1648.npz\ndata/train/c5e_2122_736.npz\ndata/train/vr8b_2333_231.npz\ndata/train/ah94w301_2669_818.npz\ndata/train/jn153_2101_-667.npz\ndata/train/marske5_3208_557.npz\ndata/train/naca0006_9198_-1779.npz\ndata/train/e176_1560_-292.npz\ndata/train/hq159b_8910_2627.npz\ndata/train/e180_3261_-790.npz\ndata/train/goe633_6557_-545.npz\ndata/train/rhodesg32_2877_63.npz\ndata/train/e333_3940_-476.npz\ndata/train/isa962_6573_-643.npz\ndata/train/ah93k132_6144_2447.npz\ndata/train/goe770_3205_-29.npz\ndata/train/goe411_1719_-117.npz\ndata/train/fxs03182_7689_2882.npz\ndata/train/oa206_6212_-2070.npz\ndata/train/m5_5637_489.npz\ndata/train/goe335_2426_907.npz\ndata/train/c5e_6308_-887.npz\ndata/train/goe286_6793_-1058.npz\ndata/train/n2h15_9476_90.npz\ndata/train/hq109_3039_383.npz\ndata/train/e325_9055_305.npz\ndata/train/s2062_7129_-2872.npz\ndata/train/e182_3431_-1167.npz\ndata/train/goe500_5049_-1285.npz\ndata/train/goe121_4475_-1223.npz\ndata/train/bambino6_1435_-80.npz\ndata/train/goe375_7965_-1436.npz\ndata/train/drgnfly_7259_574.npz\ndata/train/esa40_8688_3285.npz\ndata/train/bacj_9550_-1674.npz\ndata/train/l188tip_3539_-755.npz\ndata/train/s4233_5508_-1775.npz\ndata/train/goe419_6857_-681.npz\ndata/train/sd2083_1696_183.npz\ndata/train/ah88k130_6065_814.npz\ndata/train/s1046_2947_817.npz\ndata/train/n12_4778_-407.npz\ndata/train/a63a108c_1694_486.npz\ndata/train/mh20_6910_1321.npz\ndata/train/usa28_6246_-1765.npz\ndata/train/ec863914_5211_1261.npz\ndata/train/eh2010_5087_-1225.npz\ndata/train/fx08s176_3499_-1175.npz\ndata/train/goe155_5873_-999.npz\ndata/train/fx84w150_1578_310.npz\ndata/train/sc20410_5215_-1817.npz\ndata/train/rc10n1_4332_-1157.npz\ndata/train/naca001034a08cli0.2_7089_-222.npz\ndata/train/goe451_1935_-164.npz\ndata/train/goe256_8778_-2085.npz\ndata/train/goe437_5103_-22.npz\ndata/train/e549_5593_1984.npz\ndata/train/fx74130wp2mod_2569_-359.npz\ndata/train/fx057816_4888_-1016.npz\ndata/train/e550_9850_614.npz\ndata/train/hq3014_5172_-940.npz\ndata/train/goe428_9027_-600.npz\ndata/train/nacam12_6865_892.npz\ndata/train/dh4009sm_3743_-1316.npz\ndata/train/naca64209_7460_973.npz\ndata/train/goe610bm_2099_-778.npz\ndata/train/naca643618_3096_-929.npz\ndata/train/naca0010_2064_-729.npz\ndata/train/ah93157_7235_-1473.npz\ndata/train/mh112_9086_-94.npz\ndata/train/rc08n1_5280_-1474.npz\ndata/train/m26_6523_1253.npz\ndata/train/s1016_4795_800.npz\ndata/train/nacam3_9285_2384.npz\ndata/train/goe682_1017_235.npz\ndata/train/e184_3637_-558.npz\ndata/train/goe530_4390_-1298.npz\ndata/train/goe796_4006_1281.npz\ndata/train/e420_8169_-1449.npz\ndata/train/e422_4833_-401.npz\ndata/train/fx6617a2_4177_-1468.npz\ndata/train/goe703_4119_1639.npz\ndata/train/ah79100c_2074_655.npz\ndata/train/usa50_4444_-862.npz\ndata/train/eiffel385_4312_216.npz\ndata/train/atr72sm_1903_-344.npz\ndata/train/k3311_7930_327.npz\ndata/train/mh62_2604_961.npz\ndata/train/naca66210_3630_64.npz\ndata/train/mh23_1793_-112.npz\ndata/train/hq3014_6391_2475.npz\ndata/train/goe235_2845_-332.npz\ndata/train/goe744_3233_582.npz\ndata/train/mh64_3545_179.npz\ndata/train/goe08k_4461_721.npz\ndata/train/m16_4791_-1062.npz\ndata/train/goe376_9632_970.npz\ndata/train/fx77w270s_6761_-2597.npz\ndata/train/e603_7497_-1051.npz\ndata/train/naca63209_8129_-2523.npz\ndata/train/goe165_3217_-253.npz\ndata/train/e853_5082_-1504.npz\ndata/train/mh122_6956_-1050.npz\ndata/train/ys930_8687_1276.npz\ndata/train/naca001066_7478_-3084.npz\ndata/train/e327_8485_-899.npz\ndata/train/goe477_5151_349.npz\ndata/train/fx76mp120_4685_-860.npz\ndata/train/goe143_7665_-166.npz\ndata/train/hq3513_6005_503.npz\ndata/train/fx84w218_4076_-658.npz\ndata/train/goe217_9258_-919.npz\ndata/train/eiffel371_1177_-86.npz\ndata/train/ah93156_7020_-2043.npz\ndata/train/naca662415_4312_-1617.npz\ndata/train/goe711_3507_-697.npz\ndata/train/tempest1_7561_-2162.npz\ndata/train/fx79w470a_6055_-1675.npz\ndata/train/ht05_6788_-2570.npz\ndata/train/c5b_5225_523.npz\ndata/train/fx69274_3806_-25.npz\ndata/train/goe288_5870_-661.npz\ndata/train/gm15sm_9523_2666.npz\ndata/train/b29tip_1667_644.npz\ndata/train/goe310_7112_-489.npz\ndata/train/goe419_7015_-764.npz\ndata/train/rhodesg34_3006_-1048.npz\ndata/train/s9033_6082_689.npz\ndata/train/usa32_4993_-1699.npz\ndata/train/ys930_2114_-54.npz\ndata/train/sc20402_4872_1235.npz\ndata/train/naca644221_7285_1794.npz\ndata/train/ht23_9872_1095.npz\ndata/train/goe16k_7839_2771.npz\ndata/train/goe741_8951_-2042.npz\ndata/train/n1h15_6381_253.npz\ndata/train/fx60157_8899_2937.npz\ndata/train/nl722343_2018_802.npz\ndata/train/goe115_6264_-1328.npz\ndata/train/nacam12_2934_-90.npz\ndata/train/fx66s161_8802_-48.npz\ndata/train/goe528_2491_-860.npz\ndata/train/goe574_4014_576.npz\ndata/train/oaf095_1767_-377.npz\ndata/train/ls413mod_6279_-781.npz\ndata/train/goe424_2689_487.npz\ndata/train/mh45_8275_1294.npz\ndata/train/goe361_6578_-476.npz\ndata/train/fx77w270_5079_-2045.npz\ndata/train/giiin_4952_-831.npz\ndata/train/e395_2794_78.npz\ndata/train/goe422_1871_465.npz\ndata/train/fx63110_6435_-1835.npz\ndata/train/goe512_8397_-1094.npz\ndata/train/hq2012_8817_1674.npz\ndata/train/sc20612_4774_-738.npz\ndata/train/hh02_2829_48.npz\ndata/train/doa5_1956_519.npz\ndata/train/goe298_6952_2657.npz\ndata/train/nacam12_2060_-308.npz\ndata/train/goe113_1646_-485.npz\ndata/train/usa50_3956_1082.npz\ndata/train/m20_1607_424.npz\ndata/train/goe361_5802_1002.npz\ndata/train/e853_3383_595.npz\ndata/train/amsoil2_9105_-2995.npz\ndata/train/goe405_5551_1644.npz\ndata/train/goe481_9288_1619.npz\ndata/train/goe199_1773_-84.npz\ndata/train/nlf0115_9826_1042.npz\ndata/train/eiffel430_9437_660.npz\ndata/train/naca642415_9423_-3156.npz\ndata/train/naca661212_4200_-1143.npz\ndata/train/tsagi8_4952_1125.npz\ndata/train/goe274_7195_9.npz\ndata/train/v13009_1099_332.npz\ndata/train/goe416a_4733_-105.npz\ndata/train/goe180_4221_-406.npz\ndata/train/goe335_3070_-475.npz\ndata/train/goe567_4927_2017.npz\ndata/train/e180_9081_-540.npz\ndata/train/goe225_9841_-978.npz\ndata/train/b737c_1286_307.npz\ndata/train/goe226_1045_415.npz\ndata/train/mh30_8662_2434.npz\ndata/train/goe529_4085_-50.npz\ndata/train/e387_5572_698.npz\ndata/train/n13_8331_-318.npz\ndata/train/goe363_5766_-1659.npz\ndata/train/sc1012r8_9771_2005.npz\ndata/train/e477_3350_-945.npz\ndata/train/stf86361_1400_-501.npz\ndata/train/e63_4348_-1331.npz\ndata/train/goe241_4539_684.npz\ndata/train/rg14_2070_588.npz\ndata/train/goe372_7740_-3107.npz\ndata/train/e908_9054_-1529.npz\ndata/train/s4320_2578_731.npz\ndata/train/naca0006_7258_-1737.npz\ndata/train/sa7038_9712_-2157.npz\ndata/train/c5e_2688_-77.npz\ndata/train/n22_1772_211.npz\ndata/train/naca644221_1000_141.npz\ndata/train/ls413_5854_-1501.npz\ndata/train/s1014_5709_-499.npz\ndata/train/glennmartin4_7061_-1076.npz\ndata/train/e585_5025_1558.npz\ndata/train/sd8040_4747_-295.npz\ndata/train/goe450_6609_-1949.npz\ndata/train/ag13_9626_939.npz\ndata/train/naca652415_6255_445.npz\ndata/train/goe422_4586_-1085.npz\ndata/train/vr5_3656_-834.npz\ndata/train/goe615_1818_259.npz\ndata/train/nlf414f_1031_-360.npz\ndata/train/e266_2407_-457.npz\ndata/train/goe362_8736_1891.npz\ndata/train/goe182_8469_2110.npz\ndata/train/goe177_7902_-427.npz\ndata/train/k2_1569_-351.npz\ndata/train/goe328_4333_1508.npz\ndata/train/e543_9328_-222.npz\ndata/train/e209_7483_-73.npz\ndata/train/hq2511_6625_-1866.npz\ndata/train/mh61_2800_-1115.npz\ndata/train/goe604_3784_-1335.npz\ndata/train/eiffel430_5548_1777.npz\ndata/train/goe430_3068_-717.npz\ndata/train/sa7035_5685_-1597.npz\ndata/train/naca644421_2424_-374.npz\ndata/train/s3021_9762_1607.npz\ndata/train/sd7037_6178_2487.npz\ndata/train/hq2195_4971_1439.npz\ndata/train/usa25_9838_-174.npz\ndata/train/raf28_9426_-285.npz\ndata/train/naca651212_7342_-107.npz\ndata/train/hq2510_2158_-729.npz\ndata/train/goe289_8002_-3015.npz\ndata/train/naca66209_6239_2428.npz\ndata/train/e548_2898_1124.npz\ndata/train/vr7_2610_1008.npz\ndata/train/mh201_1121_-44.npz\ndata/train/fx711530_1493_-115.npz\ndata/train/goe497_7539_-580.npz\ndata/train/fx6617a2_1654_-42.npz\ndata/train/b707e_3553_-392.npz\ndata/train/raf69_6999_-152.npz\ndata/train/c141c_9704_52.npz\ndata/train/e541_4762_-1558.npz\ndata/train/goe277_5647_1851.npz\ndata/train/e207_6402_2492.npz\ndata/train/oaf102_7251_1146.npz\ndata/train/fx3_1298_320.npz\ndata/train/eh2012_1513_-96.npz\ndata/train/goe401_2303_662.npz\ndata/train/ag27_2897_845.npz\ndata/train/goe416a_2369_208.npz\ndata/train/apex16_7668_719.npz\ndata/train/sg6051_7919_364.npz\ndata/train/naca64210_6242_2233.npz\ndata/train/goe804_3699_-842.npz\ndata/train/hobie_3536_914.npz\ndata/train/clarkysm_2251_231.npz\ndata/train/ua2-180_6403_982.npz\ndata/train/mh104_5330_-1583.npz\ndata/train/e344_8141_2107.npz\ndata/train/fx78k140_4905_-113.npz\ndata/train/goe654_7652_2700.npz\ndata/train/e475_2342_281.npz\ndata/train/as5046_6436_469.npz\ndata/train/fx057816_5072_-1535.npz\ndata/train/goe612_8275_2541.npz\ndata/train/goe500_7862_-1692.npz\ndata/train/s2050_4387_77.npz\ndata/train/fx73cl2152_9115_-2399.npz\ndata/train/e266_6691_-2526.npz\ndata/train/clarkx_1075_58.npz\ndata/train/e422_5266_480.npz\ndata/train/goe164_8940_-2214.npz\ndata/train/goe593_5131_330.npz\ndata/train/goe55_929_-384.npz\ndata/train/raf48_5702_-300.npz\ndata/train/goe478_9535_-1487.npz\ndata/train/n6h10_4652_632.npz\ndata/train/falcon_7959_-2800.npz\ndata/train/nl722362_2368_501.npz\ndata/train/ah80136_1711_426.npz\ndata/train/goe242_7661_-722.npz\ndata/train/fx6617a2_1416_-549.npz\ndata/train/goe498_8218_-373.npz\ndata/train/naca63a210_9631_469.npz\ndata/train/fx62k153_6637_2239.npz\ndata/train/goe207_4185_-1396.npz\ndata/train/sd5060_7259_900.npz\ndata/train/goe116_7031_-2304.npz\ndata/train/fx84w127_1584_567.npz\ndata/train/e554_3119_-320.npz\ndata/train/l7769_5360_-877.npz\ndata/train/naca632615_6245_462.npz\ndata/train/hq3015_9317_650.npz\ndata/train/fx71120_8431_2396.npz\ndata/train/fx711525_6456_-1136.npz\ndata/train/fx6617a2_2053_360.npz\ndata/train/usa50_8138_181.npz\ndata/train/goe182_8344_2976.npz\ndata/train/mh93_6614_-1016.npz\ndata/train/ag18_8165_-3252.npz\ndata/train/naca662215_8351_484.npz\ndata/train/raf32_5550_-1685.npz\ndata/train/naca644221_9361_-1507.npz\ndata/train/e399_5059_1207.npz\ndata/train/hh02_9471_740.npz\ndata/train/fx05191_5364_1397.npz\ndata/train/ht12_1443_-301.npz\ndata/train/spicasm_4617_-136.npz\ndata/train/naca652415_3655_373.npz\ndata/train/goe442_8227_-2155.npz\ndata/train/m685_6136_2408.npz\ndata/train/naca634421_8516_3202.npz\ndata/train/goe137_9540_-2842.npz\ndata/train/goe309_1792_-20.npz\ndata/train/goe377_3258_393.npz\ndata/train/mh92_5697_443.npz\ndata/train/s3_5042_1835.npz\ndata/train/hq300gd2_9337_-2744.npz\ndata/train/mh32_4312_878.npz\ndata/train/e325_3662_143.npz\ndata/train/hq3015_3051_939.npz\ndata/train/goe392_4775_1967.npz\ndata/train/hq309_7270_2142.npz\ndata/train/sc21010_2193_819.npz\ndata/train/hq1010_4492_107.npz\ndata/train/eh1090_6978_609.npz\ndata/train/e478_7624_-1791.npz\ndata/train/be50_4222_-394.npz\ndata/train/ag46ct02r_8553_-864.npz\ndata/train/hq010_3656_732.npz\ndata/train/naca651412_4819_1656.npz\ndata/train/e520_3230_695.npz\ndata/train/rhodesg32_9245_-1175.npz\ndata/train/naca747a315_8368_3220.npz\ndata/train/eh2070_2110_-549.npz\ndata/train/august160_3273_857.npz\ndata/train/ah88k136_3700_-335.npz\ndata/train/e343_5616_300.npz\ndata/train/s1046_3380_1214.npz\ndata/train/fxlv152_8007_-279.npz\ndata/train/naca1412_9267_84.npz\ndata/train/goe596_4013_-1246.npz\ndata/train/goe629_3429_-1040.npz\ndata/train/goe310_7547_-1201.npz\ndata/train/sc20612_7105_1555.npz\ndata/train/goe451_7673_2142.npz\ndata/train/b29root_2660_-489.npz\ndata/train/naca001065_6469_-2518.npz\ndata/train/e182_4184_-396.npz\ndata/train/nlf415_2988_-293.npz\ndata/train/goe526_4141_-1128.npz\ndata/train/fxlv152_2595_722.npz\ndata/train/naca633218_2467_236.npz\ndata/train/goe795sm_7965_-3286.npz\ndata/train/usa29_8732_2171.npz\ndata/train/l188tip_8477_-2103.npz\ndata/train/e858_1909_330.npz\ndata/train/esa40_7130_158.npz\ndata/train/s1046_4482_741.npz\ndata/train/hq3011_4146_1197.npz\ndata/train/fx66s196_2340_-412.npz\ndata/train/fx78k140a20_6921_242.npz\ndata/train/ag27_7286_-267.npz\ndata/train/fx83w160_1619_337.npz\ndata/train/usa45_1551_-13.npz\ndata/train/naca652215_8191_2473.npz\ndata/train/raf69_1440_-379.npz\ndata/train/e339_3212_111.npz\ndata/train/hq308_8047_3075.npz\ndata/train/e520_2082_-45.npz\ndata/train/isa960_7905_-2814.npz\ndata/train/m10_6291_1009.npz\ndata/train/ah80140_6170_-1602.npz\ndata/train/goe595_4413_1052.npz\ndata/train/hybrid_1_4149_-298.npz\ndata/train/s9000_7899_-1708.npz\ndata/train/e587_4661_1614.npz\ndata/train/s9000_3151_-317.npz\ndata/train/ag38_1742_670.npz\ndata/train/daytonwrightt1_5097_1379.npz\ndata/train/vr7b_5099_-1237.npz\ndata/train/boe103_6202_-588.npz\ndata/train/goe410_8552_933.npz\ndata/train/goe459_1957_-315.npz\ndata/train/goe407_2496_928.npz\ndata/train/v43015_2406_968.npz\ndata/train/goe222_9579_608.npz\ndata/train/goe315_8243_-105.npz\ndata/train/e556_4710_390.npz\ndata/train/mh43_2912_1186.npz\ndata/train/goe797_3692_577.npz\ndata/train/hq159b_8591_-2663.npz\ndata/train/mh78_2210_-487.npz\ndata/train/goe428_7763_1101.npz\ndata/train/s3_7511_-515.npz\ndata/train/oaf128_2386_-60.npz\ndata/train/goe318_2365_-407.npz\ndata/train/fx78k161_7683_-2024.npz\ndata/train/usa46_6561_1556.npz\ndata/train/ag35_8624_1887.npz\ndata/train/dormoy_5593_1583.npz\ndata/train/s1048_6454_693.npz\ndata/train/sc20402_5796_-1990.npz\ndata/train/goe314_9061_-239.npz\ndata/train/goe562_2178_-176.npz\ndata/train/e66_8772_-639.npz\ndata/train/mh92_8243_-3132.npz\ndata/train/fx057816_5894_-1656.npz\ndata/train/ls417_8267_-3202.npz\ndata/train/m8_2207_-29.npz\ndata/train/goe180_8662_1925.npz\ndata/train/c141f_5360_618.npz\ndata/train/goe484_8043_-90.npz\ndata/train/goe14k_6437_2121.npz\ndata/train/goe188_7604_1868.npz\ndata/train/goe390_1143_92.npz\ndata/train/fx711530_4158_-852.npz\ndata/train/ah21-9_4962_805.npz\ndata/train/e551_6432_2220.npz\ndata/train/e343_2375_440.npz\ndata/train/ah93w174_8652_-2623.npz\ndata/train/mh82_2664_419.npz\ndata/train/m24_3262_70.npz\ndata/train/npl9627_5859_-1715.npz\ndata/train/fx74130wp1_7607_-923.npz\ndata/train/goe505_2939_274.npz\ndata/train/goe358_5787_-237.npz\ndata/train/fx6617ai_6591_2492.npz\ndata/train/goe617_9343_425.npz\ndata/train/e582_6409_1378.npz\ndata/train/hq2195_5457_-873.npz\ndata/train/fx63100_4981_-1218.npz\ndata/train/naca66-018_4232_-1317.npz\ndata/train/goe411_8330_-287.npz\ndata/train/saratov_7732_-2476.npz\ndata/train/e682_3452_242.npz\ndata/train/ag26_2290_-872.npz\ndata/train/e176_4823_134.npz\ndata/train/goe443_6647_-1220.npz\ndata/train/raf48_8456_271.npz\ndata/train/goe677_3079_-660.npz\ndata/train/goe430_6510_-1227.npz\ndata/train/goe92_4348_262.npz\ndata/train/mh43_7894_-1721.npz\ndata/train/sg6043_9374_1968.npz\ndata/train/clarym15_1613_-637.npz\ndata/train/joukowsk_5718_1653.npz\ndata/train/dfvlrr4_5287_877.npz\ndata/train/goe244_4679_624.npz\ndata/train/m1_4516_-157.npz\ndata/train/e226_8746_-2274.npz\ndata/train/fx69pr281_1076_59.npz\ndata/train/naca633618_6794_-820.npz\ndata/train/oaf095_6383_1820.npz\ndata/train/fx69h098_5644_1661.npz\ndata/train/sc2110_1018_-285.npz\ndata/train/v43015_9521_-349.npz\ndata/train/m3_6896_-1725.npz\ndata/train/m16_4773_-1366.npz\ndata/train/sd8000_7419_-1354.npz\ndata/train/ah93w215_6573_-114.npz\ndata/train/e715_3087_-1163.npz\ndata/train/eiffel428_4516_-1024.npz\ndata/train/n2415_3202_1259.npz\ndata/train/ht05_8116_1595.npz\ndata/train/mh60_4355_-995.npz\ndata/train/goe448_5784_446.npz\ndata/train/e67_2903_811.npz\ndata/train/n64215_3026_104.npz\ndata/train/ht08_9002_589.npz\ndata/train/fg1_7158_-1983.npz\ndata/train/fauvel_6216_-2065.npz\ndata/train/mh61_8098_2938.npz\ndata/train/goe617_2541_431.npz\ndata/train/naca65206_4273_-452.npz\ndata/train/goe332_5734_-1971.npz\ndata/train/e475_9252_-1500.npz\ndata/train/gs1_8061_2171.npz\ndata/train/npl9615_1320_-519.npz\ndata/train/goe187_6354_1941.npz\ndata/train/goe525_5330_952.npz\ndata/train/c5e_4698_-1037.npz\ndata/train/s9037_5244_-1199.npz\ndata/train/n12_7631_-397.npz\ndata/train/e636_4587_1218.npz\ndata/train/e431_7333_1304.npz\ndata/train/usa98_9525_-2122.npz\ndata/train/ah6407_4167_-1122.npz\ndata/train/e339_1258_-32.npz\ndata/train/arad10_8208_842.npz\ndata/train/goe549_4393_-370.npz\ndata/train/sc20712_2681_-482.npz\ndata/train/n9_1621_-96.npz\ndata/train/s4083_3008_310.npz\ndata/train/e551_2270_-792.npz\ndata/train/n64212mb_1505_-236.npz\ndata/train/goe646_9308_2022.npz\ndata/train/fx66a175_7758_-2150.npz\ndata/train/goe81_6125_-2134.npz\ndata/train/e395_3160_-716.npz\ndata/train/n64015a_6341_302.npz\ndata/train/ag45ct02r_2345_774.npz\ndata/train/s8025_8056_-418.npz\ndata/train/e434_7397_-918.npz\ndata/train/raf15_7503_-1834.npz\ndata/train/b707d_5121_-1737.npz\ndata/train/usa98_5596_61.npz\ndata/train/goe613_6426_177.npz\ndata/train/nplx_8234_-2522.npz\ndata/train/naca2410_9305_3180.npz\ndata/train/ls413_6244_-1011.npz\ndata/train/raf30md_2970_-1175.npz\ndata/train/fx61168_2810_790.npz\ndata/train/goe255_9443_-1615.npz\ndata/train/ht12_6189_-1059.npz\ndata/train/goe134_4360_-1214.npz\ndata/train/e360_9377_-1850.npz\ndata/train/ys930_2305_-344.npz\ndata/train/naca0021_3547_-1328.npz\ndata/train/goe365_6180_-124.npz\ndata/train/goe445_8363_1188.npz\ndata/train/s8055_4449_-70.npz\ndata/train/e420_9120_-2496.npz\ndata/train/goe483_5704_1725.npz\ndata/train/goe222_4403_-439.npz\ndata/train/goe284_2239_532.npz\ndata/train/usa35b_9066_-2151.npz\ndata/train/goe12k_2885_-83.npz\ndata/train/mh114_2666_-564.npz\ndata/train/fx63143_9615_1464.npz\ndata/train/goe448_7506_3077.npz\ndata/train/goe310_4730_1627.npz\ndata/train/naca652215_1315_262.npz\ndata/train/n63215b_3438_146.npz\ndata/train/e387_8152_-939.npz\ndata/train/goe511_8881_1495.npz\ndata/train/goe587_7213_-1727.npz\ndata/train/naca653218_5397_-768.npz\ndata/train/goe06k_6706_1351.npz\ndata/train/n64212_5138_1791.npz\ndata/train/usa33_2703_946.npz\ndata/train/goe510_6555_-761.npz\ndata/train/e472_7291_-2685.npz\ndata/train/nlf0115_5639_-1362.npz\ndata/train/goe513_6249_1701.npz\ndata/train/e682_6079_2041.npz\ndata/train/fx74cl6140_3331_1252.npz\ndata/train/c141c_8053_1259.npz\ndata/train/eh2510_7160_1433.npz\ndata/train/naca1410_5302_-1616.npz\ndata/train/n11_8887_3130.npz\ndata/train/n13_2174_-312.npz\ndata/train/goe443_4147_841.npz\ndata/train/c141e_9513_2376.npz\ndata/train/ua2-180sm_6875_2385.npz\ndata/train/ah21-7_4653_21.npz\ndata/train/naca662415_4853_741.npz\ndata/train/gu255118_7842_-3067.npz\ndata/train/goe584_1789_-89.npz\ndata/train/tempest3_7414_2528.npz\ndata/train/goe29b_8958_1806.npz\ndata/train/goe491_1505_170.npz\ndata/train/sc1012r8_8595_291.npz\ndata/train/s3016_2759_-713.npz\ndata/train/ah82150f_4744_-961.npz\ndata/train/cr1_1095_-183.npz\ndata/train/goe436_8844_-2127.npz\ndata/train/ag26_6847_-29.npz\ndata/train/fx711525_5965_431.npz\ndata/train/s4180_1648_-264.npz\ndata/train/fauvel_3610_906.npz\ndata/train/b707e_4891_1502.npz\ndata/train/ah93k132_6011_832.npz\ndata/train/rc12b3_7258_1581.npz\ndata/train/fx69274_1824_-622.npz\ndata/train/s3021_2904_-236.npz\ndata/train/goe610b_1967_558.npz\ndata/train/naca65209_5151_1994.npz\ndata/train/s2091_2770_-649.npz\ndata/train/usa35a_2630_-391.npz\ndata/train/e210_5310_-1640.npz\ndata/train/e852_5179_1009.npz\ndata/train/eh2070_8047_-1146.npz\ndata/train/goe325_1992_129.npz\ndata/train/goe14k_9145_-2301.npz\ndata/train/mh18_4399_1734.npz\ndata/train/raf32md_5993_278.npz\ndata/train/hq2090sm_8775_2769.npz\ndata/train/k2_4968_-979.npz\ndata/train/goe15k_7277_-1662.npz\ndata/train/goe118_3924_-1468.npz\ndata/train/fx74cl6140_6535_-843.npz\ndata/train/tempest3_2998_805.npz\ndata/train/kc135c_3179_1147.npz\ndata/train/rae69ck_8121_656.npz\ndata/train/naca4415_8297_-2230.npz\ndata/train/n63415_4411_1074.npz\ndata/train/goe528_5224_257.npz\ndata/train/goe190_7848_-1498.npz\ndata/train/vr13_3163_-763.npz\ndata/train/goe493_3229_548.npz\ndata/train/mh45_2555_365.npz\ndata/train/hq159b_3228_-1101.npz\ndata/train/raf26_2146_-650.npz\ndata/train/ys915_5750_1304.npz\ndata/train/ah81k144_3884_1239.npz\ndata/train/goe279_8957_-3332.npz\ndata/train/goe427_8903_-618.npz\ndata/train/oaf117_5884_1770.npz\ndata/train/goe529_2129_-838.npz\ndata/train/eh3012_9598_2708.npz\ndata/train/whitcomb_4789_-253.npz\ndata/train/boe103_8634_1311.npz\ndata/train/m21_1885_513.npz\ndata/train/rc1264c_7603_255.npz\ndata/train/goe648_1264_-417.npz\ndata/train/goe795_2447_-116.npz\ndata/train/fx601001_8024_3166.npz\ndata/train/hq3514_4615_-1673.npz\ndata/train/fx84w140_1002_145.npz\ndata/train/n63215_6201_93.npz\ndata/train/us1000root_7460_2304.npz\ndata/train/fauvel_1820_185.npz\ndata/train/e1200_3725_944.npz\ndata/train/hq1512_9144_-1854.npz\ndata/train/s1046_8675_-3089.npz\ndata/train/e837_3614_-384.npz\ndata/train/mh32_6300_868.npz\ndata/train/e549_3214_981.npz\ndata/train/rg12a189_5331_1488.npz\ndata/train/waspsm_2863_131.npz\ndata/train/naca747a415_5622_1718.npz\ndata/train/goe184_3408_-375.npz\ndata/train/e374_6523_844.npz\ndata/train/fx84w140_8455_2484.npz\ndata/train/goe441_3029_-1015.npz\ndata/train/hq1012_9194_630.npz\ndata/train/mh42_1073_-297.npz\ndata/train/s2091_5252_-300.npz\ndata/train/e340_8021_931.npz\ndata/train/m5_4502_204.npz\ndata/train/goe527_5859_600.npz\ndata/train/nl722343_8241_1257.npz\ndata/train/hq208_1808_-734.npz\ndata/train/e178_7549_-810.npz\ndata/train/oa209_9693_2151.npz\ndata/train/usa35b_3984_1100.npz\ndata/train/fx84w175_9442_539.npz\ndata/train/fg1_1645_-126.npz\ndata/train/fx67k170_8565_-3376.npz\ndata/train/s6062_8133_-2208.npz\ndata/train/e479_3921_-957.npz\ndata/train/eh2010_3671_-946.npz\ndata/train/n0012_2596_583.npz\ndata/train/naca662215_4667_-662.npz\ndata/train/goe413_3634_-856.npz\ndata/train/fg1_8653_1032.npz\ndata/train/ah88k136_4008_986.npz\ndata/train/goe602m_6755_968.npz\ndata/train/m22_3248_-796.npz\ndata/train/ag455ct02r_4708_1772.npz\ndata/train/eiffel428_5137_697.npz\ndata/train/ames03_8068_626.npz\ndata/train/fx60160_1797_430.npz\ndata/train/sc21006_7597_-634.npz\ndata/train/naca664221_7273_-803.npz\ndata/train/mh45_8879_-2751.npz\ndata/train/goe122_7384_326.npz\ndata/train/s2027_3903_-898.npz\ndata/train/goe408_8167_977.npz\ndata/train/pfcm_6703_-2724.npz\ndata/train/npl9627_2261_-426.npz\ndata/train/goe514_1225_-257.npz\ndata/train/fx76mp140_1761_531.npz\ndata/train/goe190_1651_-108.npz\ndata/train/hq2512_7809_-615.npz\ndata/train/e502_1832_-447.npz\ndata/train/e1210_7207_-2635.npz\ndata/train/goe05k_2524_120.npz\ndata/train/fx84w175_4184_-1282.npz\ndata/train/naca0010_8308_-734.npz\ndata/train/usa31_3821_610.npz\ndata/train/goe676_4198_-518.npz\ndata/train/hq158_2570_-129.npz\ndata/train/goe222_4272_1481.npz\ndata/train/e433_2298_111.npz\ndata/train/goe155_6529_-285.npz\ndata/train/npl9660_7563_-1013.npz\ndata/train/e398_2504_833.npz\ndata/train/nacam3_4295_226.npz\ndata/train/goe528_2967_130.npz\ndata/train/goe431_8346_-2781.npz\ndata/train/ah93157_4752_522.npz\ndata/train/s4180_9764_1062.npz\ndata/train/m5_7912_-2640.npz\ndata/train/aquilasm_5393_1859.npz\ndata/train/fx73cl3152_8181_-2132.npz\ndata/train/a18_6887_-1764.npz\ndata/train/goe244_987_-353.npz\ndata/train/fx68h120_2827_-370.npz\ndata/train/fx84w150_4173_-253.npz\ndata/train/goe289_4771_-1796.npz\ndata/train/s8055_4913_-1875.npz\ndata/train/goe328_7427_386.npz\ndata/train/e655_4234_-652.npz\ndata/train/s5010_8547_1432.npz\ndata/train/eh2012_1974_-722.npz\ndata/train/fx69h083_1302_-121.npz\ndata/train/e420_6791_1516.npz\ndata/train/kc135c_5478_1624.npz\ndata/train/naca65410_4692_-192.npz\ndata/train/e637_2235_609.npz\ndata/train/m20_4976_-1413.npz\ndata/train/goe481a_1796_-527.npz\ndata/train/eh2070_9097_-230.npz\ndata/train/fx77w258_8055_-1819.npz\ndata/train/fx6617a2_7961_-1726.npz\ndata/train/naca66-018_9769_-353.npz\ndata/train/e603_3504_-1012.npz\ndata/train/glennmartin2_3632_-1009.npz\ndata/train/oa212_3622_-1378.npz\ndata/train/e325_4945_1469.npz\ndata/train/e908_7691_2535.npz\ndata/train/fx84w175_3624_851.npz\ndata/train/goe614_6966_695.npz\ndata/train/mh44_1711_354.npz\ndata/train/miley_7342_2529.npz\ndata/train/sd7032_4153_-483.npz\ndata/train/goe499_3667_-1509.npz\ndata/train/e331_8680_1033.npz\ndata/train/c141d_1407_278.npz\ndata/train/goe375_6038_-1601.npz\ndata/train/goe570_3940_1127.npz\ndata/train/raf89_7612_2245.npz\ndata/train/goe550_9330_-205.npz\ndata/train/oa209_3768_-1143.npz\ndata/train/goe411_6843_2171.npz\ndata/train/goe769_7759_896.npz\ndata/train/e334_7053_1028.npz\ndata/train/fx63158_9465_549.npz\ndata/train/m24_1086_-274.npz\ndata/train/goe534_4398_-269.npz\ndata/train/e393_4794_86.npz\ndata/train/goe679_4044_1140.npz\ndata/train/sc21010_4192_1376.npz\ndata/train/fx72ls160_8686_-2910.npz\ndata/train/r140sm_9632_184.npz\ndata/train/gm15sm_9405_311.npz\ndata/train/goe527_7097_-1104.npz\ndata/train/s8036_7335_759.npz\ndata/train/wb140_6720_-120.npz\ndata/train/naca16009_6419_-558.npz\ndata/train/goe288_1366_72.npz\ndata/train/fx69h098_4043_253.npz\ndata/train/daytonwright6_1781_-249.npz\ndata/train/e212_2920_647.npz\ndata/train/kc135a_8299_-744.npz\ndata/train/e548_2781_318.npz\ndata/train/goe770_7499_2756.npz\ndata/train/nlr7301_5660_2274.npz\ndata/train/goe278_1198_85.npz\ndata/train/hq159_2213_23.npz\ndata/train/mh78_4088_-857.npz\ndata/train/e335_6552_1586.npz\ndata/train/lwk80080_4057_155.npz\ndata/train/usa35a_3266_-801.npz\ndata/train/goe448_3411_-1364.npz\ndata/train/isa962_3459_32.npz\ndata/train/goe797_9715_-466.npz\ndata/train/n64008a_6144_775.npz\ndata/train/n63215_1864_-376.npz\ndata/train/dae21_3120_-545.npz\ndata/train/e635_4852_1661.npz\ndata/train/rg14_2358_-744.npz\ndata/train/goe655_4814_-1504.npz\ndata/train/mh94_3009_-813.npz\ndata/train/m14_7421_-874.npz\ndata/train/goe187_2840_194.npz\ndata/train/m7_4732_546.npz\ndata/train/naca63a210_6692_1702.npz\ndata/train/fx69h083_8727_1337.npz\ndata/train/s9027_8171_376.npz\ndata/train/s1014_8151_1080.npz\ndata/train/pfcm_2541_316.npz\ndata/train/gm15sm_6576_59.npz\ndata/train/goe359_8462_-340.npz\ndata/train/naca16018_5554_-1404.npz\ndata/train/goe387_1029_153.npz\ndata/train/goe199_8220_-1915.npz\ndata/train/sc1095r8_8067_2133.npz\ndata/train/pmc19sm_4393_-1733.npz\ndata/train/b29tip_1635_263.npz\ndata/train/goe602m_4307_-813.npz\ndata/train/goe257_6221_1358.npz\ndata/train/hq2511_3201_-567.npz\ndata/train/clarkv_3871_1075.npz\ndata/train/goe289_6471_1831.npz\ndata/train/goe513_5520_1325.npz\ndata/train/naca1410_9614_2299.npz\ndata/train/hq1012_4911_-1530.npz\ndata/train/goe574_6887_2827.npz\ndata/train/hq300gd2_2950_-1213.npz\ndata/train/goe300_4541_1579.npz\ndata/train/e551_5332_-628.npz\ndata/train/naca23012_1921_-431.npz\ndata/train/drgnfly_9130_1115.npz\ndata/train/goe409_8207_-842.npz\ndata/train/e836_4008_-297.npz\ndata/train/e664_3562_315.npz\ndata/train/naca633418_1976_579.npz\ndata/train/c5c_1756_191.npz\ndata/train/goe613_2859_610.npz\ndata/train/usa48_3852_-850.npz\ndata/train/ah7476_1630_316.npz\ndata/train/n64015_6369_1003.npz\ndata/train/e420_1017_311.npz\ndata/train/sc21006_9456_-88.npz\ndata/train/eiffel371_5546_1768.npz\ndata/train/e591_1616_-495.npz\ndata/train/p51dtip_2008_308.npz\ndata/train/naca0015_7866_-1750.npz\ndata/train/e62_9160_-3321.npz\ndata/train/goe322_4926_-1122.npz\ndata/train/e403_1455_-186.npz\ndata/train/goe602_4822_1926.npz\ndata/train/n0009sm_8821_-2740.npz\ndata/train/e67_2214_-906.npz\ndata/train/isa960_5331_342.npz\ndata/train/eiffel428_5005_-134.npz\ndata/train/ua2-180_3872_0.npz\ndata/train/ag47ct02r_5051_-1957.npz\ndata/train/ncambre_7786_-1701.npz\ndata/train/fx66s161_2098_777.npz\ndata/train/hq309_9972_3.npz\ndata/train/goe15k_5539_2099.npz\ndata/train/ag08_7325_-3.npz\ndata/train/mh110_4822_1146.npz\ndata/train/dbln526_1506_-356.npz\ndata/train/e174_1516_-331.npz\ndata/train/e477_2105_630.npz\ndata/train/goe63_5826_1014.npz\ndata/train/e197_2768_-1063.npz\ndata/train/goe326_3757_-1061.npz\ndata/train/goe121_8908_-772.npz\ndata/train/sc20403_5028_1534.npz\ndata/train/n64212mb_9420_2905.npz\ndata/train/fx61140_3624_-109.npz\ndata/train/rcsc2_6604_-2709.npz\ndata/train/mb253515sm_6170_-465.npz\ndata/train/raf33_3023_-342.npz\ndata/train/e1200_1815_506.npz\ndata/train/goe325_9653_-479.npz\ndata/train/goe371_5797_-591.npz\ndata/train/mh22_9757_-739.npz\ndata/train/k1_3638_496.npz\ndata/train/goe344_4685_-711.npz\ndata/train/goe441_3677_-1339.npz\ndata/train/naca642415_4671_-718.npz\ndata/train/e549_7767_-1265.npz\ndata/train/e639_2569_-73.npz\ndata/train/sd8000_2688_888.npz\ndata/train/goe527_9511_2723.npz\ndata/train/goe421_5713_1695.npz\ndata/train/rc1264c_5942_2408.npz\ndata/train/sc20714_2436_963.npz\ndata/train/mh38_4173_-24.npz\ndata/train/m27_6031_2467.npz\ndata/train/usa35_9247_3690.npz\ndata/train/hq2510_6023_-820.npz\ndata/train/usa32_5530_-1134.npz\ndata/train/goe777_6446_111.npz\ndata/train/e226_8672_987.npz\ndata/train/fx69pr281_2477_-685.npz\ndata/train/e393_8235_2478.npz\ndata/train/s1046_7028_-2621.npz\ndata/train/whitcomb_7697_320.npz\ndata/train/goe802b_6766_796.npz\ndata/train/e583_3301_445.npz\ndata/train/naca0008_1463_-467.npz\ndata/train/goe361_8572_2594.npz\ndata/train/goe746_2308_-443.npz\ndata/train/rae5214_5905_198.npz\ndata/train/goe364_4920_-538.npz\ndata/train/v43015_3594_-432.npz\ndata/train/b707c_6940_-853.npz\ndata/train/dae11_8326_-1329.npz\ndata/train/e63_6924_-1984.npz\ndata/train/goe575_4996_508.npz\ndata/train/fx057816_2252_-184.npz\ndata/train/e326_3229_-423.npz\ndata/train/mh106_5506_-136.npz\ndata/train/sc20403_5963_-57.npz\ndata/train/goe531_4321_-1562.npz\ndata/train/e603_1197_-11.npz\ndata/train/usa28_4376_467.npz\ndata/train/goe437_1323_8.npz\ndata/train/fx79w151a_8287_2854.npz\ndata/train/e642_3992_-853.npz\ndata/train/naca654421a05_7601_761.npz\ndata/train/c141a_4633_1448.npz\ndata/train/fauvel_5047_1102.npz\ndata/train/goe284_8460_-637.npz\ndata/train/r140sm_4815_843.npz\ndata/train/rc1064c_6576_-499.npz\ndata/train/goe422_8314_-3206.npz\ndata/train/naca66210_3561_-844.npz\ndata/train/e182_6908_1439.npz\ndata/train/hq158_2107_-491.npz\ndata/train/ah93w300_8987_-3037.npz\ndata/train/goe177_5946_1703.npz\ndata/train/rae69ck_2073_-286.npz\ndata/train/goe243_4610_1310.npz\ndata/train/n14_2315_261.npz\ndata/train/ah94w301_7765_1679.npz\ndata/train/mh61_3955_-781.npz\ndata/train/rhodesg30_5051_886.npz\ndata/train/naca66206_9093_2883.npz\ndata/train/fx74cl5140_8910_-2582.npz\ndata/train/e555_6890_2487.npz\ndata/train/rc08n1_5481_-1624.npz\ndata/train/e403_9199_3271.npz\ndata/train/e478_8883_2728.npz\ndata/train/stcyr171_1107_-341.npz\ndata/train/fx049915_3480_169.npz\ndata/train/goe10k_4357_-739.npz\ndata/train/griffith30SymSuction_5162_-616.npz\ndata/train/fx76mp160_1802_10.npz\ndata/train/e1214_5758_-1050.npz\ndata/train/usa35_3779_-953.npz\ndata/train/goe394_3739_-1295.npz\ndata/train/df102_1584_1.npz\ndata/train/s7055_4166_633.npz\ndata/train/rhodesg34_1122_200.npz\ndata/train/npl9615_4446_-49.npz\ndata/train/goe390_8616_1049.npz\ndata/train/coanda3_3526_-554.npz\ndata/train/e377_7015_-957.npz\ndata/train/sd2030_7553_-1311.npz\ndata/train/c5e_1384_-553.npz\ndata/train/vr11x_7979_2335.npz\ndata/train/r1082t_7816_637.npz\ndata/train/fx05191_2844_-193.npz\ndata/train/ah21-7_9260_-3061.npz\ndata/train/amsoil1_2005_404.npz\ndata/train/goe223_3560_1093.npz\ndata/train/fx83w108_5173_1784.npz\ndata/train/s4310_1769_342.npz\ndata/train/goe746_8276_2692.npz\ndata/train/fx79l120_5405_-1109.npz\ndata/train/fx74cl6140_5083_87.npz\ndata/train/goe223_8620_1891.npz\ndata/train/e591_1377_3.npz\ndata/train/s6062_9922_-464.npz\ndata/train/goe309_5709_1971.npz\ndata/train/goe650_4556_1240.npz\ndata/train/dae51_6754_-253.npz\ndata/train/goe481a_8815_617.npz\ndata/train/sd7062_9292_2755.npz\ndata/train/fx78pk188_9166_3640.npz\ndata/train/vr14_6572_-1430.npz\ndata/train/m16_4416_240.npz\ndata/train/usa45m_8070_-1988.npz\ndata/train/e548_4378_752.npz\ndata/train/naca663218_5045_-118.npz\ndata/train/ls013_1925_427.npz\ndata/train/n64212ma_4815_488.npz\ndata/train/mh61_5034_-176.npz\ndata/train/usa29_2786_-944.npz\ndata/train/m16_7873_-844.npz\ndata/train/naca64208_2799_940.npz\ndata/train/ag18_3754_1251.npz\ndata/train/e593_7754_-1722.npz\ndata/train/goe412_2602_-344.npz\ndata/train/s3021_7927_784.npz\ndata/train/goe178_1961_155.npz\ndata/train/mrc-16_2827_-1139.npz\ndata/train/goe746_8856_-718.npz\ndata/train/e548_1997_-415.npz\ndata/train/fx72150b_7304_-1316.npz\ndata/train/la2573a_2094_615.npz\ndata/train/hq3011_1035_-253.npz\ndata/train/goe767_3842_-887.npz\ndata/train/goe518_5064_-1704.npz\ndata/train/goe446_7140_1144.npz\ndata/train/goe585_2029_-161.npz\ndata/train/waspsm_8105_-1832.npz\ndata/train/goe418_1371_36.npz\ndata/train/eh2510_1854_358.npz\ndata/train/raf38_8514_-2134.npz\ndata/train/fx84w140_8999_-185.npz\ndata/train/ag18_5734_1093.npz\ndata/train/hh02_3839_341.npz\ndata/train/ag25_8159_1829.npz\ndata/train/goe450_6266_-2060.npz\ndata/train/n10_5951_1090.npz\ndata/train/goe276_8982_797.npz\ndata/train/n24_1335_372.npz\ndata/train/n63010a_7651_3092.npz\ndata/train/usa40_4015_339.npz\ndata/train/vr7b_6442_-993.npz\ndata/train/mh38_5635_-2090.npz\ndata/train/oaf139_4238_-1263.npz\ndata/train/e550_2300_39.npz\ndata/train/s4053_4483_-1273.npz\ndata/train/defcnd2_6038_-818.npz\ndata/train/rhodesg32_3695_-714.npz\ndata/train/a63a108c_1406_361.npz\ndata/train/ag17_2520_-347.npz\ndata/train/nlr1t_9511_-1667.npz\ndata/train/e397_7063_-2727.npz\ndata/train/goe304_6596_96.npz\ndata/train/goe16k_7128_-434.npz\ndata/train/k2_1132_-311.npz\ndata/train/ag45ct02r_5189_1405.npz\ndata/train/e333_2989_182.npz\ndata/train/goe409_3370_-1049.npz\ndata/train/fx60126_7830_2860.npz\ndata/train/fx05191_8624_427.npz\ndata/train/fx84w218_1203_-146.npz\ndata/train/fx84w175_2109_378.npz\ndata/train/ah93w174_7155_-439.npz\ndata/train/ag455ct02r_4628_1874.npz\ndata/train/fx79w151a_3737_1506.npz\ndata/train/mh32_5664_44.npz\ndata/train/mh27_1986_-688.npz\ndata/train/fx72ls160_2603_-278.npz\ndata/train/fx79w660a_7706_-1928.npz\ndata/train/fx78k150_7117_-2419.npz\ndata/train/lnv109a_5248_-2110.npz\ndata/train/goe255_4056_1004.npz\ndata/train/lwk79100_1729_-182.npz\ndata/train/ssca07_9259_3565.npz\ndata/train/sd6080_8092_-759.npz\ndata/train/usa50_6829_49.npz\ndata/train/goe482_4465_-52.npz\ndata/train/fxs02196_6640_414.npz\ndata/train/goe766_7597_-521.npz\ndata/train/tempest1_9276_3104.npz\ndata/train/fx77w270s_5561_-2280.npz\ndata/train/n9_6345_-456.npz\ndata/train/giiil_2995_891.npz\ndata/train/s8035_4966_691.npz\ndata/train/stcyr24_1271_373.npz\ndata/train/n63015a_7083_1073.npz\ndata/train/fx60177_8506_432.npz\ndata/train/vr1_2016_-316.npz\ndata/train/raf30md_1412_-432.npz\ndata/train/nplx_3394_-586.npz\ndata/train/e328_4679_1211.npz\ndata/train/e585_2403_594.npz\ndata/train/e176_5005_-1533.npz\ndata/train/rg14_6127_1621.npz\ndata/train/n64215_2733_-59.npz\ndata/train/eh3012_7916_-1862.npz\ndata/train/goe458_1722_-189.npz\ndata/train/goe621_4422_-1613.npz\ndata/train/naca654421_5859_2208.npz\ndata/train/hq3510_8334_1969.npz\ndata/train/usa22_8457_2767.npz\ndata/train/ah81k144_6080_1164.npz\ndata/train/goe459_8628_-3544.npz\ndata/train/goe683_8554_1248.npz\ndata/train/n63215_3343_126.npz\ndata/train/e212_7564_940.npz\ndata/train/goe532_3934_-1000.npz\ndata/train/e585_1209_68.npz\ndata/train/fx76120_2955_-356.npz\ndata/train/usa5_1316_422.npz\ndata/train/gm15sm_7175_-571.npz\ndata/train/goe228_3706_1212.npz\ndata/train/e520_3980_1085.npz\ndata/train/ag37_9082_733.npz\ndata/train/eh2070_6552_991.npz\ndata/train/goe240_5923_649.npz\ndata/train/naca64210_1834_514.npz\ndata/train/sg6041_1701_67.npz\ndata/train/fx69pr281_5043_-1658.npz\ndata/train/ah94145_8372_2242.npz\ndata/train/e664ex_3753_-829.npz\ndata/train/s3002_2799_556.npz\ndata/train/n63215_2429_592.npz\ndata/train/fx38153_6387_-144.npz\ndata/train/m12_7720_-2802.npz\ndata/train/usa33_1757_261.npz\ndata/train/fx73cl2152_8134_-1866.npz\ndata/train/nlf1015_9105_1724.npz\ndata/train/curtisc72_2980_-687.npz\ndata/train/goe803h_9190_2879.npz\ndata/train/m20_9307_73.npz\ndata/train/goe367_5707_-305.npz\ndata/train/nlf1015_2352_-667.npz\ndata/train/goe387_3641_655.npz\ndata/train/goe116_4570_60.npz\ndata/train/fx711520_2333_-43.npz\ndata/train/ah95160_9032_-3039.npz\ndata/train/e297_7454_-1972.npz\ndata/train/e1213_1334_-506.npz\ndata/train/ls413mod_7317_-393.npz\ndata/train/goe561_7675_-2401.npz\ndata/train/ls417mod_3982_-687.npz\ndata/train/npl9627_8876_-1392.npz\ndata/train/sg6043_5560_-2136.npz\ndata/train/eh1090_2298_558.npz\ndata/train/tempest2_1187_-414.npz\ndata/train/goe679_2859_-959.npz\ndata/train/goe359_1548_41.npz\ndata/train/rc08b3_4183_-457.npz\ndata/train/oaf128_7289_-2059.npz\ndata/train/ah93w300_7522_1893.npz\ndata/train/avistar_8719_-2434.npz\ndata/train/rc10n1_4915_-424.npz\ndata/train/wb13535sm_3368_-111.npz\ndata/train/e546_4824_-1299.npz\ndata/train/goe113_7249_-1320.npz\ndata/train/nl722343_1713_32.npz\ndata/train/goe05k_5726_444.npz\ndata/train/sd7003_6877_609.npz\ndata/train/ah93k132_5253_-9.npz\ndata/train/e417_6126_-640.npz\ndata/train/ea81006_5984_-1497.npz\ndata/train/eh3012_6166_-973.npz\ndata/train/goe369_1261_109.npz\ndata/train/hq3014_6601_2670.npz\ndata/train/goe372_2925_1151.npz\ndata/train/n6h15_6096_468.npz\ndata/train/sd7080_5741_-64.npz\ndata/train/pmc19sm_6854_-2173.npz\ndata/train/fx60100sm_1708_-561.npz\ndata/train/ag25_4782_1352.npz\ndata/train/naca661212_3384_-913.npz\ndata/train/goe670_5121_1400.npz\ndata/train/ag47c03_4002_-1185.npz\ndata/train/naca633218_3210_-759.npz\ndata/train/b29tip_4202_-1518.npz\ndata/train/fx6617a2_1509_533.npz\ndata/train/fx66s171_1228_-268.npz\ndata/train/ht12_5844_93.npz\ndata/train/naca63a210_4632_-1693.npz\ndata/train/e328_7934_1907.npz\ndata/train/sc1012r8_7076_1565.npz\ndata/train/goe420_4335_-330.npz\ndata/train/m15_5011_-1013.npz\ndata/train/naca0021_9528_-1132.npz\ndata/train/goe421_976_243.npz\ndata/train/e61_7096_839.npz\ndata/train/naca001264_2950_-121.npz\ndata/train/rc1264c_7708_1152.npz\ndata/train/s1014_8099_621.npz\ndata/train/e557_3916_1364.npz\ndata/train/m3_2687_-1048.npz\ndata/train/goe758_3166_-1181.npz\ndata/train/s4233_5464_1003.npz\ndata/train/sd7084_7691_-2168.npz\ndata/train/e387_2108_-718.npz\ndata/train/fx79w660a_5826_2363.npz\ndata/train/e818_2181_-129.npz\ndata/train/s4110_7537_-2257.npz\ndata/train/b29root_5349_640.npz\ndata/train/sd7034_7830_-1107.npz\ndata/train/goe619_6027_1845.npz\ndata/train/b29root_1450_-393.npz\ndata/train/naca663418_4706_1050.npz\ndata/train/b707e_6790_2358.npz\ndata/train/goe373_5054_-1414.npz\ndata/train/e231_1264_-177.npz\ndata/train/giiil_4850_-971.npz\ndata/train/usa49_4162_533.npz\ndata/train/goe421_2372_-125.npz\ndata/train/eh3012_3004_1218.npz\ndata/train/ag10_9211_756.npz\ndata/train/rc10n1_7636_1577.npz\ndata/train/goe574_8739_-689.npz\ndata/train/goe269_2038_-109.npz\ndata/train/isa571_4573_-567.npz\ndata/train/ag36_5003_-1579.npz\ndata/train/fx63137sm_9373_38.npz\ndata/train/mh120_1221_357.npz\ndata/train/goe451_3497_-602.npz\ndata/train/eh1590_3830_1333.npz\ndata/train/mh22_9057_1481.npz\ndata/train/eh1590_3535_-509.npz\ndata/train/fx63143_3111_-1083.npz\ndata/train/e545_1252_270.npz\ndata/train/sc1094r8_3595_499.npz\ndata/train/b737c_9286_-2619.npz\ndata/train/e207_7294_1726.npz\ndata/train/naca653218_6052_268.npz\ndata/train/fx78k150_9617_-574.npz\ndata/train/fx63137sm_4605_-1062.npz\ndata/train/tsagi8_7896_-1070.npz\ndata/train/arad13_7927_2287.npz\ndata/train/ah21-9_8891_-1982.npz\ndata/train/r140_5026_-971.npz\ndata/train/goe433_3168_1057.npz\ndata/train/sa7035_5949_217.npz\ndata/train/fx60160_9501_1879.npz\ndata/train/fx61163_9709_718.npz\ndata/train/rc1264c_2695_-849.npz\ndata/train/c5b_1454_-463.npz\ndata/train/sd7037_3236_593.npz\ndata/train/jn153_1769_414.npz\ndata/train/e635_8132_-2655.npz\ndata/train/goe13k_1441_-216.npz\ndata/train/naca16006_5887_1107.npz\ndata/train/goe379_8139_-1500.npz\ndata/train/goe320_8668_-684.npz\ndata/train/hq3012_4299_608.npz\ndata/train/naca001034a08cli0.2_2412_704.npz\ndata/train/mh24_3151_-874.npz\ndata/train/e540_981_364.npz\ndata/train/nl722362_7301_1366.npz\ndata/train/hq2010_1415_141.npz\ndata/train/goe376_2798_-309.npz\ndata/train/mh22_1824_25.npz\ndata/train/e857_5293_-398.npz\ndata/train/sa7038_6438_-1025.npz\ndata/train/s9037_1822_-422.npz\ndata/train/fx74cl6140_4589_1311.npz\ndata/train/fx63100_3495_-370.npz\ndata/train/goe223_5067_-1452.npz\ndata/train/sc21010_7466_-2328.npz\ndata/train/e593_5154_-604.npz\ndata/train/naca652215_3679_1426.npz\ndata/train/b737c_1371_-402.npz\ndata/train/august160_3241_961.npz\ndata/train/goe406_5323_-465.npz\ndata/train/trainer60_1928_786.npz\ndata/train/usa48_7765_1560.npz\ndata/train/e1212mod_2458_-622.npz\ndata/train/goe397_996_-123.npz\ndata/train/cootie_8325_1381.npz\ndata/train/e214_8959_3626.npz\ndata/train/stf86361_2350_216.npz\ndata/train/mh45_6894_-1739.npz\ndata/train/goe508_3287_-754.npz\ndata/train/fx72ls160_6532_-703.npz\ndata/train/ag18_5329_230.npz\ndata/train/s4158_2494_-943.npz\ndata/train/e853_3371_943.npz\ndata/train/s3002_6376_-786.npz\ndata/train/e195_3492_-1029.npz\ndata/train/sc20610_9391_2546.npz\ndata/train/e63_8935_-2264.npz\ndata/train/goe358_6549_-366.npz\ndata/train/nn7mk20_8733_-1252.npz\ndata/train/goe571_7338_607.npz\ndata/train/mh26_4877_1757.npz\ndata/train/goe101_5394_-2111.npz\ndata/train/goe239_9838_872.npz\ndata/train/e556_9762_1550.npz\ndata/train/s1048_3082_1025.npz\ndata/train/usa31_8831_1526.npz\ndata/train/raf89_8249_-1895.npz\ndata/train/ag03_5938_-176.npz\ndata/train/naca633418_6993_-2359.npz\ndata/train/e205_6749_-26.npz\ndata/train/oa213_3602_-992.npz\ndata/train/august160_2185_471.npz\ndata/train/goe198_5425_1779.npz\ndata/train/goe458_6412_-96.npz\ndata/train/usa51_1151_115.npz\ndata/train/goe391_3633_507.npz\ndata/train/fx67k170_5255_-1030.npz\ndata/train/fx3_8814_2420.npz\ndata/train/mh120_7307_-340.npz\ndata/train/n63015a_7722_-2159.npz\ndata/train/wb140_2322_-487.npz\ndata/train/goe617_7894_983.npz\ndata/train/fx76120_8075_-1188.npz\ndata/train/e851_6210_-1801.npz\ndata/train/davissm_4552_1687.npz\ndata/train/goe256_3724_-719.npz\ndata/train/s2091_6933_-1719.npz\ndata/train/stcyr24_8255_2807.npz\ndata/train/goe282_4703_203.npz\ndata/train/naca747a315_2062_429.npz\ndata/train/ames01_3715_232.npz\ndata/train/ag04_4519_297.npz\ndata/train/goe288_5179_2089.npz\ndata/train/e546_7574_1209.npz\ndata/train/naca16006_6283_-2002.npz\ndata/train/sc20714_1659_466.npz\ndata/train/goe561_7241_-1700.npz\ndata/train/e582_7717_2248.npz\ndata/train/goe222_8510_1746.npz\ndata/train/e210_3854_-1408.npz\ndata/train/goe615_4224_-1011.npz\ndata/train/s2048_2648_-342.npz\ndata/train/usa29_5280_2132.npz\ndata/train/e836_3251_-125.npz\ndata/train/goe481_7203_1605.npz\ndata/train/goe592_4288_-188.npz\ndata/train/raf32md_9037_-3514.npz\ndata/train/goe409_7819_-2238.npz\ndata/train/defcnd3_6335_-2316.npz\ndata/train/m19_4034_-1195.npz\ndata/train/goe676_5288_1582.npz\ndata/train/r140_6856_-1589.npz\ndata/train/mh42_1167_-177.npz\ndata/train/fx6617ai_1847_42.npz\ndata/train/clarkw_2095_239.npz\ndata/train/goe592_5932_-1605.npz\ndata/train/e1230_6325_2282.npz\ndata/train/mh32_9191_-2875.npz\ndata/train/august160_2799_307.npz\ndata/train/ah80129_4470_1399.npz\ndata/train/ah93w257_1374_-60.npz\ndata/train/ah94145_6609_1043.npz\ndata/train/goe460_4731_1367.npz\ndata/train/fx78pk188_8722_2834.npz\ndata/train/davissm_7949_-2961.npz\ndata/train/usa34_6185_1775.npz\ndata/train/ames01_3689_825.npz\ndata/train/goe533_2892_-1140.npz\ndata/train/goe769_6075_1369.npz\ndata/train/fx63158_7226_-634.npz\ndata/train/goe281_1487_270.npz\ndata/train/m5_7039_-1831.npz\ndata/train/la203a_6785_-1339.npz\ndata/train/goe16k_4603_-233.npz\ndata/train/ste87151_8652_783.npz\ndata/train/goe326_2802_850.npz\ndata/train/eiffel371_5529_-854.npz\ndata/train/e642_6927_1596.npz\ndata/train/usa25_6452_737.npz\ndata/train/hq09_3484_875.npz\ndata/train/dbln526_2461_-566.npz\ndata/train/fx74130wp2_6652_1486.npz\ndata/train/fxlv152_5761_-327.npz\ndata/train/v23010_8257_841.npz\ndata/train/goe304_5425_-337.npz\ndata/train/nl722362_7138_2709.npz\ndata/train/hq308_4960_482.npz\ndata/train/fx63158_2488_713.npz\ndata/train/goe436_2554_345.npz\ndata/train/v23010_1706_346.npz\ndata/train/usa5_1526_601.npz\ndata/train/n2414_7716_-1420.npz\ndata/train/goe685_5427_1591.npz\ndata/train/raf34_3299_492.npz\ndata/train/npl9510_9365_-2890.npz\ndata/train/m8_9481_-2664.npz\ndata/train/goe11k_7127_-1508.npz\ndata/train/raf32_9050_219.npz\ndata/train/mh82_7997_-391.npz\ndata/train/raf28_9900_683.npz\ndata/train/goe167_4650_-1154.npz\ndata/train/mh43_4584_1704.npz\ndata/train/goe137_2505_-565.npz\ndata/train/naca632a015_2380_663.npz\ndata/train/goe117_4793_1009.npz\ndata/train/sa7036_5254_54.npz\ndata/train/e585_5830_139.npz\ndata/train/amsoil2_8172_1022.npz\ndata/train/naca65210_2636_808.npz\ndata/train/goe460_3909_-66.npz\ndata/train/isa960_4525_1126.npz\ndata/train/goe702_8511_-2347.npz\ndata/train/giiin_7277_-1634.npz\ndata/train/mh102_8590_3455.npz\ndata/train/e678_9021_255.npz\ndata/train/c141b_7211_1083.npz\ndata/train/e231_2541_895.npz\ndata/train/e502_9096_730.npz\ndata/train/goe366_3233_151.npz\ndata/train/goe316_3879_1542.npz\ndata/train/nl722343_8293_-1108.npz\ndata/train/goe526_3218_1149.npz\ndata/train/mb253515sm_3988_-756.npz\ndata/train/naca642415_8658_535.npz\ndata/train/ag36_4014_550.npz\ndata/train/l188tip_1408_122.npz\ndata/train/goe243_7840_2006.npz\ndata/train/goe277_2534_-869.npz\ndata/train/e226_6430_-342.npz\ndata/train/e559_6280_-1672.npz\ndata/train/e593_7608_1548.npz\ndata/train/e694_7847_1234.npz\ndata/train/goe116_8534_-871.npz\ndata/train/nlf0215f_4528_1448.npz\ndata/train/mh84_5217_2079.npz\ndata/train/naca662215_5899_1464.npz\ndata/train/goe366_5218_1377.npz\ndata/train/fx76mp140_8665_-3253.npz\ndata/train/goe241_7966_-3173.npz\ndata/train/e858_7373_1425.npz\ndata/train/oaf128_8838_-650.npz\ndata/train/fx79w151a_6667_-145.npz\ndata/train/eiffel10_8611_-893.npz\ndata/train/naca0008_2187_-327.npz\ndata/train/goe319_5145_-236.npz\ndata/train/goe447_6312_-2276.npz\ndata/train/goe81_2077_-700.npz\ndata/train/e561_4229_-1352.npz\ndata/train/m3_3403_425.npz\ndata/train/m21_7785_2519.npz\ndata/train/e479_5728_1749.npz\ndata/train/naca0006_3177_904.npz\ndata/train/goe167_9029_3462.npz\ndata/train/b707a_2113_-53.npz\ndata/train/goe324_7552_195.npz\ndata/train/e543_4681_1683.npz\ndata/train/e638_2111_682.npz\ndata/train/raf26_4753_383.npz\ndata/train/wb140_5504_-2135.npz\ndata/train/m15_8399_-641.npz\ndata/train/n2415_7543_-2.npz\ndata/train/goe372_7458_-932.npz\ndata/train/mh110_3491_800.npz\ndata/train/c141b_4886_-1351.npz\ndata/train/goe335_8020_2351.npz\ndata/train/eiffel10_9020_2244.npz\ndata/train/k3311sm_8013_2362.npz\ndata/train/s1014_3250_157.npz\ndata/train/e637_5921_1844.npz\ndata/train/e678_7766_672.npz\ndata/train/ht22_9615_1331.npz\ndata/train/goe703_1190_-252.npz\ndata/train/rc0864c_9374_449.npz\ndata/train/fxl142k_3826_278.npz\ndata/train/hq1512_5586_1756.npz\ndata/train/fx711530_9530_-2567.npz\ndata/train/hq109_9501_-1427.npz\ndata/train/usa35b_3986_58.npz\ndata/train/hq2511_4360_100.npz\ndata/train/n13_4580_1581.npz\ndata/train/isa960_4052_-962.npz\ndata/train/n2414_3987_-250.npz\ndata/train/eh1070_6728_-1020.npz\ndata/train/fx73cl1152_5779_432.npz\ndata/train/ah93w145_9484_-2881.npz\ndata/train/hq1512_9638_-374.npz\ndata/train/goe92_2308_-5.npz\ndata/train/e543_2702_-44.npz\ndata/train/goe144_6839_-1016.npz\ndata/train/goe328_9050_1409.npz\ndata/train/goe285_7473_-2472.npz\ndata/train/stcyr171_3973_-139.npz\ndata/train/m3_2253_-527.npz\ndata/train/e1210_8522_439.npz\ndata/train/e330_3218_915.npz\ndata/train/arad10_9209_-201.npz\ndata/train/c5c_5804_-1082.npz\ndata/train/e209_4411_773.npz\ndata/train/fx66196v_8721_1536.npz\ndata/train/m3_8761_2283.npz\ndata/train/e1212_2063_696.npz\ndata/train/npl9626_4510_-700.npz\ndata/train/s1223_3508_-1287.npz\ndata/train/rae100_1790_-394.npz\ndata/train/rae5214_2653_807.npz\ndata/train/goe776_3725_-124.npz\ndata/train/n6h10_8641_751.npz\ndata/train/goe322_3069_-1185.npz\ndata/train/goe449_2682_284.npz\ndata/train/fx6617ai_1877_515.npz\ndata/train/goe683_5663_359.npz\ndata/train/ah80129_9531_1303.npz\ndata/train/fx60100sm_8360_-2253.npz\ndata/train/s6063_2200_731.npz\ndata/train/e328_4976_-1985.npz\ndata/train/fx08s176_2254_-925.npz\ndata/train/goe681_5114_1320.npz\ndata/train/goe587_4502_-1259.npz\ndata/train/e543_5999_2145.npz\ndata/train/mh201_2349_-913.npz\ndata/train/hq09_4845_1319.npz\ndata/train/goe553_1415_460.npz\ndata/train/rc08n1_5515_872.npz\ndata/train/goe275_7001_-2418.npz\ndata/train/k2_9006_2513.npz\ndata/train/goe143_8360_1265.npz\ndata/train/raf27_4327_1164.npz\ndata/train/goe492_8812_700.npz\ndata/train/sd7084_8397_2827.npz\ndata/train/goe769_9640_60.npz\ndata/train/rhodesg34_6586_-1299.npz\ndata/train/goe14k_7961_-3264.npz\ndata/train/eh1070_3616_-656.npz\ndata/train/goe447_9607_1023.npz\ndata/train/isa961_7558_-116.npz\ndata/train/e266_3420_-515.npz\ndata/train/sc1012r8_4618_380.npz\ndata/train/goe572_4044_1505.npz\ndata/train/naca651212a06_6867_-2634.npz\ndata/train/goe460_6675_1645.npz\ndata/train/ah21-9_1574_-455.npz\ndata/train/e603_7804_2376.npz\ndata/train/goe419_2783_643.npz\ndata/train/fx84w140_5634_1587.npz\ndata/train/ag08_6803_1371.npz\ndata/train/goe381_3542_154.npz\ndata/train/e555_7582_-390.npz\ndata/train/uag8814320_8818_1586.npz\ndata/train/fx61168_6087_-1498.npz\ndata/train/vr7b_8588_-101.npz\ndata/train/raf38_9042_2111.npz\ndata/train/m12_9115_-530.npz\ndata/train/ys915_3561_1335.npz\ndata/train/naca4415_4043_905.npz\ndata/train/oa212_7193_-951.npz\ndata/train/ag36_3458_-902.npz\ndata/train/e343_4921_-563.npz\ndata/train/goe241_9199_-1037.npz\ndata/train/mrc-16_6094_1914.npz\ndata/train/e174_6529_-1985.npz\ndata/train/e485_3350_1203.npz\ndata/train/ames01_6238_225.npz\ndata/train/naca66209_8697_-3140.npz\ndata/train/lg10sc_4059_-1064.npz\ndata/train/n63210_2002_-174.npz\ndata/train/oa212_3597_99.npz\ndata/train/naca000834_2077_220.npz\ndata/train/goe514_2578_767.npz\ndata/train/goe795sm_6226_-92.npz\ndata/train/naca0015_3505_-22.npz\ndata/train/mh62_3605_903.npz\ndata/train/mh32_8167_-289.npz\ndata/train/goe426_9649_-70.npz\ndata/train/raf25_5417_989.npz\ndata/train/mh64_1314_178.npz\ndata/train/e554_9184_3092.npz\ndata/train/ah93157_8024_1198.npz\ndata/train/ma409_3241_-269.npz\ndata/train/e330_7919_-954.npz\ndata/train/s4320_5037_-1718.npz\ndata/train/spicasm_1107_-199.npz\ndata/train/goe377_8853_2576.npz\ndata/train/fx60177_3074_-97.npz\ndata/train/goe346_8140_1829.npz\ndata/train/goe239_2269_-77.npz\ndata/train/goe702_6848_-1200.npz\ndata/train/goe386_3360_6.npz\ndata/train/fx78k161_2921_820.npz\ndata/train/ames03_9260_-580.npz\ndata/train/r1080_7881_2768.npz\ndata/train/goe269_8678_-1314.npz\ndata/train/fx76100_5746_481.npz\ndata/train/m14_4424_-122.npz\ndata/train/goe387_2519_-658.npz\ndata/train/ah80136_3640_-848.npz\ndata/train/ames02_3662_1183.npz\ndata/train/goe417_9007_-3243.npz\ndata/train/naca0015_6575_-425.npz\ndata/train/ag14_2182_847.npz\ndata/train/goe655_7806_-1683.npz\ndata/train/vr11x_7756_432.npz\ndata/train/mh114_5131_-1889.npz\ndata/train/sd6080_3497_261.npz\ndata/train/goe304_7956_-1329.npz\ndata/train/goe497_3202_-256.npz\ndata/train/mh23_3033_-349.npz\ndata/train/fx74130wp1_9372_2849.npz\ndata/train/e748_5608_-1106.npz\ndata/train/fx61140_9295_-2018.npz\ndata/train/s2027_9383_2019.npz\ndata/train/goe335_4077_1149.npz\ndata/train/naca1408_7569_-1069.npz\ndata/train/s9000_8667_3139.npz\ndata/train/tempest3_9309_1863.npz\ndata/train/c141a_4748_-631.npz\ndata/train/mh122_1552_146.npz\ndata/train/goe528_7577_452.npz\ndata/train/goe243_3578_-1360.npz\ndata/train/goe425_8550_579.npz\ndata/train/stf86361_4685_1462.npz\ndata/train/mh61_3647_700.npz\ndata/train/goe384_4697_1194.npz\ndata/train/goe165_8411_2200.npz\ndata/train/goe288_1235_-227.npz\ndata/train/hq209_8676_-698.npz\ndata/train/goe367_3960_-161.npz\ndata/train/sd7032_9816_-34.npz\ndata/train/fx63137_8737_5.npz\ndata/train/stcyr234_7371_-2931.npz\ndata/train/goe100_6053_-1322.npz\ndata/train/pfcm_4640_327.npz\ndata/train/goe257_4231_-351.npz\ndata/train/jn153_1170_368.npz\ndata/train/goe198_1081_30.npz\ndata/train/goe314_4951_1138.npz\ndata/train/goe496_4104_-1602.npz\ndata/train/clarkysm_5584_1543.npz\ndata/train/e1098_4785_250.npz\ndata/train/be50_6498_-354.npz\ndata/train/goe366_1356_-22.npz\ndata/train/august160_5123_-1011.npz\ndata/train/v43015_3344_-1173.npz\ndata/train/goe281_5542_1743.npz\ndata/train/fx74130wp2mod_9628_-1667.npz\ndata/train/ncambre_2992_-892.npz\ndata/train/fx83w227_9615_1622.npz\ndata/train/goe325_2822_-387.npz\ndata/train/e379_3115_1096.npz\ndata/train/mh110_7844_-2253.npz\ndata/train/m20_9777_1361.npz\ndata/train/goe63_1150_421.npz\ndata/train/nplx_2526_-725.npz\ndata/train/coanda3_6003_-1983.npz\ndata/train/s6063_1530_-518.npz\ndata/train/b29root_7666_-749.npz\ndata/train/vr15_1704_366.npz\ndata/train/hsnlf213_2431_661.npz\ndata/train/e325_5444_719.npz\ndata/train/s4110_6152_263.npz\ndata/train/raf27_1420_415.npz\ndata/train/e422_6183_710.npz\ndata/train/sc1095_8589_763.npz\ndata/train/goe574_4375_-1382.npz\ndata/train/goe118_6293_-1810.npz\ndata/train/fx74130wp2mod_3464_-1304.npz\ndata/train/goe803h_2347_-277.npz\ndata/train/e336_8822_-476.npz\ndata/train/nplx_4842_-394.npz\ndata/train/ea81006_3411_-1397.npz\ndata/train/s6062_7356_7.npz\ndata/train/fx63137sm_8692_2570.npz\ndata/train/s2062_9049_3629.npz\ndata/train/s8025_2003_-277.npz\ndata/train/lwk80120k25_5549_224.npz\ndata/train/goe316_4575_-1458.npz\ndata/train/defcnd1_4544_-1284.npz\ndata/train/goe723_1655_-257.npz\ndata/train/m15_6998_-1508.npz\ndata/train/arad20_4449_-277.npz\ndata/train/arad6_1647_336.npz\ndata/train/sd7080_2027_-259.npz\ndata/train/ag37_5150_-1563.npz\ndata/train/e904_5631_1029.npz\ndata/train/eh0009_3619_883.npz\ndata/train/n64110_9235_67.npz\ndata/train/e639_2860_-535.npz\ndata/train/mh200_8540_-2653.npz\ndata/train/goe798_3065_729.npz\ndata/train/goe404_7929_1414.npz\ndata/train/s5020_5092_-522.npz\ndata/train/m7_1376_-263.npz\ndata/train/ma409sm_3541_561.npz\ndata/train/rg15a213_1761_472.npz\ndata/train/ag14_6325_1622.npz\ndata/train/goe155_2315_-626.npz\ndata/train/n64212_2768_91.npz\ndata/train/e328_4644_1404.npz\ndata/train/mh84_8524_-3099.npz\ndata/train/e591_9084_2728.npz\ndata/train/c141b_4624_-645.npz\ndata/train/hq3518_2550_-673.npz\ndata/train/fx38153_7945_427.npz\ndata/train/nasasc2-0714_2755_-42.npz\ndata/train/sd7084_2828_510.npz\ndata/train/goe405_4091_-173.npz\ndata/train/fx6617a2_1118_410.npz\ndata/train/rg1410_7778_-399.npz\ndata/train/e176_5451_945.npz\ndata/train/ag45c03_3895_1367.npz\ndata/train/mh43_8995_-3376.npz\ndata/train/goe479_6246_386.npz\ndata/train/trainer60_8309_153.npz\ndata/train/goe279_5516_384.npz\ndata/train/mh26_3217_750.npz\ndata/train/e552_3034_376.npz\ndata/train/mh104_1393_310.npz\ndata/train/nacacyh_2232_284.npz\ndata/train/fx76mp140_9201_2319.npz\ndata/train/goe457_5158_32.npz\ndata/train/fx74130wp2_4877_-885.npz\ndata/train/sa7038_4545_-310.npz\ndata/train/2032c_7347_-2527.npz\ndata/train/naca634221_8476_3253.npz\ndata/train/goe585_8507_3241.npz\ndata/train/goe424_3831_752.npz\ndata/train/e562_3825_408.npz\ndata/train/goe565_1297_-453.npz\ndata/train/goe322_2322_170.npz\ndata/train/rc10b3_2119_-77.npz\ndata/train/e664_2560_531.npz\ndata/train/goe358_9871_313.npz\ndata/train/goe500_5346_-981.npz\ndata/train/goe284_3011_496.npz\ndata/train/fx76mp120_8409_3165.npz\ndata/train/m14_2954_697.npz\ndata/train/nacam18_7478_981.npz\ndata/train/fauvel_2456_-293.npz\ndata/train/l7769_2598_206.npz\ndata/train/goe528_2430_-119.npz\ndata/train/jn153_5924_-2382.npz\ndata/train/naca001264a08cli0.2_1212_-179.npz\ndata/train/eh0009_1473_415.npz\ndata/train/bambino6_8781_-2398.npz\ndata/train/fx60177_5658_669.npz\ndata/train/goe630_6234_-39.npz\ndata/train/goe380_4718_-634.npz\ndata/train/m665_1770_456.npz\ndata/train/e556_8830_364.npz\ndata/train/goe376_3087_941.npz\ndata/train/fx75vg166_8020_-2262.npz\ndata/train/hq158_1511_110.npz\ndata/train/m3_8007_1664.npz\ndata/train/goe92_8429_-706.npz\ndata/train/fxm2_3016_445.npz\ndata/train/e226_9451_-2745.npz\ndata/train/naca652415a05_8702_-2495.npz\ndata/train/vr11x_5103_-965.npz\ndata/train/n64012_2811_978.npz\ndata/train/n10_5025_1595.npz\ndata/train/e266_6886_-2075.npz\ndata/train/fx75vg166_3495_-1107.npz\ndata/train/ah79k135_8331_1609.npz\ndata/train/n5h10_1212_115.npz\ndata/train/vr9_1903_-184.npz\ndata/train/s8038_9334_-907.npz\ndata/train/e520_8798_3361.npz\ndata/train/goe744_3599_-169.npz\ndata/train/goe366_7622_-1224.npz\ndata/train/ah93k130_4157_-1452.npz\ndata/train/miley_2443_121.npz\ndata/train/naca16009_3291_-927.npz\ndata/train/vr1_5714_2206.npz\ndata/train/ah81k144_9811_1873.npz\ndata/train/goe433_9251_349.npz\ndata/train/m26_2838_-791.npz\ndata/train/sc20710_4877_197.npz\ndata/train/fx73cl3152_1563_15.npz\ndata/train/goe741_2159_155.npz\ndata/train/naca651412_8576_-1786.npz\ndata/train/e327_1293_-333.npz\ndata/train/e544_8204_-516.npz\ndata/train/e330_3498_-954.npz\ndata/train/geminism_1607_427.npz\ndata/train/ls413_2969_-739.npz\ndata/train/fx69pr281_9380_-2075.npz\ndata/train/goe515_6422_1439.npz\ndata/train/m1_1468_484.npz\ndata/train/mh114_7980_-2692.npz\ndata/train/goe395_1779_-463.npz\ndata/train/naca671215_5399_2030.npz\ndata/train/goe483_8966_1631.npz\ndata/train/goe54_8387_-3176.npz\ndata/train/fx83w160_8094_-2293.npz\ndata/train/hq258_1604_211.npz\ndata/train/fx61163_7730_2325.npz\ndata/train/goe447_2689_248.npz\ndata/train/goe693_3480_-749.npz\ndata/train/e171_5786_220.npz\ndata/train/k2_6665_-2629.npz\ndata/train/goe623_9151_115.npz\ndata/train/n64015a_5931_1689.npz\ndata/train/sc20610_2560_511.npz\ndata/train/gu255118_4721_-1339.npz\ndata/train/fx60100_9623_-1038.npz\ndata/train/naca641112_5971_-315.npz\ndata/train/e1230_3887_-494.npz\ndata/train/goe655_5550_610.npz\ndata/train/usa22_7428_2229.npz\ndata/train/npl9626_7564_2594.npz\ndata/train/n22_8918_1158.npz\ndata/train/ag14_9376_2414.npz\ndata/train/b29tip_1477_-551.npz\ndata/train/v13006_3884_596.npz\ndata/train/e377_5393_156.npz\ndata/train/ultimate_4820_-908.npz\ndata/train/defcnd1_8441_-2956.npz\ndata/train/oaf128_8848_893.npz\ndata/train/goe502_8114_-1638.npz\ndata/train/n66021_5045_-326.npz\ndata/train/goe523_5110_1663.npz\ndata/train/eh2012_9073_3608.npz\ndata/train/s8055_6974_1869.npz\ndata/train/goe117_4799_153.npz\ndata/train/e477_8173_611.npz\ndata/train/e67_5996_-2113.npz\ndata/train/goe610b_2632_455.npz\ndata/train/ah80140_7659_1913.npz\ndata/train/goe614_3593_852.npz\ndata/train/r1080_3130_567.npz\ndata/train/usa35a_5683_346.npz\ndata/train/goe525_4320_-1526.npz\ndata/train/goe683_6715_-1385.npz\ndata/train/fx84w127_3248_-905.npz\ndata/train/e837_6415_856.npz\ndata/train/fx84w150_2852_-1104.npz\ndata/train/mh18_3973_441.npz\ndata/train/rae101_8047_-2083.npz\ndata/train/mh22_3513_-1236.npz\ndata/train/naca64206_2412_158.npz\ndata/train/naca634421_5165_1295.npz\ndata/train/fx77w121_4636_-903.npz\ndata/train/s2048_6374_689.npz\ndata/train/goe575_7700_953.npz\ndata/train/ah93w300_7093_-148.npz\ndata/train/goe144_4913_-308.npz\ndata/train/e230_2919_885.npz\ndata/train/e396_8370_544.npz\ndata/train/sc20706_9015_-1787.npz\ndata/train/goe654_7298_651.npz\ndata/train/nn7mk20_6006_1398.npz\ndata/train/daytonwrightt1_7694_2888.npz\ndata/train/goe525_8583_-3468.npz\ndata/train/eh2010_8825_-985.npz\ndata/train/e471_6611_853.npz\ndata/train/goe600_4449_971.npz\ndata/train/goe502_9541_-1520.npz\ndata/train/usa34_4042_1518.npz\ndata/train/sg6042_8548_-1597.npz\ndata/train/goe575_1781_231.npz\ndata/train/hq109_9051_-2782.npz\ndata/train/be50_7028_-1367.npz\ndata/train/m5_6776_-2730.npz\ndata/train/n2415_2107_-526.npz\ndata/train/naca001034a08cli0.2_3164_-897.npz\ndata/train/goe683_8554_-3139.npz\ndata/train/e547_1629_303.npz\ndata/train/m11_1170_30.npz\ndata/train/e585_7046_2333.npz\ndata/train/n6409_2439_77.npz\ndata/train/goe610bm_4417_1375.npz\ndata/train/n2h15_5989_-1287.npz\ndata/train/dae31_1229_-416.npz\ndata/train/e377m_5836_135.npz\ndata/train/goe547_4283_525.npz\ndata/train/ag04_8978_698.npz\ndata/train/ah81k144wfKlappe_1255_-102.npz\ndata/train/goe517_3570_468.npz\ndata/train/s1223rtl_5743_-1168.npz\ndata/train/goe491_5706_2319.npz\ndata/train/sc20610_6167_2085.npz\ndata/train/goe802_3359_-89.npz\ndata/train/curtisc72_6244_834.npz\ndata/train/hq1585_6418_-1112.npz\ndata/train/goe602_1723_97.npz\ndata/train/goe321_1566_178.npz\ndata/train/goe239_8185_-1891.npz\ndata/train/goe314_5240_1753.npz\ndata/train/goe239_6470_-2554.npz\ndata/train/e58_1624_-122.npz\ndata/train/s2046_9447_2352.npz\ndata/train/goe217_5636_-1839.npz\ndata/train/usa35b_8691_-854.npz\ndata/train/e559_1206_-446.npz\ndata/train/e214_3434_1359.npz\ndata/train/m10_2363_-420.npz\ndata/train/e186_8814_-1573.npz\ndata/train/nlf0215f_4434_-1778.npz\ndata/train/sd7084_6047_-169.npz\ndata/train/psu-90-125wl_2194_-616.npz\ndata/train/rhodesg36_6497_1117.npz\ndata/train/goe529_3286_260.npz\ndata/train/ht12_5252_-1028.npz\ndata/train/ste87151_7676_3179.npz\ndata/train/naca001034a08cli0.2_5095_-205.npz\ndata/train/goe433_7067_-2328.npz\ndata/train/naca001264_9407_2209.npz\ndata/train/usnps4_8841_-1314.npz\ndata/train/usa50_3805_-914.npz\ndata/train/marsden_4437_-971.npz\ndata/train/fx74130wp1_6170_1060.npz\ndata/train/e583_3928_169.npz\ndata/train/goe401_4203_-815.npz\ndata/train/fauvel_4179_64.npz\ndata/train/naca643618_4370_735.npz\ndata/train/e1213_4606_1499.npz\ndata/train/s4062_1275_-465.npz\ndata/train/raf15_8749_2927.npz\ndata/train/naca662415_4789_906.npz\ndata/train/m25_8074_914.npz\ndata/train/naca652415_6494_1430.npz\ndata/train/e205_6147_1430.npz\ndata/train/ui1720_7753_-792.npz\ndata/train/dae11_1008_-413.npz\ndata/train/glennmartin2_1750_550.npz\ndata/train/goe692_7717_-2436.npz\ndata/train/n6h10_6777_-2317.npz\ndata/train/mh113_8960_-2555.npz\ndata/train/ebambino7_4811_1819.npz\ndata/train/naca643418_6676_702.npz\ndata/train/goe447_5431_1173.npz\ndata/train/hsnlf213_2354_184.npz\ndata/train/n63015a_5388_-837.npz\ndata/train/rcsc2_2704_-939.npz\ndata/train/daytonwright6_9151_2124.npz\ndata/train/goe572_7715_1712.npz\ndata/train/e397_7790_-940.npz\ndata/train/rae69ck_2377_423.npz\ndata/train/goe587_6706_-2745.npz\ndata/train/ec863914_6123_-423.npz\ndata/train/goe241_1990_-290.npz\ndata/train/mh93_2614_-799.npz\ndata/train/n8h12_1640_144.npz\ndata/train/rae100_1620_-219.npz\ndata/train/goe460_8851_1431.npz\ndata/train/e193_6061_-1669.npz\ndata/train/m5_3436_-746.npz\ndata/train/e543_9397_3377.npz\ndata/train/r1082_7828_2496.npz\ndata/train/goe458_9772_-1898.npz\ndata/train/e325_5219_-516.npz\ndata/train/goe500_3715_-210.npz\ndata/train/goe366_5328_1146.npz\ndata/train/clarkv_7812_575.npz\ndata/train/goe319_1380_-24.npz\ndata/train/goe325_4185_-755.npz\ndata/train/saratov_7078_-270.npz\ndata/train/sd8000_1853_177.npz\ndata/train/goe610b_8480_2955.npz\ndata/train/fx75193_2587_-500.npz\ndata/train/fg4_1207_-284.npz\ndata/train/rae103_8580_3123.npz\ndata/train/e423_7260_-1481.npz\ndata/train/amsoil2_2325_909.npz\ndata/train/kenmar_8854_1072.npz\ndata/train/n63415_1668_-643.npz\ndata/train/df101_4747_-1465.npz\ndata/train/fx61147_3762_-1139.npz\ndata/train/j5012_5585_923.npz\ndata/train/fx61184_2633_-593.npz\ndata/train/nlf416_8269_-1324.npz\ndata/train/apex16_2813_-683.npz\ndata/train/uag8814320_7884_1518.npz\ndata/train/vr11x_4010_-1652.npz\ndata/train/fx74cl6140_5036_646.npz\ndata/train/raf31_2487_448.npz\ndata/train/goe525_3785_842.npz\ndata/train/mh32_5123_-2026.npz\ndata/train/goe243_4203_1628.npz\ndata/train/goe406_5841_1289.npz\ndata/train/goe207_1794_-394.npz\ndata/train/tsagi8_8516_-2998.npz\ndata/train/goe401_8629_1828.npz\ndata/train/goe685_7928_-476.npz\ndata/train/e817_9282_2235.npz\ndata/train/goe404_4864_1308.npz\ndata/train/lwk80120k25_8261_460.npz\ndata/train/goe512_5527_-2122.npz\ndata/train/goe15_6534_753.npz\ndata/train/e341_5553_-1604.npz\ndata/train/n63210_5093_-29.npz\ndata/train/vr14_3605_-1009.npz\ndata/train/c141b_2827_1101.npz\ndata/train/sg6051_3900_-977.npz\ndata/train/nasasc2-0714_2971_-1169.npz\ndata/train/n22_9051_1167.npz\ndata/train/s7055_8945_3579.npz\ndata/train/sa7038_3915_-1374.npz\ndata/train/mh26_6322_-1557.npz\ndata/train/glennmartin3_2847_1071.npz\ndata/train/naca643218_6181_1104.npz\ndata/train/nacam18_4402_331.npz\ndata/train/fx63110_9336_-2049.npz\ndata/train/e855_1462_-102.npz\ndata/train/ua79sff_9144_-1675.npz\ndata/train/fx78k140a20_1945_-516.npz\ndata/train/eh1590_9603_-473.npz\ndata/train/goe500_5372_-1456.npz\ndata/train/e385_7563_1089.npz\ndata/train/raf19_1240_38.npz\ndata/train/s1048_1882_-174.npz\ndata/train/b540ols_1889_50.npz\ndata/train/hq159b_7888_590.npz\ndata/train/vr7_9412_2451.npz\ndata/train/goe633_3286_1334.npz\ndata/train/s2055_7146_-1286.npz\ndata/train/rg14a147_2977_-720.npz\ndata/train/giiil_2385_755.npz\ndata/train/e385_6944_-1237.npz\ndata/train/stcyr24_5032_191.npz\ndata/train/rae104_4450_5.npz\ndata/train/goe673_1175_-265.npz\ndata/train/fx75vg166_4584_-1030.npz\ndata/train/fx057816_8064_1847.npz\ndata/train/goe113_3813_845.npz\ndata/train/avistar_1174_-321.npz\ndata/train/raf30md_2240_701.npz\ndata/train/goe480_1231_425.npz\ndata/train/nacam6_8320_2110.npz\ndata/train/goe328_2428_753.npz\ndata/train/s1223_9456_-486.npz\ndata/train/chen_4027_923.npz\ndata/train/rc0864c_8956_3562.npz\ndata/train/fx78k150_9156_-938.npz\ndata/train/goe741_2041_-798.npz\ndata/train/fx79w151a_3967_-697.npz\ndata/train/goe484_2568_-126.npz\ndata/train/e587_8091_2776.npz\ndata/train/e205_2323_-898.npz\ndata/train/mh64_1002_-349.npz\ndata/train/e330_6842_641.npz\ndata/train/s8036_8593_-3384.npz\ndata/train/s8038_6613_-566.npz\ndata/train/goe523_2042_-554.npz\ndata/train/hq1510_6331_-357.npz\ndata/train/naca64a410_9380_-3189.npz\ndata/train/npl9626_9431_1763.npz\ndata/train/e540_2663_1021.npz\ndata/train/m14_2449_518.npz\ndata/train/goe591_8355_1285.npz\ndata/train/dsma523b_6604_572.npz\ndata/train/raf32md_1180_-252.npz\ndata/train/naca1410_7521_2200.npz\ndata/train/naca001234_1309_416.npz\ndata/train/s3021_1452_-225.npz\ndata/train/hq159_6497_441.npz\ndata/train/fxs03182_7624_-1940.npz\ndata/train/ah79k143_5990_755.npz\ndata/train/ah93156_6391_-765.npz\ndata/train/goe744_1696_-523.npz\ndata/train/dsma523b_4746_-1787.npz\ndata/train/rae5214_7992_1427.npz\ndata/train/ys900_5498_-853.npz\ndata/train/fx05191_8084_-2891.npz\ndata/train/goe123_3111_745.npz\ndata/train/usa98_5675_1527.npz\ndata/train/ls417_7162_-764.npz\ndata/train/e420_1749_-598.npz\ndata/train/e434_9148_2597.npz\ndata/train/goe769_5693_-1377.npz\ndata/train/marske1_6969_-396.npz\ndata/train/goe382_4375_-1396.npz\ndata/train/dae21_4474_-558.npz\ndata/train/e546_1868_399.npz\ndata/train/fx60177_8741_2776.npz\ndata/train/v13009_3429_-1151.npz\ndata/train/e562_2996_-566.npz\ndata/train/eh1590_5145_-98.npz\ndata/train/fx79w151a_6681_2496.npz\ndata/train/e426_9246_-1940.npz\ndata/train/goe770_4202_-1003.npz\ndata/train/sc20010_3310_-571.npz\ndata/train/goe367_6884_1863.npz\ndata/train/goe239_8754_-1336.npz\ndata/train/goe165_8341_-355.npz\ndata/train/m4_2222_817.npz\ndata/train/hq1010_6195_-2275.npz\ndata/train/vr12_7863_-2069.npz\ndata/train/naca632615_5008_-592.npz\ndata/train/s4083_8569_2221.npz\ndata/train/c5c_4313_-223.npz\ndata/train/fx6617ai_3452_958.npz\ndata/train/n2415_1424_278.npz\ndata/train/npl9626_4845_1887.npz\ndata/train/e544_2816_376.npz\ndata/train/fxl142k_6408_2569.npz\ndata/train/oaf117_1065_-18.npz\ndata/train/oaf102_9733_-93.npz\ndata/train/rc12n1_2030_-539.npz\ndata/train/goe491_7169_-1523.npz\ndata/train/sc20614_3600_-447.npz\ndata/train/goe612_5740_2011.npz\ndata/train/goe383_7362_2298.npz\ndata/train/e435_4904_-185.npz\ndata/train/ch10sm_1163_-289.npz\ndata/train/dbln526_4702_460.npz\ndata/train/fx77w270_7574_1557.npz\ndata/train/ah93w257_3130_-559.npz\ndata/train/fx601001_8541_1718.npz\ndata/train/ah82150a_1493_-57.npz\ndata/train/goe627_2921_857.npz\ndata/train/e668_5783_2284.npz\ndata/train/davis_7990_-560.npz\ndata/train/goe504_6668_-2382.npz\ndata/train/n63210_1246_-17.npz\ndata/train/mh114_3311_-245.npz\ndata/train/lrn1007_9900_-692.npz\ndata/train/goe114_3722_-1100.npz\ndata/train/daytonwright6_6996_-428.npz\ndata/train/ah83159_5413_1972.npz\ndata/train/b707d_7931_2742.npz\ndata/train/goe122_4418_-590.npz\ndata/train/mh115_5725_-821.npz\ndata/train/goe523_1319_222.npz\ndata/train/mh27_7025_-274.npz\ndata/train/fx67k150_4047_-1664.npz\ndata/train/us1000root_3078_-52.npz\ndata/train/eiffel371_6615_-967.npz\ndata/train/goe11k_1539_-397.npz\ndata/train/mh93_3187_811.npz\ndata/train/goe741_4044_-570.npz\ndata/train/ea81006_1046_110.npz\ndata/train/goe384_5411_652.npz\ndata/train/goe495_7227_-1195.npz\ndata/train/sa7035_5870_169.npz\ndata/train/ag25_1659_583.npz\ndata/train/la203a_5126_-1914.npz\ndata/train/goe477_8762_-2694.npz\ndata/train/n0012_1515_194.npz\ndata/train/s1014_3513_1264.npz\ndata/train/naca16006_9433_956.npz\ndata/train/ah82150f_7291_1403.npz\ndata/train/e1213_6183_-1481.npz\ndata/train/goe480_6209_-771.npz\ndata/train/clarkys_6985_-1718.npz\ndata/train/goe490_6883_-1739.npz\ndata/train/raf6_6358_732.npz\ndata/train/oa212_7187_-129.npz\ndata/train/goe561_6555_1705.npz\ndata/train/goe434_4335_-116.npz\ndata/train/e207_1014_-12.npz\ndata/train/naca643218_6718_2642.npz\ndata/train/nlf0215f_3457_-906.npz\ndata/train/s3002_6730_-1024.npz\ndata/train/goe587_3331_691.npz\ndata/train/fx63110_3505_360.npz\ndata/train/e335_1122_185.npz\ndata/train/fx77w343_9568_498.npz\ndata/train/e331_5903_187.npz\ndata/train/bambino6_1873_-307.npz\ndata/train/ames02_8766_99.npz\ndata/train/mh83_5003_529.npz\ndata/train/sc20503_2317_-502.npz\ndata/train/ag14_6889_-1347.npz\ndata/train/s6062_7280_1664.npz\ndata/train/e417_7536_-1157.npz\ndata/train/ah82150f_2779_421.npz\ndata/train/goe499_7454_1107.npz\ndata/train/saratov_3271_-93.npz\ndata/train/joukowsk_6590_-1454.npz\ndata/train/b707b_5360_-372.npz\ndata/train/goe100_9120_1911.npz\ndata/train/goe482_3579_-302.npz\ndata/train/goe380_5689_18.npz\ndata/train/sa7035_6568_-2111.npz\ndata/train/goe419_4468_-171.npz\ndata/train/usa40_3146_-609.npz\ndata/train/vr8b_5491_-38.npz\ndata/train/e395_2514_1008.npz\ndata/train/rc1264c_3974_338.npz\ndata/train/npl9615_9064_-910.npz\ndata/train/goe365_4174_-1081.npz\ndata/train/goe290_4360_290.npz\ndata/train/goe137_1015_187.npz\ndata/train/goe367_5650_-2145.npz\ndata/train/vr7b_1218_-194.npz\ndata/train/ag46ct02r_7331_2379.npz\ndata/train/naca747a415_4489_99.npz\ndata/train/sa7036_7974_-2533.npz\ndata/train/rc10b3_5835_1805.npz\ndata/train/marsden_4713_771.npz\ndata/train/e335_9255_753.npz\ndata/train/ag46ct02r_2851_-146.npz\ndata/train/goe397_1456_72.npz\ndata/train/s4022_6107_-1374.npz\ndata/train/naca66209_3296_-1093.npz\ndata/train/naca671215_9247_1328.npz\ndata/train/e379_1657_10.npz\ndata/train/goe591_6899_-1072.npz\ndata/train/stcyr24_5931_1180.npz\ndata/train/goe225_3779_-240.npz\ndata/train/ebambino7_1379_550.npz\ndata/train/mh44_5421_-2037.npz\ndata/train/goe443_6042_-372.npz\ndata/train/c141e_2259_-99.npz\ndata/train/goe476_9778_429.npz\ndata/train/rc510_5971_-1852.npz\ndata/train/rg149_1096_378.npz\ndata/train/goe210_2809_909.npz\ndata/train/naca652415_9351_-339.npz\ndata/train/e335_8711_3334.npz\ndata/train/ht12_4026_-818.npz\ndata/train/fx05188_1983_615.npz\ndata/train/fx61140_3443_921.npz\ndata/train/fx75vg166_9208_3684.npz\ndata/train/raf32md_5241_-1010.npz\ndata/train/e694_8000_521.npz\ndata/train/n63010a_9085_3602.npz\ndata/train/goe426_7528_-1751.npz\ndata/train/c5c_7635_-698.npz\ndata/train/e327_9186_1941.npz\ndata/train/lwk80120k25_8483_-1126.npz\ndata/train/dae21_7865_197.npz\ndata/train/ah79k132_6158_1123.npz\ndata/train/n2h15_3546_-17.npz\ndata/train/k3_7278_662.npz\ndata/train/raf19_4898_-1495.npz\ndata/train/e853_4513_1046.npz\ndata/train/e1233_4990_14.npz\ndata/train/ah94145_7137_-1880.npz\ndata/train/n14_4307_1725.npz\ndata/train/ys900_9756_-831.npz\ndata/train/goe140_8274_-41.npz\ndata/train/sc20614_3197_895.npz\ndata/train/e220_2522_-255.npz\ndata/train/fx77w270_2762_-261.npz\ndata/train/hq09_1540_-22.npz\ndata/train/lrn1007_1113_-49.npz\ndata/train/naca64208_1788_424.npz\ndata/train/e476_4835_1410.npz\ndata/train/clarkys_7273_-563.npz\ndata/train/naca001064_3515_259.npz\ndata/train/hq3012_3167_696.npz\ndata/train/sc20606_2081_318.npz\ndata/train/tsagi8_3704_795.npz\ndata/train/dae31_8807_-3474.npz\ndata/train/c141c_4142_-1065.npz\ndata/train/naca651212_3917_1597.npz\ndata/train/fxl142k_4665_-749.npz\ndata/train/raf89_3023_-873.npz\ndata/train/e422_8635_1121.npz\ndata/train/sc20518_9217_-2950.npz\ndata/train/s9032_1196_-59.npz\ndata/train/m24_4502_-180.npz\ndata/train/goe633_6454_752.npz\ndata/train/giiim_7804_-1332.npz\ndata/train/goe177_9113_3607.npz\ndata/train/goe430_1864_-296.npz\ndata/train/k3311_5354_-1973.npz\ndata/train/defcnd2_5862_-1881.npz\ndata/train/npl9626_7625_137.npz\ndata/train/raf48_4706_1109.npz\ndata/train/rhodesg34_8248_-841.npz\ndata/train/usa25_3119_799.npz\ndata/train/s3021_9381_-1228.npz\ndata/train/goe460_5649_1347.npz\ndata/train/amsoil2_6298_1480.npz\ndata/train/e66_4283_-516.npz\ndata/train/goe303_5944_425.npz\ndata/train/e328_7061_-399.npz\ndata/train/sc20402_1974_120.npz\ndata/train/hq2195_2826_297.npz\ndata/train/e339_5877_-2002.npz\ndata/train/fx74130wp2_2747_319.npz\ndata/train/oaf095_4941_108.npz\ndata/train/b707b_1849_596.npz\ndata/train/s1210_1413_45.npz\ndata/train/jn153_4977_688.npz\ndata/train/ag26_8356_-161.npz\ndata/train/fx63143_7349_-1351.npz\ndata/train/davis_corrected_1238_217.npz\ndata/train/naca66209_3351_529.npz\ndata/train/vr5_6475_389.npz\ndata/train/goe238_4678_-1641.npz\ndata/train/eh2012_7480_-1803.npz\ndata/train/raf48_6729_-445.npz\ndata/train/goe424_4877_-418.npz\ndata/train/ag46c03_979_389.npz\ndata/train/goe256_4065_1644.npz\ndata/train/sc20406_7997_-559.npz\ndata/train/sc20518_3019_-188.npz\ndata/train/goe320_8048_-2327.npz\ndata/train/goe366_4896_1849.npz\ndata/train/e554_2909_-494.npz\ndata/train/goe478_8957_-748.npz\ndata/train/goe561_6319_357.npz\ndata/train/m13_5436_-1433.npz\ndata/train/mh24_3002_464.npz\ndata/train/e344_4120_454.npz\ndata/train/mh43_2622_-615.npz\ndata/train/usa40b_8570_3025.npz\ndata/train/e562_9504_-593.npz\ndata/train/nacacyh_7269_2986.npz\ndata/train/mh116_8094_-1983.npz\ndata/train/goe314_1485_-606.npz\ndata/train/ag36_1117_-401.npz\ndata/train/ma409_7544_798.npz\ndata/train/goe488_7644_2883.npz\ndata/train/mh120_3357_-1346.npz\ndata/train/mh115_8925_-1872.npz\ndata/train/hq309_4781_-1836.npz\ndata/train/naca001234_4189_-28.npz\ndata/train/sc20706_1816_-387.npz\ndata/train/fx80080_7941_1121.npz\ndata/train/n63010a_7486_-2235.npz\ndata/train/fx76100_2240_890.npz\ndata/train/s4310_7617_-1637.npz\ndata/train/usa49_5989_271.npz\ndata/train/vr8_5194_490.npz\ndata/train/goe481a_3610_-1292.npz\ndata/train/marske2_8239_2608.npz\ndata/train/ah88k136_6257_2497.npz\ndata/train/ys915_8825_1039.npz\ndata/train/a18_2762_210.npz\ndata/train/hq259b_2837_644.npz\ndata/train/ma409sm_9870_-1187.npz\ndata/train/raf33_6654_-808.npz\ndata/train/fx74130wp2mod_7506_1599.npz\ndata/train/dfvlrr4_1295_89.npz\ndata/train/ah93w300_5961_-345.npz\ndata/train/fxm2_1401_-368.npz\ndata/train/e195_5344_1417.npz\ndata/train/goe645_4732_-613.npz\ndata/train/e668_2980_1046.npz\ndata/train/goe494_7343_1820.npz\ndata/train/saratov_4382_-563.npz\ndata/train/goe433_6833_1016.npz\ndata/train/goe565_2953_27.npz\ndata/train/fg1_8667_-2647.npz\ndata/train/clarkys_3336_684.npz\ndata/train/goe744_9890_888.npz\ndata/train/goe766_7436_2980.npz\ndata/train/ea81006_5625_-532.npz\ndata/train/e176_4647_1209.npz\ndata/train/fx711520_2125_406.npz\ndata/train/raf32md_5351_1545.npz\ndata/train/ah94145_6939_-155.npz\ndata/train/ah93k130_4255_546.npz\ndata/train/ah93157_8402_356.npz\ndata/train/ea61012_2790_948.npz\ndata/train/fx63158_2828_166.npz\ndata/train/ah21-9_8387_28.npz\ndata/train/naca64a410_5420_1702.npz\ndata/train/sd8040_5704_849.npz\ndata/train/hq3518_7581_-2806.npz\ndata/train/s8055_6871_2073.npz\ndata/train/goe442_6415_676.npz\ndata/train/marske1_8898_-1357.npz\ndata/train/hq2195_9373_3177.npz\ndata/train/ah79100b_1974_595.npz\ndata/train/geminism_8613_1230.npz\ndata/train/nacam12_1082_-218.npz\ndata/train/sg6042_3205_998.npz\ndata/train/vr8b_4966_-349.npz\ndata/train/ssca07_7777_-3178.npz\ndata/train/goe499_7103_-1921.npz\ndata/train/hq1510_6371_930.npz\ndata/train/vr8_6441_-2147.npz\ndata/train/goe288_3207_-593.npz\ndata/train/p51dtip_3012_-390.npz\ndata/train/goe05k_5002_-1459.npz\ndata/train/e604_6641_-966.npz\ndata/train/fx05188_8909_-2039.npz\ndata/train/bqm34_7497_-791.npz\ndata/train/bambino6_7456_1447.npz\ndata/train/n22_7897_-805.npz\ndata/train/hq209_3532_182.npz\ndata/train/marsden_9125_1113.npz\ndata/train/goe477_9143_-2706.npz\ndata/train/ah79k132_2922_830.npz\ndata/train/hq1012_2710_-575.npz\ndata/train/goe15k_4963_-1645.npz\ndata/train/mh114_5924_-1913.npz\ndata/train/v13006_5163_2037.npz\ndata/train/goe502_3258_-294.npz\ndata/train/e297_9094_-3160.npz\ndata/train/goe329_1733_647.npz\ndata/train/clarym15_5987_289.npz\ndata/train/goe403_5141_1617.npz\ndata/train/naca0015_7846_2193.npz\ndata/train/coanda1_4738_-694.npz\ndata/train/c5b_1980_-530.npz\ndata/train/naca16021_8069_2141.npz\ndata/train/n63215_2096_708.npz\ndata/train/goe559_4488_-341.npz\ndata/train/marske3_3115_-260.npz\ndata/train/jn153_6182_-302.npz\ndata/train/goe366_8854_3179.npz\ndata/train/ah79100b_6417_1934.npz\ndata/train/hq300gd2_4186_1613.npz\ndata/train/goe332_8788_-2204.npz\ndata/train/glennmartin4_2274_-914.npz\ndata/train/mh23_2752_904.npz\ndata/train/hq3014_6432_1190.npz\ndata/train/hq159b_5379_1987.npz\ndata/train/e853_8517_-3470.npz\ndata/train/fx77w258_2568_-779.npz\ndata/train/mh117_2470_-620.npz\ndata/train/cootie_4450_-591.npz\ndata/train/n64215_4174_656.npz\ndata/train/s3025_6257_1132.npz\ndata/train/lwk80080_6793_2535.npz\ndata/train/mh26_8280_-587.npz\ndata/train/hq3513_8729_1717.npz\ndata/train/naca654421_8043_-718.npz\ndata/train/vr1_4867_-285.npz\ndata/train/sc20503_6699_1711.npz\ndata/train/goe620_1856_180.npz\ndata/train/ah93k130_4741_-1546.npz\ndata/train/s7012_5156_-385.npz\ndata/train/glennmartin3_4509_49.npz\ndata/train/goe279_1286_134.npz\ndata/train/e326_2303_45.npz\ndata/train/goe488_5411_762.npz\ndata/train/goe451_7104_1890.npz\ndata/train/e426_4355_-814.npz\ndata/train/e668_1551_-606.npz\ndata/train/mh81_7123_2790.npz\ndata/train/sc20606_3990_-792.npz\ndata/train/cast102_5634_549.npz\ndata/train/e549_6742_-558.npz\ndata/train/fx73cl1152_6716_1323.npz\ndata/train/e604_8571_580.npz\ndata/train/usa98_2666_-338.npz\ndata/train/dae21_5905_-1944.npz\ndata/train/goe323_6534_687.npz\ndata/train/e398_8141_3269.npz\ndata/train/sd6060_4032_1573.npz\ndata/train/naca633218_7632_-1460.npz\ndata/train/n13_2416_-833.npz\ndata/train/naca64209_1051_-82.npz\ndata/train/nlf0215f_1814_-614.npz\ndata/train/fx67k170_2909_-67.npz\ndata/train/sc20410_6124_-1509.npz\ndata/train/usa45_9319_-726.npz\ndata/train/sc1095r8_7655_955.npz\ndata/train/hh02_1986_-423.npz\ndata/train/goe795_7844_1497.npz\ndata/train/goe498_1988_-100.npz\ndata/train/mh91_6815_-161.npz\ndata/train/sd2083_8446_-2869.npz\ndata/train/goe617_8795_-3006.npz\ndata/train/rhodesg30_4570_-626.npz\ndata/train/e682_4515_1193.npz\ndata/train/naca001034_7994_2136.npz\ndata/train/goe504_9569_136.npz\ndata/train/goe443_1559_197.npz\ndata/train/e333_3438_-1329.npz\ndata/train/ms317_1493_196.npz\ndata/train/fx61163_8198_-862.npz\ndata/train/dga1138_3741_954.npz\ndata/train/n5h10_6316_828.npz\ndata/train/wb140_8877_-2477.npz\ndata/train/n63215_6105_573.npz\ndata/train/naca001065_1551_-311.npz\ndata/train/goe492_1252_-242.npz\ndata/train/e836_6123_838.npz\ndata/train/rae5213_6624_1830.npz\ndata/train/ah81k144_5203_1394.npz\ndata/train/e379_5093_786.npz\ndata/train/tempest2_3812_961.npz\ndata/train/eh2510_3182_-211.npz\ndata/train/ms317_9195_2930.npz\ndata/train/goe10k_8844_-2260.npz\ndata/train/oa213_1805_149.npz\ndata/train/e336_8816_1455.npz\ndata/train/goe777_9759_-132.npz\ndata/train/naca633618_7096_1019.npz\ndata/train/k1_8177_-2389.npz\ndata/train/s8052_5623_671.npz\ndata/train/e379_6040_2043.npz\ndata/train/s3024_2958_-713.npz\ndata/train/goe528_4706_-897.npz\ndata/train/naca0008_1966_442.npz\ndata/train/ah6407_5644_-876.npz\ndata/train/goe780_3427_926.npz\ndata/train/arad13_8123_-1624.npz\ndata/train/eh2010_1256_-243.npz\ndata/train/naca643418_9679_-2306.npz\ndata/train/sm701_1721_-596.npz\ndata/train/naca651212a06_3040_-854.npz\ndata/train/goe423_5097_-1710.npz\ndata/train/goe682_2086_702.npz\ndata/train/goe491_2283_-883.npz\ndata/train/mh70_6850_-1475.npz\ndata/train/goe240_5560_799.npz\ndata/train/goe167_2746_-636.npz\ndata/train/eh2012_4500_-1410.npz\ndata/train/goe255_7275_2307.npz\ndata/train/goe744_2726_592.npz\ndata/train/goe420_4759_-1631.npz\ndata/train/goe173_1826_336.npz\ndata/train/m23_8349_-2738.npz\ndata/train/fx76mp120_3692_-981.npz\ndata/train/goe436_2593_305.npz\ndata/train/nlf0115_5161_-2015.npz\ndata/train/m16_6834_-139.npz\ndata/train/goe498_9266_3749.npz\ndata/train/ah81k144wfKlappe_5815_1712.npz\ndata/train/hq3012_7905_-1233.npz\ndata/train/goe627_3947_-683.npz\ndata/train/e546_7295_-548.npz\ndata/train/mb253515sm_3419_1341.npz\ndata/train/mh112_1984_780.npz\ndata/train/goe633_1992_413.npz\ndata/train/nacacyh_5118_-1253.npz\ndata/train/naca65209_5054_-500.npz\ndata/train/m7_2805_416.npz\ndata/train/goe803h_9193_-1840.npz\ndata/train/fx76120_3727_604.npz\ndata/train/fx66s171_1757_180.npz\ndata/train/goe393_4675_1145.npz\ndata/train/naca0021_8214_-384.npz\ndata/train/e1233_1965_-112.npz\ndata/train/r1082_4816_325.npz\ndata/train/e230_6004_-312.npz\ndata/train/naca0015_6015_-1028.npz\ndata/train/goe379_7680_-1094.npz\ndata/train/goe164_5190_2113.npz\ndata/train/e817_5617_-1366.npz\ndata/train/rae5213_1481_137.npz\ndata/train/goe13k_5680_162.npz\ndata/train/goe480_4795_-1730.npz\ndata/train/eiffel10_4755_-1239.npz\ndata/train/goe615_8866_2286.npz\ndata/train/e330_3700_-903.npz\ndata/train/hq2090sm_4276_847.npz\ndata/train/m10_9515_-1315.npz\ndata/train/goe304_8503_-1098.npz\ndata/train/goe320_9966_706.npz\ndata/train/hq1012_1706_-645.npz\ndata/train/geminism_9813_121.npz\ndata/train/fx78pk188_5218_-1790.npz\ndata/train/goe451_5139_-1254.npz\ndata/train/sd2030_8869_385.npz\ndata/train/e638_7296_-1949.npz\ndata/train/goe380_5290_1116.npz\ndata/train/e475_2931_-1126.npz\ndata/train/fx80080_6022_-221.npz\ndata/train/usa31_7543_-1997.npz\ndata/train/m20_7303_1840.npz\ndata/train/mh20_9565_-13.npz\ndata/train/s1223_2771_491.npz\ndata/train/fx66182_5907_185.npz\ndata/train/nl722343_1086_129.npz\ndata/train/sg6041_7421_2275.npz\ndata/train/s5020_9608_-883.npz\ndata/train/fx73170a_5325_1300.npz\ndata/train/goe547_5076_73.npz\ndata/train/goe766_7455_-106.npz\ndata/train/fx74modsm_1030_383.npz\ndata/train/e67_4625_-1171.npz\ndata/train/dormoy_4694_-1125.npz\ndata/train/e422_7829_455.npz\ndata/train/sd5060_9676_-965.npz\ndata/train/goe512_6863_-2136.npz\ndata/train/goe446_6017_248.npz\ndata/train/dormoy_6410_-684.npz\ndata/train/e520_8984_1226.npz\ndata/train/usa25_4304_224.npz\ndata/train/mh110_6843_157.npz\ndata/train/rc08n1_8245_-1435.npz\ndata/train/naca0010_6432_20.npz\ndata/train/hq1510_2733_-1008.npz\ndata/train/naca0024_3168_-719.npz\ndata/train/goe278_3158_-861.npz\ndata/train/b540ols_2208_-166.npz\ndata/train/e338_8114_-3309.npz\ndata/train/e858_8156_2809.npz\ndata/train/fx66196v_8185_-422.npz\ndata/train/daytonwrightt1_2042_24.npz\ndata/train/rg15a213_3955_977.npz\ndata/train/e546_1209_-259.npz\ndata/train/ames03_8012_-1713.npz\ndata/train/fauvel_2715_-1002.npz\ndata/train/naca651412_8987_824.npz\ndata/train/sc20710_1202_-128.npz\ndata/train/naca001034_1607_0.npz\ndata/train/mh20_6629_-210.npz\ndata/train/raf38_7829_-2569.npz\ndata/train/sokolov_7016_-1799.npz\ndata/train/naca664221_5150_-1958.npz\ndata/train/e338_6873_1316.npz\ndata/train/e838_8065_-763.npz\ndata/train/goe329_5887_-1661.npz\ndata/train/raf32_4385_662.npz\ndata/train/raf31_6568_55.npz\ndata/train/goe622_6828_-1104.npz\ndata/train/e625_3194_-617.npz\ndata/train/ag14_7239_544.npz\ndata/train/sc20403_7319_-846.npz\ndata/train/goe780_8310_1590.npz\ndata/train/mh104_8768_2087.npz\ndata/train/goe118_5860_-1326.npz\ndata/train/vr11x_5907_2138.npz\ndata/train/s4320_4704_-1490.npz\ndata/train/goe188_3193_-309.npz\ndata/train/goe444_3405_89.npz\ndata/train/s8035_3204_-680.npz\ndata/train/vr13_6937_-2454.npz\ndata/train/s4110_1402_-366.npz\ndata/train/fx60157_1287_-424.npz\ndata/train/e694_1282_-195.npz\ndata/train/hq1010_1252_113.npz\ndata/train/goe144_1435_20.npz\ndata/train/goe187_5912_-321.npz\ndata/train/sc21006_8956_-3236.npz\ndata/train/fx2_1813_-442.npz\ndata/train/tempest3_7516_2552.npz\ndata/train/goe619_6976_846.npz\ndata/train/goe776_2473_-410.npz\ndata/train/pfcm_7006_-2167.npz\ndata/train/e421_3527_858.npz\ndata/train/goe547_8243_1282.npz\ndata/train/goe316_4016_-1404.npz\ndata/train/goe574_9895_520.npz\ndata/train/goe63_4211_951.npz\ndata/train/glennmartin3_4758_-783.npz\ndata/train/fx77w270_5394_1396.npz\ndata/train/naca66210_1657_-51.npz\ndata/train/goe529_8326_1293.npz\ndata/train/naca001035_1338_157.npz\ndata/train/naca664221_8860_137.npz\ndata/train/ls417mod_6666_-111.npz\ndata/train/goe184_7376_-2756.npz\ndata/train/goe533_7647_-770.npz\ndata/train/fauvel_3518_-964.npz\ndata/train/s1010_4084_-150.npz\ndata/train/e197_5289_-1707.npz\ndata/train/e184_6184_-1165.npz\ndata/train/n22_2145_716.npz\ndata/train/sa7038_1394_-368.npz\ndata/train/naca643418_1719_-490.npz\ndata/train/ht12_8303_3236.npz\ndata/train/s9026_2689_852.npz\ndata/train/e657_1086_150.npz\ndata/train/hq109_9280_2155.npz\ndata/train/cr001sm_8579_3076.npz\ndata/train/fx79w151a_7444_2883.npz\ndata/train/goe403_2502_574.npz\ndata/train/rc510_2841_-509.npz\ndata/train/goe421_8921_-364.npz\ndata/train/goe29b_4227_-1473.npz\ndata/train/rae101_9221_-2770.npz\ndata/train/goe522_8637_-813.npz\ndata/train/usa33_4614_1212.npz\ndata/train/goe319_9058_-1102.npz\ndata/train/usa22_2258_-586.npz\ndata/train/rg1495_8892_468.npz\ndata/train/august160_6916_-1300.npz\ndata/train/goe685_3308_-973.npz\ndata/train/e557_4683_-1378.npz\ndata/train/goe462_7384_-3025.npz\ndata/train/raf32md_7841_566.npz\ndata/train/goe361_3104_-619.npz\ndata/train/oa206_3014_-618.npz\ndata/train/ms313_3024_645.npz\ndata/train/tempest2_3682_-244.npz\ndata/train/s4180_8288_-2691.npz\ndata/train/rc1264c_5310_-903.npz\ndata/train/e1214_8596_789.npz\ndata/train/nacam2_6712_-832.npz\ndata/train/goe758_2391_208.npz\ndata/train/s8055_2129_-169.npz\ndata/train/fx76mp120_5076_1249.npz\ndata/train/n63415_1575_-542.npz\ndata/train/sc20010_5966_-2443.npz\ndata/train/sd7084_8095_-258.npz\ndata/train/goe505_2835_890.npz\ndata/train/mh24_3337_-555.npz\ndata/train/ag14_3935_-138.npz\ndata/train/ah81k144_5220_-673.npz\ndata/train/goe389_2578_-949.npz\ndata/train/goe324_7100_925.npz\ndata/train/lds2_9291_158.npz\ndata/train/goe602m_9562_1353.npz\ndata/train/c141e_3349_383.npz\ndata/train/s9000_9554_-2786.npz\ndata/train/goe702_6185_364.npz\ndata/train/mh27_9325_-2684.npz\ndata/train/usa45m_5770_2245.npz\ndata/train/dae51_1810_-60.npz\ndata/train/naca001065_2026_-638.npz\ndata/train/n11_4172_-303.npz\ndata/train/mh18_8591_-3397.npz\ndata/train/fx77w153_8622_888.npz\ndata/train/s1223_6848_-2294.npz\ndata/train/oa206_3240_-549.npz\ndata/train/s4053_5989_-1937.npz\ndata/train/goe137_4842_770.npz\ndata/train/e604_7887_-2205.npz\ndata/train/ah93w174_4842_-786.npz\ndata/train/goe118_1948_-753.npz\ndata/train/e325_9135_-1198.npz\ndata/train/e836_1924_466.npz\ndata/train/raf30_7737_-2035.npz\ndata/train/e817_3346_-647.npz\ndata/train/s4083_2345_471.npz\ndata/train/goe316_6385_-265.npz\ndata/train/naca66209_6737_-810.npz\ndata/train/goe562_8753_-436.npz\ndata/train/e858_1480_191.npz\ndata/train/hq2090sm_2961_-1221.npz\ndata/train/m685_6609_1376.npz\ndata/train/e168_9597_481.npz\ndata/train/nlf0215f_3855_1545.npz\ndata/train/e476_4389_-844.npz\ndata/train/coanda3_1088_-346.npz\ndata/train/mh91_9231_594.npz\ndata/train/hq1512_8860_430.npz\ndata/train/oaf128_4007_-1606.npz\ndata/train/e1233_4281_732.npz\ndata/train/fx2_4579_1150.npz\ndata/train/ua79sf18_8773_224.npz\ndata/train/oaf095_8655_696.npz\ndata/train/ultimate_8681_-3593.npz\ndata/train/goe522_1232_357.npz\ndata/train/goe434_4299_512.npz\ndata/train/du861372_3614_-700.npz\ndata/train/e297_1435_577.npz\ndata/train/usa5_1126_442.npz\ndata/train/s8025_9445_810.npz\ndata/train/ssca07_9749_553.npz\ndata/train/fg3_4596_1291.npz\ndata/train/b29root_8278_1750.npz\ndata/train/n64108_9761_-1656.npz\ndata/train/goe703_8866_1849.npz\ndata/train/naca16012_1501_9.npz\ndata/train/goe711_7376_3007.npz\ndata/train/goe176_7564_-1589.npz\ndata/train/e435_2561_18.npz\ndata/train/naca63a210_8563_2207.npz\ndata/train/e393_3188_-218.npz\ndata/train/lg10sc_6565_1045.npz\ndata/train/goe241_5727_1434.npz\ndata/train/n2415_2893_665.npz\ndata/train/goe525_3845_-21.npz\ndata/train/rg15a111_6717_741.npz\ndata/train/goe431_5823_1467.npz\ndata/train/s5010_7457_-2531.npz\ndata/train/raf27_5393_1672.npz\ndata/train/naca6412_4869_1573.npz\ndata/train/usa40_3072_157.npz\ndata/train/e398_3126_71.npz\ndata/train/e434_7259_991.npz\ndata/train/mh113_4754_-1457.npz\ndata/train/goe442_4885_1491.npz\ndata/train/ma409_8550_871.npz\ndata/train/mh62_2914_-971.npz\ndata/train/goe361_5155_1857.npz\ndata/train/npl9510_8942_2468.npz\ndata/train/nlf0215f_3369_-9.npz\ndata/train/rc510_4236_-320.npz\ndata/train/naca644421_9125_1569.npz\ndata/train/dae21_4420_-1644.npz\ndata/train/goe615_4688_-1706.npz\ndata/train/rg12a_7962_2047.npz\ndata/train/goe803h_4167_441.npz\ndata/train/kc135c_9152_-20.npz\ndata/train/fx73k170_1766_622.npz\ndata/train/naca64208_1005_219.npz\ndata/train/goe408_6447_-1753.npz\ndata/train/goe562_4302_-907.npz\ndata/train/e71_3682_731.npz\ndata/train/s1223_4128_1157.npz\ndata/train/stf86361_1902_186.npz\ndata/train/e603_8465_-2704.npz\ndata/train/fx60100_9522_-2052.npz\ndata/train/goe458_1951_-433.npz\ndata/train/naca654221_4251_1102.npz\ndata/train/naca2410_4119_402.npz\ndata/train/goe269_3534_618.npz\ndata/train/nl722343_8409_2220.npz\ndata/train/df101_4681_-94.npz\ndata/train/goe63_8217_-2663.npz\ndata/train/ah93k130_4022_761.npz\ndata/train/goe303_6736_-818.npz\ndata/train/mrc-20_8687_631.npz\ndata/train/m5_4297_926.npz\ndata/train/goe518_7998_2709.npz\ndata/train/ua2-180sm_4897_967.npz\ndata/train/fx711525_2395_342.npz\ndata/train/goe360_9134_1728.npz\ndata/train/goe368_5948_996.npz\ndata/train/goe256_7301_-265.npz\ndata/train/sg6050_2292_-738.npz\ndata/train/s1010_5916_1801.npz\ndata/train/arad20_6822_2506.npz\ndata/train/e374_8163_3372.npz\ndata/train/coanda2_5394_1551.npz\ndata/train/e604_4913_1648.npz\ndata/train/rc410_4857_-1353.npz\ndata/train/ah81k144wfKlappe_3817_-1567.npz\ndata/train/goe561_6552_1366.npz\ndata/train/august160_1246_258.npz\ndata/train/e552_2215_524.npz\ndata/train/ah93w300_7333_428.npz\ndata/train/hq1012_8479_2929.npz\ndata/train/fx63145_2063_-571.npz\ndata/train/e549_8917_1003.npz\ndata/train/naca1408_9598_-1740.npz\ndata/train/raf15_1221_155.npz\ndata/train/fx83w160_3631_816.npz\ndata/train/m25_4241_-166.npz\ndata/train/v13006_3732_414.npz\ndata/train/n63212_7775_713.npz\ndata/train/goe500_8600_-1225.npz\ndata/train/daytonwrightt1_1983_804.npz\ndata/train/goe310_6093_-1405.npz\ndata/train/sc20503_5031_684.npz\ndata/train/amsoil1_5856_174.npz\ndata/train/e61_3458_-343.npz\ndata/train/goe234_5494_-2077.npz\ndata/train/c141e_9350_-3511.npz\ndata/train/s2060_9661_-562.npz\ndata/train/ah6407_5564_-1441.npz\ndata/train/rc1064c_1664_513.npz\ndata/train/usa22_4028_190.npz\ndata/train/goe494_3400_1213.npz\ndata/train/goe440_1966_491.npz\ndata/train/goe55_1277_21.npz\ndata/train/fx6617a2_6917_2475.npz\ndata/train/n2415_6692_1821.npz\ndata/train/goe279_2310_74.npz\ndata/train/sd7080_5731_1657.npz\ndata/train/naca653218_3972_-484.npz\ndata/train/fx6617ai_3105_1103.npz\ndata/train/e472_5473_-1171.npz\ndata/train/tsagi12_9213_-2513.npz\ndata/train/giiin_4404_660.npz\ndata/train/c141b_9812_1455.npz\ndata/train/e327_5277_975.npz\ndata/train/mh80_7334_2906.npz\ndata/train/e1212mod_7483_1039.npz\ndata/train/ah93w215_2296_120.npz\ndata/train/goe256_2219_590.npz\ndata/train/fx76mp120_1580_-79.npz\ndata/train/tsagi8_2887_92.npz\ndata/train/vr14_1951_-183.npz\ndata/train/goe256_9898_-514.npz\ndata/train/rae5215_8329_2706.npz\ndata/train/goe380_1089_-4.npz\ndata/train/goe418_9172_2906.npz\ndata/train/s2055_2852_-187.npz\ndata/train/e558_9236_2742.npz\ndata/train/ua2-180_2054_730.npz\ndata/train/goe284_3120_13.npz\ndata/train/goe399_4894_857.npz\ndata/train/e904_3441_314.npz\ndata/train/goe412_1534_-412.npz\ndata/train/goe474_5483_568.npz\ndata/train/e553_5899_429.npz\ndata/train/fx79l100_6676_-1131.npz\ndata/train/jn153_8473_-963.npz\ndata/train/e431_2781_1106.npz\ndata/train/eiffel385_9565_2635.npz\ndata/train/goe14k_9195_1330.npz\ndata/train/naca654421_8924_3319.npz\ndata/train/hq07_3459_-787.npz\ndata/train/fx72150b_3715_1349.npz\ndata/train/s2091_6302_1946.npz\ndata/train/goe63_5327_1686.npz\ndata/train/goe769_2848_-373.npz\ndata/train/goe430_3726_-1510.npz\ndata/train/goe531_7971_-2692.npz\ndata/train/p51hroot_8973_-1469.npz\ndata/train/oa212_9297_-926.npz\ndata/train/fx79k144_6988_-2716.npz\ndata/train/rhodesg34_8236_2715.npz\ndata/train/s1020_1725_-517.npz\ndata/train/goe388_2301_248.npz\ndata/train/goe615_8813_56.npz\ndata/train/naca634421_3019_1111.npz\ndata/train/naca64206_1134_49.npz\ndata/train/fx61163_6820_1533.npz\ndata/train/ea81006_6835_2067.npz\ndata/train/n2h15_3286_-406.npz\ndata/train/fx62k153_9304_544.npz\ndata/train/naca001065_5901_2068.npz\ndata/train/sokolov_4897_1051.npz\ndata/train/fx73cl2152_7722_1504.npz\ndata/train/goe420_9120_-2955.npz\ndata/train/e476_7657_130.npz\ndata/train/usa46_3850_1495.npz\ndata/train/e426_6895_-312.npz\ndata/train/n64015_2271_-219.npz\ndata/train/fx84w127_8195_-1150.npz\ndata/train/m8_1860_745.npz\ndata/train/npl9510_9684_7.npz\ndata/train/goe137_1078_-300.npz\ndata/train/b707b_3987_-1239.npz\ndata/train/s8025_7744_1245.npz\ndata/train/goe274_7611_594.npz\ndata/train/giiil_9394_936.npz\ndata/train/ls417mod_9465_-3020.npz\ndata/train/e1212_9151_3373.npz\ndata/train/goe681_7360_901.npz\ndata/train/giiin_5462_646.npz\ndata/train/e555_2104_298.npz\ndata/train/e520_8429_-1324.npz\ndata/train/naca661212_9424_-2359.npz\ndata/train/goe735_2226_221.npz\ndata/train/npl9510_7804_2512.npz\ndata/train/mh92_3671_-737.npz\ndata/train/trainer60_4622_-730.npz\ndata/train/fx73cl1152_6779_2650.npz\ndata/train/hq3518_6282_762.npz\ndata/train/m18_5963_-119.npz\ndata/train/cr001sm_3736_119.npz\ndata/train/goe598_8940_3563.npz\ndata/train/rc510_8144_1571.npz\ndata/train/s2091_9490_-2633.npz\ndata/train/s4061_2228_-470.npz\ndata/train/hq3010_8670_3487.npz\ndata/train/gu255118_6006_959.npz\ndata/train/sokolov_1065_252.npz\ndata/train/nacacyh_3965_-441.npz\ndata/train/rg15_7826_1951.npz\ndata/train/s1014_4805_-1762.npz\ndata/train/mh116_2982_-599.npz\ndata/train/ah85l120_3059_-1150.npz\ndata/train/goe174_1247_393.npz\ndata/train/goe464_2149_-613.npz\ndata/train/naca747a415_2931_76.npz\ndata/train/m2_4485_1351.npz\ndata/train/hq3518_7316_-2356.npz\ndata/train/e228_4770_-1871.npz\ndata/train/daytonwright6_8008_-2929.npz\ndata/train/k3_2293_399.npz\ndata/train/clarkys_9286_-3648.npz\ndata/train/naca644421_7424_45.npz\ndata/train/goe802a_8407_3467.npz\ndata/train/fx711530_5901_-69.npz\ndata/train/rae5213_7558_-2778.npz\ndata/train/nacam18_5738_-2161.npz\ndata/train/r1080_7701_720.npz\ndata/train/usa35a_9840_-770.npz\ndata/train/b707c_1334_413.npz\ndata/train/mh70_6899_-1147.npz\ndata/train/goe451_6214_-610.npz\ndata/train/naca65209_3638_-647.npz\ndata/train/s1048_6684_157.npz\ndata/train/dbln526_7373_235.npz\ndata/train/e336_7029_-269.npz\ndata/train/hq3514_8571_-2188.npz\ndata/train/n63210_1704_268.npz\ndata/train/ag08_4726_1093.npz\ndata/train/goe523_5888_645.npz\ndata/train/goe435_6224_-49.npz\ndata/train/s9027_6972_671.npz\ndata/train/dbln526_5791_1843.npz\ndata/train/fx60177_3900_158.npz\ndata/train/goe410_6143_-2192.npz\ndata/train/n9_2780_34.npz\ndata/train/fx63158_2545_586.npz\ndata/train/goe392_1471_13.npz\ndata/train/naca641112_1301_127.npz\ndata/train/goe676_2534_439.npz\ndata/train/goe238_4774_78.npz\ndata/train/goe386_5982_1779.npz\ndata/train/rae69ck_3585_-45.npz\ndata/train/n63215b_7096_2338.npz\ndata/train/ma409_7598_59.npz\ndata/train/ste87391_8325_-891.npz\ndata/train/e858_2774_251.npz\ndata/train/raf89_6973_-278.npz\ndata/train/n2414_8582_1969.npz\ndata/train/ys900_7155_1471.npz\ndata/train/goe324_6531_-1348.npz\ndata/train/goe510_7333_1959.npz\ndata/train/goe410_9194_-1370.npz\ndata/train/npl9510_1026_-352.npz\ndata/train/goe359_1323_431.npz\ndata/train/goe375_3591_-1172.npz\ndata/train/ag13_9426_-1133.npz\ndata/train/m665_6172_1077.npz\ndata/train/fx73cl2152_4752_1124.npz\ndata/train/m3_3827_-155.npz\ndata/train/goe445_6511_-1989.npz\ndata/train/e856_6232_1318.npz\ndata/train/naca6412_1177_-172.npz\ndata/train/goe363_4541_-202.npz\ndata/train/vr7b_4289_-1474.npz\ndata/train/goe479_8024_-126.npz\ndata/train/e1212_4994_1269.npz\ndata/train/b707e_5375_2213.npz\ndata/train/fx77w343_3196_-544.npz\ndata/train/ssca07_2824_-669.npz\ndata/train/fx67k170_5797_1117.npz\ndata/train/trainer60_1793_186.npz\ndata/train/naca65410_3609_1023.npz\ndata/train/eiffel385_7623_-2536.npz\ndata/train/goe596_7371_-2914.npz\ndata/train/fx79k144_2065_-695.npz\ndata/train/mh92_6311_-2150.npz\ndata/train/goe173_8862_-491.npz\ndata/train/k1_7742_3206.npz\ndata/train/goe122_6017_-901.npz\ndata/train/goe311_1801_-497.npz\ndata/train/goe518_2491_326.npz\ndata/train/goe701_9778_598.npz\ndata/train/naca001035_2408_-46.npz\ndata/train/e71_7296_-195.npz\ndata/train/naca1412_6705_-1192.npz\ndata/train/s2055_2596_1034.npz\ndata/train/goe379_6736_1668.npz\ndata/train/goe493_5924_743.npz\ndata/train/k3_8691_1367.npz\ndata/train/goe802_1605_-457.npz\ndata/train/ag24_5300_469.npz\ndata/train/goe483_4344_-863.npz\ndata/train/goe116_5265_1799.npz\ndata/train/e343_1751_149.npz\ndata/train/e554_5392_2142.npz\ndata/train/usa29_8661_-1426.npz\ndata/train/e168_2806_1003.npz\ndata/train/hh02_7819_-1050.npz\ndata/train/naca16012_6150_1955.npz\ndata/train/fx711525_2418_-884.npz\ndata/train/e593_7438_-2294.npz\ndata/train/goe627_5443_1681.npz\ndata/train/goe332_4011_1125.npz\ndata/train/goe314_8366_-1496.npz\ndata/train/goe796_2593_-427.npz\ndata/train/e423_6582_942.npz\ndata/train/goe494_7499_1580.npz\ndata/train/e1214_3894_-1565.npz\ndata/train/naca66-018_3285_-1301.npz\ndata/train/e585_1619_-78.npz\ndata/train/e562_5578_698.npz\ndata/train/fx63158_6468_-13.npz\ndata/train/fx74130wp2mod_5393_-53.npz\ndata/train/goe617_3272_1053.npz\ndata/train/tsagi12_5619_-779.npz\ndata/train/ah80136_7351_1507.npz\ndata/train/hq3011_9145_-2546.npz\ndata/train/goe629_7133_796.npz\ndata/train/m10_4840_211.npz\ndata/train/k1_8761_-3318.npz\ndata/train/goe553_5043_301.npz\ndata/train/hq1010_5443_-356.npz\ndata/train/ag17_6227_2108.npz\ndata/train/goe381_4568_368.npz\ndata/train/usa98_9066_2718.npz\ndata/train/goe780_3349_315.npz\ndata/train/goe187_7299_-2398.npz\ndata/train/e332_2379_-6.npz\ndata/train/ht05_8270_3078.npz\ndata/train/sc21010_3715_-1347.npz\ndata/train/e396_4030_459.npz\ndata/train/e502_2925_-147.npz\ndata/train/goe79_6625_-1758.npz\ndata/train/tsagi8_2639_-405.npz\ndata/train/nlf1015_5661_-1536.npz\ndata/train/fx61163_4370_517.npz\ndata/train/goe287_6248_315.npz\ndata/train/e395_1886_199.npz\ndata/train/usa26_5134_-1280.npz\ndata/train/ah93k130_2371_164.npz\ndata/train/goe482_5298_1073.npz\ndata/train/rhodesg36_1033_195.npz\ndata/train/th25816_4390_-1648.npz\ndata/train/e817_4679_-1851.npz\ndata/train/s1010_5728_-1990.npz\ndata/train/fx711520_7913_-1674.npz\ndata/train/e475_4558_-379.npz\ndata/train/e377_4055_-1016.npz\ndata/train/goe173_2336_188.npz\ndata/train/sc20706_1880_-198.npz\ndata/train/e635_4181_-330.npz\ndata/train/rg15a111_3296_-832.npz\ndata/train/e339_1946_161.npz\ndata/train/k1_8318_26.npz\ndata/train/ag45ct02r_8952_2325.npz\ndata/train/e584_6738_979.npz\ndata/train/e477_2674_-940.npz\ndata/train/ua79sfm_8197_1879.npz\ndata/train/goe184_3957_-1324.npz\ndata/train/m25_8273_3371.npz\ndata/train/davissm_2795_-573.npz\ndata/train/eh2070_6791_1559.npz\ndata/train/fx66s171_9512_2583.npz\ndata/train/naca0024_3915_52.npz\ndata/train/goe630_2410_470.npz\ndata/train/mh112_2134_-403.npz\ndata/train/rg15_5955_4.npz\ndata/train/psu-90-125wl_2314_747.npz\ndata/train/usnps4_8901_952.npz\ndata/train/ua79sfm_7036_2766.npz\ndata/train/n64108_3522_-173.npz\ndata/train/vr15_6277_1794.npz\ndata/train/e639_7483_1062.npz\ndata/train/cast102_2862_940.npz\ndata/train/sd7003_3244_1214.npz\ndata/train/eh1090_5413_-2092.npz\ndata/train/r140sm_6504_-1654.npz\ndata/train/ah93w215_9758_-2047.npz\ndata/train/rae5212_5679_1365.npz\ndata/train/goe526_4544_-575.npz\ndata/train/goe324_1867_-63.npz\ndata/train/m16_3937_967.npz\ndata/train/waspsm_1162_-249.npz\ndata/train/hq3512_6609_711.npz\ndata/train/sc20010_7260_1693.npz\ndata/train/goe482_7566_1109.npz\ndata/train/n64015a_997_196.npz\ndata/train/fxlv152_2006_792.npz\ndata/train/s1016_1813_-40.npz\ndata/train/e340_8875_-3374.npz\ndata/train/s1210_4599_1227.npz\ndata/train/fx63143_8195_2989.npz\ndata/train/fx73k170_2615_537.npz\ndata/train/goe367_3775_649.npz\ndata/train/goe451_3404_-280.npz\ndata/train/fx83w160_8975_698.npz\ndata/train/goe381_6404_-28.npz\ndata/train/goe767_2357_134.npz\ndata/train/sc1094r8_4978_603.npz\ndata/train/cr001sm_3559_442.npz\ndata/train/e548_8140_2043.npz\ndata/train/goe371_3118_-164.npz\ndata/train/fx72150a_7256_402.npz\ndata/train/k3_9331_375.npz\ndata/train/joukowsk_7362_-1888.npz\ndata/train/goe457_973_302.npz\ndata/train/hq2010_8327_2677.npz\ndata/train/goe184_9768_2054.npz\ndata/train/naca0021_7487_836.npz\ndata/train/r1082t_1473_-578.npz\ndata/train/goe308_4696_-97.npz\ndata/train/fx78pk188_2545_-264.npz\ndata/train/goe584_9292_3415.npz\ndata/train/n10_7088_-683.npz\ndata/train/e421_4000_468.npz\ndata/train/ah80129_2615_826.npz\ndata/train/sg6041_9718_-247.npz\ndata/train/goe06k_4019_-856.npz\ndata/train/e399_1620_534.npz\ndata/train/giiin_1495_-604.npz\ndata/train/goe627_6926_-2334.npz\ndata/train/goe329_3465_1086.npz\ndata/train/mh43_2319_32.npz\ndata/train/e325_6232_-108.npz\ndata/train/fx78pk188_6074_-399.npz\ndata/train/tsagi12_3576_-826.npz\ndata/train/fx75vg166_7609_-1355.npz\ndata/train/sc1095r8_8452_-704.npz\ndata/train/goe388_4049_859.npz\ndata/train/naca662215_4622_943.npz\ndata/train/e62_1610_248.npz\ndata/train/e168_6572_436.npz\ndata/train/e656_4066_477.npz\ndata/train/fx69274_3940_866.npz\ndata/train/naca64208_1320_286.npz\ndata/train/hq07_2034_403.npz\ndata/train/goe277_6415_-1010.npz\ndata/train/clarkz_3252_-1216.npz\ndata/train/goe101_7464_205.npz\ndata/train/fx69pr281_1220_-334.npz\ndata/train/e62_9861_-1210.npz\ndata/train/sa7036_6189_-257.npz\ndata/train/goe431_1417_-223.npz\ndata/train/e360_8594_878.npz\ndata/train/usa40b_3591_207.npz\ndata/train/e66_1023_-148.npz\ndata/train/s9027_3570_926.npz\ndata/train/e186_2371_958.npz\ndata/train/e197_6809_1131.npz\ndata/train/amsoil1_4281_1570.npz\ndata/train/mh70_8518_436.npz\ndata/train/fx74130wp1_5180_-1465.npz\ndata/train/th25816_2541_588.npz\ndata/train/m2_6159_-353.npz\ndata/train/sc1095r8_7910_-1162.npz\ndata/train/naca662415_4486_1663.npz\ndata/train/goe14_6750_2293.npz\ndata/train/sa7038_8138_3295.npz\ndata/train/goe155_5002_-753.npz\ndata/train/ah6407_6676_-1691.npz\ndata/train/ste87151_8564_3024.npz\ndata/train/goe239_4886_86.npz\ndata/train/august160_7892_-2774.npz\ndata/train/e476_5851_-2364.npz\ndata/train/dormoy_9269_-51.npz\ndata/train/goe422_9405_1104.npz\ndata/train/kenmar_2977_-710.npz\ndata/train/mrc-20_3140_-24.npz\ndata/train/vr14_3125_-221.npz\ndata/train/rc10n1_2249_-294.npz\ndata/train/s9037_6744_2426.npz\ndata/train/e207_7231_340.npz\ndata/train/sd6080_5045_-1488.npz\ndata/train/rg1410_7095_-804.npz\ndata/train/s2050_1337_-475.npz\ndata/train/stf86361_7610_-1954.npz\ndata/train/naca001064_5530_-460.npz\ndata/train/fg1_1358_-511.npz\ndata/train/n64008a_7870_2878.npz\ndata/train/mh121_1082_-105.npz\ndata/train/hq208_7045_-938.npz\ndata/train/e655_2549_651.npz\ndata/train/goe123_5497_-1497.npz\ndata/train/goe476_6722_-1266.npz\ndata/train/uag8814320_6633_-1916.npz\ndata/train/august160_1391_502.npz\ndata/train/goe424_6756_505.npz\ndata/train/drgnfly_4099_365.npz\ndata/train/isa962_2175_238.npz\ndata/train/rae100_8145_-572.npz\ndata/train/goe561_2635_917.npz\ndata/train/goe570_1194_-89.npz\ndata/train/m21_5045_-1721.npz\ndata/train/goe499_6747_-1666.npz\ndata/train/fx61168_1593_-647.npz\ndata/train/v13009_6699_1650.npz\ndata/train/npl9510_7611_-798.npz\ndata/train/ag44ct02r_9433_3228.npz\ndata/train/e195_3641_-881.npz\ndata/train/fx08s176_8685_138.npz\ndata/train/arad13_2057_-475.npz\ndata/train/coanda2_4212_-740.npz\ndata/train/goe389_3072_616.npz\ndata/train/mh81_6932_-1864.npz\ndata/train/ah81k144_3404_1226.npz\ndata/train/r140_9547_-1475.npz\ndata/train/goe769_9287_2530.npz\ndata/train/sd7062_9025_-1267.npz\ndata/train/m14_4100_-1483.npz\ndata/train/e214_2838_-527.npz\ndata/train/goe342_8276_-1485.npz\ndata/train/goe622_5354_-1082.npz\ndata/train/eiffel428_4172_1218.npz\ndata/train/goe310_8204_881.npz\ndata/train/s7055_4093_1500.npz\ndata/train/dsma523b_5909_-2077.npz\ndata/train/goe142_8036_-754.npz\ndata/train/ua79sf18_5532_498.npz\ndata/train/sc2110_2743_129.npz\ndata/train/goe506_3328_-465.npz\ndata/train/ag19_5824_1338.npz\ndata/train/s4061_1804_-692.npz\ndata/train/goe770_2603_-475.npz\ndata/train/m7_6668_898.npz\ndata/train/coanda2_1613_-577.npz\ndata/train/fx77w258_8483_-1744.npz\ndata/train/fx76mp140_4032_-882.npz\ndata/train/goe384_3839_-326.npz\ndata/train/ag46ct02r_4502_1161.npz\ndata/train/naca16015_9025_721.npz\ndata/train/e343_8485_-519.npz\ndata/train/n63215b_8211_-2009.npz\ndata/train/df102_8234_-1203.npz\ndata/train/clarym15_7703_-673.npz\ndata/train/fx77w258_7844_-1334.npz\ndata/train/sg6040_1099_-269.npz\ndata/train/lds2_9142_2468.npz\ndata/train/clarkx_2098_-341.npz\ndata/train/fx74modsm_8317_-3103.npz\ndata/train/clarkw_6177_-1622.npz\ndata/train/goe423_9939_74.npz\ndata/train/p51dtip_1976_-466.npz\ndata/train/be50_5876_-1159.npz\ndata/train/sc20712_3420_1050.npz\ndata/train/n64015a_9416_2031.npz\ndata/train/usa28_1238_295.npz\ndata/train/e385_4124_-1283.npz\ndata/train/goe563_7222_-1906.npz\ndata/train/fx79w660a_2062_-649.npz\ndata/train/naca65206_7339_-55.npz\ndata/train/drgnfly_9081_2117.npz\ndata/train/sg6042_6715_-78.npz\ndata/train/s1223rtl_3470_403.npz\ndata/train/n8h12_9088_1227.npz\ndata/train/naca001264a08cli0.2_2980_313.npz\ndata/train/sc20614_9323_72.npz\ndata/train/naca23012_5959_-105.npz\ndata/train/ah81k144_9804_992.npz\ndata/train/usa22_6958_283.npz\ndata/train/hq2511_8259_1624.npz\ndata/train/goe795sm_9436_3033.npz\ndata/train/b707d_4362_1789.npz\ndata/train/goe443_1153_65.npz\ndata/train/tsagi12_3155_611.npz\ndata/train/goe238_7363_-906.npz\ndata/train/goe207_1992_-126.npz\ndata/train/ames02_5755_-1375.npz\ndata/train/hq2590sm_2029_107.npz\ndata/train/naca643618_8396_-1765.npz\ndata/train/fxs02196_1737_625.npz\ndata/train/fx79l100_4331_-1754.npz\ndata/train/eh1090_5190_820.npz\ndata/train/bambino6_3975_-805.npz\ndata/train/mh80_6649_-50.npz\ndata/train/goe124_7102_2246.npz\ndata/train/e874_4111_1057.npz\ndata/train/lwk80150k25_3273_-160.npz\ndata/train/eh1590_8840_-774.npz\ndata/train/marske7_2693_-213.npz\ndata/train/oaf128_7738_1361.npz\ndata/train/goe522_5339_700.npz\ndata/train/sa7035_5080_-1224.npz\ndata/train/marske5_9053_3200.npz\ndata/train/eiffel371_9313_-2337.npz\ndata/train/e178_7940_50.npz\ndata/train/amsoil1_9728_-2222.npz\ndata/train/goe167_2954_1159.npz\ndata/train/e428_7939_2576.npz\ndata/train/r1046_1282_-478.npz\ndata/train/e478_2380_817.npz\ndata/train/hq010_3641_875.npz\ndata/train/fx80080_5567_206.npz\ndata/train/e836_3623_-1496.npz\ndata/train/npl9510_7974_3075.npz\ndata/train/goe133_2334_924.npz\ndata/train/s2062_5375_857.npz\ndata/train/goe584_1409_-242.npz\ndata/train/goe574_8351_-2879.npz\ndata/train/tsagi12_6722_2195.npz\ndata/train/whitcomb_2570_108.npz\ndata/train/naca651212a06_2823_75.npz\ndata/train/e180_4560_-1055.npz\ndata/train/c141c_8495_-3381.npz\ndata/train/df101_2224_519.npz\ndata/train/rc1064c_1642_-614.npz\ndata/train/mh117_1936_377.npz\ndata/train/ht23_9676_-395.npz\ndata/train/goe411_9305_-925.npz\ndata/train/goe275_1815_-602.npz\ndata/train/naca651212a06_3753_-1430.npz\ndata/train/s4022_7243_-1898.npz\ndata/train/mh43_8501_-1959.npz\ndata/train/goe529_4874_-1534.npz\ndata/train/as5046_1536_-542.npz\ndata/train/marske1_7328_3032.npz\ndata/train/ls013_5682_1203.npz\ndata/train/e226_6841_-2781.npz\ndata/train/e541_1839_-223.npz\ndata/train/hq159b_6345_-2089.npz\ndata/train/goe619_3481_585.npz\ndata/train/goe10k_4499_1851.npz\ndata/train/goe284_2606_-614.npz\ndata/train/s3025_933_363.npz\ndata/train/glennmartin2_2288_621.npz\ndata/train/goe167_7747_261.npz\ndata/train/doa5_6844_1913.npz\ndata/train/e838_2994_-170.npz\ndata/train/goe411_1646_16.npz\ndata/train/mh30_2287_-688.npz\ndata/train/mh91_9425_-1130.npz\ndata/train/ag08_7851_-2775.npz\ndata/train/fx69h083_6694_-2162.npz\ndata/train/sc20614_1714_599.npz\ndata/train/sd7062_1580_-601.npz\ndata/train/ah80129_2564_-750.npz\ndata/train/mh24_1582_-538.npz\ndata/train/e874_7527_-1798.npz\ndata/train/goe548_9242_20.npz\ndata/train/e168_3564_-333.npz\ndata/train/glennmartin2_2345_-702.npz\ndata/train/goe370_4331_1153.npz\ndata/train/s1014_2892_1197.npz\ndata/train/e559_1759_-342.npz\ndata/train/lwk80150k25_2556_-801.npz\ndata/train/goe287_3102_626.npz\ndata/train/ag455ct02r_9436_3293.npz\ndata/train/ah82150a_3115_575.npz\ndata/train/e231_3816_587.npz\ndata/train/coanda2_9142_-102.npz\ndata/train/sg6050_4289_854.npz\ndata/train/e203_1958_-809.npz\ndata/train/sa7035_7751_1646.npz\ndata/train/as5046_6806_-1056.npz\ndata/train/c5b_8669_-2626.npz\ndata/train/goe650_3243_705.npz\ndata/train/b540ols_2052_640.npz\ndata/train/e544_7032_248.npz\ndata/train/ag24_5573_194.npz\ndata/train/curtisc72_2935_-116.npz\ndata/train/goe648_1968_600.npz\ndata/train/giiim_8715_3390.npz\ndata/train/fx05191_1932_-282.npz\ndata/train/lnv109a_1089_434.npz\ndata/train/fx082512_8359_1020.npz\ndata/train/goe155_1514_157.npz\ndata/train/n5h15_8121_-2207.npz\ndata/train/cast102_5050_-63.npz\ndata/train/raf28_4581_-498.npz\ndata/train/goe476_9400_2988.npz\ndata/train/nlf416_3643_-1005.npz\ndata/train/fg2_1606_452.npz\ndata/train/goe118_2524_570.npz\ndata/train/s1016_3087_899.npz\ndata/train/dae11_1534_-300.npz\ndata/train/hq2511_1693_-559.npz\ndata/train/goe525_3815_-411.npz\ndata/train/fx73170a_4664_-466.npz\ndata/train/goe284_3298_708.npz\ndata/train/hq2010_8614_-1522.npz\ndata/train/n1h15_4839_1136.npz\ndata/train/goe117_1548_-191.npz\ndata/train/naca2411_2835_446.npz\ndata/train/s8052_9538_2805.npz\ndata/train/s4180_2196_205.npz\ndata/train/e858_8830_-1059.npz\ndata/train/fx78k140_1926_-137.npz\ndata/train/ah82150a_2824_-1028.npz\ndata/train/goe561_9077_3536.npz\ndata/train/goe285_8817_-888.npz\ndata/train/goe365_5253_-713.npz\ndata/train/s6062_3321_855.npz\ndata/train/fx73170a_3555_845.npz\ndata/train/e385_5176_692.npz\ndata/train/e637_6777_480.npz\ndata/train/usa5_1534_-501.npz\ndata/train/ag26_9086_3409.npz\ndata/train/goe407_3372_-1140.npz\ndata/train/ah93w145_8238_2797.npz\ndata/train/rg1495_1311_97.npz\ndata/train/fx69pr281_4031_223.npz\ndata/train/goe374_2017_753.npz\ndata/train/c141d_2771_-8.npz\ndata/train/goe702_7912_1501.npz\ndata/train/goe314_9115_-544.npz\ndata/train/fx76120_4900_-1292.npz\ndata/train/boe103_7158_-804.npz\ndata/train/goe346_8119_-385.npz\ndata/train/goe629_4866_-1123.npz\ndata/train/dga1182_1572_-392.npz\ndata/train/ys930_3405_-635.npz\ndata/train/ah93156_1278_359.npz\ndata/train/s3_5526_1782.npz\ndata/train/ah94145_5162_-1419.npz\ndata/train/raf25_2043_-267.npz\ndata/train/fx61163_8690_676.npz\ndata/train/goe362_3935_-1593.npz\ndata/train/e654_2624_651.npz\ndata/train/goe382_1773_60.npz\ndata/train/naca1410_7518_-2559.npz\ndata/train/goe567_4627_156.npz\ndata/train/e205_2662_-3.npz\ndata/train/goe447_6302_2354.npz\ndata/train/hq3514_8531_1728.npz\ndata/train/naca001066_6503_-2522.npz\ndata/train/mh38_6892_-1679.npz\ndata/train/goe437_1243_-70.npz\ndata/train/e561_6070_-378.npz\ndata/train/e636_7856_347.npz\ndata/train/goe738_2909_-909.npz\ndata/train/rae104_1869_-402.npz\ndata/train/fx66s171_8172_-2336.npz\ndata/train/uag8814320_6597_171.npz\ndata/train/goe408_2363_466.npz\ndata/train/fx66s171_4541_1581.npz\ndata/train/goe346_8254_277.npz\ndata/train/s9037_5809_759.npz\ndata/train/goe572_7245_-1805.npz\ndata/train/fx78pk188_3653_650.npz\ndata/train/e360_5880_-145.npz\ndata/train/goe15_7227_1106.npz\ndata/train/e474_7736_-886.npz\ndata/train/goe417_6709_-2566.npz\ndata/train/hq2590sm_4105_161.npz\ndata/train/stf86361_5455_-1723.npz\ndata/train/mh104_7620_-2251.npz\ndata/train/e184_7086_2597.npz\ndata/train/e852_4196_-304.npz\ndata/train/m6_3441_-58.npz\ndata/train/e682_6045_-1462.npz\ndata/train/fx66196v_2972_-477.npz\ndata/train/glennmartin3_5291_1319.npz\ndata/train/e220_1019_-391.npz\ndata/train/fx78k140_8395_606.npz\ndata/train/goe498_8414_-2533.npz\ndata/train/glennmartin2_3846_259.npz\ndata/train/fx79w660a_2151_-514.npz\ndata/train/naca654221_4427_162.npz\ndata/train/n14_4431_636.npz\ndata/train/goe137_2111_-795.npz\ndata/train/arad6_5115_-155.npz\ndata/train/sd8000_4191_1059.npz\ndata/train/goe426_7465_122.npz\ndata/train/goe446_6100_-1230.npz\ndata/train/e818_9238_-2567.npz\ndata/train/e325_4668_-846.npz\ndata/train/goe405_6876_1249.npz\ndata/train/naca64210_1701_-8.npz\ndata/train/naca632a015_4702_589.npz\ndata/train/ht05_9656_29.npz\ndata/train/goe741_4137_-962.npz\ndata/train/goe533_7779_-325.npz\ndata/train/naca001034_7762_-1200.npz\ndata/train/n63015a_5706_1105.npz\ndata/train/saratov_2128_360.npz\ndata/train/e637_1391_-443.npz\ndata/train/goe329_2880_-906.npz\ndata/train/usnps4_4349_487.npz\ndata/train/vr8_4619_-1392.npz\ndata/train/ua79sf18_7017_2345.npz\ndata/train/sc21006_8319_3274.npz\ndata/train/goe590_2517_-803.npz\ndata/train/naca651212a06_2060_-13.npz\ndata/train/goe621_7742_-1381.npz\ndata/train/sc20503_5770_1424.npz\ndata/train/goe490_3569_-96.npz\ndata/train/e548_6638_1987.npz\ndata/train/goe428_2020_703.npz\ndata/train/dbln526_1928_569.npz\ndata/train/fx76mp120_9618_925.npz\ndata/train/goe322_6951_-228.npz\ndata/train/e171_7169_2075.npz\ndata/train/goe434_4632_1189.npz\ndata/train/ah93156_1276_357.npz\ndata/train/naca66210_7801_1791.npz\ndata/train/fx73170_2844_-758.npz\ndata/train/naca643418_7808_-3187.npz\ndata/train/ls013_2046_-719.npz\ndata/train/ys900_7002_-2705.npz\ndata/train/n64012_5700_-793.npz\ndata/train/goe723_4350_676.npz\ndata/train/goe449_5361_1500.npz\ndata/train/2032c_7403_-728.npz\ndata/train/fx83w160_1103_61.npz\ndata/train/goe440_9192_-638.npz\ndata/train/e403_8997_501.npz\ndata/train/sokolov_3923_1624.npz\ndata/train/mh43_2002_628.npz\ndata/train/naca644421_2923_-763.npz\ndata/train/goe363_1552_64.npz\ndata/train/df101_5708_-1140.npz\ndata/train/s1010_5166_1145.npz\ndata/train/naca6412_1502_-308.npz\ndata/train/ag10_2369_939.npz\ndata/train/goe550_5964_2146.npz\ndata/train/e176_9118_1606.npz\ndata/train/goe422_1561_-602.npz\ndata/train/npl9627_7652_1461.npz\ndata/train/naca66209_8783_-1873.npz\ndata/train/e1230_5650_1190.npz\ndata/train/kenmar_1407_-520.npz\ndata/train/goe11k_6407_-1092.npz\ndata/train/nlr7301_3030_444.npz\ndata/train/bacxxx_3227_1075.npz\ndata/train/e521_9068_3566.npz\ndata/train/sd8020_8958_1673.npz\ndata/train/goe685_5751_2082.npz\ndata/train/ec863914_6659_-1975.npz\ndata/train/sd8040_5091_-1620.npz\ndata/train/mh23_6170_-1695.npz\ndata/train/c5a_8484_-1918.npz\ndata/train/fx73k170_1351_-172.npz\ndata/train/e585_9466_-1729.npz\ndata/train/e472_3667_-1331.npz\ndata/train/s4310_7966_-2102.npz\ndata/train/jn153_7663_-2785.npz\ndata/train/goe670_7478_-390.npz\ndata/train/sd7032_5785_514.npz\ndata/train/oa212_2829_-838.npz\ndata/train/vr9_8474_534.npz\ndata/train/goe358_5647_571.npz\ndata/train/goe498_6385_-2497.npz\ndata/train/fx73cl1152_6640_-987.npz\ndata/train/df102_9555_-2745.npz\ndata/train/goe330_1779_-574.npz\ndata/train/pt40_4090_-1540.npz\ndata/train/p51htip_2903_161.npz\ndata/train/rc1064c_9537_-223.npz\ndata/train/goe426_5001_-1574.npz\ndata/train/fx69h083_6861_-770.npz\ndata/train/hq109_3023_35.npz\ndata/train/e561_6311_464.npz\ndata/train/goe432_3803_1164.npz\ndata/train/glennmartin4_2462_336.npz\ndata/train/goe406_9164_1219.npz\ndata/train/fx057816_3873_-869.npz\ndata/train/rc10n1_4974_330.npz\ndata/train/fx66a175_4144_-165.npz\ndata/train/n2h15_6420_2521.npz\ndata/train/goe374_5295_1666.npz\ndata/train/m12_7579_183.npz\ndata/train/s1046_9176_-3539.npz\ndata/train/goe321_2285_-140.npz\ndata/train/hq07_4029_1404.npz\ndata/train/naca64208_8302_-1242.npz\ndata/train/e377m_3549_428.npz\ndata/train/goe371_5513_-80.npz\ndata/train/goe477_8814_-2408.npz\ndata/train/marske3_4689_932.npz\ndata/train/nacam3_4963_214.npz\ndata/train/goe290_5814_-1782.npz\ndata/train/naca0006_7071_206.npz\ndata/train/usa49_1370_299.npz\ndata/train/fx74130wp1_9782_-438.npz\ndata/train/e180_4788_278.npz\ndata/train/marske1_8179_1550.npz\ndata/train/goe596_1152_-205.npz\ndata/train/b29root_3328_518.npz\ndata/train/goe477_1824_-582.npz\ndata/train/c141b_7968_-1097.npz\ndata/train/oa209_6361_-950.npz\ndata/train/pmc19sm_4795_614.npz\ndata/train/naca644221_3240_-123.npz\ndata/train/eiffel428_8874_3399.npz\ndata/train/e171_5447_-1796.npz\ndata/train/ah80129_2352_758.npz\ndata/train/e657_3776_-1558.npz\ndata/train/fx78k161_8022_-1064.npz\ndata/train/ah88k136_4700_1933.npz\ndata/train/defcnd2_4808_-1377.npz\ndata/train/c141a_8312_801.npz\ndata/train/dh4009sm_6253_2366.npz\ndata/train/goe269_9062_1185.npz\ndata/train/rg14a147_7802_-1783.npz\ndata/train/ag13_3225_-413.npz\ndata/train/e407_9436_-2087.npz\ndata/train/goe420_3677_-1089.npz\ndata/train/e344_4661_1420.npz\ndata/train/hq358_5500_-1569.npz\ndata/train/ah93w174_3251_-391.npz\ndata/train/s8037_5983_-1594.npz\ndata/train/naca16015_8950_381.npz\ndata/train/e340_6811_-2059.npz\ndata/train/ah93w300_4561_-1475.npz\ndata/train/arad6_3037_634.npz\ndata/train/fx75193_4246_-1645.npz\ndata/train/ma409sm_6925_-1397.npz\ndata/train/fx61168_4425_-1767.npz\ndata/train/e561_8436_-744.npz\ndata/train/goe584_5188_907.npz\ndata/train/n14_2968_48.npz\ndata/train/raf89_9644_1956.npz\ndata/train/dga1138_9124_2621.npz\ndata/train/nacam6_1796_-474.npz\ndata/train/mh61_6001_-2223.npz\ndata/train/goe440_2205_-468.npz\ndata/train/ea81006_8241_-2110.npz\ndata/train/goe361_6342_-1259.npz\ndata/train/goe123_3909_-1588.npz\ndata/train/e193_3220_526.npz\ndata/train/goe54_3897_-1248.npz\ndata/train/rc10n1_5956_-1686.npz\ndata/train/e326_2385_271.npz\ndata/train/goe599_1284_-158.npz\ndata/train/s6062_6653_-574.npz\ndata/train/rhodesg34_1478_461.npz\ndata/train/ag11_981_-382.npz\ndata/train/fx63120_9142_1763.npz\ndata/train/e817_2436_-85.npz\ndata/train/goe411_6956_1921.npz\ndata/train/ea81006_2148_-43.npz\ndata/train/naca6412_4218_303.npz\ndata/train/dga1138_3434_-673.npz\ndata/train/naca64210_6952_1321.npz\ndata/train/ua79sf18_3886_860.npz\ndata/train/e793_2649_-116.npz\ndata/train/df102_9263_-801.npz\ndata/train/goe685_8417_691.npz\ndata/train/ag10_1971_700.npz\ndata/train/v13009_4826_25.npz\ndata/train/goe319_4161_-1212.npz\ndata/train/goe09k_3157_-1247.npz\ndata/train/eiffel10_4951_-693.npz\ndata/train/du8608418_9696_1167.npz\ndata/train/fx84w218_6990_900.npz\ndata/train/oaf139_9911_-942.npz\ndata/train/eiffel428_4333_-1220.npz\ndata/train/goe798_4704_-325.npz\ndata/train/goe602m_4437_204.npz\ndata/train/mb253515sm_6576_915.npz\ndata/train/sc20414_4761_1286.npz\ndata/train/usa35_5310_375.npz\ndata/train/eh0009_7108_2224.npz\ndata/train/goe417a_1652_-529.npz\ndata/train/rae2822_2814_475.npz\ndata/train/dga1138_1511_36.npz\ndata/train/sd2083_4090_1018.npz\ndata/train/mh84_2022_754.npz\ndata/train/e1213_9510_689.npz\ndata/train/e328_5528_394.npz\ndata/train/fg4_6903_-119.npz\ndata/train/e603_2388_-500.npz\ndata/train/nacam6_5626_-352.npz\ndata/train/rc510_6731_-1778.npz\ndata/train/goe766_1155_269.npz\ndata/train/goe285_8581_-2124.npz\ndata/train/goe506_6463_-1387.npz\ndata/train/ah88k130_994_-136.npz\ndata/train/n5h20_1136_-424.npz\ndata/train/e543_4153_-1476.npz\ndata/train/ag47c03_6296_-706.npz\ndata/train/e593_3200_26.npz\ndata/train/ec863914_7602_-2574.npz\ndata/train/goe391_3000_-849.npz\ndata/train/ah85l120_8169_526.npz\ndata/train/nacam6_7629_-71.npz\ndata/train/goe534_3932_-416.npz\ndata/train/goe534_2403_-234.npz\ndata/train/lnv109a_1462_406.npz\ndata/train/hq1012_3230_-800.npz\ndata/train/nasasc2-0714_4000_1202.npz\ndata/train/r1082t_7685_1229.npz\ndata/train/s1014_1044_-266.npz\ndata/train/s5020_2795_423.npz\ndata/train/goe529_3390_439.npz\ndata/train/goe481_2585_-363.npz\ndata/train/e477_2312_-106.npz\ndata/train/fg4_4703_-1473.npz\ndata/train/e580_5071_-1186.npz\ndata/train/ua79sf18_4734_815.npz\ndata/train/clarym15_8540_-2032.npz\ndata/train/s8025_7150_-581.npz\ndata/train/ah79k135_7807_-2774.npz\ndata/train/e343_6494_1646.npz\ndata/train/goe584_8405_-1736.npz\ndata/train/rhodesg36_4457_-1187.npz\ndata/train/goe585_9256_2222.npz\ndata/train/goe479_5321_-481.npz\ndata/train/e1230_9362_-2771.npz\ndata/train/e817_6574_1479.npz\ndata/train/k3_5940_1873.npz\ndata/train/hq1010_9714_-1409.npz\ndata/train/goe363_2897_598.npz\ndata/train/rae5214_8305_-3198.npz\ndata/train/ag12_2137_-493.npz\ndata/train/ys930_9636_-1459.npz\ndata/train/ah79k143_4496_-1610.npz\ndata/train/sc20414_5542_-453.npz\ndata/train/goe564_2452_162.npz\ndata/train/rg12a189_1287_528.npz\ndata/train/ls421mod_9011_-628.npz\ndata/train/fx66s161_1468_-129.npz\ndata/train/e337_8573_152.npz\ndata/train/goe615_6550_1955.npz\ndata/train/usa31_5101_363.npz\ndata/train/fx2_1951_-495.npz\ndata/train/e485_3479_957.npz\ndata/train/naca001234_6242_-2437.npz\ndata/train/goe308_7018_-1945.npz\ndata/train/c141e_5379_226.npz\ndata/train/bambino6_7955_1366.npz\ndata/train/goe385_4393_1462.npz\ndata/train/goe595_2125_10.npz\ndata/train/n6h10_9836_-1769.npz\ndata/train/s1020_5486_1038.npz\ndata/train/m13_6161_1042.npz\ndata/train/fx67k150_7288_2793.npz\ndata/train/r1082_5439_-89.npz\ndata/train/goe438_8950_-1291.npz\ndata/train/goe602m_5090_-210.npz\ndata/train/marske5_2162_-467.npz\ndata/train/mh201_7821_-2546.npz\ndata/train/sc20404_9262_-2296.npz\ndata/train/fx73170_4193_12.npz\ndata/train/ah93w257_3489_135.npz\ndata/train/fx60126_5943_2208.npz\ndata/train/fxs02196_6724_-902.npz\ndata/train/eiffel430_7096_-1179.npz\ndata/train/ah79k135_1239_-362.npz\ndata/train/e856_5121_-434.npz\ndata/train/goe433_7515_-1780.npz\ndata/train/rc10b3_9435_-3162.npz\ndata/train/e168_6395_1757.npz\ndata/train/goe780_2727_-232.npz\ndata/train/goe451_6126_-1247.npz\ndata/train/goe92_1643_248.npz\ndata/train/ls417_9245_612.npz\ndata/train/fx60100sm_2339_-782.npz\ndata/train/fx72ls160_4042_-507.npz\ndata/train/goe458_2739_-324.npz\ndata/train/fx83w227_7125_-2620.npz\ndata/train/goe310_2747_702.npz\ndata/train/e376_4404_-1096.npz\ndata/train/naca653218_2663_-568.npz\ndata/train/e542_3550_-788.npz\ndata/train/naca0021_4140_-420.npz\ndata/train/c141a_1636_639.npz\ndata/train/ys930_8155_2296.npz\ndata/train/hq3014_3900_-1154.npz\ndata/train/rg1410_7569_-2753.npz\ndata/train/clarky_6280_-447.npz\ndata/train/e174_6220_983.npz\ndata/train/naca64a410_7771_3073.npz\ndata/train/n6409_2134_278.npz\ndata/train/ag04_2028_169.npz\ndata/train/e62_6404_2169.npz\ndata/train/s9032_6680_-1259.npz\ndata/train/n0011sc_9712_1783.npz\ndata/train/goe450_4112_511.npz\ndata/train/e478_3485_952.npz\ndata/train/e329_7678_-1573.npz\ndata/train/raf48_4043_532.npz\ndata/train/ls013_6058_-1391.npz\ndata/train/usa34_3163_-1034.npz\ndata/train/goe508_6447_-662.npz\ndata/train/fx73cl2152_2335_-334.npz\ndata/train/hq108_8978_-1244.npz\ndata/train/goe645_6251_-1396.npz\ndata/train/usnps4_1599_-658.npz\ndata/train/dga1138_2285_-809.npz\ndata/train/goe506_6081_2155.npz\ndata/train/sc20710_9614_-1028.npz\ndata/train/m5_7506_2157.npz\ndata/train/goe427_2562_661.npz\ndata/train/naca654421a05_5926_-207.npz\ndata/train/whitcomb_8366_-1115.npz\ndata/train/goe369_1106_-129.npz\ndata/train/goe801_5700_1960.npz\ndata/train/fx67k150_6574_-1724.npz\ndata/train/naca663418_3195_-578.npz\ndata/train/goe394_8551_2684.npz\ndata/train/goe744_7790_1490.npz\ndata/train/s1014_7874_1913.npz\ndata/train/goe652_4577_-1892.npz\ndata/train/s2050_4475_-1516.npz\ndata/train/ag47c03_9397_1852.npz\ndata/train/s3025_4525_-1560.npz\ndata/train/goe195_5839_-1990.npz\ndata/train/e395_1863_459.npz\ndata/train/npl9627_8665_-2100.npz\ndata/train/ah95160_5674_560.npz\ndata/train/fx63137sm_7788_1715.npz\ndata/train/hq300gd2_5233_470.npz\ndata/train/goe184_8668_2992.npz\ndata/train/goe318_1860_-600.npz\ndata/train/kenmar_5674_-1033.npz\ndata/train/hobie_3545_1409.npz\ndata/train/nacam18_2495_408.npz\ndata/train/m665_1882_160.npz\ndata/train/hq108_4300_1332.npz\ndata/train/fx69h098_7534_-2451.npz\ndata/train/hq3510_2891_-901.npz\ndata/train/goe427_1668_182.npz\ndata/train/r1080_3673_-1008.npz\ndata/train/coanda2_8391_2056.npz\ndata/train/goe360_3387_559.npz\ndata/train/goe685_6232_210.npz\ndata/train/s8025_7924_504.npz\ndata/train/s7075_6773_-219.npz\ndata/train/nlf414f_5320_2057.npz\ndata/train/naca001264a08cli0.2_6665_1919.npz\ndata/train/b707c_1031_226.npz\ndata/train/goe428_6841_-444.npz\ndata/train/e636_7064_-624.npz\ndata/train/mh23_8763_-742.npz\ndata/train/e332_6469_892.npz\ndata/train/dae11_5560_1957.npz\ndata/train/oaf128_6363_1529.npz\ndata/train/usa22_1857_633.npz\ndata/train/goe522_6008_-1535.npz\ndata/train/naca663218_7158_2033.npz\ndata/train/s8052_5193_474.npz\ndata/train/goe391_2726_-749.npz\ndata/train/n24_8838_-1095.npz\ndata/train/vr7_2042_-531.npz\ndata/train/usa32_5769_-1454.npz\ndata/train/goe711_1105_117.npz\ndata/train/usa26_6836_-443.npz\ndata/train/n63215_8229_823.npz\ndata/train/n6h20_7855_-1721.npz\ndata/train/goe285_4458_1708.npz\ndata/train/ag12_8203_642.npz\ndata/train/m20_1622_520.npz\ndata/train/goe16k_6895_-226.npz\ndata/train/oaf117_1270_465.npz\ndata/train/fx72ls160_5986_-2103.npz\ndata/train/mh114_3558_-997.npz\ndata/train/ah93w145_3256_701.npz\ndata/train/n2414_7871_1139.npz\ndata/train/e836_1554_-68.npz\ndata/train/sc20412_6240_-554.npz\ndata/train/goe614_9278_-872.npz\ndata/train/goe633_6311_2435.npz\ndata/train/fx77w121_1970_532.npz\ndata/train/e715_5672_243.npz\ndata/train/e555_9665_-5.npz\ndata/train/saratov_1622_-111.npz\ndata/train/npl9510_5276_-870.npz\ndata/train/naca641112_4882_686.npz\ndata/train/e471_3619_733.npz\ndata/train/s4110_7905_2492.npz\ndata/train/n66021_4462_-1736.npz\ndata/train/naca0008_4056_-1579.npz\ndata/train/mh201_1260_133.npz\ndata/train/goe233_7501_-960.npz\ndata/train/lwk80080_5984_2018.npz\ndata/train/e479_6123_1053.npz\ndata/train/b707d_4376_127.npz\ndata/train/raf69_4995_-975.npz\ndata/train/sd7080_2218_-270.npz\ndata/train/e584_2006_-211.npz\ndata/train/naca641112_1040_-405.npz\ndata/train/e550_5181_-924.npz\ndata/train/kc135c_967_-379.npz\ndata/train/n10_6567_825.npz\ndata/train/naca664221_6370_-2001.npz\ndata/train/sg6043_6959_2600.npz\ndata/train/n63210_7853_-1798.npz\ndata/train/mh18_2242_-438.npz\ndata/train/ah82150f_4996_-1887.npz\ndata/train/goe692_8330_80.npz\ndata/train/e392_1552_601.npz\ndata/train/mb253515sm_7586_-2617.npz\ndata/train/sc20403_5073_1102.npz\ndata/train/e656_6879_-1463.npz\ndata/train/fx74130wp2mod_9912_419.npz\ndata/train/e625_7281_-659.npz\ndata/train/goe12k_2426_-971.npz\ndata/train/ls413mod_3996_357.npz\ndata/train/fx6617a2_9457_3225.npz\ndata/train/n22_4648_892.npz\ndata/train/goe447_2962_1086.npz\ndata/train/n6h15_5956_145.npz\ndata/train/goe54_6286_2283.npz\ndata/train/ah82150a_5664_2118.npz\ndata/train/hq2590sm_3637_1021.npz\ndata/train/oaf117_3094_-1091.npz\ndata/train/s4310_5013_1853.npz\ndata/train/p51droot_7155_61.npz\ndata/train/goe525_9384_-3184.npz\ndata/train/ah81131_5153_143.npz\ndata/train/goe405_8920_-2232.npz\ndata/train/goe113_2827_598.npz\ndata/train/ag455ct02r_5390_1106.npz\ndata/train/nlf0115_3658_752.npz\ndata/train/clarkys_4125_-1484.npz\ndata/train/fx69pr281_5747_699.npz\ndata/train/e433_4741_-1202.npz\ndata/train/e664_1112_-334.npz\ndata/train/as5048_2621_638.npz\ndata/train/sc20410_4479_-607.npz\ndata/train/sc1094r8_5475_-105.npz\ndata/train/ys915_2883_-1062.npz\ndata/train/goe495_5645_-278.npz\ndata/train/tempest2_8460_344.npz\ndata/train/naca0010_8216_-360.npz\ndata/train/s1012_3217_-358.npz\ndata/train/goe368_8943_-1621.npz\ndata/train/goe367_5108_-242.npz\ndata/train/goe16k_8292_-631.npz\ndata/train/m665_5425_81.npz\ndata/train/b707a_8647_-2842.npz\ndata/train/rc12b3_1600_651.npz\ndata/train/sc20518_3635_1262.npz\ndata/train/e334_4953_1719.npz\ndata/train/k3311_8460_2861.npz\ndata/train/naca2408_4387_1247.npz\ndata/train/goe407_7112_-597.npz\ndata/train/naca1408_6364_1060.npz\ndata/train/goe388_9639_1399.npz\ndata/train/n2h15_6966_324.npz\ndata/train/goe100_3761_159.npz\ndata/train/fx84w175_8137_-3145.npz\ndata/train/goe447_2763_762.npz\ndata/train/e542_4134_-1303.npz\ndata/train/s3016_1987_148.npz\ndata/train/s1016_4931_-1264.npz\ndata/train/goe744_1990_547.npz\ndata/train/goe10k_2722_-568.npz\ndata/train/e205_6390_2029.npz\ndata/train/hq159b_9031_-2974.npz\ndata/train/davis_4519_750.npz\ndata/train/ag35_8296_85.npz\ndata/train/e186_8097_1081.npz\ndata/train/fg1_4775_-1423.npz\ndata/train/e193_7189_-2073.npz\ndata/train/clarkyh_8219_954.npz\ndata/train/npl9627_6146_-1743.npz\ndata/train/m685_3804_757.npz\ndata/train/r1046_5916_-1408.npz\ndata/train/ah82150f_1073_103.npz\ndata/train/e664_3901_-1296.npz\ndata/train/sc20402_9394_2203.npz\ndata/train/goe417_8178_779.npz\ndata/train/nacam2_7387_2962.npz\ndata/train/goe288_4162_-88.npz\ndata/train/c141f_8151_903.npz\ndata/train/e220_8793_1410.npz\ndata/train/sc20010_5318_-1348.npz\ndata/train/giiil_9613_-200.npz\ndata/train/e328_8358_-2354.npz\ndata/train/goe134_6353_-145.npz\ndata/train/goe403_1338_-415.npz\ndata/train/mh44_2659_800.npz\ndata/train/fx84w140_6372_-541.npz\ndata/train/j5012_5532_-1260.npz\ndata/train/goe288_4150_-1305.npz\ndata/train/hybrid_1_7377_-169.npz\ndata/train/goe629_8912_2372.npz\ndata/train/e403_1733_-31.npz\ndata/train/e344_3658_541.npz\ndata/train/sc20012_7599_-2735.npz\ndata/train/s8037_4095_-912.npz\ndata/train/goe311_3818_108.npz\ndata/train/n5h10_8484_1468.npz\ndata/train/goe563_8756_-2549.npz\ndata/train/s6061_5197_120.npz\ndata/train/rc12n1_3347_551.npz\ndata/train/sd7084_4526_-1420.npz\ndata/train/lwk79100_3209_-687.npz\ndata/train/ah93w300_4654_1587.npz\ndata/train/e195_2347_-55.npz\ndata/train/goe319_6983_-1351.npz\ndata/train/e169_9557_-2926.npz\ndata/train/fg1_7870_-2238.npz\ndata/train/sc21010_8881_2864.npz\ndata/train/naca663218_7191_-792.npz\ndata/train/n63412_2914_-946.npz\ndata/train/goe598_4404_-1043.npz\ndata/train/whitcomb_8605_-2948.npz\ndata/train/goe593_9289_-2261.npz\ndata/train/as5046_7357_-1998.npz\ndata/train/ah93w145_9329_-2382.npz\ndata/train/e874_6312_-431.npz\ndata/train/b707a_9425_-2270.npz\ndata/train/e180_1346_100.npz\ndata/train/bambino6_9408_228.npz\ndata/train/m25_9130_1531.npz\ndata/train/s1048_5403_-772.npz\ndata/train/naca642415_9578_253.npz\ndata/train/goe303_2323_-721.npz\ndata/train/usa29_2766_-1121.npz\ndata/train/ht22_1827_549.npz\ndata/train/goe374_1365_-30.npz\ndata/train/e817_1495_-128.npz\ndata/train/goe395_7966_1752.npz\ndata/train/goe482_4085_-317.npz\ndata/train/arad20_6073_1931.npz\ndata/train/s5020_5801_-1284.npz\ndata/train/goe565_3771_841.npz\ndata/train/2032c_4984_1260.npz\ndata/train/goe274_8455_-26.npz\ndata/train/ah82150a_4497_85.npz\ndata/train/fx69274_7555_2205.npz\ndata/train/boe103_4526_-1699.npz\ndata/train/lwk80120k25_7617_-219.npz\ndata/train/goe424_7664_-1964.npz\ndata/train/wb140_4629_1736.npz\ndata/train/naca661212_1007_-302.npz\ndata/train/goe801_2764_566.npz\ndata/train/e184_5696_-2129.npz\ndata/train/goe11k_7393_-2554.npz\ndata/train/goe114_8192_-841.npz\ndata/train/ste87391_4823_1780.npz\ndata/train/daytonwrightt1_2170_-642.npz\ndata/train/e336_7408_1026.npz\ndata/train/oaf095_7476_1756.npz\ndata/train/goe29b_7698_-84.npz\ndata/train/arad10_8759_1970.npz\ndata/train/ah93156_3129_1073.npz\ndata/train/goe11k_4935_-12.npz\ndata/train/s2046_8695_2346.npz\ndata/train/n1h15_4218_300.npz\ndata/train/goe404_1386_257.npz\ndata/train/naca66-018_8158_-1292.npz\ndata/train/ag19_6378_-899.npz\ndata/train/isa962_8672_-388.npz\ndata/train/marsden_6384_-86.npz\ndata/train/chen_2463_-564.npz\ndata/train/usa33_4099_434.npz\ndata/train/ag47c03_2853_1002.npz\ndata/train/s4320_7223_-1479.npz\ndata/train/naca633418_9936_119.npz\ndata/train/marske3_6692_-1700.npz\ndata/train/e171_4576_-129.npz\ndata/train/goe685_6895_-787.npz\ndata/train/goe504_8066_-1069.npz\ndata/train/goe304_5407_-1153.npz\ndata/train/goe648_2276_721.npz\ndata/train/ah85l120_1492_-349.npz\ndata/train/goe592_8200_1137.npz\ndata/train/naca64209_8663_-1964.npz\ndata/train/hq258_1537_-516.npz\ndata/train/usa46_8636_3531.npz\ndata/train/naca6412_6154_-578.npz\ndata/train/raf32_1638_-320.npz\ndata/train/goe118_1183_-211.npz\ndata/train/goe460_6570_551.npz\ndata/train/naca64208_2245_-373.npz\ndata/train/b29tip_8492_-2797.npz\ndata/train/fx84w150_6041_2131.npz\ndata/train/e434_4442_-482.npz\ndata/train/goe480_8873_1655.npz\ndata/train/tsagi8_2683_795.npz\ndata/train/goe655_2895_70.npz\ndata/train/naca16021_1631_31.npz\ndata/train/naca663218_8294_830.npz\ndata/train/e407_7995_-178.npz\ndata/train/goe15k_7190_-2468.npz\ndata/train/vr1_7571_2509.npz\ndata/train/e209_4098_-1013.npz\ndata/train/n66021_3601_209.npz\ndata/train/raf38_7721_-3069.npz\ndata/train/v43012_8541_1975.npz\ndata/train/rae5213_4903_-1321.npz\ndata/train/naca000834_3987_130.npz\ndata/train/goe491_9235_-1719.npz\ndata/train/s2027_7428_-1651.npz\ndata/train/mh82_5169_101.npz\ndata/train/goe389_6513_269.npz\ndata/train/naca662215_7059_2732.npz\ndata/train/e555_9489_2498.npz\ndata/train/goe711_1062_-300.npz\ndata/train/goe518_5130_793.npz\ndata/train/goe133_1158_92.npz\ndata/train/raf38_7753_379.npz\ndata/train/nl722343_6697_328.npz\ndata/train/e333_5385_793.npz\ndata/train/usa98_5590_2170.npz\ndata/train/sg6040_3068_-1086.npz\ndata/train/fx60100_1507_335.npz\ndata/train/oa212_9453_891.npz\ndata/train/hq2590sm_3203_-1308.npz\ndata/train/a63a108c_9280_946.npz\ndata/train/e477_6496_-716.npz\ndata/train/hq09_4347_-1210.npz\ndata/train/e1200_8758_3468.npz\ndata/train/naca001264a08cli0.2_7507_2963.npz\ndata/train/goe228_3988_211.npz\ndata/train/fx77w343_2319_285.npz\ndata/train/m23_6769_623.npz\ndata/train/naca0006_6943_-2453.npz\ndata/train/fx61163_8522_-774.npz\ndata/train/du8608418_6014_2196.npz\ndata/train/goe508_4549_-953.npz\ndata/train/goe703_6806_1735.npz\ndata/train/usa98_2875_67.npz\ndata/train/goe627_6819_1155.npz\ndata/train/e420_7459_2933.npz\ndata/train/naca6412_2600_699.npz\ndata/train/hq108_8864_2466.npz\ndata/train/l7769_3145_621.npz\ndata/train/mh60_9487_-1299.npz\ndata/train/goe275_8098_60.npz\ndata/train/n14_3084_-643.npz\ndata/train/goe442_6690_97.npz\ndata/train/rae5213_1781_357.npz\ndata/train/hq2010_2942_992.npz\ndata/train/hq2511_5530_1518.npz\ndata/train/n9_9340_2480.npz\ndata/train/eh2510_6907_974.npz\ndata/train/naca63209_6005_993.npz\ndata/train/pt40_9571_407.npz\ndata/train/m21_8078_-2723.npz\ndata/train/goe585_2475_-122.npz\ndata/train/us1000root_6746_-2324.npz\ndata/train/goe574_3515_1137.npz\ndata/train/n64215_2311_751.npz\ndata/train/hq358_1013_-418.npz\ndata/train/e485_8358_339.npz\ndata/train/vr14_9456_193.npz\ndata/train/ah79k135_4427_-1047.npz\ndata/train/fxm2_8501_-2907.npz\ndata/train/rae2822_3873_-618.npz\ndata/train/n64015a_2537_702.npz\ndata/train/mh70_2573_-282.npz\ndata/train/ag37_8824_-2098.npz\ndata/train/ag11_1617_408.npz\ndata/train/a63a108c_6696_705.npz\ndata/train/s2091_6959_-1162.npz\ndata/train/goe217_7942_2651.npz\ndata/train/goe55_2316_-575.npz\ndata/train/goe548_3745_378.npz\ndata/train/goe494_5227_2058.npz\ndata/train/n64008a_6654_-474.npz\ndata/train/m665_4302_107.npz\ndata/train/goe602_8076_-2421.npz\ndata/train/goe08k_8126_-890.npz\ndata/train/s1048_2287_-485.npz\ndata/train/v23010_8953_-1602.npz\ndata/train/eh2070_8351_1237.npz\ndata/train/goe511_2197_-17.npz\ndata/train/goe423_3425_779.npz\ndata/train/lwk80150k25_1341_100.npz\ndata/train/s8036_3810_-571.npz\ndata/train/e212_6626_2258.npz\ndata/train/mh23_4573_364.npz\ndata/train/e1233_3090_603.npz\ndata/train/fx082512_2422_510.npz\ndata/train/isa962_2128_798.npz\ndata/train/la203a_6263_930.npz\ndata/train/sc20606_8083_1803.npz\ndata/train/goe404_5323_-186.npz\ndata/train/mh91_5902_424.npz\ndata/train/goe101_8806_1964.npz\ndata/train/e637_9925_-561.npz\ndata/train/raf6_6262_1138.npz\ndata/train/hq1585_9783_813.npz\ndata/train/raf38_5053_-730.npz\ndata/train/glennmartin2_6095_2354.npz\ndata/train/sd7084_5742_88.npz\ndata/train/e502_6025_-838.npz\ndata/train/aquilasm_3282_394.npz\ndata/train/giiim_3640_-1313.npz\ndata/train/goe535_2593_49.npz\ndata/train/mh116_3281_406.npz\ndata/train/fx77w343_8651_964.npz\ndata/train/nacam12_1554_159.npz\ndata/train/vr12_5696_-2078.npz\ndata/train/fx63137sm_1771_-208.npz\ndata/train/goe06k_3972_-35.npz\ndata/train/coanda2_3199_-527.npz\ndata/train/s2027_7396_-1879.npz\ndata/train/goe546_5354_1490.npz\ndata/train/s7075_3512_613.npz\ndata/train/eh2510_7882_-2531.npz\ndata/train/raf19_3729_-985.npz\ndata/train/usa28_5172_42.npz\ndata/train/sokolov_7164_-2770.npz\ndata/train/r1082t_4723_-874.npz\ndata/train/nlf415_8583_785.npz\ndata/train/e66_7036_-1455.npz\ndata/train/ua79sff_5248_-1370.npz\ndata/train/e475_1627_-200.npz\ndata/train/sc2110_4375_71.npz\ndata/train/goe614_7130_-2295.npz\ndata/train/aquilasm_9581_-2386.npz\ndata/train/goe615_8428_615.npz\ndata/train/n64012_6268_-1614.npz\ndata/train/goe54_5790_-2162.npz\ndata/train/hq2511_3508_-530.npz\ndata/train/c141a_1036_367.npz\ndata/train/goe532_5346_943.npz\ndata/train/naca747a415_9066_1342.npz\ndata/train/c5c_3323_734.npz\ndata/train/s3016_5528_2274.npz\ndata/train/goe527_8011_-1740.npz\ndata/train/2032c_4460_113.npz\ndata/train/e593_9411_-2220.npz\ndata/train/goe613_4661_1720.npz\ndata/train/m5_5480_-1062.npz\ndata/train/goe797_8966_1649.npz\ndata/train/goe574_3733_57.npz\ndata/train/usa5_4655_-1111.npz\ndata/train/goe223_5415_1423.npz\ndata/train/nlf0115_3838_945.npz\ndata/train/vr14_9192_742.npz\ndata/train/fg3_2252_-117.npz\ndata/train/goe746_3654_-1155.npz\ndata/train/fx049915_2894_-468.npz\ndata/train/e477_4774_1027.npz\ndata/train/oa213_1437_-562.npz\ndata/train/fx74cl6140_8661_2973.npz\ndata/train/goe269_6864_2120.npz\ndata/train/e477_4256_533.npz\ndata/train/sokolov_5164_-1982.npz\ndata/train/sc20714_4496_1506.npz\ndata/train/e176_2838_74.npz\ndata/train/ag08_1407_394.npz\ndata/train/fx77080_9737_2141.npz\ndata/train/august160_3902_-1547.npz\ndata/train/n64012_5535_1655.npz\ndata/train/eh0009_7107_-2470.npz\ndata/train/e398_7256_971.npz\ndata/train/boe103_7067_-2827.npz\ndata/train/marske5_6189_-386.npz\ndata/train/goe285_5578_-1513.npz\ndata/train/fx60100sm_4823_-269.npz\ndata/train/ua79sfm_8696_-1846.npz\ndata/train/mrc-20_6103_-813.npz\ndata/train/goe630_3842_-1412.npz\ndata/train/goe430_6419_1846.npz\ndata/train/raf48_7468_-114.npz\ndata/train/goe278_2515_735.npz\ndata/train/us1000root_7344_2572.npz\ndata/train/r140sm_6961_-888.npz\ndata/train/goe443_6350_-737.npz\ndata/train/s3002_1180_-302.npz\ndata/train/geminism_7820_2257.npz\ndata/train/goe647_6859_2734.npz\ndata/train/s4110_7781_-1486.npz\ndata/train/nlf416_3906_-1469.npz\ndata/train/sg6041_1894_20.npz\ndata/train/goe652_4829_-176.npz\ndata/train/hq1012_6476_-2414.npz\ndata/train/fx73k170_6556_351.npz\ndata/train/e340_5722_337.npz\ndata/train/ag04_7345_203.npz\ndata/train/e226_9513_-530.npz\ndata/train/m8_6929_-1924.npz\ndata/train/ste87151_5616_-698.npz\ndata/train/goe804_4027_147.npz\ndata/train/fx711530_3227_1253.npz\ndata/train/raf6_4991_-74.npz\ndata/train/fx73cl1152_2624_-236.npz\ndata/train/jn153_5036_222.npz\ndata/train/goe617_3305_993.npz\ndata/train/m24_1744_167.npz\ndata/train/e329_5031_316.npz\ndata/train/ls413mod_4078_666.npz\ndata/train/hq3015_1589_83.npz\ndata/train/goe344_5687_2312.npz\ndata/train/raf31_6630_2575.npz\ndata/train/goe628_9356_254.npz\ndata/train/marske7_8220_3082.npz\ndata/train/naca63209_1658_-199.npz\ndata/train/m11_1121_422.npz\ndata/train/e340_1966_55.npz\ndata/train/goe604_7309_1949.npz\ndata/train/e862_8961_1231.npz\ndata/train/n11_3469_-1319.npz\ndata/train/e68_4056_-771.npz\ndata/train/goe365_6299_1177.npz\ndata/train/nacam12_2487_225.npz\ndata/train/usa46_4574_1739.npz\ndata/train/goe460_4682_1255.npz\ndata/train/naca1408_9062_2238.npz\ndata/train/naca654421a05_2241_615.npz\ndata/train/n1h15_1743_-710.npz\ndata/train/ah93w257_7908_-76.npz\ndata/train/sd7003_7318_-330.npz\ndata/train/goe199_8879_-1015.npz\ndata/train/hq1010_6716_1604.npz\ndata/train/sd7003_5762_2310.npz\ndata/train/ht05_2080_9.npz\ndata/train/goe630_4286_-1188.npz\ndata/train/e837_4857_1618.npz\ndata/train/hq3518_2722_-923.npz\ndata/train/e58_7464_2685.npz\ndata/train/goe432_6914_-1892.npz\ndata/train/s3010_3999_-1141.npz\ndata/train/ah82150a_7905_-2315.npz\ndata/train/goe491_4175_-1347.npz\ndata/train/spicasm_3179_922.npz\ndata/train/arad6_6201_-1126.npz\ndata/train/naca643618_2855_821.npz\ndata/train/naca6412_6496_-1921.npz\ndata/train/sc20610_5092_-1927.npz\ndata/train/goe178_7795_-2128.npz\ndata/train/goe420_5221_-1018.npz\ndata/train/m12_2654_337.npz\ndata/train/fx74cl5140_1594_-542.npz\ndata/train/fx66s196_7534_1214.npz\ndata/train/ls421_2784_-609.npz\ndata/train/goe16k_4015_884.npz\ndata/train/s8036_1164_123.npz\ndata/train/goe504_6453_-1352.npz\ndata/train/goe367_4149_-1216.npz\ndata/train/ag45ct02r_9127_-3033.npz\ndata/train/mh201_7109_-1792.npz\ndata/train/goe124_4460_-1301.npz\ndata/train/e472_1770_553.npz\ndata/train/fx3_2099_420.npz\ndata/train/usa33_1726_611.npz\ndata/train/sd2083_1367_267.npz\ndata/train/chen_1167_222.npz\ndata/train/goe09k_3208_846.npz\ndata/train/eh1070_4062_1110.npz\ndata/train/e837_2128_-105.npz\ndata/train/fx73cl3152_1256_-158.npz\ndata/train/fx72ls160_4229_-734.npz\ndata/train/goe650_8730_-495.npz\ndata/train/e642_5070_1515.npz\ndata/train/boe103_3378_947.npz\ndata/train/marske5_4921_-1706.npz\ndata/train/rg1410_1401_-492.npz\ndata/train/mh108_5211_-1972.npz\ndata/train/goe144_3333_-793.npz\ndata/train/goe802b_2082_810.npz\ndata/train/goe723_5252_-1445.npz\ndata/train/fx61163_2978_-87.npz\ndata/train/s7012_1422_-142.npz\ndata/train/usa26_6526_-436.npz\ndata/train/e544_3674_-950.npz\ndata/train/goe711_9263_3549.npz\ndata/train/e434_9463_1655.npz\ndata/train/goe523_5238_-1380.npz\ndata/train/e1233_7793_315.npz\ndata/train/e655_5261_-1085.npz\ndata/train/goe360_9003_1404.npz\ndata/train/goe121_2153_-794.npz\ndata/train/waspsm_7146_-1473.npz\ndata/train/ua79sfm_8844_-2890.npz\ndata/train/be50_9187_-1695.npz\ndata/train/goe481_6491_-1888.npz\ndata/train/goe477_1794_-128.npz\ndata/train/goe280_8988_2053.npz\ndata/train/e584_1526_556.npz\ndata/train/m9_8434_977.npz\ndata/train/e407_5265_970.npz\ndata/train/goe746_2781_1048.npz\ndata/train/nacam2_2923_-1076.npz\ndata/train/davis_corrected_4343_1652.npz\ndata/train/raf32_3314_183.npz\ndata/train/rc410_2760_-580.npz\ndata/train/goe233_2102_36.npz\ndata/train/hq3514_5712_622.npz\ndata/train/raf28_6264_-246.npz\ndata/train/sd8000_4073_293.npz\ndata/train/goe527_1936_-456.npz\ndata/train/goe217_8319_-1443.npz\ndata/train/m5_5195_-333.npz\ndata/train/oaf102_5243_1416.npz\ndata/train/sd6060_4425_1106.npz\ndata/train/nlf414f_3898_-1590.npz\ndata/train/naca0006_6854_-266.npz\ndata/train/e836_5780_876.npz\ndata/train/goe758_3190_685.npz\ndata/train/e541_8064_-1389.npz\ndata/train/fx80080_5932_-1666.npz\ndata/train/e397_9188_1327.npz\ndata/train/dae51_2395_-879.npz\ndata/train/goe645_4755_-548.npz\ndata/train/ah81131_1413_114.npz\ndata/train/goe244_3911_1588.npz\ndata/train/usa33_2593_-89.npz\ndata/train/mh122_8671_-811.npz\ndata/train/s9000_8080_2046.npz\ndata/train/naca64208_8132_1128.npz\ndata/train/sd8020_1461_464.npz\ndata/train/fx63100_4527_-891.npz\ndata/train/nn7mk20_3183_-623.npz\ndata/train/goe382_6794_-1158.npz\ndata/train/goe393_9223_-805.npz\ndata/train/mh20_1176_285.npz\ndata/train/n64212mb_3037_-870.npz\ndata/train/goe365_9021_316.npz\ndata/train/fx78k161_5026_1648.npz\ndata/train/e71_8083_-2174.npz\ndata/train/df101_4891_-773.npz\ndata/train/e818_8287_2277.npz\ndata/train/gs1_7943_627.npz\ndata/train/e591_2120_581.npz\ndata/train/ua2-180sm_7225_-698.npz\ndata/train/ls413_7218_-1441.npz\ndata/train/e201_2262_421.npz\ndata/train/eh1090_4241_-451.npz\ndata/train/ua79sff_1606_-145.npz\ndata/train/fx83w227_1971_318.npz\ndata/train/goe443_2423_334.npz\ndata/train/hq108_7105_-1670.npz\ndata/train/usa50_9005_483.npz\ndata/train/goe675_9547_2548.npz\ndata/train/goe460_4197_691.npz\ndata/train/usa45_6998_-1413.npz\ndata/train/p51dtip_3877_-587.npz\ndata/train/e428_3238_-104.npz\ndata/train/e67_3035_1251.npz\ndata/train/goe802_953_-354.npz\ndata/train/e201_3943_-730.npz\ndata/train/fxs21158_1973_308.npz\ndata/train/fx05188_2135_241.npz\ndata/train/goe373_5600_1238.npz\ndata/train/fx83w108_4163_-242.npz\ndata/train/sc1095_5216_-551.npz\ndata/train/n63212_2055_-619.npz\ndata/train/m23_8993_-2130.npz\ndata/train/rae5215_1687_211.npz\ndata/train/e1214_4884_847.npz\ndata/train/goe621_2304_761.npz\ndata/train/l188root_4257_579.npz\ndata/train/mh24_8331_-32.npz\ndata/train/n24_3090_77.npz\ndata/train/usa35a_5259_74.npz\ndata/train/e1213_1027_312.npz\ndata/train/ag26_9470_3147.npz\ndata/train/a18sm_6891_853.npz\ndata/train/s2060_8551_902.npz\ndata/train/fx62k153_6448_392.npz\ndata/train/fx60126_5496_772.npz\ndata/train/goe316_5055_-1808.npz\ndata/train/rae102_993_260.npz\ndata/train/e417_1606_513.npz\ndata/train/goe458_6289_-1738.npz\ndata/train/nlf0115_1395_326.npz\ndata/train/goe256_4307_-933.npz\ndata/train/goe360_6891_-2796.npz\ndata/train/goe571_5024_-333.npz\ndata/train/goe15k_4819_1980.npz\ndata/train/e555_4229_457.npz\ndata/train/goe593_3239_-523.npz\ndata/train/fx057816_7176_-2727.npz\ndata/train/dh4009sm_3946_68.npz\ndata/train/ls417mod_2504_-235.npz\ndata/train/goe407_9702_-1791.npz\ndata/train/sc1012r8_9797_129.npz\ndata/train/naca0018_3055_-12.npz\ndata/train/goe359_1971_396.npz\ndata/train/fx68h120_1597_-89.npz\ndata/train/ah93157_8037_1903.npz\ndata/train/fx74cl6140_1896_-144.npz\ndata/train/fx73170_7119_2856.npz\ndata/train/e748_1274_-243.npz\ndata/train/e471_2707_751.npz\ndata/train/hq1012_3194_155.npz\ndata/train/n24_7085_59.npz\ndata/train/goe173_9503_-2499.npz\ndata/train/goe325_9426_63.npz\ndata/train/goe315_1290_131.npz\ndata/train/sc20010_9664_185.npz\ndata/train/goe256_2146_73.npz\ndata/train/nacam2_4493_-221.npz\ndata/train/ms317_2755_593.npz\ndata/train/goe400_5153_-1732.npz\ndata/train/e174_8028_35.npz\ndata/train/jn153_6232_1825.npz\ndata/train/goe421_2950_1005.npz\ndata/train/e377m_5882_338.npz\ndata/train/fx72ls160_2868_-1016.npz\ndata/train/avistar_5284_751.npz\ndata/train/e207_1774_308.npz\ndata/train/fx63110_5695_-1737.npz\ndata/train/rae2822_2408_911.npz\ndata/train/sd7062_3333_963.npz\ndata/train/la203a_1853_-198.npz\ndata/train/goe285_4126_-847.npz\ndata/train/e837_7259_-2351.npz\ndata/train/s6063_5759_-449.npz\ndata/train/ag04_4602_-1087.npz\ndata/train/goe517_973_-366.npz\ndata/train/r1082t_8147_-3103.npz\ndata/train/goe512_9504_-2426.npz\ndata/train/fxl142k_4562_-1481.npz\ndata/train/goe81_3670_-690.npz\ndata/train/defcnd2_6691_-102.npz\ndata/train/goe226_3052_-1140.npz\ndata/train/goe369_3999_-442.npz\ndata/train/rc0864c_4210_-1481.npz\ndata/train/ah93k130_6997_1809.npz\ndata/train/trainer60_8805_-3000.npz\ndata/train/goe549_3724_939.npz\ndata/train/fx74130wp1_3882_1129.npz\ndata/train/goe287_6808_1719.npz\ndata/train/rg12a_5303_956.npz\ndata/train/fx66h60_2610_259.npz\ndata/train/fx74130wp1_2646_254.npz\ndata/train/naca65206_1848_134.npz\ndata/train/goe655_8785_-1145.npz\ndata/train/n63412_6315_979.npz\ndata/train/goe447_2259_63.npz\ndata/train/fx84w140_7974_269.npz\ndata/train/mh61_2561_-375.npz\ndata/train/e637_3602_895.npz\ndata/train/ste87151_8359_570.npz\ndata/train/goe803h_3383_-1179.npz\ndata/train/goe173_1368_219.npz\ndata/train/m19_3880_178.npz\ndata/train/nlr7301_7638_2369.npz\ndata/train/goe365_6635_-2253.npz\ndata/train/fx69h083_5760_-1445.npz\ndata/train/esa40_6376_2547.npz\ndata/train/ah95160_1794_260.npz\ndata/train/eh1070_8371_665.npz\ndata/train/goe412_1898_477.npz\ndata/train/e472_2612_367.npz\ndata/train/hq259_1359_327.npz\ndata/train/goe08k_9750_340.npz\ndata/train/rhodesg32_7022_-168.npz\ndata/train/e407_5754_128.npz\ndata/train/e224_1414_-353.npz\ndata/train/us1000root_6489_-1559.npz\ndata/train/s9000_9258_-701.npz\ndata/train/goe369_5565_1687.npz\ndata/train/goe612_5222_1640.npz\ndata/train/sc1095r8_1819_-700.npz\ndata/train/p51htip_7643_-1867.npz\ndata/train/rg8_7294_1225.npz\ndata/train/df101_4930_-715.npz\n"
],
[
"# # Full data set with 53.8k samples plus test data (10GB):\n# # https://dataserv.ub.tum.de/s/m1459172/download?path=%2F&files=data_full.tar.gz\n\n# with open(\"data_full.tar.gz\", 'wb') as datafile:\n# resp = requests.get('https://dataserv.ub.tum.de/s/m1459172/download?path=%2F&files=data_full.tar.gz', verify=False)\n# datafile.write(resp.content)",
"_____no_output_____"
],
[
"# %cd train",
"_____no_output_____"
],
[
"# !python ./runTrain.py",
"_____no_output_____"
]
],
[
[
"## Dataset generation using OpenFoam",
"_____no_output_____"
]
],
[
[
"# !git clone https://github.com/thunil/Deep-Flow-Prediction.git",
"_____no_output_____"
],
[
"# !pip install torch numpy\n# # !apt-get install openfoam5 gmsh",
"_____no_output_____"
],
[
"# %%bash\n# sh -c \"wget -O - http://dl.openfoam.org/gpg.key | apt-key add -\"\n# add-apt-repository http://dl.openfoam.org/ubuntu\n# apt-get update\n# apt-get -y install openfoam6 gmsh",
"_____no_output_____"
],
[
"# %%bash\n\n# sh -c \"wget -O - http://dl.openfoam.org/gpg.key | apt-key add -\"\n# sh -c \"wget -O - http://dl.openfoam.org/gpg.key | apt-key add -\"\n# add-apt-repository http://dl.openfoam.org/ubuntu\n# apt-get update\n# apt-get -y install openfoam6\n# pip install PyFoam\n# apt-get -y install gmsh",
"_____no_output_____"
],
[
"# %%bash\n# /opt/openfoam6/etc/bashrc\n# cp -r $FOAM_TUTORIALS/incompressible/icoFoam/cavity/cavity ./",
"_____no_output_____"
],
[
"# %%bash\n# ./opt/openfoam6/etc/bashrc\n# cd ./cavity\n\n# blockMesh >log.blockMesh 2>&1\n\n# icoFoam >log.icoFoam 2>&1 \n# ls",
"_____no_output_____"
],
[
"# %cd /content/Deep-Flow-Prediction/data",
"_____no_output_____"
],
[
"# !./download_airfoils.sh",
"_____no_output_____"
],
[
"# !python ./dataGen.py",
"_____no_output_____"
]
],
[
[
"## RANS training data\n\nNow we have some training data. In general it's very important to understand the data we're working with as much as possible (for any ML task the _garbage-in-gargabe-out_ principle definitely holds). We should at least understand the data in terms of dimensions and rough statistics, but ideally also in terms of content. Otherwise we'll have a very hard time interpreting the results of a training run. And despite all the DL magic: if you can't make out any patterns in your data, NNs surely won't find any useful ones.\n\nHence, let's look at one of the training samples... The following is just some helper code to show images side by side.",
"_____no_output_____"
]
],
[
[
"import pylab\n\n# helper to show three target channels: normalized, with colormap, side by side\ndef showSbs(a1,a2, stats=False, bottom=\"NN Output\", top=\"Reference\", title=None): \n c=[]\n for i in range(3):\n b = np.flipud( np.concatenate((a2[i],a1[i]),axis=1).transpose())\n min, mean, max = np.min(b), np.mean(b), np.max(b); \n if stats: print(\"Stats %d: \"%i + format([min,mean,max]))\n b -= min; b /= (max-min)\n c.append(b)\n fig, axes = pylab.subplots(1, 1, figsize=(16, 5))\n axes.set_xticks([]); axes.set_yticks([]); \n im = axes.imshow(np.concatenate(c,axis=1), origin='upper', cmap='magma')\n\n pylab.colorbar(im); pylab.xlabel('p, ux, uy'); pylab.ylabel('%s %s'%(bottom,top))\n if title is not None: pylab.title(title)\n\n# NUM=72\n# showSbs(npfile[\"inputs\"][NUM],npfile[\"targets\"][NUM], stats=False, bottom=\"Target Output\", top=\"Inputs\", title=\"3 inputs are shown at the top (mask, in-ux, in-uy), with the 3 output channels (p,ux,uy) at the bottom\")\n",
"_____no_output_____"
]
],
[
[
"Next, let's define a small helper class `DfpDataset` to organize inputs and targets. We'll transfer the corresponding data to the pytorch `DataLoader` class. \n\nWe also set up some globals to control training parameters, maybe most importantly: the learning rate `LR`, i.e. $\\eta$ from the previous setions. When your training run doesn't converge this is the first parameter to experiment with.\n\nHere, we'll keep it relatively small throughout. (Using _learning rate decay_ would be better, i.e. potentially give an improved convergence, but is omitted here for clarity.) ",
"_____no_output_____"
]
],
[
[
"# # some global training constants\n\n# # number of training epochs\n# EPOCHS = 100\n# # batch size\n# BATCH_SIZE = 10\n# # learning rate\n# LR = 0.00002\n\n# class DfpDataset():\n# def __init__(self, inputs,targets): \n# self.inputs = inputs\n# self.targets = targets\n\n# def __len__(self):\n# return len(self.inputs)\n\n# def __getitem__(self, idx):\n# return self.inputs[idx], self.targets[idx]\n\n# tdata = DfpDataset(npfile[\"inputs\"],npfile[\"targets\"])\n# vdata = DfpDataset(npfile[\"vinputs\"],npfile[\"vtargets\"])\n\n# trainLoader = torch.utils.data.DataLoader(tdata, batch_size=BATCH_SIZE, shuffle=True , drop_last=True) \n# valiLoader = torch.utils.data.DataLoader(vdata, batch_size=BATCH_SIZE, shuffle=False, drop_last=True) \n\n# print(\"Training & validation batches: {} , {}\".format(len(trainLoader),len(valiLoader) ))",
"_____no_output_____"
],
[
"",
"_____no_output_____"
],
[
"################\n#\n# Deep Flow Prediction - N. Thuerey, K. Weissenov, H. Mehrotra, N. Mainali, L. Prantl, X. Hu (TUM)\n#\n# Dataset handling\n#\n################\nimport torch\nfrom torch.utils.data import Dataset\nimport numpy as np\nfrom os import listdir\nimport random\n\n# global switch, use fixed max values for dim-less airfoil data?\nfixedAirfoilNormalization = True\n# global switch, make data dimensionless?\nmakeDimLess = True\n# global switch, remove constant offsets from pressure channel?\nremovePOffset = True\n\n## helper - compute absolute of inputs or targets\ndef find_absmax(data, use_targets, x):\n maxval = 0\n for i in range(data.totalLength):\n if use_targets == 0:\n temp_tensor = data.inputs[i]\n else:\n temp_tensor = data.targets[i]\n temp_max = np.max(np.abs(temp_tensor[x]))\n if temp_max > maxval:\n maxval = temp_max\n return maxval\n\n\n######################################## DATA LOADER #########################################\n# also normalizes data with max , and optionally makes it dimensionless #\n\ndef LoaderNormalizer(data, isTest = False, shuffle = 0, dataProp = None):\n \"\"\"\n # data: pass TurbDataset object with initialized dataDir / dataDirTest paths\n # train: when off, process as test data (first load regular for normalization if needed, then replace by test data)\n # dataProp: proportions for loading & mixing 3 different data directories \"reg\", \"shear\", \"sup\"\n # should be array with [total-length, fraction-regular, fraction-superimposed, fraction-sheared],\n # passing None means off, then loads from single directory\n \"\"\"\n\n if dataProp is None:\n # load single directory\n files = listdir(data.dataDir)\n files.sort()\n for i in range(shuffle):\n random.shuffle(files) \n if isTest:\n print(\"Reducing data to load for tests\")\n files = files[0:min(10, len(files))]\n data.totalLength = len(files)\n data.inputs = np.empty((len(files), 3, 128, 128))\n data.targets = np.empty((len(files), 3, 128, 128))\n\n for i, file in enumerate(files):\n npfile = np.load(data.dataDir + file)\n d = npfile['a']\n data.inputs[i] = d[0:3]\n data.targets[i] = d[3:6]\n print(\"Number of data loaded:\", len(data.inputs) )\n\n else:\n # load from folders reg, sup, and shear under the folder dataDir\n data.totalLength = int(dataProp[0])\n data.inputs = np.empty((data.totalLength, 3, 128, 128))\n data.targets = np.empty((data.totalLength, 3, 128, 128))\n\n files1 = listdir(data.dataDir + \"reg/\")\n files1.sort()\n files2 = listdir(data.dataDir + \"sup/\")\n files2.sort()\n files3 = listdir(data.dataDir + \"shear/\" )\n files3.sort()\n for i in range(shuffle):\n random.shuffle(files1) \n random.shuffle(files2) \n random.shuffle(files3) \n\n temp_1, temp_2 = 0, 0\n for i in range(data.totalLength):\n if i >= (1-dataProp[3])*dataProp[0]:\n npfile = np.load(data.dataDir + \"shear/\" + files3[i-temp_2])\n d = npfile['a']\n data.inputs[i] = d[0:3]\n data.targets[i] = d[3:6]\n elif i >= (dataProp[1])*dataProp[0]:\n npfile = np.load(data.dataDir + \"sup/\" + files2[i-temp_1])\n d = npfile['a']\n data.inputs[i] = d[0:3]\n data.targets[i] = d[3:6]\n temp_2 = i + 1\n else:\n npfile = np.load(data.dataDir + \"reg/\" + files1[i])\n d = npfile['a']\n data.inputs[i] = d[0:3]\n data.targets[i] = d[3:6]\n temp_1 = i + 1\n temp_2 = i + 1\n print(\"Number of data loaded (reg, sup, shear):\", temp_1, temp_2 - temp_1, i+1 - temp_2)\n\n ################################## NORMALIZATION OF TRAINING DATA ##########################################\n\n if removePOffset:\n for i in range(data.totalLength):\n data.targets[i,0,:,:] -= np.mean(data.targets[i,0,:,:]) # remove offset\n data.targets[i,0,:,:] -= data.targets[i,0,:,:] * data.inputs[i,2,:,:] # pressure * mask\n\n # make dimensionless based on current data set\n if makeDimLess:\n for i in range(data.totalLength):\n # only scale outputs, inputs are scaled by max only\n v_norm = ( np.max(np.abs(data.inputs[i,0,:,:]))**2 + np.max(np.abs(data.inputs[i,1,:,:]))**2 )**0.5 \n data.targets[i,0,:,:] /= v_norm**2\n data.targets[i,1,:,:] /= v_norm\n data.targets[i,2,:,:] /= v_norm\n\n # normalize to -1..1 range, from min/max of predefined\n if fixedAirfoilNormalization:\n # hard coded maxima , inputs dont change\n data.max_inputs_0 = 100.\n data.max_inputs_1 = 38.12\n data.max_inputs_2 = 1.0\n\n # targets depend on normalization\n if makeDimLess:\n data.max_targets_0 = 4.65 \n data.max_targets_1 = 2.04\n data.max_targets_2 = 2.37\n print(\"Using fixed maxima \"+format( [data.max_targets_0,data.max_targets_1,data.max_targets_2] ))\n else: # full range\n data.max_targets_0 = 40000.\n data.max_targets_1 = 200.\n data.max_targets_2 = 216.\n print(\"Using fixed maxima \"+format( [data.max_targets_0,data.max_targets_1,data.max_targets_2] ))\n\n else: # use current max values from loaded data\n data.max_inputs_0 = find_absmax(data, 0, 0)\n data.max_inputs_1 = find_absmax(data, 0, 1)\n data.max_inputs_2 = find_absmax(data, 0, 2) # mask, not really necessary\n print(\"Maxima inputs \"+format( [data.max_inputs_0,data.max_inputs_1,data.max_inputs_2] )) \n\n data.max_targets_0 = find_absmax(data, 1, 0)\n data.max_targets_1 = find_absmax(data, 1, 1)\n data.max_targets_2 = find_absmax(data, 1, 2)\n print(\"Maxima targets \"+format( [data.max_targets_0,data.max_targets_1,data.max_targets_2] )) \n\n data.inputs[:,0,:,:] *= (1.0/data.max_inputs_0)\n data.inputs[:,1,:,:] *= (1.0/data.max_inputs_1)\n\n data.targets[:,0,:,:] *= (1.0/data.max_targets_0)\n data.targets[:,1,:,:] *= (1.0/data.max_targets_1)\n data.targets[:,2,:,:] *= (1.0/data.max_targets_2)\n\n ###################################### NORMALIZATION OF TEST DATA #############################################\n\n if isTest:\n files = listdir(data.dataDirTest)\n files.sort()\n data.totalLength = len(files)\n data.inputs = np.empty((len(files), 3, 128, 128))\n data.targets = np.empty((len(files), 3, 128, 128))\n for i, file in enumerate(files):\n npfile = np.load(data.dataDirTest + file)\n d = npfile['a']\n data.inputs[i] = d[0:3]\n data.targets[i] = d[3:6]\n\n if removePOffset:\n for i in range(data.totalLength):\n data.targets[i,0,:,:] -= np.mean(data.targets[i,0,:,:]) # remove offset\n data.targets[i,0,:,:] -= data.targets[i,0,:,:] * data.inputs[i,2,:,:] # pressure * mask\n\n if makeDimLess:\n for i in range(len(files)):\n v_norm = ( np.max(np.abs(data.inputs[i,0,:,:]))**2 + np.max(np.abs(data.inputs[i,1,:,:]))**2 )**0.5 \n data.targets[i,0,:,:] /= v_norm**2\n data.targets[i,1,:,:] /= v_norm\n data.targets[i,2,:,:] /= v_norm\n \n data.inputs[:,0,:,:] *= (1.0/data.max_inputs_0)\n data.inputs[:,1,:,:] *= (1.0/data.max_inputs_1)\n\n data.targets[:,0,:,:] *= (1.0/data.max_targets_0)\n data.targets[:,1,:,:] *= (1.0/data.max_targets_1)\n data.targets[:,2,:,:] *= (1.0/data.max_targets_2)\n\n print(\"Data stats, input mean %f, max %f; targets mean %f , max %f \" % ( \n np.mean(np.abs(data.targets), keepdims=False), np.max(np.abs(data.targets), keepdims=False) , \n np.mean(np.abs(data.inputs), keepdims=False) , np.max(np.abs(data.inputs), keepdims=False) ) ) \n\n return data\n\n######################################## DATA SET CLASS #########################################\n\nclass TurbDataset(Dataset):\n\n # mode \"enum\" , pass to mode param of TurbDataset (note, validation mode is not necessary anymore)\n TRAIN = 0\n TEST = 2\n\n def __init__(self, dataProp=None, mode=TRAIN, dataDir=\"../data/train/\", dataDirTest=\"../data/test/\", shuffle=0, normMode=0):\n global makeDimLess, removePOffset\n \"\"\"\n :param dataProp: for split&mix from multiple dirs, see LoaderNormalizer; None means off\n :param mode: TRAIN|TEST , toggle regular 80/20 split for training & validation data, or load test data\n :param dataDir: directory containing training data\n :param dataDirTest: second directory containing test data , needs training dir for normalization\n :param normMode: toggle normalization\n \"\"\"\n if not (mode==self.TRAIN or mode==self.TEST):\n print(\"Error - TurbDataset invalid mode \"+format(mode) ); exit(1)\n\n if normMode==1:\t\n print(\"Warning - poff off!!\")\n removePOffset = False\n if normMode==2:\t\n print(\"Warning - poff and dimless off!!!\")\n makeDimLess = False\n removePOffset = False\n\n self.mode = mode\n self.dataDir = dataDir\n self.dataDirTest = dataDirTest # only for mode==self.TEST\n\n # load & normalize data\n self = LoaderNormalizer(self, isTest=(mode==self.TEST), dataProp=dataProp, shuffle=shuffle)\n\n if not self.mode==self.TEST:\n # split for train/validation sets (80/20) , max 400\n targetLength = self.totalLength - min( int(self.totalLength*0.2) , 400)\n\n self.valiInputs = self.inputs[targetLength:]\n self.valiTargets = self.targets[targetLength:]\n self.valiLength = self.totalLength - targetLength\n\n self.inputs = self.inputs[:targetLength]\n self.targets = self.targets[:targetLength]\n self.totalLength = self.inputs.shape[0]\n\n def __len__(self):\n return self.totalLength\n\n def __getitem__(self, idx):\n return self.inputs[idx], self.targets[idx]\n\n # reverts normalization \n def denormalize(self, data, v_norm):\n a = data.copy()\n a[0,:,:] /= (1.0/self.max_targets_0)\n a[1,:,:] /= (1.0/self.max_targets_1)\n a[2,:,:] /= (1.0/self.max_targets_2)\n\n if makeDimLess:\n a[0,:,:] *= v_norm**2\n a[1,:,:] *= v_norm\n a[2,:,:] *= v_norm\n return a\n\n# simplified validation data set (main one is TurbDataset above)\n\nclass ValiDataset(TurbDataset):\n def __init__(self, dataset): \n self.inputs = dataset.valiInputs\n self.targets = dataset.valiTargets\n self.totalLength = dataset.valiLength\n\n def __len__(self):\n return self.totalLength\n\n def __getitem__(self, idx):\n return self.inputs[idx], self.targets[idx]",
"_____no_output_____"
],
[
"device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')\n\nseed = random.randint(0, 2**32 - 1)\nprint(\"Random seed: {}\".format(seed))\nrandom.seed(seed)\nnp.random.seed(seed)\ntorch.manual_seed(seed)\n\nif device.type == 'cuda':\n print(torch.cuda.get_device_name(0))\n print('Memory Usage:')\n print('Allocated:', round(torch.cuda.memory_allocated(0)/1024**3,1), 'GB')\n print('Cached: ', round(torch.cuda.memory_reserved(0)/1024**3,1), 'GB')\n torch.cuda.manual_seed_all(seed)\n #torch.backends.cudnn.deterministic=True # warning, slower",
"Random seed: 2964277700\nTesla K80\nMemory Usage:\nAllocated: 0.0 GB\nCached: 0.0 GB\n"
],
[
"print(device)",
"cuda\n"
],
[
"######## Settings ########\n\n# number of training iterations\n# iterations = 10000\n# batch size\n# batch_size = 10\n\n# learning rate, generator\nlrG = 0.0006\n# decay learning rate?\ndecayLr = True\n# channel exponent to control network size\nexpo = 5\n# data set config\nprop=None # by default, use all from \"../data/train\"\n#prop=[1000,0.75,0,0.25] # mix data from multiple directories\n# save txt files with per epoch loss?\nsaveL1 = False\n\n##########################\n\nprefix = \"\"\n# if len(sys.argv)>1:\n# prefix = sys.argv[1]\n# print(\"Output prefix: {}\".format(prefix))\n\ndropout = 0. # note, the original runs from https://arxiv.org/abs/1810.08217 used slight dropout, but the effect is minimal; conv layers \"shouldn't need\" dropout, hence set to 0 here.\ndoLoad = \"\" # optional, path to pre-trained model\n\nprint(\"LR: {}\".format(lrG))\nprint(\"LR decay: {}\".format(decayLr))\n# print(\"Iterations: {}\".format(iterations))\nprint(\"Dropout: {}\".format(dropout))\n\n##########################",
"LR: 0.0006\nLR decay: True\nDropout: 0.0\n"
],
[
"# some global training constants\n\n# number of training epochs\nEPOCHS = 100\n# batch size\nBATCH_SIZE = 10\n# # learning rate\n# LR = 0.00002",
"_____no_output_____"
],
[
"# create pytorch data object with dfp dataset\ndata = TurbDataset(prop, shuffle=1,dataDir=\"data/train/\",dataDirTest=\"data/test/\" )",
"Number of data loaded: 6400\nUsing fixed maxima [4.65, 2.04, 2.37]\nData stats, input mean 0.189310, max 1.058965; targets mean 0.271461 , max 1.000000 \n"
],
[
"trainLoader = torch.utils.data.DataLoader(data, batch_size=BATCH_SIZE, shuffle=True, drop_last=True)\nprint(\"Training batches: {}\".format(len(trainLoader)))",
"Training batches: 600\n"
],
[
"dataValidation = ValiDataset(data)\nvaliLoader = torch.utils.data.DataLoader(dataValidation, batch_size=BATCH_SIZE, shuffle=False, drop_last=True) \nprint(\"Validation batches: {}\".format(len(valiLoader)))",
"Validation batches: 40\n"
],
[
"print(\"Training & validation batches: {} , {}\".format(len(trainLoader),len(valiLoader) ))",
"Training & validation batches: 600 , 40\n"
],
[
"# EPOCHS = 2",
"_____no_output_____"
]
],
[
[
"## Network setup\n\nNow we can set up the architecture of our neural network, we'll use a fully convolutional U-net. This is a widely used architecture that uses a stack of convolutions across different spatial resolutions. The main deviation from a regular conv-net is to introduce _skip connection_ from the encoder to the decoder part. This ensures that no information is lost during feature extraction. (Note that this only works if the network is to be used as a whole. It doesn't work in situations where we'd, e.g., want to use the decoder as a standalone component.)\n\nHere's a overview of the architecure:\n\n\n\nFirst, we'll define a helper to set up a convolutional block in the network, `blockUNet`. Note, we don't use any pooling! Instead we use strides and transpose convolutions (these need to be symmetric for the decoder part, i.e. have an uneven kernel size), following [best practices](https://distill.pub/2016/deconv-checkerboard/). The full pytroch neural network is managed via the `DfpNet` class.",
"_____no_output_____"
]
],
[
[
"import os, sys, random\nimport numpy as np\n\nimport torch\nimport torch.nn as nn\nimport torch.optim as optim\nimport torch.autograd \nimport torch.utils.data \n\ndef blockUNet(in_c, out_c, name, transposed=False, bn=True, relu=True, size=4, pad=1, dropout=0.):\n block = nn.Sequential()\n\n if relu:\n block.add_module('%s_relu' % name, nn.ReLU(inplace=True))\n else:\n block.add_module('%s_leakyrelu' % name, nn.LeakyReLU(0.2, inplace=True))\n\n if not transposed:\n block.add_module('%s_conv' % name, nn.Conv2d(in_c, out_c, kernel_size=size, stride=2, padding=pad, bias=True))\n else:\n block.add_module('%s_upsam' % name, nn.Upsample(scale_factor=2, mode='bilinear'))\n # reduce kernel size by one for the upsampling (ie decoder part)\n block.add_module('%s_tconv' % name, nn.Conv2d(in_c, out_c, kernel_size=(size-1), stride=1, padding=pad, bias=True))\n\n if bn:\n block.add_module('%s_bn' % name, nn.BatchNorm2d(out_c))\n if dropout>0.:\n block.add_module('%s_dropout' % name, nn.Dropout2d( dropout, inplace=True))\n\n return block\n \nclass TurbNetG(nn.Module):\n def __init__(self, channelExponent=6, dropout=0.):\n super(TurbNetG, self).__init__()\n channels = int(2 ** channelExponent + 0.5)\n\n self.layer1 = nn.Sequential()\n self.layer1.add_module('layer1', nn.Conv2d(3, channels, 4, 2, 1, bias=True))\n\n self.layer2 = blockUNet(channels , channels*2, 'enc_layer2', transposed=False, bn=True, relu=False, dropout=dropout )\n self.layer3 = blockUNet(channels*2, channels*2, 'enc_layer3', transposed=False, bn=True, relu=False, dropout=dropout )\n self.layer4 = blockUNet(channels*2, channels*4, 'enc_layer4', transposed=False, bn=True, relu=False, dropout=dropout )\n self.layer5 = blockUNet(channels*4, channels*8, 'enc_layer5', transposed=False, bn=True, relu=False, dropout=dropout ) \n self.layer6 = blockUNet(channels*8, channels*8, 'enc_layer6', transposed=False, bn=True, relu=False, dropout=dropout , size=2,pad=0)\n self.layer7 = blockUNet(channels*8, channels*8, 'enc_layer7', transposed=False, bn=True, relu=False, dropout=dropout , size=2,pad=0)\n \n # note, kernel size is internally reduced by one for the decoder part\n self.dlayer7 = blockUNet(channels*8, channels*8, 'dec_layer7', transposed=True, bn=True, relu=True, dropout=dropout , size=2,pad=0)\n self.dlayer6 = blockUNet(channels*16,channels*8, 'dec_layer6', transposed=True, bn=True, relu=True, dropout=dropout , size=2,pad=0)\n self.dlayer5 = blockUNet(channels*16,channels*4, 'dec_layer5', transposed=True, bn=True, relu=True, dropout=dropout ) \n self.dlayer4 = blockUNet(channels*8, channels*2, 'dec_layer4', transposed=True, bn=True, relu=True, dropout=dropout )\n self.dlayer3 = blockUNet(channels*4, channels*2, 'dec_layer3', transposed=True, bn=True, relu=True, dropout=dropout )\n self.dlayer2 = blockUNet(channels*4, channels , 'dec_layer2', transposed=True, bn=True, relu=True, dropout=dropout )\n\n self.dlayer1 = nn.Sequential()\n self.dlayer1.add_module('dec_layer1_relu', nn.ReLU(inplace=True))\n self.dlayer1.add_module('dec_layer1_tconv', nn.ConvTranspose2d(channels*2, 3, 4, 2, 1, bias=True))\n\n def forward(self, x):\n # note, this Unet stack could be allocated with a loop, of course... \n out1 = self.layer1(x)\n out2 = self.layer2(out1)\n out3 = self.layer3(out2)\n out4 = self.layer4(out3)\n out5 = self.layer5(out4)\n out6 = self.layer6(out5)\n out7 = self.layer7(out6)\n # ... bottleneck ...\n dout6 = self.dlayer7(out7)\n dout6_out6 = torch.cat([dout6, out6], 1)\n dout6 = self.dlayer6(dout6_out6)\n dout6_out5 = torch.cat([dout6, out5], 1)\n dout5 = self.dlayer5(dout6_out5)\n dout5_out4 = torch.cat([dout5, out4], 1)\n dout4 = self.dlayer4(dout5_out4)\n dout4_out3 = torch.cat([dout4, out3], 1)\n dout3 = self.dlayer3(dout4_out3)\n dout3_out2 = torch.cat([dout3, out2], 1)\n dout2 = self.dlayer2(dout3_out2)\n dout2_out1 = torch.cat([dout2, out1], 1)\n dout1 = self.dlayer1(dout2_out1)\n return dout1\n\ndef weights_init(m):\n classname = m.__class__.__name__\n if classname.find('Conv') != -1:\n m.weight.data.normal_(0.0, 0.02)\n elif classname.find('BatchNorm') != -1:\n m.weight.data.normal_(1.0, 0.02)\n m.bias.data.fill_(0)\n\n",
"_____no_output_____"
]
],
[
[
"Next, we can initialize an instance of the `DfpNet`.\n\nBelow, the `EXPO` parameter here controls the exponent for the feature maps of our Unet: this directly scales the network size (3 gives a network with ca. 150k parameters). This is relatively small for a generative NN with $3 \\times 128^2 = \\text{ca. }49k$ outputs, but yields fast training times and prevents overfitting given the relatively small data set we're using here. Hence it's a good starting point.",
"_____no_output_____"
]
],
[
[
"# channel exponent to control network size\n# EXPO = 5\n\n# setup network\nnetG = TurbNetG(channelExponent=expo, dropout=dropout)\n#print(netG) # to double check the details...\n\nnn_parameters = filter(lambda p: p.requires_grad, netG.parameters())\nparams = sum([np.prod(p.size()) for p in nn_parameters])\n\n# crucial parameter to keep in view: how many parameters do we have?\nprint(\"Trainable params: {} -> crucial! always keep in view... \".format(params)) \n\nnetG.apply(weights_init)\nif len(doLoad)>0:\n netG.load_state_dict(torch.load(doLoad))\n print(\"Loaded model \"+doLoad)\nnetG.to(device)\n\ncriterionL1 = nn.L1Loss()\ncriterionL1.to(device)\n\n# optimizerG = optim.Adam(netG.parameters(), lr=LR, betas=(0.5, 0.999), weight_decay=0.0)\noptimizerG = optim.Adam(netG.parameters(), lr=lrG, betas=(0.5, 0.999), weight_decay=0.0)\n\ninputs = torch.autograd.Variable(torch.FloatTensor(BATCH_SIZE, 3, 128, 128))\ninputs = inputs.to(device)\n\ntargets = torch.autograd.Variable(torch.FloatTensor(BATCH_SIZE, 3, 128, 128))\ntargets = targets.to(device)\n",
"Trainable params: 2332547 -> crucial! always keep in view... \n"
]
],
[
[
"With an exponent of 3, this network has 147555 trainable parameters. As the subtle hint in the print statement indicates, this is a crucial number to always have in view when training NNs. It's easy to change settings, and get a network that has millions of parameters, and as a result probably all kinds of convergence and overfitting problems. The number of parameters definitely has to be matched with the amount of training data, and should also scale with the depth of the network. How these three relate to each other exactly is problem dependent, though.",
"_____no_output_____"
],
[
"## Training\n\nFinally, we can train the NN. This step can take a while, as the training runs over all 320 samples 100 times, and continually evaluates the validation samples to keep track of how well the current state of the NN is doing.",
"_____no_output_____"
]
],
[
[
"# history_L1 = []\n# history_L1val = []\n\n# if os.path.isfile(\"network\"):\n# print(\"Found existing network, loading & skipping training\")\n# net.load_state_dict(torch.load(\"network\")) # optionally, load existing network\n\n# else:\n# print(\"Training from scratch\")\n# for epoch in range(EPOCHS):\n# net.train()\n# L1_accum = 0.0\n# for i, traindata in enumerate(trainLoader, 0):\n# inputs_curr, targets_curr = traindata\n# inputs.data.copy_(inputs_curr.float())\n# targets.data.copy_(targets_curr.float())\n\n# net.zero_grad()\n# gen_out = net(inputs)\n\n# lossL1 = criterionL1(gen_out, targets)\n# lossL1.backward()\n# optimizerG.step()\n# L1_accum += lossL1.item()\n\n# # validation\n# net.eval()\n# L1val_accum = 0.0\n# for i, validata in enumerate(valiLoader, 0):\n# inputs_curr, targets_curr = validata\n# inputs.data.copy_(inputs_curr.float())\n# targets.data.copy_(targets_curr.float())\n\n# outputs = net(inputs)\n# outputs_curr = outputs.data.cpu().numpy()\n\n# lossL1val = criterionL1(outputs, targets)\n# L1val_accum += lossL1val.item()\n\n# # data for graph plotting\n# history_L1.append( L1_accum / len(trainLoader) )\n# history_L1val.append( L1val_accum / len(valiLoader) )\n\n# # if epoch<3 or epoch%20==0:\n# print( \"Epoch: {}, L1 train: {:7.5f}, L1 vali: {:7.5f}\".format(epoch, history_L1[-1], history_L1val[-1]) )\n\n# torch.save(net.state_dict(), \"network\" )\n# print(\"Training done, saved network\")\n",
"_____no_output_____"
],
[
"print(device)\nprint(inputs.device)\nprint(targets.device)",
"cuda\ncuda:0\ncuda:0\n"
],
[
"# utils.py\n################\n#\n# Deep Flow Prediction - N. Thuerey, K. Weissenov, H. Mehrotra, N. Mainali, L. Prantl, X. Hu (TUM)\n#\n# Helper functions for image output\n#\n################\n\nimport math, re, os\nimport numpy as np\nfrom PIL import Image\nfrom matplotlib import cm\n\n# add line to logfiles\ndef log(file, line, doPrint=True):\n f = open(file, \"a+\")\n f.write(line + \"\\n\")\n f.close()\n if doPrint: print(line)\n\n# reset log file\ndef resetLog(file):\n f = open(file, \"w\")\n f.close()\n\n# compute learning rate with decay in second half\ndef computeLR(i,epochs, minLR, maxLR):\n if i < epochs*0.5:\n return maxLR\n e = (i/float(epochs)-0.5)*2.\n # rescale second half to min/max range\n fmin = 0.\n fmax = 6.\n e = fmin + e*(fmax-fmin)\n f = math.pow(0.5, e)\n return minLR + (maxLR-minLR)*f\n\n# image output\ndef imageOut(filename, _outputs, _targets, saveTargets=False, normalize=False, saveMontage=True):\n outputs = np.copy(_outputs)\n targets = np.copy(_targets)\n \n s = outputs.shape[1] # should be 128\n if saveMontage:\n new_im = Image.new('RGB', ( (s+10)*3, s*2) , color=(255,255,255) )\n BW_im = Image.new('RGB', ( (s+10)*3, s*3) , color=(255,255,255) )\n\n for i in range(3):\n outputs[i] = np.flipud(outputs[i].transpose())\n targets[i] = np.flipud(targets[i].transpose())\n min_value = min(np.min(outputs[i]), np.min(targets[i]))\n max_value = max(np.max(outputs[i]), np.max(targets[i]))\n if normalize:\n outputs[i] -= min_value\n targets[i] -= min_value\n max_value -= min_value\n outputs[i] /= max_value\n targets[i] /= max_value\n else: # from -1,1 to 0,1\n outputs[i] -= -1.\n targets[i] -= -1.\n outputs[i] /= 2.\n targets[i] /= 2.\n\n if not saveMontage:\n suffix = \"\"\n if i==0:\n suffix = \"_pressure\"\n elif i==1:\n suffix = \"_velX\"\n else:\n suffix = \"_velY\"\n\n im = Image.fromarray(cm.magma(outputs[i], bytes=True))\n im = im.resize((512,512))\n im.save(filename + suffix + \"_pred.png\")\n\n im = Image.fromarray(cm.magma(targets[i], bytes=True))\n if saveTargets:\n im = im.resize((512,512))\n im.save(filename + suffix + \"_target.png\")\n\n if saveMontage:\n im = Image.fromarray(cm.magma(targets[i], bytes=True))\n new_im.paste(im, ( (s+10)*i, s*0))\n im = Image.fromarray(cm.magma(outputs[i], bytes=True))\n new_im.paste(im, ( (s+10)*i, s*1))\n\n im = Image.fromarray(targets[i] * 256.)\n BW_im.paste(im, ( (s+10)*i, s*0))\n im = Image.fromarray(outputs[i] * 256.)\n BW_im.paste(im, ( (s+10)*i, s*1))\n imE = Image.fromarray( np.abs(targets[i]-outputs[i]) * 10. * 256. )\n BW_im.paste(imE, ( (s+10)*i, s*2))\n\n if saveMontage:\n new_im.save(filename + \".png\")\n BW_im.save( filename + \"_bw.png\")\n\n# save single image\ndef saveAsImage(filename, field_param):\n field = np.copy(field_param)\n field = np.flipud(field.transpose())\n\n min_value = np.min(field)\n max_value = np.max(field)\n field -= min_value\n max_value -= min_value\n field /= max_value\n\n im = Image.fromarray(cm.magma(field, bytes=True))\n im = im.resize((512, 512))\n im.save(filename)\n\n# read data split from command line\ndef readProportions():\n flag = True\n while flag:\n input_proportions = input(\"Enter total numer for training files and proportions for training (normal, superimposed, sheared respectively) seperated by a comma such that they add up to 1: \")\n input_p = input_proportions.split(\",\")\n prop = [ float(x) for x in input_p ]\n if prop[1] + prop[2] + prop[3] == 1:\n flag = False\n else:\n print( \"Error: poportions don't sum to 1\")\n print(\"##################################\")\n return(prop)\n\n# helper from data/utils\ndef makeDirs(directoryList):\n for directory in directoryList:\n if not os.path.exists(directory):\n os.makedirs(directory)\n",
"_____no_output_____"
],
[
"history_L1 = []\nhistory_L1val = []\n\nif os.path.isfile(\"network\"):\n print(\"Found existing network, loading & skipping training\")\n net.load_state_dict(torch.load(\"network\")) # optionally, load existing network\n\nelse:\n print(\"Training from scratch\")\n\n for epoch in range(EPOCHS):\n # print(\"Starting epoch {} / {}\".format((epoch+1),EPOCHS))\n\n netG.train()\n L1_accum = 0.0\n for i, traindata in enumerate(trainLoader, 0):\n inputs_cpu, targets_cpu = traindata\n targets_cpu, inputs_cpu = targets_cpu.float().cuda(), inputs_cpu.float().cuda()\n inputs.data.resize_as_(inputs_cpu).copy_(inputs_cpu)\n targets.data.resize_as_(targets_cpu).copy_(targets_cpu)\n\n # compute LR decay\n if decayLr:\n # currLr = utils.computeLR(epoch, EPOCHS, lrG*0.1, lrG)\n currLr = computeLR(epoch, EPOCHS, lrG*0.1, lrG)\n if currLr < lrG:\n for g in optimizerG.param_groups:\n g['lr'] = currLr\n\n netG.zero_grad()\n gen_out = netG(inputs)\n\n lossL1 = criterionL1(gen_out, targets)\n lossL1.backward()\n optimizerG.step()\n L1_accum += lossL1.item()\n\n # validation\n netG.eval()\n L1val_accum = 0.0\n for i, validata in enumerate(valiLoader, 0):\n inputs_cpu, targets_cpu = validata\n targets_cpu, inputs_cpu = targets_cpu.float().cuda(), inputs_cpu.float().cuda()\n inputs.data.resize_as_(inputs_cpu).copy_(inputs_cpu)\n targets.data.resize_as_(targets_cpu).copy_(targets_cpu)\n\n outputs = netG(inputs)\n outputs_cpu = outputs.data.cpu().numpy()\n\n lossL1val = criterionL1(outputs, targets)\n L1val_accum += lossL1val.item()\n\n if i==0:\n input_ndarray = inputs_cpu.cpu().numpy()[0]\n v_norm = ( np.max(np.abs(input_ndarray[0,:,:]))**2 + np.max(np.abs(input_ndarray[1,:,:]))**2 )**0.5\n\n outputs_denormalized = data.denormalize(outputs_cpu[0], v_norm)\n targets_denormalized = data.denormalize(targets_cpu.cpu().numpy()[0], v_norm)\n # utils.makeDirs([\"results_train\"])\n # utils.imageOut(\"results_train/epoch{}_{}\".format(epoch, i), outputs_denormalized, targets_denormalized, saveTargets=True)\n makeDirs([\"results_train\"])\n imageOut(\"results_train/epoch{}_{}\".format(epoch, i), outputs_denormalized, targets_denormalized, saveTargets=True)\n\n # data for graph plotting\n history_L1.append( L1_accum / len(trainLoader) )\n history_L1val.append( L1val_accum / len(valiLoader) )\n\n # if epoch<3 or epoch%20==0:\n print( f\"Epoch: {epoch+1}, L1 train: {history_L1[-1]}, L1 vali: {history_L1val[-1]}\")\n\n if (epoch+1)%20==0:\n # torch.save(netG.state_dict(), f\"network_{epoch+1}\" )\n torch.save({\n 'epoch': epoch,\n 'model_state_dict': netG.state_dict(),\n 'optimizer_state_dict': optimizerG.state_dict(),\n 'loss': lossL1,\n ...\n }, f\"network_{epoch+1}.pth\")\n\n\n torch.save(netG.state_dict(), \"network\" )\n print(\"Training done, saved network\")\n",
"Training from scratch\nStarting epoch 1 / 100\n"
]
],
[
[
"The NN is finally trained! The losses should have nicely gone down in terms of absolute values: With the standard settings from an initial value of around 0.2 for the validation loss, to ca. 0.02 after 100 epochs. \n\nLet's look at the graphs to get some intuition for how the training progressed over time. This is typically important to identify longer-term trends in the training. In practice it's tricky to spot whether the overall trend of 100 or so noisy numbers in a command line log is going slightly up or down - this is much easier to spot in a visualization.",
"_____no_output_____"
]
],
[
[
"import matplotlib.pyplot as plt\n\nl1train = np.asarray(history_L1)\nl1vali = np.asarray(history_L1val)\n\nplt.plot(np.arange(l1train.shape[0]),l1train,'b',label='Training loss')\nplt.plot(np.arange(l1vali.shape[0] ),l1vali ,'g',label='Validation loss')\nplt.legend()\nplt.show()",
"_____no_output_____"
]
],
[
[
"You should see a curve that goes down for ca. 40 epochs, and then starts to flatten out. In the last part, it's still slowly decreasing, and most importantly, the validation loss is not increasing. This would be a certain sign of overfitting, and something that we should avoid. (Try decreasing the amount of training data artificially, then you should be able to intentionally cause overfitting.)\n\n## Training progress and validation\n\nIf you look closely at this graph, you should spot something peculiar:\n_Why is the validation loss lower than the training loss_?\nThe data is similar to the training data of course, but in a way it's slightly \"tougher\", because the network certainly never received any validation samples during training. It is natural that the validation loss slightly deviates from the training loss, but how can the L1 loss be _lower_ for these inputs?\n\nThis is a subtlety of the training loop above: it runs a training step first, and the loss for each point in the graph is measured with the evolving state of the network in an epoch. The network is updated, and afterwards runs through the validation samples. Thus all validation samples are using a state that is definitely different (and hopefully a bit better) than the initial states of the epoch. Hence, the validation loss can be slightly lower.\n\nA general word of caution here: never evaluate your network with training data! That won't tell you much because overfitting is a very common problem. At least use data the network hasn't seen before, i.e. validation data, and if that looks good, try some more different (at least slightly out-of-distribution) inputs, i.e., _test data_. The next cell runs the trained network over the validation data, and displays one of them with the `showSbs` function.\n\n",
"_____no_output_____"
]
],
[
[
"netG.eval()\nfor i, validata in enumerate(valiLoader, 0):\n inputs_curr, targets_curr = validata\n inputs.data.copy_(inputs_curr.float())\n targets.data.copy_(targets_curr.float())\n \n outputs = netG(inputs)\n outputs_curr = outputs.data.cpu().numpy()\n if i<1: showSbs(targets_curr[0] , outputs_curr[0], title=\"Validation sample %d\"%(i*BATCH_SIZE))\n",
"/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3613: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.\n \"See the documentation of nn.Upsample for details.\".format(mode)\n"
]
],
[
[
"Visually, there should at least be a rough resemblance here between input out network output. We'll save the more detailed evaluation for the test data, though.",
"_____no_output_____"
],
[
"## Test evaluation\n\nNow let's look at actual test samples: In this case we'll use new airfoil shapes as out-of-distribution (OOD) data. These are shapes that the network never saw in any training samples, and hence it tells us a bit about how well the NN generalizes to unseen inputs (the validation data wouldn't suffice to draw conclusions about generalization).\n\nWe'll use the same visualization as before, and as indicated by the Bernoulli equation, especially the _pressure_ in the first column is a challenging quantity for the network. Due to it's cubic scaling w.r.t. the input freestream velocity and localized peaks, it is the toughest quantity to infer for the network.\n\nThe cell below first downloads a smaller archive with these test data samples, and then runs them through the network. The evaluation loop also computes the accumulated L1 error such that we can quantify how well the network does on the test samples.",
"_____no_output_____"
]
],
[
[
"# testdata = TurbDataset(prop, shuffle=1,mode=2, dataDir=\"data/train/\",dataDirTest=\"data/test/\" )\n# testLoader = torch.utils.data.DataLoader(testdata, batch_size=1, shuffle=False, drop_last=True) \n# print(\"Training batches: {}\".format(len(testLoader)))",
"Reducing data to load for tests\nNumber of data loaded: 10\nUsing fixed maxima [4.65, 2.04, 2.37]\nData stats, input mean 0.190220, max 0.961052; targets mean 0.289502 , max 1.000000 \nTraining batches: 90\n"
],
[
"# if not os.path.isfile('data-airfoils-test.npz'):\n# import urllib.request\n# url=\"https://physicsbaseddeeplearning.org/data/data_test.npz\"\n# print(\"Downloading test data, this should be fast...\")\n# urllib.request.urlretrieve(url, 'data-airfoils-test.npz')\n\n# nptfile=np.load('data-airfoils-test.npz')\n# print(\"Loaded {}/{} test samples\\n\".format(len(nptfile[\"test_inputs\"]),len(nptfile[\"test_targets\"])))\n\n# testdata = DfpDataset(nptfile[\"test_inputs\"],nptfile[\"test_targets\"])\ntestdata = TurbDataset(prop, shuffle=1,mode=2, dataDir=\"data/train/\",dataDirTest=\"data/test/\" )\ntestLoader = torch.utils.data.DataLoader(testdata, batch_size=1, shuffle=False, drop_last=True) \n\nnetG.eval()\nL1t_accum = 0.\nfor i, validata in enumerate(testLoader, 0):\n inputs_curr, targets_curr = validata\n inputs.data.copy_(inputs_curr.float())\n targets.data.copy_(targets_curr.float())\n\n outputs = netG(inputs)\n outputs_curr = outputs.data.cpu().numpy()\n\n lossL1t = criterionL1(outputs, targets)\n L1t_accum += lossL1t.item()\n if i<3: showSbs(targets_curr[0] , outputs_curr[0], title=\"Test sample %d\"%(i))\n\nprint(\"\\nAverage test error: {}\".format( L1t_accum/len(testLoader) ))",
"Loaded 10/10 test samples\n\nReducing data to load for tests\nNumber of data loaded: 10\nUsing fixed maxima [4.65, 2.04, 2.37]\nData stats, input mean 0.190220, max 0.961052; targets mean 0.289502 , max 1.000000 \n"
]
],
[
[
"The average test error with the default settings should be ca. 0.03. As the inputs are normalized, this means the average error across all three fields is 3% w.r.t. the maxima of each quantity. This is not too bad for new shapes, but clearly leaves room for improvement.\n\nLooking at the visualizations, you'll notice that especially high-pressure peaks and pockets of larger y-velocities are missing in the outputs. This is primarily caused by the small network, which does not have enough resources to reconstruct details.\n\nNonetheless, we have successfully replaced a fairly sophisticated RANS solver with a very small and fast neural network architecture. It has GPU support \"out-of-the-box\" (via pytorch), is differentiable, and introduces an error of only a few per-cent.\n\n---\n\n\n",
"_____no_output_____"
],
[
"## Next steps\n\nThere are many obvious things to try here (see the suggestions below), e.g. longer training, larger data sets, larger networks etc. \n\n* Experiment with learning rate, dropout, and network size to reduce the error on the test set. How small can you make it with the given training data?\n\n* The setup above uses normalized data. Instead you can recover [the original fields by undoing the normalization](https://github.com/thunil/Deep-Flow-Prediction) to check how well the network does w.r.t. the original quantities.\n\n* As you'll see, it's a bit limited here what you can get out of this dataset, head over to [the main github repo of this project](https://github.com/thunil/Deep-Flow-Prediction) to download larger data sets, or generate own data.\n\n",
"_____no_output_____"
]
],
[
[
"torch.save({\n 'epoch': epoch,\n 'model_state_dict': netG.state_dict(),\n 'optimizer_state_dict': optimizerG.state_dict(),\n 'loss': lossL1,\n # ...\n }, f\"network_{epoch+1}.pth\")\n",
"_____no_output_____"
],
[
"!zip results_train.zip /content/Deep-Flow-Prediction/results_train/*",
" adding: content/Deep-Flow-Prediction/results_train/epoch0_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch0_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch10_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch10_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch1_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch1_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch11_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch11_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch12_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch12_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch13_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch13_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch14_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch14_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch15_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch15_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch16_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch16_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch17_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch17_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch18_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch18_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch19_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch19_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch20_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch20_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch2_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch2_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch21_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch21_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch22_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch22_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch23_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch23_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch24_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch24_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch25_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch25_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch26_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch26_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch27_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch27_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch28_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch28_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch29_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch29_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch30_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch30_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch3_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch3_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch31_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch31_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch32_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch32_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch33_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch33_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch34_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch34_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch35_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch35_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch36_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch36_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch37_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch37_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch38_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch38_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch39_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch39_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch40_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch40_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch4_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch4_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch41_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch41_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch42_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch42_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch43_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch43_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch44_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch44_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch45_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch45_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch46_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch46_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch47_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch47_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch48_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch48_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch49_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch49_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch50_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch50_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch5_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch5_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch51_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch51_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch52_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch52_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch53_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch53_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch54_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch54_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch55_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch55_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch56_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch56_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch57_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch57_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch58_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch58_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch59_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch59_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch60_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch60_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch6_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch6_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch61_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch61_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch62_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch62_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch63_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch63_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch64_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch64_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch65_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch65_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch66_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch66_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch67_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch67_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch68_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch68_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch69_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch69_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch70_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch70_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch7_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch7_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch71_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch71_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch72_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch72_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch73_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch73_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch74_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch74_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch75_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch75_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch76_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch76_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch77_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch77_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch78_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch78_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch79_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch79_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch80_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch80_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch8_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch8_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch81_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch81_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch82_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch82_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch83_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch83_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch84_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch84_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch85_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch85_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch86_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch86_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch87_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch87_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch88_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch88_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch89_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch89_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch90_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch90_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch9_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch9_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch91_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch91_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch92_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch92_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch93_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch93_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch94_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch94_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch95_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch95_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch96_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch96_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch97_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch97_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch98_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch98_0.png (deflated 0%)\n adding: content/Deep-Flow-Prediction/results_train/epoch99_0_bw.png (deflated 1%)\n adding: content/Deep-Flow-Prediction/results_train/epoch99_0.png (deflated 0%)\n"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code",
"code",
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code",
"code"
]
] |
d0cddf2af54cc907426dea0aa10fb38481de00d0 | 43,714 | ipynb | Jupyter Notebook | scripts/03_Decoding_SVM_Haxby_Bonus.ipynb | smgrady-git/medianeuroclass | 76fe1ffbb766616a86e98a7ec3ad0291772fc20a | [
"Apache-2.0"
] | 1 | 2020-03-09T14:19:06.000Z | 2020-03-09T14:19:06.000Z | scripts/03_Decoding_SVM_Haxby_Bonus.ipynb | smgrady-git/medianeuroclass | 76fe1ffbb766616a86e98a7ec3ad0291772fc20a | [
"Apache-2.0"
] | null | null | null | scripts/03_Decoding_SVM_Haxby_Bonus.ipynb | smgrady-git/medianeuroclass | 76fe1ffbb766616a86e98a7ec3ad0291772fc20a | [
"Apache-2.0"
] | 4 | 2019-07-02T05:59:08.000Z | 2019-07-02T07:48:41.000Z | 137.034483 | 35,204 | 0.884225 | [
[
[
"\nDecoding with ANOVA + SVM: face vs house in the Haxby dataset\n===============================================================\n\nThis example does a simple but efficient decoding on the Haxby dataset:\nusing a feature selection, followed by an SVM.\n",
"_____no_output_____"
]
],
[
[
"import warnings\nwarnings.filterwarnings('ignore')\n\nimport matplotlib.pyplot as plt\n%matplotlib inline",
"_____no_output_____"
]
],
[
[
"Retrieve the files of the Haxby dataset\n----------------------------------------\n\n",
"_____no_output_____"
]
],
[
[
"from nilearn import datasets\n\n# By default 2nd subject will be fetched\nhaxby_dataset = datasets.fetch_haxby()\n\n# print basic information on the dataset\nprint('Mask nifti image (3D) is located at: %s' % haxby_dataset.mask)\nprint('Functional nifti image (4D) is located at: %s' %\n haxby_dataset.func[0])",
"Mask nifti image (3D) is located at: /Users/Ralf/nilearn_data/haxby2001/mask.nii.gz\nFunctional nifti image (4D) is located at: /Users/Ralf/nilearn_data/haxby2001/subj2/bold.nii.gz\n"
]
],
[
[
"Load the behavioral data\n-------------------------\n\n",
"_____no_output_____"
]
],
[
[
"import pandas as pd\n\n# Load target information as string and give a numerical identifier to each\nbehavioral = pd.read_csv(haxby_dataset.session_target[0], sep=\" \")\nconditions = behavioral['labels']\n\n# Restrict the analysis to faces and places\ncondition_mask = behavioral['labels'].isin(['face', 'house'])\nconditions = conditions[condition_mask]\n\n# Confirm that we now have 2 conditions\nprint(conditions.unique())\n\n# Record these as an array of sessions, with fields\n# for condition (face or house) and run\nsession = behavioral[condition_mask].to_records(index=False)\nprint(session.dtype.names)",
"['face' 'house']\n('labels', 'chunks')\n"
]
],
[
[
"Prepare the fMRI data: smooth and apply the mask\n-------------------------------------------------\n\n",
"_____no_output_____"
]
],
[
[
"from nilearn.input_data import NiftiMasker\n\nmask_filename = haxby_dataset.mask\n\n# For decoding, standardizing is often very important\n# note that we are also smoothing the data\nmasker = NiftiMasker(mask_img=mask_filename, smoothing_fwhm=4,\n standardize=True, memory=\"nilearn_cache\", memory_level=1)\nfunc_filename = haxby_dataset.func[0]\nX = masker.fit_transform(func_filename)\n# Apply our condition_mask\nX = X[condition_mask]",
"_____no_output_____"
]
],
[
[
"Build the decoder\n------------------\nDefine the prediction function to be used.\nHere we use a Support Vector Classification, with a linear kernel\n\n",
"_____no_output_____"
]
],
[
[
"from sklearn.svm import SVC\nsvc = SVC(kernel='linear')\n\n# Define the dimension reduction to be used.\n# Here we use a classical univariate feature selection based on F-test,\n# namely Anova. When doing full-brain analysis, it is better to use\n# SelectPercentile, keeping 5% of voxels\n# (because it is independent of the resolution of the data).\nfrom sklearn.feature_selection import SelectPercentile, f_classif\nfeature_selection = SelectPercentile(f_classif, percentile=5)\n\n# We have our classifier (SVC), our feature selection (SelectPercentile),and now,\n# we can plug them together in a *pipeline* that performs the two operations\n# successively:\nfrom sklearn.pipeline import Pipeline\nanova_svc = Pipeline([('anova', feature_selection), ('svc', svc)])",
"_____no_output_____"
]
],
[
[
"Fit the decoder and predict\n----------------------------\n\n",
"_____no_output_____"
]
],
[
[
"anova_svc.fit(X, conditions)\ny_pred = anova_svc.predict(X)",
"_____no_output_____"
]
],
[
[
"Obtain prediction scores via cross validation\n-----------------------------------------------\n\n",
"_____no_output_____"
]
],
[
[
"from sklearn.model_selection import LeaveOneGroupOut, cross_val_score\n\n# Define the cross-validation scheme used for validation.\n# Here we use a LeaveOneGroupOut cross-validation on the session group\n# which corresponds to a leave-one-session-out\ncv = LeaveOneGroupOut()\n\n# Compute the prediction accuracy for the different folds (i.e. session)\ncv_scores = cross_val_score(anova_svc, X, conditions, cv=cv, groups=session)\n\n# Return the corresponding mean prediction accuracy\nclassification_accuracy = cv_scores.mean()\n\n# Print the results\nprint(\"Classification accuracy: %.4f / Chance level: %f\" %\n (classification_accuracy, 1. / len(conditions.unique())))\n# Classification accuracy: 0.70370 / Chance level: 0.5000",
"Classification accuracy: 0.7037 / Chance level: 0.500000\n"
]
],
[
[
"Visualize the results\n----------------------\nLook at the SVC's discriminating weights\n\n",
"_____no_output_____"
]
],
[
[
"coef = svc.coef_\n# reverse feature selection\ncoef = feature_selection.inverse_transform(coef)\n# reverse masking\nweight_img = masker.inverse_transform(coef)\n\n\n# Use the mean image as a background to avoid relying on anatomical data\nfrom nilearn import image\nmean_img = image.mean_img(func_filename)\n\n# Create the figure\nfrom nilearn.plotting import plot_stat_map, show\nplot_stat_map(weight_img, mean_img, title='SVM weights')\n\n# Saving the results as a Nifti file may also be important\nweight_img.to_filename('haxby_face_vs_house.nii')\n\n\nshow()",
"_____no_output_____"
]
],
[
[
"***Exercise:***\n\nWhat do you see? ",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
]
] |
d0cde94d35beacd639072ea9e4890435aa055e9d | 3,440 | ipynb | Jupyter Notebook | download_radiosonde_UWyoming.ipynb | franzihe/Radiosonde | a9456679ac3cdb73f95a638e025343754c026aea | [
"MIT"
] | null | null | null | download_radiosonde_UWyoming.ipynb | franzihe/Radiosonde | a9456679ac3cdb73f95a638e025343754c026aea | [
"MIT"
] | null | null | null | download_radiosonde_UWyoming.ipynb | franzihe/Radiosonde | a9456679ac3cdb73f95a638e025343754c026aea | [
"MIT"
] | null | null | null | 27.96748 | 184 | 0.455523 | [
[
[
"# supress warnings\nimport warnings\nwarnings.filterwarnings('ignore') # don't output warnings\n\n# import packages\nfrom imports import (np, urllib3, BeautifulSoup, fct)\n\n# reload imports\n%load_ext autoreload\n%autoreload 2\n",
"_____no_output_____"
],
[
"stn = '01415' #1415 is ID for Stavanger\n\n\nfct.createFolder('/home/franzihe/Documents/Data/Sounding/{}'.format(stn)) # for text files",
"_____no_output_____"
],
[
"m = ['12','01', '02']\nh = ['00', '12']",
"_____no_output_____"
],
[
"for month in m:\n if month == '12':\n t = np.array([8, 9, 10, 12, 15, 20, 21, 22, 23, 24, 25, 26, 29, 31])\n if month == '01':\n t = np.array([2, 3, 5, 6, 8, 9, 10, 11, 12, 28])\n if month == '02':\n t = np.array([2, 3, 4]) \n if month == '12':\n year = '2016'\n if month == '01' or month == '02':\n year = '2017'\n for day in t:\n if day < 10:\n day = '0%s' %day\n \n for hour in h:\n \n\n # 1) \n # Wyoming URL to download Sounding from\n url = 'http://weather.uwyo.edu/cgi-bin/sounding?region=naconf&TYPE=TEXT%3ALIST&YEAR='+year+'&MONTH='+month+'&FROM='+str(day)+hour+'&TO='+str(day)+hour+'&STNM='+stn\n\n\n #2)\n # Remove the html tags\n http = urllib3.PoolManager()\n response = http.request('GET', url)\n soup = BeautifulSoup(response.data.decode('utf-8'),'lxml')\n data_text = soup.get_text()\n\n # 3)\n # Split the content by new line.\n splitted = data_text.split(\"\\n\",data_text.count(\"\\n\"))\n\n\n # 4)\n # Write this splitted text to a .txt document\n Sounding_filename = '/home/franzihe/Documents/Data/Sounding/{}/{}{}{}_{}.txt'.format(stn,year,month,day,hour)\n f = open(Sounding_filename,'w')\n for line in splitted[4:]:\n f.write(line+'\\n')\n f.close()\n \n print('file written: {}'.format(Sounding_filename))",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code"
]
] |
d0cdf071ec7f2866b5e9fde0fa665eb57b4e167a | 52,244 | ipynb | Jupyter Notebook | notebooks/Flair Basics.ipynb | peey/python-tutorial-notebooks | 915b7c99eef17e5f54507f3b1cdcc33006ec3acf | [
"Apache-2.0"
] | null | null | null | notebooks/Flair Basics.ipynb | peey/python-tutorial-notebooks | 915b7c99eef17e5f54507f3b1cdcc33006ec3acf | [
"Apache-2.0"
] | null | null | null | notebooks/Flair Basics.ipynb | peey/python-tutorial-notebooks | 915b7c99eef17e5f54507f3b1cdcc33006ec3acf | [
"Apache-2.0"
] | null | null | null | 33.532734 | 1,312 | 0.588871 | [
[
[
"# Python Flair Basics",
"_____no_output_____"
],
[
"**(C) 2018-2020 by [Damir Cavar](http://damir.cavar.me/)**",
"_____no_output_____"
],
[
"**Version:** 0.3, February 2020",
"_____no_output_____"
],
[
"**Download:** This and various other Jupyter notebooks are available from my [GitHub repo](https://github.com/dcavar/python-tutorial-for-ipython).",
"_____no_output_____"
],
[
"**License:** [Creative Commons Attribution-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-sa/4.0/) ([CA BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/))",
"_____no_output_____"
],
[
"This material was used in my Advanced Topics in AI class, introduction to Deep Learning environments in Spring 2019 at Indiana University.",
"_____no_output_____"
],
[
"Two types of central objects:\n\n- Sentence\n- Token\n\nA Sentence holds a textual sentence and is essentially a list of Token objects.",
"_____no_output_____"
],
[
"For creating a Sentence object we first import the Sentence class from the *flair.data* module:",
"_____no_output_____"
]
],
[
[
"from flair.data import Sentence",
"_____no_output_____"
]
],
[
[
"We can now define a sentence:",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('The grass is green .')\nprint(sentence)",
"Sentence: \"The grass is green .\" - 5 Tokens\n"
]
],
[
[
"We can access the tokens of a sentence via their token id or with their index:",
"_____no_output_____"
]
],
[
[
"print(sentence.get_token(4))\nprint(sentence[3])",
"Token: 4 green\nToken: 4 green\n"
]
],
[
[
"We can also iterate over all tokens in a sentence:",
"_____no_output_____"
]
],
[
[
"for token in sentence:\n print(token)",
"Token: 1 The\nToken: 2 grass\nToken: 3 is\nToken: 4 green\nToken: 5 .\n"
]
],
[
[
"## Tokenization",
"_____no_output_____"
],
[
"There is a simple tokenizer included in the library using the lightweight segtok library to tokenize your text for such a Sentence definition. In the Sentence constructor use the flag *use_tokenize* to tokenize the input string before instantiating a Sentence object:",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('The grass is green.', use_tokenizer=True)\nprint(sentence)",
"Sentence: \"The grass is green .\" - 5 Tokens\n"
]
],
[
[
"## Tags on Tokens",
"_____no_output_____"
],
[
"A Token has fields for linguistic annotation:\n\n- lemma\n- part-of-speech tag\n- named entity tag\n\nWe can add a tag by specifying the tag type and the tag value.\n\nWe will adding an NER tag of type 'color' to the word 'green'. This means that we've tagged this word as an entity of type color:",
"_____no_output_____"
]
],
[
[
"sentence[3].add_tag('ner', 'color')\nprint(sentence.to_tagged_string())",
"The grass is green <color> .\n"
]
],
[
[
"Each tag is of class Label. An associated score indicates confidence:",
"_____no_output_____"
]
],
[
[
"from flair.data import Label\n\ntag: Label = sentence[3].get_tag('ner')\nprint(f'\"{sentence[3]}\" is tagged as \"{tag.value}\" with confidence score \"{tag.score}\"')",
"\"Token: 4 green\" is tagged as \"color\" with confidence score \"1.0\"\n"
]
],
[
[
"The manually added color tag has a score of 1.0. A tag predicted by a sequence labeler will have a score value that indicates the classifier confidence.",
"_____no_output_____"
],
[
"A Sentence can have one or multiple labels that can for example be used in text classification tasks. For instance, the example below shows how we add the label 'sports' to a sentence, thereby labeling it as belonging to the sports category.",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('France is the current world cup winner.')\nsentence.add_label('sports')\nsentence.add_labels(['sports', 'world cup'])\nsentence = Sentence('France is the current world cup winner.', labels=['sports', 'world cup'])",
"_____no_output_____"
]
],
[
[
"Labels are also of the Label class. So, you can print a sentence's labels like this:",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('France is the current world cup winner.', labels=['sports', 'world cup'])\n\nprint(sentence)\nfor label in sentence.labels:\n print(label)",
"Sentence: \"France is the current world cup winner.\" - 7 Tokens - Labels: [sports (1.0), world cup (1.0)] \nsports (1.0)\nworld cup (1.0)\n"
]
],
[
[
"## Tagging Text",
"_____no_output_____"
],
[
"### Using Pre-Trained Sequence Tagging Models",
"_____no_output_____"
],
[
"Flair has numerous pre-trained models. For the named entity recognition (NER) task there is a model that was trained on the English CoNLL-03 task and can recognize 4 different entity types. Import it using:",
"_____no_output_____"
]
],
[
[
"from flair.models import SequenceTagger\n\ntagger = SequenceTagger.load('ner')",
"_____no_output_____"
]
],
[
[
"We use the predict() method of the tagger on a sentence to add predicted tags to the tokens in the sentence:",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('Washington went to New York .')\n\ntagger.predict(sentence)\n\nprint(sentence.to_tagged_string())",
"Washington <S-PER> went to New <B-LOC> York <E-LOC> .\n"
]
],
[
[
"Getting annotated spans for multi-word expressions can be achieved using the following command:",
"_____no_output_____"
]
],
[
[
"for entity in sentence.get_spans('ner'):\n print(entity)",
"PER-span [1]: \"Washington\"\nLOC-span [4,5]: \"New York\"\n"
]
],
[
[
"Which indicates that \"George Washington\" is a person (PER) and \"Washington\" is a location (LOC). Each such Span has a text, a tag value, its position in the sentence and \"score\" that indicates how confident the tagger is that the prediction is correct. You can also get additional information, such as the position offsets of each entity in the sentence by calling:",
"_____no_output_____"
]
],
[
[
"print(sentence.to_dict(tag_type='ner'))",
"{'text': 'Washington went to New York .', 'labels': [], 'entities': [{'text': 'Washington', 'start_pos': 0, 'end_pos': 10, 'type': 'PER', 'confidence': 0.999004065990448}, {'text': 'New York', 'start_pos': 19, 'end_pos': 27, 'type': 'LOC', 'confidence': 0.9995943009853363}]}\n"
],
[
"print(sentence.to_dict())",
"_____no_output_____"
]
],
[
[
"Flair contains various sequence tagger models. You choose which pre-trained model you load by passing the appropriate string to the load() method of the SequenceTagger class. Currently, the following pre-trained models are provided:",
"_____no_output_____"
],
[
"As indicated in the list above, we also provide pre-trained models for languages other than English. Currently, we support German, French, and Dutch other languages are forthcoming. To tag a German sentence, just load the appropriate model:",
"_____no_output_____"
]
],
[
[
"tagger = SequenceTagger.load('de-ner')\n\nsentence = Sentence('George Washington ging nach Washington .')\n\ntagger.predict(sentence)\n\nprint(sentence.to_tagged_string())",
"2020-02-03 18:41:11,589 loading file C:\\Users\\damir\\.flair\\models\\de-ner-conll03-v0.4.pt\nGeorge <B-PER> Washington <E-PER> ging nach Washington <S-LOC> .\n"
]
],
[
[
"Flair offers access to multi-lingual models for multi-lingual text.",
"_____no_output_____"
]
],
[
[
"tagger = SequenceTagger.load('pos-multi')\n\nsentence = Sentence('George Washington lebte in Washington . Dort kaufte er a horse .')\n\ntagger.predict(sentence)\n\nprint(sentence.to_tagged_string())",
"2020-02-03 18:42:43,387 loading file C:\\Users\\damir\\.flair\\models\\pos-multi-v0.1.pt\nGeorge <PROPN> Washington <PROPN> lebte <VERB> in <ADP> Washington <PROPN> . <PUNCT> Dort <PROPN> kaufte <VERB> er <PRON> a <DET> horse <NOUN> . <PUNCT>\n"
]
],
[
[
"## Semantic Frames",
"_____no_output_____"
],
[
"For English, Flair provides a pre-trained model that detects semantic frames in text, trained using Propbank 3.0 frames. This provides some sort of word sense disambiguation for frame evoking words.",
"_____no_output_____"
]
],
[
[
"tagger = SequenceTagger.load('frame')\n\nsentence_1 = Sentence('George returned to Berlin to return his hat .')\nsentence_2 = Sentence('He had a look at different hats .')\n\ntagger.predict(sentence_1)\ntagger.predict(sentence_2)\n\nprint(sentence_1.to_tagged_string())\nprint(sentence_2.to_tagged_string())",
"_____no_output_____"
]
],
[
[
"The frame detector makes a distinction in sentence 1 between two different meanings of the word 'return'. 'return.01' means returning to a location, while 'return.02' means giving something back.\n\nSimilarly, in sentence 2 the frame detector finds a light verb construction in which 'have' is the light verb and 'look' is a frame evoking word.",
"_____no_output_____"
],
[
"## Sentence Tagging",
"_____no_output_____"
],
[
"To tag an entire text corpus, one needs to split the corpus into sentences and pass a list of Sentence objects to the .predict() method.",
"_____no_output_____"
]
],
[
[
"text = \"This is a sentence. John read a book. This is another sentence. I love Berlin.\"\n\nfrom segtok.segmenter import split_single\n\nsentences = [Sentence(sent, use_tokenizer=True) for sent in split_single(text)]\n\ntagger: SequenceTagger = SequenceTagger.load('ner')\ntagger.predict(sentences)\nfor i in sentences:\n print(i.to_tagged_string())",
"2020-02-03 09:43:07,071 loading file C:\\Users\\damir\\.flair\\models\\en-ner-conll03-v0.4.pt\nThis is a sentence .\nJohn <S-PER> read a book .\nThis is another sentence .\nI love Berlin <S-LOC> .\n"
]
],
[
[
"Using the mini_batch_size parameter of the .predict() method, you can set the size of mini batches passed to the tagger. Depending on your resources, you might want to play around with this parameter to optimize speed.",
"_____no_output_____"
],
[
"## Pre-Trained Text Classification Models",
"_____no_output_____"
],
[
"Flair provides a pre-trained model for detecting positive or negative comments. It was trained on the IMDB dataset and it can recognize positive and negative sentiment in English text. The IMDB data set can be downloaded from the [linked site](http://ai.stanford.edu/~amaas/data/sentiment/).",
"_____no_output_____"
]
],
[
[
"from flair.models import TextClassifier\n\nclassifier = TextClassifier.load('en-sentiment')",
"2020-02-03 18:45:19,296 loading file C:\\Users\\damir\\.flair\\models\\imdb-v0.4.pt\n"
]
],
[
[
"We call the predict() method of the classifier on a sentence. This will add the predicted label to the sentence:",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('This film hurts. It is so bad that I am confused.')\n\nclassifier.predict(sentence)\n\nprint(sentence.labels)",
"[NEGATIVE (0.9598665833473206)]\n"
],
[
"sentence = Sentence('This film is fantastic. I love it.')\n\nclassifier.predict(sentence)\n\nprint(sentence.labels)",
"[POSITIVE (0.9998914003372192)]\n"
]
],
[
[
"Flair has a pre-trained German and English model.",
"_____no_output_____"
],
[
"## Using Word Embeddings",
"_____no_output_____"
],
[
"Flair provides a set of classes with which we can embed the words in sentences in various ways.",
"_____no_output_____"
],
[
"All word embedding classes inherit from the TokenEmbeddings class and implement the embed() method which we need to call to embed our text. This means that for most users of Flair, the complexity of different embeddings remains hidden behind this interface. Simply instantiate the embedding class we require and call embed() to embed our text.\n\nAll embeddings produced with Flair's methods are Pytorch vectors, so they can be immediately used for training and fine-tuning.",
"_____no_output_____"
],
[
"Classic word embeddings are static and word-level, meaning that each distinct word gets exactly one pre-computed embedding. Most embeddings fall under this class, including the popular GloVe or Komninos embeddings.",
"_____no_output_____"
],
[
"We instantiate the WordEmbeddings class and pass a string identifier of the embedding we wish to load. If we want to use GloVe embeddings, we pass the string 'glove' to the constructor:",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import WordEmbeddings\n\nglove_embedding = WordEmbeddings('glove')",
"_____no_output_____"
]
],
[
[
"We create an example sentence and call the embedding's embed() method. We can also pass a list of sentences to this method since some embedding types make use of batching to increase speed.",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('The grass is green .')\n\nglove_embedding.embed(sentence)\n\nfor token in sentence:\n print(token)\n print(token.embedding)",
"Token: 1 The\ntensor([-0.0382, -0.2449, 0.7281, -0.3996, 0.0832, 0.0440, -0.3914, 0.3344,\n -0.5755, 0.0875, 0.2879, -0.0673, 0.3091, -0.2638, -0.1323, -0.2076,\n 0.3340, -0.3385, -0.3174, -0.4834, 0.1464, -0.3730, 0.3458, 0.0520,\n 0.4495, -0.4697, 0.0263, -0.5415, -0.1552, -0.1411, -0.0397, 0.2828,\n 0.1439, 0.2346, -0.3102, 0.0862, 0.2040, 0.5262, 0.1716, -0.0824,\n -0.7179, -0.4153, 0.2033, -0.1276, 0.4137, 0.5519, 0.5791, -0.3348,\n -0.3656, -0.5486, -0.0629, 0.2658, 0.3020, 0.9977, -0.8048, -3.0243,\n 0.0125, -0.3694, 2.2167, 0.7220, -0.2498, 0.9214, 0.0345, 0.4674,\n 1.1079, -0.1936, -0.0746, 0.2335, -0.0521, -0.2204, 0.0572, -0.1581,\n -0.3080, -0.4162, 0.3797, 0.1501, -0.5321, -0.2055, -1.2526, 0.0716,\n 0.7056, 0.4974, -0.4206, 0.2615, -1.5380, -0.3022, -0.0734, -0.2831,\n 0.3710, -0.2522, 0.0162, -0.0171, -0.3898, 0.8742, -0.7257, -0.5106,\n -0.5203, -0.1459, 0.8278, 0.2706])\nToken: 2 grass\ntensor([-0.8135, 0.9404, -0.2405, -0.1350, 0.0557, 0.3363, 0.0802, -0.1015,\n -0.5478, -0.3537, 0.0734, 0.2587, 0.1987, -0.1433, 0.2507, 0.4281,\n 0.1950, 0.5346, 0.7424, 0.0578, -0.3178, 0.9436, 0.8145, -0.0824,\n 0.6166, 0.7284, -0.3262, -1.3641, 0.1232, 0.5373, -0.5123, 0.0246,\n 1.0822, -0.2296, 0.6039, 0.5541, -0.9610, 0.4803, 0.0022, 0.5591,\n -0.1637, -0.8468, 0.0741, -0.6216, 0.0260, -0.5162, -0.0525, -0.1418,\n -0.0161, -0.4972, -0.5534, -0.4037, 0.5096, 1.0276, -0.0840, -1.1179,\n 0.3226, 0.4928, 0.9488, 0.2040, 0.5388, 0.8397, -0.0689, 0.3136,\n 1.0450, -0.2267, -0.0896, -0.6427, 0.6443, -1.1001, -0.0096, 0.2668,\n -0.3230, -0.6065, 0.0479, -0.1664, 0.8571, 0.2335, 0.2539, 1.2546,\n 0.5472, -0.1980, -0.7186, 0.2076, -0.2587, -0.3650, 0.0834, 0.6932,\n 0.1574, 1.0931, 0.0913, -1.3773, -0.2717, 0.7071, 0.1872, -0.3307,\n -0.2836, 0.1030, 1.2228, 0.8374])\nToken: 3 is\ntensor([-0.5426, 0.4148, 1.0322, -0.4024, 0.4669, 0.2182, -0.0749, 0.4733,\n 0.0810, -0.2208, -0.1281, -0.1144, 0.5089, 0.1157, 0.0282, -0.3628,\n 0.4382, 0.0475, 0.2028, 0.4986, -0.1007, 0.1327, 0.1697, 0.1165,\n 0.3135, 0.2571, 0.0928, -0.5683, -0.5297, -0.0515, -0.6733, 0.9253,\n 0.2693, 0.2273, 0.6636, 0.2622, 0.1972, 0.2609, 0.1877, -0.3454,\n -0.4263, 0.1398, 0.5634, -0.5691, 0.1240, -0.1289, 0.7248, -0.2610,\n -0.2631, -0.4360, 0.0789, -0.8415, 0.5160, 1.3997, -0.7646, -3.1453,\n -0.2920, -0.3125, 1.5129, 0.5243, 0.2146, 0.4245, -0.0884, -0.1780,\n 1.1876, 0.1058, 0.7657, 0.2191, 0.3582, -0.1164, 0.0933, -0.6248,\n -0.2190, 0.2180, 0.7406, -0.4374, 0.1434, 0.1472, -1.1605, -0.0505,\n 0.1268, -0.0144, -0.9868, -0.0913, -1.2054, -0.1197, 0.0478, -0.5400,\n 0.5246, -0.7096, -0.3253, -0.1346, -0.4131, 0.3343, -0.0072, 0.3225,\n -0.0442, -1.2969, 0.7622, 0.4635])\nToken: 4 green\ntensor([-6.7907e-01, 3.4908e-01, -2.3984e-01, -9.9652e-01, 7.3782e-01,\n -6.5911e-04, 2.8010e-01, 1.7287e-02, -3.6063e-01, 3.6955e-02,\n -4.0395e-01, 2.4092e-02, 2.8958e-01, 4.0497e-01, 6.9992e-01,\n 2.5269e-01, 8.0350e-01, 4.9370e-02, 1.5562e-01, -6.3286e-03,\n -2.9414e-01, 1.4728e-01, 1.8977e-01, -5.1791e-01, 3.6986e-01,\n 7.4582e-01, 8.2689e-02, -7.2601e-01, -4.0939e-01, -9.7822e-02,\n -1.4096e-01, 7.1121e-01, 6.1933e-01, -2.5014e-01, 4.2250e-01,\n 4.8458e-01, -5.1915e-01, 7.7125e-01, 3.6685e-01, 4.9652e-01,\n -4.1298e-02, -1.4683e+00, 2.0038e-01, 1.8591e-01, 4.9860e-02,\n -1.7523e-01, -3.5528e-01, 9.4153e-01, -1.1898e-01, -5.1903e-01,\n -1.1887e-02, -3.9186e-01, -1.7479e-01, 9.3451e-01, -5.8931e-01,\n -2.7701e+00, 3.4522e-01, 8.6533e-01, 1.0808e+00, -1.0291e-01,\n -9.1220e-02, 5.5092e-01, -3.9473e-01, 5.3676e-01, 1.0383e+00,\n -4.0658e-01, 2.4590e-01, -2.6797e-01, -2.6036e-01, -1.4151e-01,\n -1.2022e-01, 1.6234e-01, -7.4320e-01, -6.4728e-01, 4.7133e-02,\n 5.1642e-01, 1.9898e-01, 2.3919e-01, 1.2550e-01, 2.2471e-01,\n 8.2613e-01, 7.8328e-02, -5.7020e-01, 2.3934e-02, -1.5410e-01,\n -2.5739e-01, 4.1262e-01, -4.6967e-01, 8.7914e-01, 7.2629e-01,\n 5.3862e-02, -1.1575e+00, -4.7835e-01, 2.0139e-01, -1.0051e+00,\n 1.1515e-01, -9.6609e-01, 1.2960e-01, 1.8388e-01, -3.0383e-02])\nToken: 5 .\ntensor([-0.3398, 0.2094, 0.4635, -0.6479, -0.3838, 0.0380, 0.1713, 0.1598,\n 0.4662, -0.0192, 0.4148, -0.3435, 0.2687, 0.0446, 0.4213, -0.4103,\n 0.1546, 0.0222, -0.6465, 0.2526, 0.0431, -0.1945, 0.4652, 0.4565,\n 0.6859, 0.0913, 0.2188, -0.7035, 0.1679, -0.3508, -0.1263, 0.6638,\n -0.2582, 0.0365, -0.1361, 0.4025, 0.1429, 0.3813, -0.1228, -0.4589,\n -0.2528, -0.3043, -0.1121, -0.2618, -0.2248, -0.4455, 0.2991, -0.8561,\n -0.1450, -0.4909, 0.0083, -0.1749, 0.2752, 1.4401, -0.2124, -2.8435,\n -0.2796, -0.4572, 1.6386, 0.7881, -0.5526, 0.6500, 0.0864, 0.3901,\n 1.0632, -0.3538, 0.4833, 0.3460, 0.8417, 0.0987, -0.2421, -0.2705,\n 0.0453, -0.4015, 0.1139, 0.0062, 0.0367, 0.0185, -1.0213, -0.2081,\n 0.6407, -0.0688, -0.5864, 0.3348, -1.1432, -0.1148, -0.2509, -0.4591,\n -0.0968, -0.1795, -0.0634, -0.6741, -0.0689, 0.5360, -0.8777, 0.3180,\n -0.3924, -0.2339, 0.4730, -0.0288])\n"
]
],
[
[
"GloVe embeddings are Pytorch vectors of dimensionality 100.\n\nWe choose which pre-trained embeddings we want to load by passing the appropriate id string to the constructor of the WordEmbeddings class. We would use the two-letter language code to init an embedding, so 'en' for English and 'de' for German and so on. By default, this will initialize FastText embeddings trained over Wikipedia. We can also always use FastText embeddings over Web crawls, by instantiating with '-crawl'. The 'de-crawl' option would use embeddings trained over German web crawls.\n\nFor English, Flair provides a few more options. We can choose between instantiating 'en-glove', 'en-extvec' and so on.",
"_____no_output_____"
],
[
"If we want to load German FastText embeddings, instantiate as follows:",
"_____no_output_____"
]
],
[
[
"german_embedding = WordEmbeddings('de')",
"_____no_output_____"
]
],
[
[
"If we want to load German FastText embeddings trained over crawls, we instantiate as follows:",
"_____no_output_____"
]
],
[
[
"german_embedding = WordEmbeddings('de-crawl')",
"_____no_output_____"
]
],
[
[
"If the models are not locally available, Flair will automatically download them and install them into the local user cache.",
"_____no_output_____"
],
[
"It is recommended to use the FastText embeddings, or GloVe if we want a smaller model.\n\nIf we want to use any other embeddings (not listed in the list above), we can load those by calling:",
"_____no_output_____"
]
],
[
[
"custom_embedding = WordEmbeddings('path/to/your/custom/embeddings.gensim')",
"_____no_output_____"
]
],
[
[
"If we want to load custom embeddings, we need to make sure that the custom embeddings are correctly formatted to gensim.\n\nWe can, for example, convert FastText embeddings to gensim using the following code snippet:",
"_____no_output_____"
]
],
[
[
"import gensim\n\nword_vectors = gensim.models.KeyedVectors.load_word2vec_format('/path/to/fasttext/embeddings.txt', binary=False)\nword_vectors.save('/path/to/converted')",
"_____no_output_____"
]
],
[
[
"## Character Embeddings",
"_____no_output_____"
],
[
"Some embeddings - such as character-features - are not pre-trained but rather trained on the downstream task. Normally this requires an implementation of a hierarchical embedding architecture.\n\nWith Flair, we don't need to worry about such things. Just choose the appropriate embedding class and the character features will then automatically train during downstream task training.",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import CharacterEmbeddings\n\nembedding = CharacterEmbeddings()\n\nsentence = Sentence('The grass is green .')\n\nembedding.embed(sentence)",
"_____no_output_____"
]
],
[
[
"### Sub-Word Embeddings",
"_____no_output_____"
],
[
"Flair now also includes the byte pair embeddings calulated by @bheinzerling that segment words into subsequences. This can dramatically reduce the model size vis-a-vis using normal word embeddings at nearly the same accuracy. So, if we want to train small models try out the new BytePairEmbeddings class.",
"_____no_output_____"
],
[
"We initialize with a language code (275 languages supported), a number of 'syllables', and a number of dimensions (one of 50, 100, 200 or 300). The following initializes and uses byte pair embeddings for English:",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import BytePairEmbeddings\n\nembedding = BytePairEmbeddings('en')\n\nsentence = Sentence('The grass is green .')\n\nembedding.embed(sentence)",
"_____no_output_____"
]
],
[
[
"[Sub-word embeddings](https://nlp.h-its.org/bpemb/) are interesting, since \n\n[BPEmb](https://nlp.h-its.org/bpemb/) is a collection of pre-trained subword embeddings in 275 languages, based on Byte-Pair Encoding (BPE) and trained on Wikipedia. Its intended use is as input for neural models in natural language processing.\n\n- subwords allow guessing the meaning of unknown / out-of-vocabulary words. E.g., the suffix -shire in Melfordshire indicates a location.\n- Byte-Pair Encoding gives a subword segmentation that is often good enough, without requiring tokenization or morphological analysis. In this case the BPE segmentation might be something like melf ord shire.\n- Pre-trained byte-pair embeddings work surprisingly well, while requiring no tokenization and being much smaller than alternatives: an 11 MB BPEmb English model matches the results of the 6 GB FastText model in our evaluation.",
"_____no_output_____"
],
[
"If you are using word embeddings like word2vec or GloVe, you have probably encountered out-of-vocabulary words, i.e., words for which no embedding exists. A makeshift solution is to replace such words with an UNK token and train a generic embedding representing such unknown words.\n\nSubword approaches try to solve the unknown word problem differently, by assuming that you can reconstruct a word's meaning from its parts. For example, the suffix -shire lets you guess that Melfordshire is probably a location, or the suffix -osis that Myxomatosis might be a sickness.\n\nThere are many ways of splitting a word into subwords. A simple method is to split into characters and then learn to transform this character sequence into a vector representation by feeding it to a convolutional neural network (CNN) or a recurrent neural network (RNN), usually a long-short term memory (LSTM). This vector representation can then be used like a word embedding.\n\nAnother, more linguistically motivated way is a morphological analysis, but this requires tools and training data which might not be available for your language and domain of interest.\n\nEnter Byte-Pair Encoding (BPE) [Sennrich et al, 2016], an unsupervised subword segmentation method. BPE starts with a sequence of symbols, for example characters, and iteratively merges the most frequent symbol pair into a new symbol.\n\nFor example, applying BPE to English might first merge the characters h and e into a new symbol he, then t and h into th, then t and he into the, and so on.\n\nLearning these merge operations from a large corpus (e.g. all Wikipedia articles in a given language) often yields reasonable subword segementations. For example, a BPE model trained on English Wikipedia splits melfordshire into mel, ford, and shire.",
"_____no_output_____"
],
[
"### Stacked Embeddings",
"_____no_output_____"
],
[
"Stacked embeddings are one of the most important concepts of Flair. We can use them to combine different embeddings together, for instance if we want to use both traditional embeddings together with contextual string embeddings (see below). Stacked embeddings allow us to mix and match. We find that a combination of embeddings often gives best results.\n\nAll we need to do is use the StackedEmbeddings class and instantiate it by passing a list of embeddings that we wish to combine. For instance, lets combine classic GloVe embeddings with character embeddings. This is effectively the architecture proposed in (Lample et al., 2016).",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import WordEmbeddings, CharacterEmbeddings\n\nglove_embedding = WordEmbeddings('glove')\n\ncharacter_embeddings = CharacterEmbeddings()",
"_____no_output_____"
]
],
[
[
"Now instantiate the StackedEmbeddings class and pass it a list containing these two embeddings.",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import StackedEmbeddings\n\nstacked_embeddings = StackedEmbeddings(\n embeddings=[glove_embedding, character_embeddings])",
"_____no_output_____"
]
],
[
[
"We use this embedding like all the other embeddings, i.e. call the embed() method over our sentences.",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('The grass is green .')\n\nstacked_embeddings.embed(sentence)\n\nfor token in sentence:\n print(token)\n print(token.embedding)",
"Token: 1 The\ntensor([-0.0382, -0.2449, 0.7281, ..., -0.0065, -0.0053, 0.0090])\nToken: 2 grass\ntensor([-0.8135, 0.9404, -0.2405, ..., 0.0354, -0.0255, -0.0143])\nToken: 3 is\ntensor([-5.4264e-01, 4.1476e-01, 1.0322e+00, ..., -5.3691e-04,\n -9.6750e-03, -2.7541e-02])\nToken: 4 green\ntensor([-0.6791, 0.3491, -0.2398, ..., -0.0007, -0.1333, 0.0161])\nToken: 5 .\ntensor([-0.3398, 0.2094, 0.4635, ..., 0.0005, -0.0177, 0.0032])\n"
]
],
[
[
"Words are now embedded using a concatenation of two different embeddings. This means that the resulting embedding vector is still a single PyTorch vector.",
"_____no_output_____"
],
[
"## Other Embeddings: BERT, ELMo, Flair",
"_____no_output_____"
],
[
"Next to standard WordEmbeddings and CharacterEmbeddings, Flair also provides classes for BERT, ELMo and Flair embeddings. These embeddings enable us to train truly state-of-the-art NLP models.\n\nAll word embedding classes inherit from the TokenEmbeddings class and implement the embed() method which we need to call to embed our text. This means that for most users of Flair, the complexity of different embeddings remains hidden behind this interface. We instantiate the embedding class we require and call embed() to embed our text.\n\nAll embeddings produced with Flair's methods are Pytorch vectors, so they can be immediately used for training and fine-tuning.",
"_____no_output_____"
],
[
"### Flair Embeddings",
"_____no_output_____"
],
[
"Contextual string embeddings are powerful embeddings that capture latent syntactic-semantic information that goes beyond standard word embeddings. Key differences are: (1) they are trained without any explicit notion of words and thus fundamentally model words as sequences of characters. And (2) they are contextualized by their surrounding text, meaning that the same word will have different embeddings depending on its contextual use.\n\nRecent advances in language modeling using recurrent neural networks have made it viable to model language as distributions over characters. By learning to predict the next character on the basis of previous characters, such models have been shown to automatically internalize linguistic concepts such as words, sentences, subclauses and even sentiment. In Flair the internal states of a trained character language model is leveraged to produce a novel type of word embedding which the authors refer to as contextual string embeddings. The proposed embeddings have the distinct properties that they (a) are trained without any explicit notion of words and thus fundamentally model words as sequences of characters, and (b) are contextualized by their surrounding text, meaning that the same word will have different embeddings depending on its contextual use. The authors conduct a comparative evaluation against previous embeddings and find that their embeddings are highly useful for downstream tasks: across four classic sequence labeling tasks they consistently outperform the previous state-of-the-art. In particular, they significantly outperform previous work on English and German named entity recognition (NER), allowing them to report new state-of-the-art F1-scores on the CONLL03 shared task.\n\nWith Flair, we can use these embeddings simply by instantiating the appropriate embedding class, same as standard word embeddings:",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import FlairEmbeddings\n\nflair_embedding_forward = FlairEmbeddings('news-forward')\n\nsentence = Sentence('The grass is green .')\n\nflair_embedding_forward.embed(sentence)",
"_____no_output_____"
]
],
[
[
"We can choose which embeddings we load by passing the appropriate string to the constructor of the FlairEmbeddings class. Currently, there are numerous contextual string embeddings provided in models (more coming). See [list](https://github.com/zalandoresearch/flair/blob/master/resources/docs/TUTORIAL_4_ELMO_BERT_FLAIR_EMBEDDING.md).",
"_____no_output_____"
],
[
"The recommendation is to combine both forward and backward Flair embeddings. Depending on the task, it is also recommended to add standard word embeddings into the mix. So, the recommendation is to use StackedEmbedding for most English tasks:",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import WordEmbeddings, FlairEmbeddings, StackedEmbeddings\n\nstacked_embeddings = StackedEmbeddings([\n WordEmbeddings('glove'), \n FlairEmbeddings('news-forward'), \n FlairEmbeddings('news-backward'),\n ])",
"_____no_output_____"
]
],
[
[
"We would use this embedding like all the other embeddings, i.e. call the embed() method over our sentences.",
"_____no_output_____"
],
[
"### BERT Embeddings",
"_____no_output_____"
],
[
"BERT embeddings were developed by Devlin et al. (2018) and are a different kind of powerful word embedding based on a bidirectional transformer architecture. Flair is using the implementation of huggingface. The embeddings are wrapped into our simple embedding interface, so that they can be used like any other embedding.",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import BertEmbeddings\n\nembedding = BertEmbeddings()\n\nsentence = Sentence('The grass is green .')\n\nembedding.embed(sentence)",
"_____no_output_____"
],
[
"for i in sentence:\n print(i, i.embedding)",
"Token: 1 The tensor([-0.0323, -0.3904, -1.1946, ..., 0.1305, -0.1365, -0.4323])\nToken: 2 grass tensor([-0.3973, 0.2652, -0.1337, ..., 0.3715, 0.1097, -1.1625])\nToken: 3 is tensor([ 0.1374, -0.3688, -0.8292, ..., 0.2533, 0.0294, 0.4293])\nToken: 4 green tensor([-0.7722, -0.1152, 0.3661, ..., 0.1575, -0.0682, -0.7661])\nToken: 5 . tensor([ 0.1441, -0.1772, -0.5911, ..., -1.4830, 0.1995, -0.0112])\n"
]
],
[
[
"We can load any of the pre-trained BERT models by providing the model string during initialization:",
"_____no_output_____"
],
[
"- 'bert-base-uncased': English; 12-layer, 768-hidden, 12-heads, 110M parameters\n- 'bert-large-uncased': English; 24-layer, 1024-hidden, 16-heads, 340M parameters\n- 'bert-base-cased': English; 12-layer, 768-hidden, 12-heads , 110M parameters\n- 'bert-large-cased': English; 24-layer, 1024-hidden, 16-heads, 340M parameters\n- 'bert-base-multilingual-cased': 104 languages; 12-layer, 768-hidden, 12-heads, 110M parameters\n- 'bert-base-chinese': Chinese Simplified and Traditional; 12-layer, 768-hidden, 12-heads, 110M parameters",
"_____no_output_____"
],
[
"### ELMo Embeddings",
"_____no_output_____"
],
[
"ELMo embeddings were presented by Peters et al. in 2018. They are using a bidirectional recurrent neural network to predict the next word in a text. Flair is using the implementation of AllenNLP. As this implementation comes with a lot of sub-dependencies, which Flair authors don't want to include in Flair, you need to first install the library via `pip install allennlp` before we can use it in Flair. Using the embeddings is as simple as using any other embedding type. To specify the correct model, pick one of *small*, *medium*, *portugese*, *original*:",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import ELMoEmbeddings\n\nembedding = ELMoEmbeddings(model=\"small\")\n\nsentence = Sentence('The grass is green .')\n\nembedding.embed(sentence)",
"_____no_output_____"
]
],
[
[
"AllenNLP provides the following pre-trained models. To use any of the following models inside Flair simple specify the embedding id when initializing the ELMoEmbeddings.",
"_____no_output_____"
],
[
"- 'small': English; 1024-hidden, 1 layer, 14.6M parameters\n- 'medium': English; 2048-hidden, 1 layer, 28.0M parameters\n- 'original': English; 4096-hidden, 2 layers, 93.6M parameters\n- 'pt': Portuguese\n- 'pubmed': English biomedical data; more information",
"_____no_output_____"
],
[
"### BERT and Flair Combined",
"_____no_output_____"
],
[
"We can very easily mix and match Flair, ELMo, BERT and classic word embeddings. We instantiate each embedding we wish to combine and use them in a StackedEmbedding.\n\nFor instance, let's say we want to combine the multilingual Flair and BERT embeddings to train a hyper-powerful multilingual downstream task model.\n\nFirst, instantiate the embeddings we wish to combine:",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import FlairEmbeddings, BertEmbeddings\n\nflair_forward_embedding = FlairEmbeddings('multi-forward')\nflair_backward_embedding = FlairEmbeddings('multi-backward')\n\nbert_embedding = BertEmbeddings('bert-base-multilingual-cased')",
"_____no_output_____"
]
],
[
[
"Now we instantiate the StackedEmbeddings class and pass it a list containing these three embeddings:",
"_____no_output_____"
]
],
[
[
"from flair.embeddings import StackedEmbeddings\n\nstacked_embeddings = StackedEmbeddings(\n embeddings=[flair_forward_embedding, flair_backward_embedding, bert_embedding])",
"_____no_output_____"
]
],
[
[
"We use this embedding like all the other embeddings, i.e. call the embed() method over our sentences.",
"_____no_output_____"
]
],
[
[
"sentence = Sentence('The grass is green .')\n\nstacked_embeddings.embed(sentence)\n\nfor token in sentence:\n print(token)\n print(token.embedding)",
"Token: 1 The\ntensor([-1.4812e-07, 4.5007e-08, 6.0273e-07, ..., 3.8287e-01,\n 4.7210e-01, 2.9850e-01])\nToken: 2 grass\ntensor([ 1.6254e-04, 1.8764e-07, -7.9034e-09, ..., 8.5283e-01,\n -5.0724e-02, 3.4476e-01])\nToken: 3 is\ntensor([-2.4521e-04, 3.4869e-07, 5.5841e-06, ..., -1.8283e-01,\n 7.1532e-01, 5.0825e-03])\nToken: 4 green\ntensor([8.3005e-05, 4.7261e-08, 5.7316e-07, ..., 1.0157e+00, 7.5358e-01,\n 1.1230e-01])\nToken: 5 .\ntensor([-8.3244e-07, 1.6451e-07, -1.7201e-08, ..., -6.0930e-01,\n 9.0591e-01, 1.7857e-01])\n"
]
],
[
[
"Words are now embedded using a concatenation of three different embeddings. This means that the resulting embedding vector is still a single PyTorch vector.",
"_____no_output_____"
],
[
"## Document Embeddings",
"_____no_output_____"
],
[
"Document embeddings are different from word embeddings in that they provide one embedding for an entire text, whereas word embeddings provide embeddings for individual words.",
"_____no_output_____"
],
[
"...",
"_____no_output_____"
],
[
"**(C) 2018-2020 by [Damir Cavar](http://damir.cavar.me/)**",
"_____no_output_____"
]
]
] | [
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown",
"code",
"markdown"
] | [
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown"
],
[
"code",
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown"
],
[
"code"
],
[
"markdown",
"markdown",
"markdown",
"markdown",
"markdown"
]
] |
d0cdf272240683801626bc98b2d14532c1485e56 | 1,175 | ipynb | Jupyter Notebook | demo/survey-data.ipynb | ryuntalan/jupyterlab-tabular-data-editor | 507bf9f17efb6f01b69ff32f3f616eada23a796c | [
"BSD-3-Clause"
] | 120 | 2020-07-08T08:37:46.000Z | 2022-03-08T16:34:43.000Z | demo/survey-data.ipynb | ryuntalan/jupyterlab-tabular-data-editor | 507bf9f17efb6f01b69ff32f3f616eada23a796c | [
"BSD-3-Clause"
] | 146 | 2020-06-23T19:26:15.000Z | 2021-06-30T23:05:38.000Z | demo/survey-data.ipynb | ryuntalan/jupyterlab-tabular-data-editor | 507bf9f17efb6f01b69ff32f3f616eada23a796c | [
"BSD-3-Clause"
] | 16 | 2020-07-14T12:54:36.000Z | 2021-04-17T16:05:52.000Z | 18.076923 | 90 | 0.514894 | [
[
[
"import pandas as pd",
"_____no_output_____"
],
[
"data = pd.read_csv('survey-data(cleaned).csv')\ndf = pd.DataFrame(data)\ndf",
"_____no_output_____"
],
[
"df2 = df.groupby(['Company Satisfaction', 'Age'])['Company Satisfaction'].count()\ndf2",
"_____no_output_____"
],
[
"df2.unstack('Age').plot.barh()",
"_____no_output_____"
]
]
] | [
"code"
] | [
[
"code",
"code",
"code",
"code"
]
] |
d0cdf74174b7ae3419a01f57df87a352f8624066 | 152,947 | ipynb | Jupyter Notebook | sample-code/notebooks/4-03.ipynb | luka3117/practical_python | d5205968bedf3433c96b10e52d59d5607d6e8169 | [
"CC0-1.0"
] | 29 | 2019-02-17T23:51:17.000Z | 2021-09-10T10:30:51.000Z | sample-code/notebooks/4-03.ipynb | luka3117/practical_python | d5205968bedf3433c96b10e52d59d5607d6e8169 | [
"CC0-1.0"
] | null | null | null | sample-code/notebooks/4-03.ipynb | luka3117/practical_python | d5205968bedf3433c96b10e52d59d5607d6e8169 | [
"CC0-1.0"
] | 12 | 2019-02-27T23:02:06.000Z | 2021-09-12T10:43:37.000Z | 536.65614 | 56,756 | 0.943052 | [
[
[
"## 第4章 Matplotlibでグラフを 描画しよう\n\n### 4-3: 折れ線グラフ",
"_____no_output_____"
]
],
[
[
"import matplotlib.pyplot as plt",
"_____no_output_____"
],
[
"# リスト4.3.1:折れ線グラフの描画\nplt.style.use(\"ggplot\")\nfig = plt.figure()\nax = fig.add_subplot(111)\nax.plot([1, 3])\nplt.show()",
"_____no_output_____"
],
[
"# リスト4.3.2:X値とY値を指定した折れ線グラフの描画\nfig = plt.figure()\nax = fig.add_subplot(111)\nx = [0, 2, 4]\ny = [0, 4, 2]\nax.plot(x, y)\nplt.show()",
"_____no_output_____"
],
[
"# リスト4.3.3:複数の線の描画\nfig = plt.figure()\nax = fig.add_subplot(111)\nx = [0, 2, 4]\ny1 = [0, 4, 2.5]\ny2 = [4, 0, 1.5]\n# 2本の線を描画\nax.plot(x, y1)\nax.plot(x, y2)\nplt.show()",
"_____no_output_____"
],
[
"# リスト4.3.4:anime_stock_returns.csvファイルの読み込み\nimport os\nimport pandas as pd\n\nbase_url = (\"https://raw.githubusercontent.com/practical-jupyter/sample-data/master/anime/\")\nanime_stock_returns_csv = os.path.join(base_url, \"anime_stock_returns.csv\")\ndf = pd.read_csv(anime_stock_returns_csv, index_col=0, parse_dates=[\"Date\"])\ndf.head()",
"_____no_output_____"
],
[
"# リスト4.3.5:anime_stock_returns.csvの折れ線グラフ\nfig = plt.figure(figsize=(10, 4))\nax = fig.add_subplot(111)\n# データと凡例を指定\nax.plot(df.index, df[\"TOEI ANIMATION\"], label=\"TOEI ANIMATION\")\nax.plot(df.index, df[\"IG Port\"], label=\"IG Port\")\n# タイトル、 軸ラベルを指定\nax.set_title(\"株価騰落率 2年間の推移\")\nax.set_ylabel(\"株価騰落率\")\nax.set_xlabel(\"年月\")\n# 凡例を有効化\nax.legend()\nplt.show()",
"_____no_output_____"
],
[
"# リスト4.3.6:2軸を持つグラフ\nt4816_csv = os.path.join(base_url, \"4816.csv\")\ndf = pd.read_csv(t4816_csv, index_col=0, parse_dates=[\"Date\"])\nfig = plt.figure(figsize=(10, 4))\nax1 = fig.add_subplot(111)\nax1.plot(df.index, df[\"Close\"], color=\"b\", label=\"株価\")\n# X軸を共有しY軸を2つ使用する設定\nax2 = ax1.twinx()\nax2.bar(df.index, df[\"Volume\"], color=\"g\", label=\"出来高\", width=2)\n# 軸と軸ラベルの設定\nax1.set_yticks([i * 2000 for i in range(5)])\nax1.set_ylabel(\"株価\")\nax2.set_yticks([i * 50000 for i in range(5)])\nax2.set_ylabel(\"出来高\")\nax1.set_xlabel(\"年月\")\n# グラフタイトルの設定\nax1.set_title(\"株価と出来高\")\n# 凡例の設定\nax1.legend(loc=1)\nax2.legend(loc=2)\nplt.show()",
"_____no_output_____"
]
]
] | [
"markdown",
"code"
] | [
[
"markdown"
],
[
"code",
"code",
"code",
"code",
"code",
"code",
"code"
]
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.