Problems with machine learning - predicting time

Viewed 38

I'm trying to forecast ending time of an action based on starting time.
My data-set looks like this:

id,start_time,start_weekday,end
2,180733,2,180823
2,184745,2,072530
2,200000,3,210651
2,213500,4,130144
2,172317,5,172431
2,173305,5,173352
2,173710,5,183956
2,184001,5,095509
2,225521,6,232317
2,232335,6,120215
2,171114,7,172103
2,172148,7,214331
.
.
.
2,214409,7,080618
2,104629,1,132910
2,162128,1,184410
2,193340,1,212252
2,212325,1,115046
2,154808,2,160414
2,160432,2,191113
2,191128,2,191629
2,191645,2,221928
2,221951,2,222359
2,094145,3,094327
2,094411,3,094858
2,105252,3,105730
2,141108,3,141503
2,153650,3,084532

the time is formatted like this: Hour:Minute:Second
I want to be able to estimate the end time based on the id, start_time and start_weekday
The problem is that the score I get after running the algorithm is a little more than 1 percent.

I add below the code I wrote to try and forecast the ending time:

# installing dependencies
from unittest import registerResult
import numpy as np
import seaborn as sns
import pandas as pd
from sklearn.linear_model import LinearRegression
from sklearn.model_selection import train_test_split

data = pd.read_csv('./formatted_data.csv')
print(data.head())
print(data.shape)
print(data.describe())
print(data.isnull().sum())

train = data.drop(['plug_out_time'], axis=1)
test = data['plug_out_time']

x_train, x_test, y_train, y_test = train_test_split(
    train, test, test_size=0.3, random_state=2)
regr = LinearRegression()

regr.fit(x_train, y_train)
pred = regr.predict(x_test)

print(regr.score(x_test, y_test))
0 Answers
Related