Skip to content

Commit e925897

Browse files
authored
add --profile=black to isort args (#1702)
* add --profile=black to isort args * Reformat impacted notebooks
1 parent 1684ceb commit e925897

13 files changed

+92
-125
lines changed

docs/ipynb/customized.ipynb

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"outputs": [],
1010
"source": [
11-
"!pip install autokeras\n"
11+
"!pip install autokeras"
1212
]
1313
},
1414
{
@@ -23,7 +23,7 @@
2323
"import tensorflow as tf\n",
2424
"from tensorflow.keras.datasets import mnist\n",
2525
"\n",
26-
"import autokeras as ak\n"
26+
"import autokeras as ak"
2727
]
2828
},
2929
{
@@ -67,7 +67,6 @@
6767
},
6868
"outputs": [],
6969
"source": [
70-
"\n",
7170
"input_node = ak.ImageInput()\n",
7271
"output_node = ak.Normalization()(input_node)\n",
7372
"output_node1 = ak.ConvBlock()(output_node)\n",
@@ -77,7 +76,7 @@
7776
"\n",
7877
"auto_model = ak.AutoModel(\n",
7978
" inputs=input_node, outputs=output_node, overwrite=True, max_trials=1\n",
80-
")\n"
79+
")"
8180
]
8281
},
8382
{
@@ -108,7 +107,6 @@
108107
},
109108
"outputs": [],
110109
"source": [
111-
"\n",
112110
"(x_train, y_train), (x_test, y_test) = mnist.load_data()\n",
113111
"print(x_train.shape) # (60000, 28, 28)\n",
114112
"print(y_train.shape) # (60000,)\n",
@@ -119,7 +117,7 @@
119117
"# Predict with the best model.\n",
120118
"predicted_y = auto_model.predict(x_test)\n",
121119
"# Evaluate the best model with testing data.\n",
122-
"print(auto_model.evaluate(x_test, y_test))\n"
120+
"print(auto_model.evaluate(x_test, y_test))"
123121
]
124122
},
125123
{
@@ -176,7 +174,6 @@
176174
},
177175
"outputs": [],
178176
"source": [
179-
"\n",
180177
"class SingleDenseLayerBlock(ak.Block):\n",
181178
" def build(self, hp, inputs=None):\n",
182179
" # Get the input_node from inputs.\n",
@@ -185,8 +182,7 @@
185182
" hp.Int(\"num_units\", min_value=32, max_value=512, step=32)\n",
186183
" )\n",
187184
" output_node = layer(input_node)\n",
188-
" return output_node\n",
189-
"\n"
185+
" return output_node"
190186
]
191187
},
192188
{
@@ -220,7 +216,7 @@
220216
"y_test = np.random.rand(num_instances, 1).astype(np.float32)\n",
221217
"# Train the model\n",
222218
"auto_model.fit(x_train, y_train, epochs=1)\n",
223-
"print(auto_model.evaluate(x_test, y_test))\n"
219+
"print(auto_model.evaluate(x_test, y_test))"
224220
]
225221
},
226222
{

docs/ipynb/export.ipynb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"outputs": [],
1010
"source": [
11-
"!pip install autokeras\n"
11+
"!pip install autokeras"
1212
]
1313
},
1414
{
@@ -23,7 +23,7 @@
2323
"from tensorflow.keras.datasets import mnist\n",
2424
"from tensorflow.keras.models import load_model\n",
2525
"\n",
26-
"import autokeras as ak\n"
26+
"import autokeras as ak"
2727
]
2828
},
2929
{
@@ -47,7 +47,6 @@
4747
},
4848
"outputs": [],
4949
"source": [
50-
"\n",
5150
"print(tf.__version__)\n",
5251
"(x_train, y_train), (x_test, y_test) = mnist.load_data()\n",
5352
"\n",
@@ -71,7 +70,7 @@
7170
"loaded_model = load_model(\"model_autokeras\", custom_objects=ak.CUSTOM_OBJECTS)\n",
7271
"\n",
7372
"predicted_y = loaded_model.predict(tf.expand_dims(x_test, -1))\n",
74-
"print(predicted_y)\n"
73+
"print(predicted_y)"
7574
]
7675
}
7776
],

docs/ipynb/image_classification.ipynb

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"outputs": [],
1010
"source": [
11-
"!pip install autokeras\n"
11+
"!pip install autokeras"
1212
]
1313
},
1414
{
@@ -23,7 +23,7 @@
2323
"import tensorflow as tf\n",
2424
"from tensorflow.keras.datasets import mnist\n",
2525
"\n",
26-
"import autokeras as ak\n"
26+
"import autokeras as ak"
2727
]
2828
},
2929
{
@@ -47,7 +47,7 @@
4747
"(x_train, y_train), (x_test, y_test) = mnist.load_data()\n",
4848
"print(x_train.shape) # (60000, 28, 28)\n",
4949
"print(y_train.shape) # (60000,)\n",
50-
"print(y_train[:3]) # array([7, 2, 1], dtype=uint8)\n"
50+
"print(y_train[:3]) # array([7, 2, 1], dtype=uint8)"
5151
]
5252
},
5353
{
@@ -83,7 +83,7 @@
8383
"\n",
8484
"\n",
8585
"# Evaluate the best model with testing data.\n",
86-
"print(clf.evaluate(x_test, y_test))\n"
86+
"print(clf.evaluate(x_test, y_test))"
8787
]
8888
},
8989
{
@@ -112,7 +112,7 @@
112112
" # Split the training data and use the last 15% as validation data.\n",
113113
" validation_split=0.15,\n",
114114
" epochs=10,\n",
115-
")\n"
115+
")"
116116
]
117117
},
118118
{
@@ -144,7 +144,7 @@
144144
" # Use your own validation set.\n",
145145
" validation_data=(x_val, y_val),\n",
146146
" epochs=10,\n",
147-
")\n"
147+
")"
148148
]
149149
},
150150
{
@@ -184,7 +184,7 @@
184184
"clf = ak.AutoModel(\n",
185185
" inputs=input_node, outputs=output_node, overwrite=True, max_trials=1\n",
186186
")\n",
187-
"clf.fit(x_train, y_train, epochs=10)\n"
187+
"clf.fit(x_train, y_train, epochs=10)"
188188
]
189189
},
190190
{
@@ -218,7 +218,7 @@
218218
"clf = ak.AutoModel(\n",
219219
" inputs=input_node, outputs=output_node, overwrite=True, max_trials=1\n",
220220
")\n",
221-
"clf.fit(x_train, y_train, epochs=10)\n"
221+
"clf.fit(x_train, y_train, epochs=10)"
222222
]
223223
},
224224
{
@@ -268,7 +268,7 @@
268268
"print(y_train[:3])\n",
269269
"# array([[0., 0., 0., 0., 0., 1., 0., 0., 0., 0.],\n",
270270
"# [1., 0., 0., 0., 0., 0., 0., 0., 0., 0.],\n",
271-
"# [0., 0., 0., 0., 1., 0., 0., 0., 0., 0.]])\n"
271+
"# [0., 0., 0., 0., 1., 0., 0., 0., 0., 0.]])"
272272
]
273273
},
274274
{
@@ -297,7 +297,7 @@
297297
"# Predict with the best model.\n",
298298
"predicted_y = clf.predict(test_set)\n",
299299
"# Evaluate the best model with testing data.\n",
300-
"print(clf.evaluate(test_set))\n"
300+
"print(clf.evaluate(test_set))"
301301
]
302302
},
303303
{

docs/ipynb/image_regression.ipynb

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"outputs": [],
1010
"source": [
11-
"!pip install autokeras\n"
11+
"!pip install autokeras"
1212
]
1313
},
1414
{
@@ -22,7 +22,7 @@
2222
"import tensorflow as tf\n",
2323
"from tensorflow.keras.datasets import mnist\n",
2424
"\n",
25-
"import autokeras as ak\n"
25+
"import autokeras as ak"
2626
]
2727
},
2828
{
@@ -49,13 +49,12 @@
4949
},
5050
"outputs": [],
5151
"source": [
52-
"\n",
5352
"(x_train, y_train), (x_test, y_test) = mnist.load_data()\n",
5453
"x_train = x_train[:100]\n",
5554
"y_train = y_train[:100]\n",
5655
"print(x_train.shape) # (60000, 28, 28)\n",
5756
"print(y_train.shape) # (60000,)\n",
58-
"print(y_train[:3]) # array([7, 2, 1], dtype=uint8)\n"
57+
"print(y_train[:3]) # array([7, 2, 1], dtype=uint8)"
5958
]
6059
},
6160
{
@@ -90,7 +89,7 @@
9089
"\n",
9190
"\n",
9291
"# Evaluate the best model with testing data.\n",
93-
"print(reg.evaluate(x_test, y_test))\n"
92+
"print(reg.evaluate(x_test, y_test))"
9493
]
9594
},
9695
{
@@ -119,7 +118,7 @@
119118
" # Split the training data and use the last 15% as validation data.\n",
120119
" validation_split=0.15,\n",
121120
" epochs=2,\n",
122-
")\n"
121+
")"
123122
]
124123
},
125124
{
@@ -151,7 +150,7 @@
151150
" # Use your own validation set.\n",
152151
" validation_data=(x_val, y_val),\n",
153152
" epochs=2,\n",
154-
")\n"
153+
")"
155154
]
156155
},
157156
{
@@ -191,7 +190,7 @@
191190
"reg = ak.AutoModel(\n",
192191
" inputs=input_node, outputs=output_node, overwrite=True, max_trials=1\n",
193192
")\n",
194-
"reg.fit(x_train, y_train, epochs=2)\n"
193+
"reg.fit(x_train, y_train, epochs=2)"
195194
]
196195
},
197196
{
@@ -225,7 +224,7 @@
225224
"reg = ak.AutoModel(\n",
226225
" inputs=input_node, outputs=output_node, overwrite=True, max_trials=1\n",
227226
")\n",
228-
"reg.fit(x_train, y_train, epochs=2)\n"
227+
"reg.fit(x_train, y_train, epochs=2)"
229228
]
230229
},
231230
{
@@ -278,7 +277,7 @@
278277
"# Predict with the best model.\n",
279278
"predicted_y = reg.predict(test_set)\n",
280279
"# Evaluate the best model with testing data.\n",
281-
"print(reg.evaluate(test_set))\n"
280+
"print(reg.evaluate(test_set))"
282281
]
283282
},
284283
{

docs/ipynb/load.ipynb

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"outputs": [],
1010
"source": [
11-
"!pip install autokeras\n"
11+
"!pip install autokeras"
1212
]
1313
},
1414
{
@@ -25,7 +25,7 @@
2525
"import numpy as np\n",
2626
"import tensorflow as tf\n",
2727
"\n",
28-
"import autokeras as ak\n"
28+
"import autokeras as ak"
2929
]
3030
},
3131
{
@@ -61,7 +61,7 @@
6161
"local_dir_path = os.path.dirname(local_file_path)\n",
6262
"# After check mannually, we know the extracted data is in 'flower_photos'.\n",
6363
"data_dir = os.path.join(local_dir_path, \"flower_photos\")\n",
64-
"print(data_dir)\n"
64+
"print(data_dir)"
6565
]
6666
},
6767
{
@@ -115,7 +115,7 @@
115115
" seed=123,\n",
116116
" image_size=(img_height, img_width),\n",
117117
" batch_size=batch_size,\n",
118-
")\n"
118+
")"
119119
]
120120
},
121121
{
@@ -137,7 +137,7 @@
137137
"source": [
138138
"clf = ak.ImageClassifier(overwrite=True, max_trials=1)\n",
139139
"clf.fit(train_data, epochs=1)\n",
140-
"print(clf.evaluate(test_data))\n"
140+
"print(clf.evaluate(test_data))"
141141
]
142142
},
143143
{
@@ -171,8 +171,7 @@
171171
"data_dir = os.path.join(local_dir_path, \"aclImdb\")\n",
172172
"# Remove the unused data folder.\n",
173173
"\n",
174-
"shutil.rmtree(os.path.join(data_dir, \"train/unsup\"))\n",
175-
"\n"
174+
"shutil.rmtree(os.path.join(data_dir, \"train/unsup\"))"
176175
]
177176
},
178177
{
@@ -204,8 +203,7 @@
204203
"\n",
205204
"clf = ak.TextClassifier(overwrite=True, max_trials=1)\n",
206205
"clf.fit(train_data, epochs=2)\n",
207-
"print(clf.evaluate(test_data))\n",
208-
"\n"
206+
"print(clf.evaluate(test_data))"
209207
]
210208
},
211209
{
@@ -226,7 +224,6 @@
226224
},
227225
"outputs": [],
228226
"source": [
229-
"\n",
230227
"N_BATCHES = 30\n",
231228
"BATCH_SIZE = 100\n",
232229
"N_FEATURES = 10\n",
@@ -255,7 +252,7 @@
255252
"\n",
256253
"clf = ak.StructuredDataClassifier(overwrite=True, max_trials=1, seed=5)\n",
257254
"clf.fit(x=dataset, validation_data=dataset, batch_size=BATCH_SIZE)\n",
258-
"print(clf.evaluate(dataset))\n"
255+
"print(clf.evaluate(dataset))"
259256
]
260257
},
261258
{

0 commit comments

Comments
 (0)