Vikas Sharma
Vikas Sharma

Reputation: 11

Error in PyCaret AutoML Web App: Unexpected 'setup()' Argument 'silent' - How Can I Fix This?

I'm working on an AutoML web application using PyCaret, Streamlit, and pandas_profiling. My app allows users to upload a dataset, perform exploratory data analysis (EDA) with pandas_profiling, and build classification models using PyCaret. However, I've run into an issue while trying to use the 'setup()' function in PyCaret for model setup. Specifically, I'm getting a 'TypeError' related to an unexpected 'silent' argument in the 'setup()' function call.

AutoMl Program is as follows:

%%writefile app.py

from operator import index
import streamlit as st

from pycaret.classification import setup, compare_models, pull, save_model, load_model
import pandas as pd
import os

if os.path.exists('./dataset.csv'):
    df = pd.read_csv('dataset.csv', index_col=None)
if choice == "Modelling":
    chosen_target = st.selectbox('Choose the Target Column', df.columns)
    if st.button('Run Modelling'):
        setup(df, target=chosen_target, silent=True)
        setup_df = pull()
        st.dataframe(setup_df)
        best_model = compare_models()
        compare_df = pull()
        st.dataframe(compare_df)
        save_model(best_model, 'best_model')

if choice == "Download":
    with open('best_model.pkl', 'rb') as f:
        st.download_button('Download Model', f, file_name="best_model.pkl")

The error message I'm encountering is as follows:

WebApp Error SnapShot

TypeError: setup() got an unexpected keyword argument 'silent'

This error seems to indicate that the 'silent' argument is not recognized by the 'setup()' function. To address this problem, I've attempted to upgrade my PyCaret version, double-check the argument name, and explore the function signature. Despite these efforts, I'm still unable to resolve the issue.

I attempted to use the 'setup()' function from the PyCaret library within my AutoML web application. I included the 'silent' argument with a value of 'True' to suppress unnecessary progress bars and logging during the model setup process.

What I expected was for the 'setup()' function to execute successfully with the 'silent' argument, allowing me to proceed with model setup and comparison.

However, what actually resulted was a 'TypeError' with the message: "setup() got an unexpected keyword argument 'silent'". This error prevented the successful execution of the 'setup()' function, disrupting the model setup process and hindering further progress in my web application.

I'm seeking guidance on how to fix this error and successfully utilize the 'setup()' function for model setup in my PyCaret-based web application. If you have any insights or suggestions, I would greatly appreciate your help. Thank you!

Upvotes: 1

Views: 361

Answers (1)

Alper Yilmaz
Alper Yilmaz

Reputation: 76

verbose = False

Instead of silent = True use verbose = False

( When set to False, Information grid is not printed )

Note: This is an issue related to the version of PyCaret.

Related SO question: setup-got-an-unexpected-keyword-argument-silent

Upvotes: 0

Related Questions