from __future__ import print_function

import numpy as np
from sklearn.metrics import accuracy_score, precision_score, recall_score
from load_csv_data import load_data
from sknn.mlp import Classifier, Layer

# configurations # default
num_of_trials = 10  #10
test_size = 0.2  #0.2
iteration = 25  #25
learning_rate = 0.001  #0.001
units = [5,10,15,20,25,30]

# load data
X_train, X_test, y_train, y_test = load_data(test_size=test_size)
# arrays for storing results
scores_train = [[] for i in range(num_of_trials)]
scores_test = [[] for i in range(num_of_trials)]

for n in range(num_of_trials):
    print('============== Trial: {} ==============='.format(n+1))
    for i, unit in enumerate(units):
        clf = Classifier(
            layers=[
                Layer('Rectifier', units=unit),
                Layer("Softmax")],
            learning_rate=learning_rate,
            n_iter=iteration)

        clf.fit(X_train, y_train)
# coding: utf-8
#======================================
#  Breast cancer tumor classification
#  with sklearn MLPClassifier module
#   (c) Keishi Ishihara
#======================================
from __future__ import print_function

from sklearn.neural_network import MLPClassifier
from sklearn.metrics import accuracy_score, precision_score, recall_score
from load_csv_data import load_data

X_train, X_test, y_train, y_test = load_data()

clf = MLPClassifier(hidden_layer_sizes=(30),
                    activation='relu',
                    alpha=1e-5,
                    learning_rate_init=0.001,
                    learning_rate='constant',
                    solver='sgd',
                    random_state=0,
                    verbose=True,
                    tol=1e-4,
                    max_iter=10000)

clf.fit(X_train, y_train)

print('Training set score: {}'.format(clf.score(X_train, y_train)))
print('Test set score: {}'.format(clf.score(X_test, y_test)))