Forum Discussion

userpowerbiii12's avatar
userpowerbiii12
Frequent Visitor
3 years ago
Solved

Using Pycaret for Random Forest Classifcation (Employee churn)

I'm trying to integrate my machine learning model (Random Forest) I did in Jupyter Notebook inside power BI. Using gridsearch , and after testing multiple algorithms, it turned out that the Random F...
  • PabloJMorenoAE's avatar
    3 years ago

    Hello,

    I'm the author of the LinkedIn article that you are refering to in your question, and you are making several mistakes:

    1. you don't need the setup, as you are importing the model from a pkl file (assuming that you saved it earlier)

    2. make sure that all your columns at the dataframe are correctly named, exactly the same as the model was trained with the original dataframe. Also the values are wtihin the same range of the training dataset used to generate the model.

    3. you are using the wrong column name to mask / rename the values. When you apply the `predict_model()`, the classification experiment will automatically produce 2 columns: 'prediction_label' (with the 0 and 1 values) and 'prediction_score' (with the probability of the class predicted). So, your mitake should be solved with:

    df = df1[['prediction_label']]
    df.rename(columns = {'prediction_label' : 'Could the employee potentially leave the company'}, inplace = True)
     
    Thank you
    Pablo