Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About "from machine_learning_algorithm.cross_validation import validate" #2

Open
YYYYWD opened this issue Oct 30, 2018 · 2 comments
Open

Comments

@YYYYWD
Copy link

YYYYWD commented Oct 30, 2018

from machine_learning_algorithm.cross_validation import validate

ModuleNotFoundError: No module named 'machine_learning_algorithm'

请问一下,您这个模块是没有上传到github上吗

@w179962443
Copy link

from machine_learning_algorithm.cross_validation import validate

ModuleNotFoundError: No module named 'machine_learning_algorithm'

请问一下,您这个模块是没有上传到github上吗

hey brother
用下面这几句替代作者那几句
if name == 'main':
import pandas as pd
dataset=pd.read_csv('iris.csv',names=['sepal length','sepal width','petal length','petal width','class'])
dataset['class']=np.where(dataset['class'].str.contains('Iris-setosa'), 1,np.where(dataset['class'].str.contains('Iris-versicolor'),2,3))
X=dataset.values
x=X[:,:4]
y=X[:,4]
from sklearn.model_selection import KFold
kf = KFold(n_splits=10)
for xun, ce in kf.split(X):
X_data_train,X_data_test,y_data_train,y_data_test = x[xun], x[ce], y[xun], y[ce]
clf = CART_CLF()
clf.fit(X_data_train, y_data_train)
score = 0
for a, b in zip(X_data_test,y_data_test):
if clf.predict(a) == b:
score += 1
print(score / len(y_data_test))

其中iris数据集自己去下载。

@future-zy
Copy link

改成 from cross_validation import validate 就行了,那个是博主自己写的代码

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants