House price prediction using PyCaret

Original article was published by Harsh Bathia on Artificial Intelligence on Medium


👉Comparing models writing a single line of Code

compare_models()

This function trains all the models available in the model library and scores them using Kfold Cross-Validation. The output prints a scoring grid with MAE, MSE RMSE, R2, RMSLE, and MAPE (averaged across folds), determined by fold parameter. This function returns the best model based on the metric defined in the sort parameter.

  • For Classification: Accuracy, AUC, Recall, Precision, F1, Kappa, MCC
  • For Regression: MAE, MSE, RMSE, R2, RMSLE, MAPE

✏️Create a model

After observing all models MAE, MSE RMSE, R2, RMSLE, and MAPE next step is to create the best model for our dataset.

lgbm = create_model(
estimator='lightgbm',
fold=5
)

This function creates a model and scores it using K-fold Cross-Validation. (default = 10 Fold). The output prints a scoring grid that shows MAE, MSE, RMSE, RMSLE, R2, and MAPE. This function returns a trained model object.

📝Prediction

This function is used to predict new data using a trained estimator.

house_prediction =  predict_model(lgbm, data=test_house)
house_prediction.head()