from provider import Provider
from feature_selection import Selector
import numpy as np
import neurolab as nl
from sklearn.metrics import mean_squared_error
from math import sqrt
import matplotlib.pyplot as plt

if __name__ == '__main__':
    provider = Selector()
    net = nl.net.newff(
        provider.getDataRanges(),
        [provider.getInputCount() * 2,
         provider.getInputCount() * 2, 1])
    # net.trainf = nl.train.train_gd
    input = []
    target = []
    mult = provider.provider.multiplier
    for d in provider.getLearnData():
        input.append(d[0])
        target.append([d[1][0] / mult])
    err = net.train(input, target, epochs=1000, show=10,
                    goal=0.001)  #, lr=0.000001)

    results = net.sim(input)
    w = open('output1.txt', 'w')
    for i, line in enumerate(results):
        w.write('%f;%f\n' % (target[i][0] * mult, line[0] * mult))
    w.close()

    input = []
Beispiel #2
0
from provider import Provider
from feature_selection import Selector
import numpy as np
import neurolab as nl
from sklearn.metrics import mean_squared_error
from math import sqrt

if __name__ == '__main__':
    provider = Selector()
    net = nl.net.newff(provider.getDataRanges(), [provider.getInputCount()*2, provider.getInputCount()*2, 1])
    # net.trainf = nl.train.train_gd
    input = []
    target = []
    mult = provider.provider.multiplier
    for d in provider.getLearnData():
        input.append(d[0])
        target.append([d[1][0]/mult])
    err = net.train(input, target, epochs=1000, show=10, goal=0.001)#, lr=0.000001)

    results = net.sim(input)
    w = open('output1.txt', 'w')
    for i, line in enumerate(results):
        w.write('%f;%f\n' % (target[i][0]*mult, line[0]*mult))
    w.close()

    input = []
    target = []
    for d in provider.getTestData():
        input.append(d[0])
        target.append([d[1][0]/mult])
    results = net.sim(input)