#begging import numpy as np from sklearn.datasets import make_moons from sklearn.metrics import accuracy_score import matplotlib.pyplot as plt from sklearn.ensemble import BaggingClassifier from sklearn.tree import DecisionTreeClassifier
#RandomForest import numpy as np from sklearn.datasets import make_moons from sklearn.metrics import accuracy_score import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestClassifier from sklearn.tree import DecisionTreeClassifier
#Boost import numpy as np from sklearn.datasets import make_moons from sklearn.metrics import accuracy_score import matplotlib.pyplot as plt from sklearn.ensemble import AdaBoostClassifier from sklearn.tree import DecisionTreeClassifier
#Stacking from sklearn import datasets from sklearn import model_selection from sklearn.linear_model import LogisticRegression from sklearn.neighbors import KNeighborsClassifier from sklearn.naive_bayes import GaussianNB from sklearn.ensemble import RandomForestClassifier from mlxtend.classifier import StackingClassifier import numpy as np
iris = datasets.load_iris() X, y = iris.data[:, 1:3], iris.target
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-4-483486e68139> in <module>
6 from sklearn.naive_bayes import GaussianNB
7 from sklearn.ensemble import RandomForestClassifier
----> 8 from mlxtend.classifier import StackingClassifier
9 import numpy as np
10
ModuleNotFoundError: No module named 'mlxtend'
1
!pip install mlxtend
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
ERROR: Could not find a version that satisfies the requirement mlxtend (from versions: none)
ERROR: No matching distribution found for mlxtend
#Voting import numpy as np from sklearn.datasets import make_moons#生成月牙形数据 from sklearn.metrics import accuracy_score#分类器的准确率 import matplotlib.pyplot as plt#画图
from sklearn.ensemble import VotingClassifier#调用集成学习的投票分类器 from sklearn.linear_model import LogisticRegression#调用逻辑回归分类器 from sklearn.svm import SVC#调用支持向量机分类器 from sklearn.neighbors import KNeighborsClassifier#调用KNN分类器