-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnn_sa.py
More file actions
executable file
·47 lines (32 loc) · 1.07 KB
/
Copy pathnn_sa.py
File metadata and controls
executable file
·47 lines (32 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import keras
from keras.models import Sequential
from keras.layers import Dense
import pandas as pd
import numpy as np
dataset = pd.read_csv("sample_data.csv")
X = dataset.drop(["Date","Referee"],axis=1)
Y = dataset["FTR"]
X_train = X[0:15]
X_test = X[15:]
Y_train = Y[0:15]
Y_test = Y[15:]
model = Sequential();
firstLayer = Dense(units = 16, activation='relu', kernel_initializer='uniform',input_dim = 20)
model.add(firstLayer);
secondLayer = Dense(units = 1, activation = 'relu', kernel_initializer = 'uniform')
model.add(secondLayer);
model.compile(optimizer = 'adam', loss = 'mse', metrics=['accuracy'])
history = model.fit(X_train, Y_train, epochs = 300, batch_size = 50)
import matplotlib.pyplot as plt
plt.plot(history.history['accuracy'])
plt.title('Model accuracy')
plt.ylabel('Accuracy')
plt.xlabel('Epoch')
plt.legend(['Train', 'Test'], loc='upper left')
plt.show()
plt.plot(history.history['loss'])
plt.title('Model loss')
plt.ylabel('Loss')
plt.xlabel('Epoch')
plt.legend(['Train', 'Test'], loc='upper left')
plt.show()