I am currently doing a grade 11 school project on neural networks. I have managed to create one with keras but I have no idea what to do after training. My big question is, how do I input a new data set with the same parameters, same weights, same everything for the training data, but with a whole new set of numbers. Here's my code so far:
from keras.models import Sequential
from keras.layers import Dense
import numpy
seed = 6
numpy.random.seed(seed)
dataset = numpy.loadtxt("Neural_Network_Dataset.csv", delimiter=",")
X = dataset[:,0:6]
Y = dataset[:,11]
model = Sequential()
model.add(Dense(20, input_dim=6, init='uniform', activation='softmax'))
model.add(Dense(20, init='uniform', activation='relu'))
model.add(Dense(1, activation='sigmoid'))
model.compile(loss='binary_crossentropy', optimizer='Adam', metrics=['accuracy'])
model.fit(X, Y, epochs=100, batch_size=100, verbose=2)
predictions = model.predict(X)
rounded = [round(x[0]) for x in predictions]
for a in range (len(rounded)):
print (rounded[a])
#print(rounded)
print(predictions)
Test = str(input("Please enter the file name + file type"))
dataset = numpy.loadtxt(Test, delimiter=",")
w = dataset[:,0:6]
v = dataset[:,11]
model.fit(w, v, epochs=1, verbose=2)
predictions = model.predict(w)
rounded = [round(w[0]) for w in predictions]
print (rounded[a])
The help would be greatly appreciated!