I have a trip duration dataset that looks like this: I want to use other parameters to predict the waiting time (wait_sec). The waiting time refers to the time the vehicle is stuck in traffic or so. The data is clean (without outliers/missing values) already.
pickup_longitude pickup_latitude dropoff_longitude dropoff_latitude trip_duration dist_meters wait_sec hour_of_day month day_of_week day_of_year week_of_year trip_duration_log dist_meters_log avg_speed -78.5092 -0.2215 -78.4920 -0.2069 955 3587 403 6 10 3 301 43 6.8628 8.1853 3.7560
I tried using LinearRegression
X = df[['pickup_longitude', 'pickup_latitude','dropoff_longitude','dropoff_latitude','trip_duration','dist_meters','hour_of_day','day_of_week','trip_duration_log','dist_meters_log', 'avg_speed']] y = df['wait_sec'] x_train, x_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 42) LR = LinearRegression() # fitting the training data LR.fit(x_train,y_train) y_prediction = LR.predict(x_test) score=r2_score(y_test,y_prediction) print('mean_abs is==',mean_absolute_error(y_test,y_prediction))
but the mean abs error I get is quite high (97). What other approach can I use? Or how can I optimise Linear Regression itself here? Original dataset can be found here: https://www.kaggle.com/mnavas/taxi-routes-for-mexico-city-and-quito?select=uio_clean.csv