following this tutorial http://machinelearningmastery.com/tutorial-first-neural-network-python-keras/
In [1]:
from keras.models import Sequential
from keras.layers import Dense
import numpy as np
data_dir = '/Users/briand/Documents/deep/courses/deeplearning1/nbs/data/'
f = 'pima-indians-diabetes.data'
np.random.seed(7)
Using Theano backend.
Couldn't import dot_parser, loading of dot files will not be possible.
In [14]:
#Load the data
data = np.loadtxt(data_dir + f, delimiter = ",")
split = .8
split_int = int(split * data.shape[0])
X_train = data[:split_int, :8]
Y_train = data[:split_int, 8]
X_test = data[split_int:, :8]
Y_test = data[split_int:, 8]
In [15]:
#Create the model structure for a fully connected network
model = Sequential() #A model is a sequence of layers, in this case dense
model.add(Dense(12, input_dim = 8, activation = 'relu', init = 'uniform')) #First layer with 8 inputs
model.add(Dense(8, activation = 'relu', init = 'uniform'))
model.add(Dense(1, activation = 'sigmoid', init = 'uniform'))
In [16]:
#Now compile the model
model.compile(loss = 'binary_crossentropy', optimizer = 'adam', metrics = ['accuracy'])
In [17]:
#Now fit the model
model.fit(X_train, Y_train, nb_epoch = 10, batch_size = 10)
Epoch 1/10
614/614 [==============================] - 0s - loss: 0.6858 - acc: 0.6433
Epoch 2/10
614/614 [==============================] - 0s - loss: 0.6640 - acc: 0.6531
Epoch 3/10
614/614 [==============================] - 0s - loss: 0.6542 - acc: 0.6531
Epoch 4/10
614/614 [==============================] - 0s - loss: 0.6487 - acc: 0.6596
Epoch 5/10
614/614 [==============================] - 0s - loss: 0.6372 - acc: 0.6710
Epoch 6/10
614/614 [==============================] - 0s - loss: 0.6318 - acc: 0.6694
Epoch 7/10
614/614 [==============================] - 0s - loss: 0.6219 - acc: 0.6694
Epoch 8/10
614/614 [==============================] - 0s - loss: 0.6245 - acc: 0.6775
Epoch 9/10
614/614 [==============================] - 0s - loss: 0.6141 - acc: 0.6678
Epoch 10/10
614/614 [==============================] - 0s - loss: 0.6051 - acc: 0.6792
Out[17]:
<keras.callbacks.History at 0x118b86d90>
In [12]:
#Let's take a look at the model object itself
model.__dict__
Out[12]:
{'_flattened_layers': None,
'_output_mask_cache': {'4645881104_4296392000': None},
'_output_shape_cache': {},
'_output_tensor_cache': {},
'_trainable': True,
'built': True,
'container_nodes': {'dense_1_ib-0',
'dense_2_ib-0',
'dense_3_ib-0',
'dense_input_1_ib-0'},
'inbound_nodes': [<keras.engine.topology.Node at 0x115013c90>],
'input_layers': [<keras.engine.topology.InputLayer at 0x114ea8490>],
'input_layers_node_indices': [0],
'input_layers_tensor_indices': [0],
'input_names': ['dense_input_1'],
'inputs': [dense_input_1],
'layers': [<keras.layers.core.Dense at 0x114ea8390>,
<keras.layers.core.Dense at 0x114ea8410>,
<keras.layers.core.Dense at 0x115013cd0>],
'loss': 'binary_crossentropy',
'loss_weights': None,
'metrics': ['accuracy'],
'metrics_names': ['loss', 'acc'],
'metrics_tensors': [mean],
'model': <keras.engine.training.Model at 0x114e97d10>,
'name': 'sequential_1',
'nodes_by_depth': {0: [<keras.engine.topology.Node at 0x115029490>],
1: [<keras.engine.topology.Node at 0x11501eb50>],
2: [<keras.engine.topology.Node at 0x115013490>],
3: [<keras.engine.topology.Node at 0x114f2bdd0>]},
'optimizer': <keras.optimizers.Adam at 0x114e1f550>,
'outbound_nodes': [],
'output_layers': [<keras.layers.core.Dense at 0x115013cd0>],
'output_layers_node_indices': [0],
'output_layers_tensor_indices': [0],
'output_names': ['dense_3'],
'outputs': [sigmoid.0],
'sample_weight_mode': None,
'stop_training': False,
'supports_masking': False}
In [21]:
scores = model.evaluate(X_test, Y_test) #Not sure what this is doing
scores
32/154 [=====>........................] - ETA: 0s
Out[21]:
[0.61455081732242134, 0.64935064780247675]
In [23]:
#Make Predictions on validation
preds = model.predict(X_test).ravel() #predict returns an array of 1d arrays
In [39]:
from sklearn.metrics import roc_auc_score, log_loss, zero_one_loss
def getMetrics(truth, preds):
return [roc_auc_score(truth, preds), log_loss(truth, preds)]
In [40]:
getMetrics(Y_test, preds)
Out[40]:
[0.66868686868686866, 0.61455081296818592]
In [44]:
#Now compare this model to a RF
def buildModel(hidden, nb_epoch):
model = Sequential() #A model is a sequence of layers, in this case dense
model.add(Dense(12, input_dim = 8, activation = 'relu', init = 'uniform')) #First layer with 8 inputs
for i in range(hidden):
model.add(Dense(8, activation = 'relu', init = 'uniform'))
model.add(Dense(1, activation = 'sigmoid', init = 'uniform'))
model.compile(loss = 'binary_crossentropy', optimizer = 'adam', metrics = ['accuracy'])
model.fit(X_train, Y_train, nb_epoch = nb_epoch, batch_size = 10)
return model
In [58]:
mod_1_10 = buildModel(1, 10)
print(1)
mod_1_50 = buildModel(1, 50)
print(2)
mod_1_150 = buildModel(1, 150)
print(3)
mod_2_10 = buildModel(2, 10)
print(4)
mod_2_50 = buildModel(2, 50)
print(5)
mod_2_150 = buildModel(2, 150)
print(6)
Epoch 1/10
614/614 [==============================] - 0s - loss: 0.6833 - acc: 0.6303
Epoch 2/10
614/614 [==============================] - 0s - loss: 0.6577 - acc: 0.6547
Epoch 3/10
614/614 [==============================] - 0s - loss: 0.6481 - acc: 0.6564
Epoch 4/10
614/614 [==============================] - 0s - loss: 0.6428 - acc: 0.6824
Epoch 5/10
614/614 [==============================] - 0s - loss: 0.6335 - acc: 0.6743
Epoch 6/10
614/614 [==============================] - 0s - loss: 0.6314 - acc: 0.6694
Epoch 7/10
614/614 [==============================] - 0s - loss: 0.6188 - acc: 0.6629
Epoch 8/10
614/614 [==============================] - 0s - loss: 0.6113 - acc: 0.6808
Epoch 9/10
614/614 [==============================] - 0s - loss: 0.6122 - acc: 0.6743
Epoch 10/10
614/614 [==============================] - 0s - loss: 0.6076 - acc: 0.6906
1
Epoch 1/50
614/614 [==============================] - 0s - loss: 0.6754 - acc: 0.6433
Epoch 2/50
614/614 [==============================] - 0s - loss: 0.6592 - acc: 0.6515
Epoch 3/50
614/614 [==============================] - 0s - loss: 0.6538 - acc: 0.6564
Epoch 4/50
614/614 [==============================] - 0s - loss: 0.6452 - acc: 0.6547
Epoch 5/50
614/614 [==============================] - 0s - loss: 0.6382 - acc: 0.6612
Epoch 6/50
614/614 [==============================] - 0s - loss: 0.6327 - acc: 0.6629
Epoch 7/50
614/614 [==============================] - 0s - loss: 0.6278 - acc: 0.6694
Epoch 8/50
614/614 [==============================] - 0s - loss: 0.6191 - acc: 0.6759
Epoch 9/50
614/614 [==============================] - 0s - loss: 0.6136 - acc: 0.6759
Epoch 10/50
614/614 [==============================] - 0s - loss: 0.6049 - acc: 0.6759
Epoch 11/50
614/614 [==============================] - 0s - loss: 0.5988 - acc: 0.7068
Epoch 12/50
614/614 [==============================] - 0s - loss: 0.5980 - acc: 0.6954
Epoch 13/50
614/614 [==============================] - 0s - loss: 0.5893 - acc: 0.7003
Epoch 14/50
614/614 [==============================] - 0s - loss: 0.5896 - acc: 0.6954
Epoch 15/50
614/614 [==============================] - 0s - loss: 0.5870 - acc: 0.6889
Epoch 16/50
614/614 [==============================] - 0s - loss: 0.5794 - acc: 0.7068
Epoch 17/50
614/614 [==============================] - 0s - loss: 0.5883 - acc: 0.6873
Epoch 18/50
614/614 [==============================] - 0s - loss: 0.5793 - acc: 0.6954
Epoch 19/50
614/614 [==============================] - 0s - loss: 0.5755 - acc: 0.7036
Epoch 20/50
614/614 [==============================] - 0s - loss: 0.5765 - acc: 0.6987
Epoch 21/50
614/614 [==============================] - 0s - loss: 0.5765 - acc: 0.7085
Epoch 22/50
614/614 [==============================] - 0s - loss: 0.5726 - acc: 0.6873
Epoch 23/50
614/614 [==============================] - 0s - loss: 0.5707 - acc: 0.7134
Epoch 24/50
614/614 [==============================] - 0s - loss: 0.5629 - acc: 0.7036
Epoch 25/50
614/614 [==============================] - 0s - loss: 0.5811 - acc: 0.6792
Epoch 26/50
614/614 [==============================] - 0s - loss: 0.5698 - acc: 0.6922
Epoch 27/50
614/614 [==============================] - 0s - loss: 0.5711 - acc: 0.7085
Epoch 28/50
614/614 [==============================] - 0s - loss: 0.5692 - acc: 0.7020
Epoch 29/50
614/614 [==============================] - 0s - loss: 0.5614 - acc: 0.6954
Epoch 30/50
614/614 [==============================] - 0s - loss: 0.5666 - acc: 0.7052
Epoch 31/50
614/614 [==============================] - 0s - loss: 0.5658 - acc: 0.7231
Epoch 32/50
614/614 [==============================] - 0s - loss: 0.5601 - acc: 0.7020
Epoch 33/50
614/614 [==============================] - 0s - loss: 0.5532 - acc: 0.7052
Epoch 34/50
614/614 [==============================] - 0s - loss: 0.5605 - acc: 0.7117
Epoch 35/50
614/614 [==============================] - 0s - loss: 0.5513 - acc: 0.7248
Epoch 36/50
614/614 [==============================] - 0s - loss: 0.5542 - acc: 0.7036
Epoch 37/50
614/614 [==============================] - 0s - loss: 0.5487 - acc: 0.7150
Epoch 38/50
614/614 [==============================] - 0s - loss: 0.5545 - acc: 0.7199
Epoch 39/50
614/614 [==============================] - 0s - loss: 0.5477 - acc: 0.7150
Epoch 40/50
614/614 [==============================] - 0s - loss: 0.5482 - acc: 0.7150
Epoch 41/50
614/614 [==============================] - 0s - loss: 0.5483 - acc: 0.7166
Epoch 42/50
614/614 [==============================] - 0s - loss: 0.5471 - acc: 0.7345
Epoch 43/50
614/614 [==============================] - 0s - loss: 0.5557 - acc: 0.7199
Epoch 44/50
614/614 [==============================] - 0s - loss: 0.5415 - acc: 0.7264
Epoch 45/50
614/614 [==============================] - 0s - loss: 0.5413 - acc: 0.7427
Epoch 46/50
614/614 [==============================] - 0s - loss: 0.5374 - acc: 0.7231
Epoch 47/50
614/614 [==============================] - 0s - loss: 0.5448 - acc: 0.7231
Epoch 48/50
614/614 [==============================] - 0s - loss: 0.5387 - acc: 0.7329
Epoch 49/50
614/614 [==============================] - 0s - loss: 0.5400 - acc: 0.7394
Epoch 50/50
614/614 [==============================] - 0s - loss: 0.5394 - acc: 0.7362
2
Epoch 1/150
614/614 [==============================] - 0s - loss: 0.6811 - acc: 0.6596
Epoch 2/150
614/614 [==============================] - 0s - loss: 0.6634 - acc: 0.6531
Epoch 3/150
614/614 [==============================] - 0s - loss: 0.6541 - acc: 0.6515
Epoch 4/150
614/614 [==============================] - 0s - loss: 0.6438 - acc: 0.6547
Epoch 5/150
614/614 [==============================] - 0s - loss: 0.6340 - acc: 0.6629
Epoch 6/150
614/614 [==============================] - 0s - loss: 0.6231 - acc: 0.6710
Epoch 7/150
614/614 [==============================] - 0s - loss: 0.6167 - acc: 0.6710
Epoch 8/150
614/614 [==============================] - 0s - loss: 0.6138 - acc: 0.6694
Epoch 9/150
614/614 [==============================] - 0s - loss: 0.6037 - acc: 0.6889
Epoch 10/150
614/614 [==============================] - 0s - loss: 0.6036 - acc: 0.6743
Epoch 11/150
614/614 [==============================] - 0s - loss: 0.5940 - acc: 0.6792
Epoch 12/150
614/614 [==============================] - 0s - loss: 0.5884 - acc: 0.7020
Epoch 13/150
614/614 [==============================] - 0s - loss: 0.5890 - acc: 0.7052
Epoch 14/150
614/614 [==============================] - 0s - loss: 0.5865 - acc: 0.7182
Epoch 15/150
614/614 [==============================] - 0s - loss: 0.5805 - acc: 0.6971
Epoch 16/150
614/614 [==============================] - 0s - loss: 0.5819 - acc: 0.7199
Epoch 17/150
614/614 [==============================] - 0s - loss: 0.5719 - acc: 0.7085
Epoch 18/150
614/614 [==============================] - 0s - loss: 0.5777 - acc: 0.7182
Epoch 19/150
614/614 [==============================] - 0s - loss: 0.5724 - acc: 0.7231
Epoch 20/150
614/614 [==============================] - 0s - loss: 0.5718 - acc: 0.7264
Epoch 21/150
614/614 [==============================] - 0s - loss: 0.5666 - acc: 0.7134
Epoch 22/150
614/614 [==============================] - 0s - loss: 0.5604 - acc: 0.7313
Epoch 23/150
614/614 [==============================] - 0s - loss: 0.5615 - acc: 0.7150
Epoch 24/150
614/614 [==============================] - 0s - loss: 0.5583 - acc: 0.7296
Epoch 25/150
614/614 [==============================] - 0s - loss: 0.5586 - acc: 0.7362
Epoch 26/150
614/614 [==============================] - 0s - loss: 0.5561 - acc: 0.7394
Epoch 27/150
614/614 [==============================] - 0s - loss: 0.5474 - acc: 0.7443
Epoch 28/150
614/614 [==============================] - 0s - loss: 0.5514 - acc: 0.7296
Epoch 29/150
614/614 [==============================] - 0s - loss: 0.5549 - acc: 0.7264
Epoch 30/150
614/614 [==============================] - 0s - loss: 0.5535 - acc: 0.7264
Epoch 31/150
614/614 [==============================] - 0s - loss: 0.5439 - acc: 0.7296
Epoch 32/150
614/614 [==============================] - 0s - loss: 0.5474 - acc: 0.7329
Epoch 33/150
614/614 [==============================] - 0s - loss: 0.5435 - acc: 0.7427
Epoch 34/150
614/614 [==============================] - 0s - loss: 0.5443 - acc: 0.7248
Epoch 35/150
614/614 [==============================] - 0s - loss: 0.5458 - acc: 0.7345
Epoch 36/150
614/614 [==============================] - 0s - loss: 0.5388 - acc: 0.7394
Epoch 37/150
614/614 [==============================] - 0s - loss: 0.5404 - acc: 0.7443
Epoch 38/150
614/614 [==============================] - 0s - loss: 0.5356 - acc: 0.7427
Epoch 39/150
614/614 [==============================] - 0s - loss: 0.5353 - acc: 0.7329
Epoch 40/150
614/614 [==============================] - 0s - loss: 0.5328 - acc: 0.7541
Epoch 41/150
614/614 [==============================] - 0s - loss: 0.5311 - acc: 0.7313
Epoch 42/150
614/614 [==============================] - 0s - loss: 0.5318 - acc: 0.7362
Epoch 43/150
614/614 [==============================] - 0s - loss: 0.5293 - acc: 0.7264
Epoch 44/150
614/614 [==============================] - 0s - loss: 0.5326 - acc: 0.7443
Epoch 45/150
614/614 [==============================] - 0s - loss: 0.5309 - acc: 0.7394
Epoch 46/150
614/614 [==============================] - 0s - loss: 0.5301 - acc: 0.7459
Epoch 47/150
614/614 [==============================] - 0s - loss: 0.5306 - acc: 0.7378
Epoch 48/150
614/614 [==============================] - 0s - loss: 0.5270 - acc: 0.7378
Epoch 49/150
614/614 [==============================] - 0s - loss: 0.5263 - acc: 0.7590
Epoch 50/150
614/614 [==============================] - 0s - loss: 0.5290 - acc: 0.7410
Epoch 51/150
614/614 [==============================] - 0s - loss: 0.5260 - acc: 0.7459
Epoch 52/150
614/614 [==============================] - 0s - loss: 0.5202 - acc: 0.7378
Epoch 53/150
614/614 [==============================] - 0s - loss: 0.5262 - acc: 0.7557
Epoch 54/150
614/614 [==============================] - 0s - loss: 0.5341 - acc: 0.7443
Epoch 55/150
614/614 [==============================] - 0s - loss: 0.5217 - acc: 0.7459
Epoch 56/150
614/614 [==============================] - 0s - loss: 0.5313 - acc: 0.7329
Epoch 57/150
614/614 [==============================] - 0s - loss: 0.5224 - acc: 0.7427
Epoch 58/150
614/614 [==============================] - 0s - loss: 0.5287 - acc: 0.7378
Epoch 59/150
614/614 [==============================] - 0s - loss: 0.5222 - acc: 0.7443
Epoch 60/150
614/614 [==============================] - 0s - loss: 0.5233 - acc: 0.7410
Epoch 61/150
614/614 [==============================] - 0s - loss: 0.5294 - acc: 0.7394
Epoch 62/150
614/614 [==============================] - 0s - loss: 0.5275 - acc: 0.7573
Epoch 63/150
614/614 [==============================] - 0s - loss: 0.5262 - acc: 0.7394
Epoch 64/150
614/614 [==============================] - 0s - loss: 0.5179 - acc: 0.7443
Epoch 65/150
614/614 [==============================] - 0s - loss: 0.5204 - acc: 0.7508
Epoch 66/150
614/614 [==============================] - 0s - loss: 0.5157 - acc: 0.7476
Epoch 67/150
614/614 [==============================] - 0s - loss: 0.5218 - acc: 0.7508
Epoch 68/150
614/614 [==============================] - 0s - loss: 0.5265 - acc: 0.7329
Epoch 69/150
614/614 [==============================] - 0s - loss: 0.5150 - acc: 0.7476
Epoch 70/150
614/614 [==============================] - 0s - loss: 0.5233 - acc: 0.7345
Epoch 71/150
614/614 [==============================] - 0s - loss: 0.5150 - acc: 0.7427
Epoch 72/150
614/614 [==============================] - 0s - loss: 0.5150 - acc: 0.7573
Epoch 73/150
614/614 [==============================] - 0s - loss: 0.5143 - acc: 0.7427
Epoch 74/150
614/614 [==============================] - 0s - loss: 0.5104 - acc: 0.7606
Epoch 75/150
614/614 [==============================] - 0s - loss: 0.5227 - acc: 0.7394
Epoch 76/150
614/614 [==============================] - 0s - loss: 0.5068 - acc: 0.7524
Epoch 77/150
614/614 [==============================] - 0s - loss: 0.5093 - acc: 0.7476
Epoch 78/150
614/614 [==============================] - 0s - loss: 0.5131 - acc: 0.7476
Epoch 79/150
614/614 [==============================] - 0s - loss: 0.5123 - acc: 0.7443
Epoch 80/150
614/614 [==============================] - 0s - loss: 0.5114 - acc: 0.7443
Epoch 81/150
614/614 [==============================] - 0s - loss: 0.5182 - acc: 0.7345
Epoch 82/150
614/614 [==============================] - 0s - loss: 0.5083 - acc: 0.7541
Epoch 83/150
614/614 [==============================] - 0s - loss: 0.5069 - acc: 0.7557
Epoch 84/150
614/614 [==============================] - 0s - loss: 0.5138 - acc: 0.7476
Epoch 85/150
614/614 [==============================] - 0s - loss: 0.5161 - acc: 0.7508
Epoch 86/150
614/614 [==============================] - 0s - loss: 0.5074 - acc: 0.7655
Epoch 87/150
614/614 [==============================] - 0s - loss: 0.5018 - acc: 0.7573
Epoch 88/150
614/614 [==============================] - 0s - loss: 0.5094 - acc: 0.7590
Epoch 89/150
614/614 [==============================] - 0s - loss: 0.5099 - acc: 0.7476
Epoch 90/150
614/614 [==============================] - 0s - loss: 0.5016 - acc: 0.7590
Epoch 91/150
614/614 [==============================] - 0s - loss: 0.4998 - acc: 0.7590
Epoch 92/150
614/614 [==============================] - 0s - loss: 0.5065 - acc: 0.7492
Epoch 93/150
614/614 [==============================] - 0s - loss: 0.5040 - acc: 0.7638
Epoch 94/150
614/614 [==============================] - 0s - loss: 0.5036 - acc: 0.7606
Epoch 95/150
614/614 [==============================] - 0s - loss: 0.4992 - acc: 0.7524
Epoch 96/150
614/614 [==============================] - 0s - loss: 0.4970 - acc: 0.7541
Epoch 97/150
614/614 [==============================] - 0s - loss: 0.4994 - acc: 0.7524
Epoch 98/150
614/614 [==============================] - 0s - loss: 0.5010 - acc: 0.7638
Epoch 99/150
614/614 [==============================] - 0s - loss: 0.4982 - acc: 0.7459
Epoch 100/150
614/614 [==============================] - 0s - loss: 0.4998 - acc: 0.7476
Epoch 101/150
614/614 [==============================] - 0s - loss: 0.4982 - acc: 0.7590
Epoch 102/150
614/614 [==============================] - 0s - loss: 0.4923 - acc: 0.7590
Epoch 103/150
614/614 [==============================] - 0s - loss: 0.4999 - acc: 0.7557
Epoch 104/150
614/614 [==============================] - 0s - loss: 0.4930 - acc: 0.7476
Epoch 105/150
614/614 [==============================] - 0s - loss: 0.4996 - acc: 0.7557
Epoch 106/150
614/614 [==============================] - 0s - loss: 0.4894 - acc: 0.7508
Epoch 107/150
614/614 [==============================] - 0s - loss: 0.4984 - acc: 0.7443
Epoch 108/150
614/614 [==============================] - 0s - loss: 0.4944 - acc: 0.7443
Epoch 109/150
614/614 [==============================] - 0s - loss: 0.4921 - acc: 0.7524
Epoch 110/150
614/614 [==============================] - 0s - loss: 0.4926 - acc: 0.7492
Epoch 111/150
614/614 [==============================] - 0s - loss: 0.4950 - acc: 0.7655
Epoch 112/150
614/614 [==============================] - 0s - loss: 0.4929 - acc: 0.7557
Epoch 113/150
614/614 [==============================] - 0s - loss: 0.4957 - acc: 0.7671
Epoch 114/150
614/614 [==============================] - 0s - loss: 0.4897 - acc: 0.7606
Epoch 115/150
614/614 [==============================] - 0s - loss: 0.4929 - acc: 0.7443
Epoch 116/150
614/614 [==============================] - 0s - loss: 0.4883 - acc: 0.7622
Epoch 117/150
614/614 [==============================] - 0s - loss: 0.4835 - acc: 0.7557
Epoch 118/150
614/614 [==============================] - 0s - loss: 0.4894 - acc: 0.7541
Epoch 119/150
614/614 [==============================] - 0s - loss: 0.4863 - acc: 0.7524
Epoch 120/150
614/614 [==============================] - 0s - loss: 0.4869 - acc: 0.7606
Epoch 121/150
614/614 [==============================] - 0s - loss: 0.4921 - acc: 0.7655
Epoch 122/150
614/614 [==============================] - 0s - loss: 0.4921 - acc: 0.7508
Epoch 123/150
614/614 [==============================] - 0s - loss: 0.4894 - acc: 0.7410
Epoch 124/150
614/614 [==============================] - 0s - loss: 0.4857 - acc: 0.7769
Epoch 125/150
614/614 [==============================] - 0s - loss: 0.4816 - acc: 0.7638
Epoch 126/150
614/614 [==============================] - 0s - loss: 0.4789 - acc: 0.7687
Epoch 127/150
614/614 [==============================] - 0s - loss: 0.4839 - acc: 0.7541
Epoch 128/150
614/614 [==============================] - 0s - loss: 0.4817 - acc: 0.7508
Epoch 129/150
614/614 [==============================] - 0s - loss: 0.4792 - acc: 0.7655
Epoch 130/150
614/614 [==============================] - 0s - loss: 0.4754 - acc: 0.7590
Epoch 131/150
614/614 [==============================] - 0s - loss: 0.4893 - acc: 0.7492
Epoch 132/150
614/614 [==============================] - 0s - loss: 0.4903 - acc: 0.7410
Epoch 133/150
614/614 [==============================] - 0s - loss: 0.4831 - acc: 0.7508
Epoch 134/150
614/614 [==============================] - 0s - loss: 0.4892 - acc: 0.7638
Epoch 135/150
614/614 [==============================] - 0s - loss: 0.4783 - acc: 0.7704
Epoch 136/150
614/614 [==============================] - 0s - loss: 0.4809 - acc: 0.7720
Epoch 137/150
614/614 [==============================] - 0s - loss: 0.4787 - acc: 0.7590
Epoch 138/150
614/614 [==============================] - 0s - loss: 0.4802 - acc: 0.7622
Epoch 139/150
614/614 [==============================] - 0s - loss: 0.4795 - acc: 0.7557
Epoch 140/150
614/614 [==============================] - 0s - loss: 0.4755 - acc: 0.7573
Epoch 141/150
614/614 [==============================] - 0s - loss: 0.4782 - acc: 0.7638
Epoch 142/150
614/614 [==============================] - 0s - loss: 0.4730 - acc: 0.7785
Epoch 143/150
614/614 [==============================] - 0s - loss: 0.4773 - acc: 0.7671
Epoch 144/150
614/614 [==============================] - 0s - loss: 0.4714 - acc: 0.7557
Epoch 145/150
614/614 [==============================] - 0s - loss: 0.4744 - acc: 0.7622
Epoch 146/150
614/614 [==============================] - 0s - loss: 0.4733 - acc: 0.7704
Epoch 147/150
614/614 [==============================] - 0s - loss: 0.4767 - acc: 0.7655
Epoch 148/150
614/614 [==============================] - 0s - loss: 0.4759 - acc: 0.7541
Epoch 149/150
614/614 [==============================] - 0s - loss: 0.4829 - acc: 0.7573
Epoch 150/150
614/614 [==============================] - 0s - loss: 0.4705 - acc: 0.7736
3
Epoch 1/10
614/614 [==============================] - 0s - loss: 0.6841 - acc: 0.6531
Epoch 2/10
614/614 [==============================] - 0s - loss: 0.6675 - acc: 0.6531
Epoch 3/10
614/614 [==============================] - 0s - loss: 0.6565 - acc: 0.6531
Epoch 4/10
614/614 [==============================] - 0s - loss: 0.6514 - acc: 0.6531
Epoch 5/10
614/614 [==============================] - 0s - loss: 0.6458 - acc: 0.6531
Epoch 6/10
614/614 [==============================] - 0s - loss: 0.6371 - acc: 0.6531
Epoch 7/10
614/614 [==============================] - 0s - loss: 0.6305 - acc: 0.6531
Epoch 8/10
614/614 [==============================] - 0s - loss: 0.6204 - acc: 0.6531
Epoch 9/10
614/614 [==============================] - 0s - loss: 0.6156 - acc: 0.6531
Epoch 10/10
614/614 [==============================] - 0s - loss: 0.6172 - acc: 0.6531
4
Epoch 1/50
614/614 [==============================] - 0s - loss: 0.6882 - acc: 0.6466
Epoch 2/50
614/614 [==============================] - 0s - loss: 0.6686 - acc: 0.6531
Epoch 3/50
614/614 [==============================] - 0s - loss: 0.6595 - acc: 0.6531
Epoch 4/50
614/614 [==============================] - 0s - loss: 0.6534 - acc: 0.6531
Epoch 5/50
614/614 [==============================] - 0s - loss: 0.6508 - acc: 0.6531
Epoch 6/50
614/614 [==============================] - 0s - loss: 0.6460 - acc: 0.6531
Epoch 7/50
614/614 [==============================] - 0s - loss: 0.6416 - acc: 0.6531
Epoch 8/50
614/614 [==============================] - 0s - loss: 0.6369 - acc: 0.6531
Epoch 9/50
614/614 [==============================] - 0s - loss: 0.6327 - acc: 0.6547
Epoch 10/50
614/614 [==============================] - 0s - loss: 0.6298 - acc: 0.6759
Epoch 11/50
614/614 [==============================] - 0s - loss: 0.6165 - acc: 0.6824
Epoch 12/50
614/614 [==============================] - 0s - loss: 0.6106 - acc: 0.6873
Epoch 13/50
614/614 [==============================] - 0s - loss: 0.6044 - acc: 0.6922
Epoch 14/50
614/614 [==============================] - 0s - loss: 0.6009 - acc: 0.7003
Epoch 15/50
614/614 [==============================] - 0s - loss: 0.5922 - acc: 0.6873
Epoch 16/50
614/614 [==============================] - 0s - loss: 0.6057 - acc: 0.6759
Epoch 17/50
614/614 [==============================] - 0s - loss: 0.5909 - acc: 0.6971
Epoch 18/50
614/614 [==============================] - 0s - loss: 0.5927 - acc: 0.6987
Epoch 19/50
614/614 [==============================] - 0s - loss: 0.5905 - acc: 0.6808
Epoch 20/50
614/614 [==============================] - 0s - loss: 0.5876 - acc: 0.7101
Epoch 21/50
614/614 [==============================] - 0s - loss: 0.6062 - acc: 0.6792
Epoch 22/50
614/614 [==============================] - 0s - loss: 0.5859 - acc: 0.6971
Epoch 23/50
614/614 [==============================] - 0s - loss: 0.5857 - acc: 0.6987
Epoch 24/50
614/614 [==============================] - 0s - loss: 0.5833 - acc: 0.7036
Epoch 25/50
614/614 [==============================] - 0s - loss: 0.5866 - acc: 0.6954
Epoch 26/50
614/614 [==============================] - 0s - loss: 0.5792 - acc: 0.7068
Epoch 27/50
614/614 [==============================] - 0s - loss: 0.5782 - acc: 0.7101
Epoch 28/50
614/614 [==============================] - 0s - loss: 0.5818 - acc: 0.7134
Epoch 29/50
614/614 [==============================] - 0s - loss: 0.5798 - acc: 0.7101
Epoch 30/50
614/614 [==============================] - 0s - loss: 0.5820 - acc: 0.7134
Epoch 31/50
614/614 [==============================] - 0s - loss: 0.5697 - acc: 0.7101
Epoch 32/50
614/614 [==============================] - 0s - loss: 0.5757 - acc: 0.7036
Epoch 33/50
614/614 [==============================] - 0s - loss: 0.5755 - acc: 0.7101
Epoch 34/50
614/614 [==============================] - 0s - loss: 0.5807 - acc: 0.7085
Epoch 35/50
614/614 [==============================] - 0s - loss: 0.5728 - acc: 0.7134
Epoch 36/50
614/614 [==============================] - 0s - loss: 0.5706 - acc: 0.7199
Epoch 37/50
614/614 [==============================] - 0s - loss: 0.5709 - acc: 0.7101
Epoch 38/50
614/614 [==============================] - 0s - loss: 0.5705 - acc: 0.7117
Epoch 39/50
614/614 [==============================] - 0s - loss: 0.5649 - acc: 0.7231
Epoch 40/50
614/614 [==============================] - 0s - loss: 0.5700 - acc: 0.7199
Epoch 41/50
614/614 [==============================] - 0s - loss: 0.5703 - acc: 0.7215
Epoch 42/50
614/614 [==============================] - 0s - loss: 0.5651 - acc: 0.7362
Epoch 43/50
614/614 [==============================] - 0s - loss: 0.5668 - acc: 0.7215
Epoch 44/50
614/614 [==============================] - 0s - loss: 0.5659 - acc: 0.7248
Epoch 45/50
614/614 [==============================] - 0s - loss: 0.5745 - acc: 0.7068
Epoch 46/50
614/614 [==============================] - 0s - loss: 0.5627 - acc: 0.7199
Epoch 47/50
614/614 [==============================] - 0s - loss: 0.5623 - acc: 0.7345
Epoch 48/50
614/614 [==============================] - 0s - loss: 0.5726 - acc: 0.7296
Epoch 49/50
614/614 [==============================] - 0s - loss: 0.5600 - acc: 0.7215
Epoch 50/50
614/614 [==============================] - 0s - loss: 0.5566 - acc: 0.7329
5
Epoch 1/150
614/614 [==============================] - 0s - loss: 0.6886 - acc: 0.6498
Epoch 2/150
614/614 [==============================] - 0s - loss: 0.6748 - acc: 0.6531
Epoch 3/150
614/614 [==============================] - 0s - loss: 0.6648 - acc: 0.6531
Epoch 4/150
614/614 [==============================] - 0s - loss: 0.6602 - acc: 0.6531
Epoch 5/150
614/614 [==============================] - 0s - loss: 0.6543 - acc: 0.6531
Epoch 6/150
614/614 [==============================] - 0s - loss: 0.6525 - acc: 0.6531
Epoch 7/150
614/614 [==============================] - 0s - loss: 0.6443 - acc: 0.6531
Epoch 8/150
614/614 [==============================] - 0s - loss: 0.6366 - acc: 0.6531
Epoch 9/150
614/614 [==============================] - 0s - loss: 0.6236 - acc: 0.6596
Epoch 10/150
614/614 [==============================] - 0s - loss: 0.6087 - acc: 0.6645
Epoch 11/150
614/614 [==============================] - 0s - loss: 0.6023 - acc: 0.6629
Epoch 12/150
614/614 [==============================] - 0s - loss: 0.6002 - acc: 0.6694
Epoch 13/150
614/614 [==============================] - 0s - loss: 0.6064 - acc: 0.6726
Epoch 14/150
614/614 [==============================] - 0s - loss: 0.5965 - acc: 0.6661
Epoch 15/150
614/614 [==============================] - 0s - loss: 0.5934 - acc: 0.6808
Epoch 16/150
614/614 [==============================] - 0s - loss: 0.6115 - acc: 0.6450
Epoch 17/150
614/614 [==============================] - 0s - loss: 0.5945 - acc: 0.6678
Epoch 18/150
614/614 [==============================] - 0s - loss: 0.5947 - acc: 0.6694
Epoch 19/150
614/614 [==============================] - 0s - loss: 0.5905 - acc: 0.6775
Epoch 20/150
614/614 [==============================] - 0s - loss: 0.5945 - acc: 0.6726
Epoch 21/150
614/614 [==============================] - 0s - loss: 0.5936 - acc: 0.6726
Epoch 22/150
614/614 [==============================] - 0s - loss: 0.5924 - acc: 0.6759
Epoch 23/150
614/614 [==============================] - 0s - loss: 0.5876 - acc: 0.6759
Epoch 24/150
614/614 [==============================] - 0s - loss: 0.5948 - acc: 0.6694
Epoch 25/150
614/614 [==============================] - 0s - loss: 0.5870 - acc: 0.6775
Epoch 26/150
614/614 [==============================] - 0s - loss: 0.5863 - acc: 0.6726
Epoch 27/150
614/614 [==============================] - 0s - loss: 0.5875 - acc: 0.6840
Epoch 28/150
614/614 [==============================] - 0s - loss: 0.5884 - acc: 0.6710
Epoch 29/150
614/614 [==============================] - 0s - loss: 0.5854 - acc: 0.6629
Epoch 30/150
614/614 [==============================] - 0s - loss: 0.5877 - acc: 0.6759
Epoch 31/150
614/614 [==============================] - 0s - loss: 0.5841 - acc: 0.6759
Epoch 32/150
614/614 [==============================] - 0s - loss: 0.5873 - acc: 0.6775
Epoch 33/150
614/614 [==============================] - 0s - loss: 0.5831 - acc: 0.6678
Epoch 34/150
614/614 [==============================] - 0s - loss: 0.5822 - acc: 0.6743
Epoch 35/150
614/614 [==============================] - 0s - loss: 0.5831 - acc: 0.6743
Epoch 36/150
614/614 [==============================] - 0s - loss: 0.5783 - acc: 0.6889
Epoch 37/150
614/614 [==============================] - 0s - loss: 0.5829 - acc: 0.6873
Epoch 38/150
614/614 [==============================] - 0s - loss: 0.5832 - acc: 0.6759
Epoch 39/150
614/614 [==============================] - 0s - loss: 0.5879 - acc: 0.6759
Epoch 40/150
614/614 [==============================] - 0s - loss: 0.5768 - acc: 0.6726
Epoch 41/150
614/614 [==============================] - 0s - loss: 0.5827 - acc: 0.6759
Epoch 42/150
614/614 [==============================] - 0s - loss: 0.5803 - acc: 0.6759
Epoch 43/150
614/614 [==============================] - 0s - loss: 0.5819 - acc: 0.6759
Epoch 44/150
614/614 [==============================] - 0s - loss: 0.5774 - acc: 0.6726
Epoch 45/150
614/614 [==============================] - 0s - loss: 0.5839 - acc: 0.6710
Epoch 46/150
614/614 [==============================] - 0s - loss: 0.5776 - acc: 0.6857
Epoch 47/150
614/614 [==============================] - 0s - loss: 0.5777 - acc: 0.6710
Epoch 48/150
614/614 [==============================] - 0s - loss: 0.5757 - acc: 0.6873
Epoch 49/150
614/614 [==============================] - 0s - loss: 0.5743 - acc: 0.6889
Epoch 50/150
614/614 [==============================] - 0s - loss: 0.5833 - acc: 0.6808
Epoch 51/150
614/614 [==============================] - 0s - loss: 0.5773 - acc: 0.6743
Epoch 52/150
614/614 [==============================] - 0s - loss: 0.5746 - acc: 0.6873
Epoch 53/150
614/614 [==============================] - 0s - loss: 0.5738 - acc: 0.6857
Epoch 54/150
614/614 [==============================] - 0s - loss: 0.5739 - acc: 0.6857
Epoch 55/150
614/614 [==============================] - 0s - loss: 0.5756 - acc: 0.6808
Epoch 56/150
614/614 [==============================] - 0s - loss: 0.5755 - acc: 0.6873
Epoch 57/150
614/614 [==============================] - 0s - loss: 0.5701 - acc: 0.6873
Epoch 58/150
614/614 [==============================] - 0s - loss: 0.5720 - acc: 0.6775
Epoch 59/150
614/614 [==============================] - 0s - loss: 0.5714 - acc: 0.6840
Epoch 60/150
614/614 [==============================] - 0s - loss: 0.5708 - acc: 0.6824
Epoch 61/150
614/614 [==============================] - 0s - loss: 0.5700 - acc: 0.6873
Epoch 62/150
614/614 [==============================] - 0s - loss: 0.5692 - acc: 0.6792
Epoch 63/150
614/614 [==============================] - 0s - loss: 0.5683 - acc: 0.6824
Epoch 64/150
614/614 [==============================] - 0s - loss: 0.5776 - acc: 0.6775
Epoch 65/150
614/614 [==============================] - 0s - loss: 0.5655 - acc: 0.6906
Epoch 66/150
614/614 [==============================] - 0s - loss: 0.5677 - acc: 0.6840
Epoch 67/150
614/614 [==============================] - 0s - loss: 0.5665 - acc: 0.6840
Epoch 68/150
614/614 [==============================] - 0s - loss: 0.5645 - acc: 0.6938
Epoch 69/150
614/614 [==============================] - 0s - loss: 0.5630 - acc: 0.6938
Epoch 70/150
614/614 [==============================] - 0s - loss: 0.5673 - acc: 0.6889
Epoch 71/150
614/614 [==============================] - 0s - loss: 0.5702 - acc: 0.6792
Epoch 72/150
614/614 [==============================] - 0s - loss: 0.5627 - acc: 0.6922
Epoch 73/150
614/614 [==============================] - 0s - loss: 0.5664 - acc: 0.6922
Epoch 74/150
614/614 [==============================] - 0s - loss: 0.5626 - acc: 0.6906
Epoch 75/150
614/614 [==============================] - 0s - loss: 0.5661 - acc: 0.6954
Epoch 76/150
614/614 [==============================] - 0s - loss: 0.5591 - acc: 0.6824
Epoch 77/150
614/614 [==============================] - 0s - loss: 0.5668 - acc: 0.6873
Epoch 78/150
614/614 [==============================] - 0s - loss: 0.5535 - acc: 0.7036
Epoch 79/150
614/614 [==============================] - 0s - loss: 0.5576 - acc: 0.6889
Epoch 80/150
614/614 [==============================] - 0s - loss: 0.5564 - acc: 0.7166
Epoch 81/150
614/614 [==============================] - 0s - loss: 0.5594 - acc: 0.7068
Epoch 82/150
614/614 [==============================] - 0s - loss: 0.5546 - acc: 0.6987
Epoch 83/150
614/614 [==============================] - 0s - loss: 0.5515 - acc: 0.6938
Epoch 84/150
614/614 [==============================] - 0s - loss: 0.5559 - acc: 0.6987
Epoch 85/150
614/614 [==============================] - 0s - loss: 0.5532 - acc: 0.6857
Epoch 86/150
614/614 [==============================] - 0s - loss: 0.5587 - acc: 0.7003
Epoch 87/150
614/614 [==============================] - 0s - loss: 0.5549 - acc: 0.6922
Epoch 88/150
614/614 [==============================] - 0s - loss: 0.5503 - acc: 0.6987
Epoch 89/150
614/614 [==============================] - 0s - loss: 0.5575 - acc: 0.6938
Epoch 90/150
614/614 [==============================] - 0s - loss: 0.5506 - acc: 0.6906
Epoch 91/150
614/614 [==============================] - 0s - loss: 0.5536 - acc: 0.7052
Epoch 92/150
614/614 [==============================] - 0s - loss: 0.5498 - acc: 0.6971
Epoch 93/150
614/614 [==============================] - 0s - loss: 0.5494 - acc: 0.6954
Epoch 94/150
614/614 [==============================] - 0s - loss: 0.5477 - acc: 0.7003
Epoch 95/150
614/614 [==============================] - 0s - loss: 0.5469 - acc: 0.6922
Epoch 96/150
614/614 [==============================] - 0s - loss: 0.5497 - acc: 0.6938
Epoch 97/150
614/614 [==============================] - 0s - loss: 0.5434 - acc: 0.7068
Epoch 98/150
614/614 [==============================] - 0s - loss: 0.5533 - acc: 0.6954
Epoch 99/150
614/614 [==============================] - 0s - loss: 0.5467 - acc: 0.6938
Epoch 100/150
614/614 [==============================] - 0s - loss: 0.5450 - acc: 0.6922
Epoch 101/150
614/614 [==============================] - 0s - loss: 0.5438 - acc: 0.7052
Epoch 102/150
614/614 [==============================] - 0s - loss: 0.5444 - acc: 0.7003
Epoch 103/150
614/614 [==============================] - 0s - loss: 0.5444 - acc: 0.7036
Epoch 104/150
614/614 [==============================] - 0s - loss: 0.5413 - acc: 0.7036
Epoch 105/150
614/614 [==============================] - 0s - loss: 0.5527 - acc: 0.6971
Epoch 106/150
614/614 [==============================] - 0s - loss: 0.5398 - acc: 0.7052
Epoch 107/150
614/614 [==============================] - 0s - loss: 0.5482 - acc: 0.6971
Epoch 108/150
614/614 [==============================] - 0s - loss: 0.5441 - acc: 0.7020
Epoch 109/150
614/614 [==============================] - 0s - loss: 0.5413 - acc: 0.7036
Epoch 110/150
614/614 [==============================] - 0s - loss: 0.5431 - acc: 0.7020
Epoch 111/150
614/614 [==============================] - 0s - loss: 0.5387 - acc: 0.7020
Epoch 112/150
614/614 [==============================] - 0s - loss: 0.5386 - acc: 0.7085
Epoch 113/150
614/614 [==============================] - 0s - loss: 0.5383 - acc: 0.7052
Epoch 114/150
614/614 [==============================] - 0s - loss: 0.5366 - acc: 0.7003
Epoch 115/150
614/614 [==============================] - 0s - loss: 0.5436 - acc: 0.7036
Epoch 116/150
614/614 [==============================] - 0s - loss: 0.5382 - acc: 0.7101
Epoch 117/150
614/614 [==============================] - 0s - loss: 0.5411 - acc: 0.6954
Epoch 118/150
614/614 [==============================] - 0s - loss: 0.5382 - acc: 0.6971
Epoch 119/150
614/614 [==============================] - 0s - loss: 0.5398 - acc: 0.7020
Epoch 120/150
614/614 [==============================] - 0s - loss: 0.5420 - acc: 0.7020
Epoch 121/150
614/614 [==============================] - 0s - loss: 0.5495 - acc: 0.7101
Epoch 122/150
614/614 [==============================] - 0s - loss: 0.5406 - acc: 0.7036
Epoch 123/150
614/614 [==============================] - 0s - loss: 0.5378 - acc: 0.7052
Epoch 124/150
614/614 [==============================] - 0s - loss: 0.5344 - acc: 0.7052
Epoch 125/150
614/614 [==============================] - 0s - loss: 0.5397 - acc: 0.6987
Epoch 126/150
614/614 [==============================] - 0s - loss: 0.5342 - acc: 0.7020
Epoch 127/150
614/614 [==============================] - 0s - loss: 0.5395 - acc: 0.7068
Epoch 128/150
614/614 [==============================] - 0s - loss: 0.5375 - acc: 0.7166
Epoch 129/150
614/614 [==============================] - 0s - loss: 0.5390 - acc: 0.7117
Epoch 130/150
614/614 [==============================] - 0s - loss: 0.5454 - acc: 0.6938
Epoch 131/150
614/614 [==============================] - 0s - loss: 0.5485 - acc: 0.7101
Epoch 132/150
614/614 [==============================] - 0s - loss: 0.5372 - acc: 0.6954
Epoch 133/150
614/614 [==============================] - 0s - loss: 0.5391 - acc: 0.7085
Epoch 134/150
614/614 [==============================] - 0s - loss: 0.5433 - acc: 0.7068
Epoch 135/150
614/614 [==============================] - 0s - loss: 0.5347 - acc: 0.7117
Epoch 136/150
614/614 [==============================] - 0s - loss: 0.5373 - acc: 0.7003
Epoch 137/150
614/614 [==============================] - 0s - loss: 0.5375 - acc: 0.7134
Epoch 138/150
614/614 [==============================] - 0s - loss: 0.5308 - acc: 0.6971
Epoch 139/150
614/614 [==============================] - 0s - loss: 0.5347 - acc: 0.7020
Epoch 140/150
614/614 [==============================] - 0s - loss: 0.5354 - acc: 0.7101
Epoch 141/150
614/614 [==============================] - 0s - loss: 0.5315 - acc: 0.7068
Epoch 142/150
614/614 [==============================] - 0s - loss: 0.5334 - acc: 0.7134
Epoch 143/150
614/614 [==============================] - 0s - loss: 0.5286 - acc: 0.7068
Epoch 144/150
614/614 [==============================] - 0s - loss: 0.5378 - acc: 0.7068
Epoch 145/150
614/614 [==============================] - 0s - loss: 0.5352 - acc: 0.7020
Epoch 146/150
614/614 [==============================] - 0s - loss: 0.5364 - acc: 0.7150
Epoch 147/150
614/614 [==============================] - 0s - loss: 0.5307 - acc: 0.7068
Epoch 148/150
614/614 [==============================] - 0s - loss: 0.5318 - acc: 0.7068
Epoch 149/150
614/614 [==============================] - 0s - loss: 0.5360 - acc: 0.7085
Epoch 150/150
614/614 [==============================] - 0s - loss: 0.5291 - acc: 0.7085
6
In [49]:
from sklearn.ensemble import RandomForestClassifier
rf = RandomForestClassifier(n_estimators = 100)
rf.fit(X_train, Y_train)
Out[49]:
RandomForestClassifier(bootstrap=True, class_weight=None, criterion='gini',
max_depth=None, max_features='auto', max_leaf_nodes=None,
min_samples_leaf=1, min_samples_split=2,
min_weight_fraction_leaf=0.0, n_estimators=100, n_jobs=1,
oob_score=False, random_state=None, verbose=0,
warm_start=False)
In [59]:
#Now get results
print(getMetrics(Y_test, mod_1_10.predict(X_test).ravel()))
print(getMetrics(Y_test, mod_1_50.predict(X_test).ravel()))
print(getMetrics(Y_test, mod_1_150.predict(X_test).ravel()))
print(getMetrics(Y_test, mod_2_10.predict(X_test).ravel()))
print(getMetrics(Y_test, mod_2_50.predict(X_test).ravel()))
print(getMetrics(Y_test, mod_2_150.predict(X_test).ravel()))
print(getMetrics(Y_test, rf.predict_proba(X_test)[:,1]))
[0.69035812672176311, 0.60342125222086906]
[0.74508723599632698, 0.56880947705600171]
[0.804040404040404, 0.52417716705663642]
[0.60899908172635442, 0.63698239479359098]
[0.79889807162534432, 0.54316266422921966]
[0.7595959595959596, 0.55747407016816075]
[0.82369146005509641, 0.48941803176737725]
In [60]:
mod_2_10.layers
Out[60]:
[<keras.layers.core.Dense at 0x11dd24c10>,
<keras.layers.core.Dense at 0x11dd149d0>,
<keras.layers.core.Dense at 0x11dd06710>,
<keras.layers.core.Dense at 0x11dd146d0>]
In [ ]:
Content source: briandalessandro/courses
Similar notebooks: