loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

model.summary()

losses = []
accuracies = []
epochs = [1, 5, 10, 50, 100, 500, 1000]
for e in epochs:
    model.fit(Xtrain, ytrain, epochs=e)
    out = model.evaluate(Xtest, ytest)
    losses.append(out[0])
    accuracies.append(out[1])

print('\n* * * Data Summarized * * *')
for i in range(len(epochs)):
    print('Epochs:', epochs[i], 'Loss:', losses[i], 'Accuracy:', accuracies[i])

df = pd.DataFrame({'epochs': epochs, 'loss': losses, 'accuracy': accuracies})

csv_name = f'./../../outputs/v1-b/activation_study/varied-epoch-{activation}-sp_out.csv'
df.to_csv(csv_name, index=False)

message = 'Subject: {}\n\n{}'.format(
    'ML Model Update', f'{csv_name.split("/")[-1]} finished computing...'
    f'\n\n* * * * Results * * * *\n'
    f'{df}'
    f'\n\nThanks! =(^_^)=')

mail(['*****@*****.**'], message)
Esempio n. 2
0
])

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

model.summary()

losses = []
accuracies = []
epochs = [1, 5, 10, 50, 100, 500, 1000]
for e in epochs:
    model.fit(Xtrain, ytrain, epochs=e)
    out = model.evaluate(Xtest, ytest)
    losses.append(out[0])
    accuracies.append(out[1])

print('\n* * * Data Summarized * * *')
for i in range(len(epochs)):
    print('Epochs:', epochs[i], 'Loss:', losses[i], 'Accuracy:', accuracies[i])

df = pd.DataFrame({
    'epochs': epochs,
    'loss': losses,
    'accuracy': accuracies
})

df.to_csv('./outputs/v1-b/varied-epoch-4HL.csv', index=False)

mail(['*****@*****.**'])