Residual plot is tight to zero, but low R2 score Hi I am a beginner at data science, and currently trying to use Gradient Boost Regressor to predict car price based on several attribute such as machine capacity, car brand, car type etc. 

I am following this tutorial: https://github.com/PaacMaan/cars-price-predictor/blob/master/cars_price_predictor.ipynb

I got a low R2 score and plotted the residual vs predicted value, what i am confused with is even though my residual value is close to zero (as showed on the graph) my r2_score is low. Can anyone kindly explain this to me?


here is my r2 score

r2_score: 0.38

and the code i am using

car_df_encoded = pd.get_dummies(car_df_encoded, columns=['Store_Loc','Brand','Type','Transmission'], prefix = ['Store_Loc','Brand','Type','Transmission'])
price= car_df_encoded.pop('Price')


x_train, x_test, y_train, y_test = train_test_split(car_df_encoded, harga, test_size=0.25)

gbr = GradientBoostingRegressor(loss='huber', max_depth=5, max_features=None,min_samples_leaf=8, min_samples_split=6, n_estimators=150,random_state=42)
gbr.fit (x_train, y_train)
predicted = gbr.predict(x_test)
residual = y_test - predicted


Tried using cross validation as well

scores = cross_val_score(gbr, car_df_encoded, harga, cv=4, scoring='r2')
print('\nMean Score:')
print(scores.mean())


and my mean r2 score is

Cross Validation Scores:
[0.76621245 0.41771035 0.35744057 0.73955563]

Mean Score:
0.5702297501214788
According to the plot there is a huge outlier in your residual. Plus taking into account that your cross-validation sometimes shows quite good results (0.77, 0.74) and sometimes not so great (0.42, 0.36) I would first try to remove that outlier from your data and see what you get.