欢迎来到 mlxtend 文档!
Mlxtend (机器学习扩展) 是一个 Python 库,为日常数据科学任务提供有用的工具。
链接
- 文档: https://mlxtend.cn/mlxtend
- 源代码库: https://github.com/rasbt/mlxtend
- PyPI: https://pypi.python.org/pypi/mlxtend
- 有问题? 查看 GitHub 讨论区
示例
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import itertools
from sklearn.linear_model import LogisticRegression
from sklearn.svm import SVC
from sklearn.ensemble import RandomForestClassifier
from mlxtend.classifier import EnsembleVoteClassifier
from mlxtend.data import iris_data
from mlxtend.plotting import plot_decision_regions
# Initializing Classifiers
clf1 = LogisticRegression(random_state=0)
clf2 = RandomForestClassifier(random_state=0)
clf3 = SVC(random_state=0, probability=True)
eclf = EnsembleVoteClassifier(clfs=[clf1, clf2, clf3],
weights=[2, 1, 1], voting='soft')
# Loading some example data
X, y = iris_data()
X = X[:,[0, 2]]
# Plotting Decision Regions
gs = gridspec.GridSpec(2, 2)
fig = plt.figure(figsize=(10, 8))
labels = ['Logistic Regression',
'Random Forest',
'RBF kernel SVM',
'Ensemble']
for clf, lab, grd in zip([clf1, clf2, clf3, eclf],
labels,
itertools.product([0, 1],
repeat=2)):
clf.fit(X, y)
ax = plt.subplot(gs[grd[0], grd[1]])
fig = plot_decision_regions(X=X, y=y,
clf=clf, legend=2)
plt.title(lab)
plt.show()
如果您在科学出版物的工作流程中使用 mlxtend,请考虑引用带有以下 DOI 的 mlxtend 仓库
@article{raschkas_2018_mlxtend,
author = {Sebastian Raschka},
title = {MLxtend: Providing machine learning and data science
utilities and extensions to Python’s
scientific computing stack},
journal = {The Journal of Open Source Software},
volume = {3},
number = {24},
month = apr,
year = 2018,
publisher = {The Open Journal},
doi = {10.21105/joss.00638},
url = {https://joss.theoj.org/papers/10.21105/joss.00638}
}
许可证
- 本项目在宽松的新 BSD 开源许可证 (LICENSE-BSD3.txt) 下发布,可用于商业目的。不提供任何担保;甚至不提供适销性或特定用途适用性的担保。
- 此外,您可以根据知识共享署名 4.0 国际许可证的条款和条件,使用、复制、修改和重新分发本发行版中目录下的所有艺术创意作品(图和图像)。详细信息请参阅文件 LICENSE-CC-BY.txt。(计算机生成的图形,如 matplotlib 生成的图,属于上述 BSD 许可证。)
联系方式
最近我收到了许多关于 mlxtend 的反馈和问题,我觉得有必要建立一个公共交流渠道。在您就 mlxtend 的问题发送电子邮件之前,请考虑在这里发布,因为这可能对其他人也有用!请加入 Google Groups 邮件列表!
如果 Google Groups 不适合您,请随时给我发送电子邮件,或者考虑在GitHub 的问题跟踪器上提交新功能请求或错误报告。此外,我还设置了一个Gitter 频道用于实时讨论。