0
$\begingroup$

I am getting all scores for my ML model as 100% for the Extra Trees Algorithm. I am applying the necessary pre-processing steps (duplication removal, correlations validating, cardinality validation, and missing values handling). Is this okay to have this kind of result?

enter image description here

Here is my code

std_features_train, std_features_test , std_output_train, std_output_test = train_test_split(encoded_balanced_std_scaled_emp_data.drop("leave", axis=1),encoded_balanced_std_scaled_emp_data['leave'],train_size=0.7)

model_std = ExtraTreesClassifier()

model_std.fit(std_features_train,std_output_train)
model_predictions_std = model_std.predict(std_features_test)
model_train_score = model_std.score(std_features_train,std_output_train)
model_test_score = model_std.score(std_features_test,std_output_test)
model_f1_score = f1_score(std_output_test, model_predictions_std, average='binary')
model_precision_score=precision_score(std_output_test, model_predictions_std, average='binary')
model_recall_score=recall_score(std_output_test, model_predictions_std, average='binary')
model_r2_score = r2_score(std_output_test,model_predictions_std)
  model_mse_score=mean_squared_error(std_output_test, model_predictions_std)

  std_results_table.add_row([model_std.__class__.__name__,round(model_train_score*100,2), 
                      round(model_test_score*100,2), round(model_r2_score*100,2), 
                      round(model_mse_score*100,2), round(model_f1_score*100,2), 
                      round(model_precision_score*100,2), 
                      round(model_recall_score*100,2)])
$\endgroup$
1
  • $\begingroup$ Please consider upvoting and accepting the answer or, alternatively, please describe why you consider it not correct or what is not clear in it. $\endgroup$
    – noe
    Feb 24 at 13:21

2 Answers 2

1
$\begingroup$

Normally this is an indication of data leakage. You should check if your test dataset may contain data from your training dataset (e.g. by splitting the datasets after performing oversampling)

$\endgroup$
0
$\begingroup$

This could indicate one of two things. Either your model is overfitting to the test data, or your features fully explain your target variable. The only way to be sure would be if you had (or could obtain) another independently collected dataset and use that to test your model. If that's not practical, then use your data exploration results to investigate further. Are there predictor variables that are very highly correlated with the target? Do you get perfect results if you create another type of model, such as a logistic regression?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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