Guest User

Untitled

a guest
Sep 30th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.57 KB | None | 0 0
  1. from sklearn.neural_network import MLPClassifier
  2. import csv
  3. import numpy as np
  4.  
  5.  
  6.  
  7.  
  8.  
  9. def read_data(path):
  10.     X = []
  11.     with open(path, 'rb') as csvfile:
  12.         spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
  13.         X.append(list(spamreader))
  14.     return np.array(X[0]).astype(np.float)
  15.  
  16.  
  17. X = read_data('inputData.csv')
  18. Y = read_data('answerData.csv')
  19. Test = read_data('testData.csv')
  20. print X.shape
  21. print Test.shape
  22. Y = Y.flatten()
  23. nn = MLPClassifier(alpha=0.001, hidden_layer_sizes=(200,))
  24.  
  25. nn.fit(X, Y)
  26.  
  27. score = nn.score(X, Y)
  28.  
  29. print score
Advertisement
Add Comment
Please, Sign In to add comment