int main
int main

Reputation: 11

End of file error due to setup function of pycaret

I am making an object of Automl and I am calling the function initial setup which displays a text widget and when text is submit it calls the target_submit_handler which internally calls classification_setup which calls the setup() of pycaret library However when setup function gets called I am getting an end of file error:

enter image description here

from pycaret.classification import *

class AutoMl():
    def __init__(self):
        self.dataframe=pd.DataFrame()
        self.w=None
        self.setup=None
            
    def classification_setup(self,data,target):
        x=setup(self.dataframe, "Species")     //this fucntion is of pycaret library which displays the end of file er
        
    def target_submit_handler(self,text):
#         print(self.dataframe,self.target.value) I am geting the correct dataframe and target column name 
        self.classification_setup(data=self.dataframe,target="Species")
        
    def initial_setup(self,dataframe=None,target=None):
        if(dataframe==None and target==None):
            if(self.dataframe.empty!=True):
                self.target = widgets.Text(description = 'Enter the target column')
                self.target.on_submit(self.target_submit_handler)
                display(self.target)

f=AutoMl()
f.initial_setup() //end of file error 

This is the end of file error:

enter image description here

Upvotes: 1

Views: 760

Answers (1)

Abhishek Gupta
Abhishek Gupta

Reputation: 11

Just replace the code in the classfication_setup function with the following code.

x=setup(self.dataframe, "Species", silent=True)

For its working read the document https://pycaret.org/setup/

Upvotes: 1

Related Questions