From 66a3a8cc42fc9ef21dbbf598dcd80d538fe4f0d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de> Date: Sat, 17 Apr 2021 16:20:13 +0200 Subject: [PATCH] Use column names instead of numbers plus logging --- slope-evaluator/app/trend_slope_computer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/slope-evaluator/app/trend_slope_computer.py b/slope-evaluator/app/trend_slope_computer.py index 84575fe83..5b9d5caf9 100644 --- a/slope-evaluator/app/trend_slope_computer.py +++ b/slope-evaluator/app/trend_slope_computer.py @@ -9,8 +9,10 @@ def compute(data, warmup_sec): print(regress) - X = regress.iloc[:, 2].values.reshape(-1, 1) # values converts it into a numpy array - Y = regress.iloc[:, 3].values.reshape(-1, 1) # -1 means that calculate the dimension of rows, but have 1 column + X = regress.iloc[:, 'timestamp'].values.reshape(-1, 1) # values converts it into a numpy array + print(X) + Y = regress.iloc[:, 'value'].values.reshape(-1, 1) # -1 means that calculate the dimension of rows, but have 1 column + print(Y) linear_regressor = LinearRegression() # create object for the class linear_regressor.fit(X, Y) # perform linear regression Y_pred = linear_regressor.predict(X) # make predictions -- GitLab