Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from sklearn.neural_network import MLPClassifier
- import csv
- import numpy as np
- def read_data(path):
- X = []
- with open(path, 'rb') as csvfile:
- spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
- X.append(list(spamreader))
- return np.array(X[0]).astype(np.float)
- X = read_data('inputData.csv')
- Y = read_data('answerData.csv')
- Test = read_data('testData.csv')
- print X.shape
- print Test.shape
- Y = Y.flatten()
- nn = MLPClassifier(alpha=0.001, hidden_layer_sizes=(200,))
- nn.fit(X, Y)
- score = nn.score(X, Y)
- print score
Advertisement
Add Comment
Please, Sign In to add comment