Package: mlxtend
Mlxtend (machine learning extensions) is a Python library of useful tools for the day-to-day data science tasks.Sebastian Raschka 2014-2024LinksDocumentation:https://rasbt.github.io/mlxtendPyPI:https://pypi.python.org/pypi/mlxtendChangelog:https://rasbt.github.io/mlxtend/CHANGELOGContributing:https://rasbt.github.io/mlxtend/CONTRIBUTINGQuestions? Check out theGitHub Discussions boardInstalling mlxtendPyPITo install mlxtend, just executepipinstallmlxtendAlternatively, you could download the package manually from the Python Package Indexhttps://pypi.python.org/pypi/mlxtend, unzip it, navigate into the package, and use the command:pythonsetup.pyinstallCondaIf you use conda, to install mlxtend just executecondainstall-cconda-forgemlxtendDev VersionThe mlxtend version on PyPI may always be one step behind; you can install the latest development version from the GitHub repository by executingpipinstallgit+git://github.com/rasbt/mlxtend.git#egg=mlxtendOr, you can fork the GitHub repository fromhttps://github.com/rasbt/mlxtendand install mlxtend from your local drive viapythonsetup.pyinstallExamplesimportnumpyasnpimportmatplotlib.pyplotaspltimportmatplotlib.gridspecasgridspecimportitertoolsfromsklearn.linear_modelimportLogisticRegressionfromsklearn.svmimportSVCfromsklearn.ensembleimportRandomForestClassifierfrommlxtend.classifierimportEnsembleVoteClassifierfrommlxtend.dataimportiris_datafrommlxtend.plottingimportplot_decision_regions# Initializing Classifiersclf1=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 dataX,y=iris_data()X=X[:,[0,2]]# Plotting Decision Regionsgs=gridspec.GridSpec(2,2)fig=plt.figure(figsize=(10,8))forclf,lab,grdinzip([clf1,clf2,clf3,eclf],['Logistic Regression','Random Forest','RBF kernel SVM','Ensemble'],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()If you use mlxtend as part of your workflow in a scientific publication, please consider citing the mlxtend repository with the following DOI:@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}
}Raschka, Sebastian (2018) MLxtend: Providing machine learning and data science utilities and extensions to Python's scientific computing stack.
J Open Source Softw 3(24).LicenseThis project is released under a permissive new BSD open source license (LICENSE-BSD3.txt) and commercially usable. There is no warranty; not even for merchantability or fitness for a particular purpose.In addition, you may use, copy, modify and redistribute all artistic creative works (figures and images) included in this distribution under the directory
according to the terms and conditions of the Creative Commons Attribution 4.0 International License.  See the fileLICENSE-CC-BY.txtfor details. (Computer-generated graphics such as the plots produced by matplotlib fall under the BSD license mentioned above).ContactThe best way to ask questions is via theGitHub Discussions channel. In case you encounter usage bugs, please don't hesitate to use theGitHub's issue trackerdirectly.