Skip to content

Commit 16540cd

Browse files
committed
Correcting indentation and line wrap
1 parent 6c0e9d4 commit 16540cd

File tree

3 files changed

+475
-440
lines changed

3 files changed

+475
-440
lines changed

tensorflow_tutorial_2.ipynb

Lines changed: 32 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
{
1717
"cell_type": "code",
1818
"execution_count": 1,
19-
"metadata": {},
19+
"metadata": {
20+
"collapsed": true
21+
},
2022
"outputs": [],
2123
"source": [
2224
"import numpy as np\n",
@@ -39,6 +41,29 @@
3941
"To keep things simple we will create a simple multilayer perceptron with only one hidden layer with size 5000 (half the size of the input) and see how it goes."
4042
]
4143
},
44+
{
45+
"cell_type": "code",
46+
"execution_count": null,
47+
"metadata": {
48+
"collapsed": true
49+
},
50+
"outputs": [],
51+
"source": [
52+
"# Load the dataset\n",
53+
"newsgroups = np.load('./resources/newsgroup.npz')\n",
54+
"\n",
55+
"# Define the model\n",
56+
"model = MLPClassifier(\n",
57+
" activation='relu', # Rectifier Linear Unit activation\n",
58+
" hidden_layer_sizes=(5000,), # 1 hidden layer of size 5000\n",
59+
" max_iter=5, # Each epochs takes a lot of time so we keep it to 5\n",
60+
" batch_size=100, # The batch size is set to 100 elements\n",
61+
" solver='adam') # We use the adam solver\n",
62+
"\n",
63+
"model.fit(newsgroups['train_data'],\n",
64+
" newsgroups['train_target'])"
65+
]
66+
},
4267
{
4368
"cell_type": "code",
4469
"execution_count": 2,
@@ -78,37 +103,23 @@
78103
}
79104
],
80105
"source": [
81-
"# Load the dataset\n",
82-
"newsgroups = np.load('./resources/newsgroup.npz')\n",
83-
"\n",
84-
"# Define the model\n",
85-
"model = MLPClassifier(\n",
86-
" activation='relu', # Rectifier Linear Unit activation\n",
87-
" hidden_layer_sizes=(5000,), # 1 hidden layer of size 5000\n",
88-
" max_iter=5, # Each epochs takes a lot of time so we keep it to 5\n",
89-
" batch_size=100, # The batch size is set to 100 elements\n",
90-
" solver='adam') # We use the adam solver\n",
91-
"\n",
92-
"model.fit(newsgroups['train_data'],\n",
93-
" newsgroups['train_target'])\n",
94-
"\n",
95106
"accuracy = accuracy_score(\n",
96-
" newsgroups['test_target'],\n",
97-
" model.predict(newsgroups['test_data']))\n",
107+
" newsgroups['test_target'],\n",
108+
" model.predict(newsgroups['test_data']))\n",
98109
"\n",
99110
"print(\"Accuracy: %.2f\" % accuracy)\n",
100111
"\n",
101112
"print(classification_report(\n",
102-
" newsgroups['test_target'],\n",
103-
" model.predict(newsgroups['test_data'])))"
113+
" newsgroups['test_target'],\n",
114+
" model.predict(newsgroups['test_data'])))"
104115
]
105116
}
106117
],
107118
"metadata": {
108119
"kernelspec": {
109-
"display_name": "Python [conda env:tensorflow-tutorial]",
120+
"display_name": "Python [conda env:env_edm]",
110121
"language": "python",
111-
"name": "conda-env-tensorflow-tutorial-py"
122+
"name": "conda-env-env_edm-py"
112123
},
113124
"language_info": {
114125
"codemirror_mode": {

0 commit comments

Comments
 (0)