2
$\begingroup$

all. Currently I am working in a regressor to predict the median house value using 1990 census as a dataset (the same on Aurélien Géron used on his book).

My best result so far has been a score of ~0.96 for the training set and ~0.80 and for the test set with a bagging regressor. Here's how I had been doing:

precisao_treino = clf.score(dados_treino_feat,dados_treino_targ) #training score
precisao_valid = clf.score(dados_valid_feat,dados_valid_targ) #test score



(0.9698880465469455, 0.8087685894971024)

But here is where I get confused. That very high training score indicate that there is a potential overfit on my model. However, the test score is maintained a relative good score. So I don't know if my model is overfitting or if doing well at predicting. Could someone explain to me whether this a bad or good model?


Here's how my final dataset looks like, with one-hot-encoding:

['longitude',
 'latitude',
 'housing_median_age',
 'total_rooms',
 'total_bedrooms',
 'population',
 'households',
 'median_income',
 'median_house_value',
 '<1H OCEAN',
 'INLAND',
 'ISLAND',
 'NEAR BAY',
 'NEAR OCEAN']

My solution to removing outliers:

df = df[(np.abs(zscore(df)) < 6).all(axis=1)]

My model:

clf = ensemble.BaggingRegressor(n_estimators=20)
$\endgroup$
1
$\begingroup$

Overfitting is nothing but when the model tries to rot learn the data given to it during the training process.

In such cases, the validation accuracy goes down as the model cannot interpret and classify unseen data.

Reviewing the accuracies of the model, the validation accuracy soars to 0.8 which is quite good.

The training accuracy is 0.96 which is a good sign and also it shows that model has generalised so well that it can classify all the data ( train and validation ) very well.

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.