import numpy as npimport pandas as pddataset=pd.read_csv("/Users/rushirajparmar/Downloads/Social_network_Ads.csv",error_bad_lines = False)X = dataset.iloc[:,[2,3]].values. Y = dataset.iloc[:,4].valuesfrom sklearn.model_selection import train_test_splitX_train,X_test,Y_train,Y_test = train_test_split(X,Y,test_size = 0.25,random_state = 0) from sklearn.preprocessing import StandardScalersc = StandardScaler()X_train = sc.fit_transform(X_train)X_test = sc.transform(X_test)from sklearn.linear_model import LogisticRegressionclassifier = LogisticRegression()classifier.fit(X_train,Y_train)y_pred = classifier.fit(X_test)from sklearn.metrics import confusion_matrixcm = confusion_matrix(Y_test, y_pred)我刚开始练习 LogisticRegression 时出现此错误。我不明白出了什么问题。我尝试在互联网上搜索它,但没有帮助y_pred = classifier.fit(X_test).values.ravel()TypeError: fit() missing 1 required positional argument: 'y'下面是数据集的链接:https://github.com/Avik-Jain/100-Days-Of-ML-Code/blob/master/datasets/Social_Network_Ads.csv
添加回答
举报
0/150
提交
取消