1

我正在制作 Automl 的对象,我正在调用函数初始设置,它显示一个文本小部件,当提交文本时,它调用 target_submit_handler,它在内部调用classification_setup它调用setup()pycaret 库但是当调用设置函数时,我正在结束文件错误:

在此处输入图像描述

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 

这是文件错误的结尾:

在此处输入图像描述

4

1 回答 1

1

只需将classfication_setup函数中的代码替换为以下代码即可。

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

对于其工作,请阅读文档https://pycaret.org/setup/

于 2021-04-25T20:40:34.863 回答