Commit 8f5394be authored by Your Name's avatar Your Name
Browse files

ad

parent 3200adbb
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import sys
import matplotlib.pyplot as plt
from scipy.linalg import inv
from sklearn.datasets import make_regression, make_classification
......@@ -9,6 +10,10 @@ import json
from pandas.io.json import json_normalize
import os
import datetime as dt
sys.path.insert(1, '..\src')
import preprocessing
kwargs = dict(random_state=42)
def linearRegression(df_singlePeriod):
......@@ -39,7 +44,7 @@ def linearRegression(df_singlePeriod):
print(y_pred)
print(lr.coef_)
def predictValues(test, temp_list, temp):
def predictValues_generel(test, temp_list, temp):
counter = 1
pred_list = list()
# pred_list.append(temp_list[0])
......@@ -63,6 +68,37 @@ def predictValues(test, temp_list, temp):
temp['linearReg'] = pred_list
print("Values have been predicted!")
def predictValues_clust0(input):
counter = 1
pred_list = list()
temp_list = input['inter_pol'].tolist()
emptie_checkpoints = preprocessing.calculate_empties(input, 1.01)
for k in range(emptie_checkpoints[0]):
y = -3.62261628 * k + temp_list[0]
pred_list.append(y)
for timeinterval in emptie_checkpoints:
if counter < len(emptie_checkpoints):
length = emptie_checkpoints[counter] - timeinterval
counter = counter + 1
for i in range(length):
y = -3.62261628 * i + temp_list[timeinterval]
pred_list.append(y)
addition = input.shape[0] - emptie_checkpoints[-1]
for j in range(addition):
y = -3.62261628 * temp_list[emptie_checkpoints[-1]]
pred_list.append(y)
print('values have been predicated')
rmse = mean_squared_error(temp_list, pred_list, squared=False)
print(rmse)
return pred_list
def linearRegressionPlot(temp, test, cluster):
plt.figure(figsize=(30,8))
plt.ylim((0,200))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment