print('----------') print('Neurono svoriniai koeficientai:') print("w1 = {}".format(syn0[0])) print("w2 = {}".format(syn0[1])) print("b = {}".format(bias)) # print(syn0) # print("Output After Training:") Tsu = np.dot(data, syn0) + bias # print(val) TsuRes = calcDirivAndE(Tsu) # year[2:202] TsuDeNormalized = deNormalization(TsuRes, min(answerForSunActivity)[0], max(answerForSunActivity)[0]) draw.DrawDiff(year[2:202], dataForTrainingAnswer, TsuDeNormalized) Ts = np.dot(dataNormalized, syn0) + bias TsRes = calcDirivAndE(Ts) TsDeNormalized = deNormalization(TsRes, min(answerForSunActivity)[0], max(answerForSunActivity)[0]) print(len(TsDeNormalized)) print(len(answerForSunActivity)) eVector = list() for real, predicted in zip(answerForSunActivity, TsDeNormalized): e = real[0] - predicted[0] eVector.append(e) draw.DrowPlot(year[2:], eVector)
print("w1 = {}".format(syn0[0])) print("w2 = {}".format(syn0[1])) print("b = {}".format(bias)) # # # print(syn0) # # print("Output After Training:") Tsu = np.dot(data, syn0) + bias # # print(val) TsuRes = calcDirivAndE(Tsu) # # year[2:202] TsuDeNormalized = deNormalization(TsuRes, min(dataWithEmpty['duration']), max(dataWithEmpty['duration'])) TsuGraphicData = [] for el in TsuRes: TsuGraphicData.append(el[0]) draw.DrawDiff(iDataNormalize[0:300], resDataNormalized[0:300], TsuGraphicData) # print(resDataNormalized[0:300]) # Ts = np.dot(dataNormalized, syn0) + bias # TsRes = calcDirivAndE(Ts) # TsDeNormalized = deNormalization(TsRes, min(answerForSunActivity)[0], max(answerForSunActivity)[0]) # print(len(TsDeNormalized)) # print(len(answerForSunActivity)) # # eVector = list() # for real, predicted in zip(answerForSunActivity, TsDeNormalized): # e = real[0] - predicted[0] # eVector.append(e) # # draw.DrowPlot(year[2:], eVector) # draw.DrowHist(eVector) #
# [0], # [1], # [1], # [1] # ] # net = linear_model.LinearRegression() net.fit(np.array(dataForTraining), np.array(dataForTrainingAnswer)) w1 = net.coef_[0][0] w2 = net.coef_[0][1] b = net.intercept_ Tsu = net.predict(dataForTraining) draw.DrawDiff(year[2:202], dataForTrainingAnswer, Tsu) Ts = net.predict(sunSpotActivityDataUsage) draw.DrawDiff(year[2:], sunSpotActivity[2:], Ts) eVector = list() for real, predicted in zip(answerForSunActivity, Ts): e = real - predicted eVector.append(e) draw.DrowPlot(year[2:], eVector) draw.DrowHist(eVector) predictionMSE = mse(eVector) predictionMAD = mad(eVector) print('MSE = {}'.format(predictionMSE))