所有代码都可以正常工作,但最后一行适合 对数据进行建模。会有任何帮助。
错误是
AttributeError: module 'sklearn.svm.libsvm_sparse' has no attribute 'set_verbosity_wrap'
原始代码如下:
# Importing necessery libraries for the Regression
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
# Importing 'Internal Glands.csv' dataset from the user directory
dataset = pd.read_csv('/Users/austinejose/Downloads/Internal Glands.csv')
# Sorting the necessary imputs and output fields from the dataset
X = dataset[['radius', 'perimeter', 'area', 'texture']]
y = dataset['diagnosis_result']
# Splitting data into training and testing
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2, random_state = 0)
# Scaling the training and testing data
from sklearn.preprocessing import StandardScaler
Sc_X = StandardScaler()
X_train = Sc_X.fit_transform(X_train)
X_test = Sc_X.transform(X_test)
from sklearn.linear_model import LogisticRegression
model = LogisticRegression(random_state = 0)
model.fit(X_train, y_train)