diff --git a/slope-evaluator/app/trend_slope_computer.py b/slope-evaluator/app/trend_slope_computer.py index 631a1217d48ea034106b9eb88e8a2ed7f9f579f8..51b28f2baa5110a6d64f3adc1ac9a94c6b6f3ce9 100644 --- a/slope-evaluator/app/trend_slope_computer.py +++ b/slope-evaluator/app/trend_slope_computer.py @@ -4,15 +4,10 @@ import os def compute(data, warmup_sec): data['sec_start'] = data.loc[0:, 'timestamp'] - data.iloc[0]['timestamp'] - print(data) regress = data.loc[data['sec_start'] >= warmup_sec] # Warm-Up - print(regress) - - X = regress.iloc[:, 2].values.reshape(-1, 1) # values converts it into a numpy array - print(X) - Y = regress.iloc[:, 3].values.reshape(-1, 1) # -1 means that calculate the dimension of rows, but have 1 column - print(Y) + X = regress.iloc[:, 1].values.reshape(-1, 1) # values converts it into a numpy array + Y = regress.iloc[:, 2].values.reshape(-1, 1) # -1 means that calculate the dimension of rows, but have 1 column linear_regressor = LinearRegression() # create object for the class linear_regressor.fit(X, Y) # perform linear regression Y_pred = linear_regressor.predict(X) # make predictions