Py之mglearn:python库之mglearn简介、安装、使用方法之详细攻略-阿里云开发者社区

开发者社区> 一个处女座的程序猿> 正文

Py之mglearn:python库之mglearn简介、安装、使用方法之详细攻略

简介: Py之mglearn:python库之mglearn简介、安装、使用方法之详细攻略
+关注继续查看

mglearn简介


     mglearn库,该库集成了sklearn和数据的许多操作方法,很便捷,获取对应数据。Helper functions for the book "Introduction to Machine Learning with Python"

GitHub:https://github.com/amueller/mglearn


1、英文解释


This repository holds the code for the forthcoming book "Introduction to Machine Learning with Python" by Andreas Muellerand Sarah Guido. You can find details about the book on the O'Reilly website.


The books requires the current stable version of scikit-learn, that is 0.20.0. Most of the book can also be used with previous versions of scikit-learn, though you need to adjust the import for everything from the model_selection module, mostly cross_val_score, train_test_split and GridSearchCV.


This repository provides the notebooks from which the book is created, together with the mglearn library of helper functions to create figures and datasets.


For the curious ones, the cover depicts a hellbender.


All datasets are included in the repository, with the exception of the aclImdb dataset, which you can download from the page of Andrew Maas. See the book for details.


If you get ImportError: No module named mglearn you can try to install mglearn into your python environment using the command pip install mglearn in your terminal or !pip install mglearn in Jupyter Notebook.




mglearn安装


pip install mglearn==0.1.6


image.png




mglearn使用方法


1、Helper functions for the book "Introduction to Machine Learning with Python"


This is the mglearn package used in the book, which you can also find in the accompanying repository


You don't need this repo, all the code is there:


https://github.com/amueller/introduction_to_ml_with_python

This repository is a stand-alone package in case you really feel like you want to install mglearn into your Python environment, for some reason or another. You can install it by running


pip install mglearn

in your terminal, or by running


!pip install mglearn

in Jupyter Notebook.


In particular, installing this package is a very easy way to add it to your Python search path. Or you can just check out the notebooks from the repository above, and add the path to the mglearn subfolder to your PYTHONPATH environment variable (or set it in your IDE).



2、Setup


To run the code, you need the packages numpy, scipy, scikit-learn, matplotlib, pandas and pillow. Some of the visualizations of decision trees and neural networks structures also require graphviz. The chapter on text processing also requirs nltk and spacy.


The easiest way to set up an environment is by installing Anaconda.


Installing packages with conda:


If you already have a Python environment set up, and you are using the conda package manager, you can get all packages by running


conda install numpy scipy scikit-learn matplotlib pandas pillow graphviz python-graphviz

For the chapter on text processing you also need to install nltk and spacy:


conda install nltk spacy

Installing packages with pip


If you already have a Python environment and are using pip to install packages, you need to run


pip install numpy scipy scikit-learn matplotlib pandas pillow graphviz

You also need to install the graphiz C-library, which is easiest using a package manager. If you are using OS X and homebrew, you can brew install graphviz. If you are on Ubuntu or debian, you can apt-get install graphviz. Installing graphviz on Windows can be tricky and using conda / anaconda is recommended. For the chapter on text processing you also need to install nltk and spacy:


pip install nltk spacy

Downloading English language model


For the text processing chapter, you need to download the English language model for spacy using


python -m spacy download en



 


版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。

相关文章
Py之gensim:gensim的简介、安装、使用方法之详细攻略
Py之gensim:gensim的简介、安装、使用方法之详细攻略
26 0
Python数据分析之anaconda安装和使用
今天开始学习Python数据分析了,说到Python数据分析,大家都会推荐使用anaconda,但作为一个初学者,总是很多疑虑,但在实践中解决了一部分,先和大家分享分享。
940 0
使用OpenApi弹性释放和设置云服务器ECS释放
云服务器ECS的一个重要特性就是按需创建资源。您可以在业务高峰期按需弹性的自定义规则进行资源创建,在完成业务计算的时候释放资源。本篇将提供几个Tips帮助您更加容易和自动化的完成云服务器的释放和弹性设置。
7623 0
python环境安装和在eclipse中插件的使用
目录 安装Python python for eclipse插件安装 配置PyDev插件 测试 python环境安装和python for eclipse插件安装1、下载python环境和python for eclipsepython环境和python for eclipse插件下载地址 在Windows命令行中使用Python 如果你想要从Windows命
1472 0
使用setuptools自动安装python模块
setuptools绝对是个好东西,它可以自动的安装模块,只需要你提供给它一个模块名字就可以了,并且自动帮你解决模块的依赖问题。
632 0
机器学习之使用sklearn构造决策树模型
机器学习之使用sklearn构造决策树模型一、任务基础导入所需要的库 1234import matplotlib.pyplot as pltimport pandas as pd %matplotlib inline加载sklearn内置数据集 ,查看数据描述 123from sklearn.
708 0
+关注
一个处女座的程序猿
国内互联网圈知名博主、人工智能领域优秀创作者,全球最大中文IT社区博客专家、CSDN开发者联盟生态成员、中国开源社区专家、华为云社区专家、51CTO社区专家、Python社区专家等,曾受邀采访和评审十多次。仅在国内的CSDN平台,博客文章浏览量超过2500万,拥有超过57万的粉丝。
1701
文章
0
问答
文章排行榜
最热
最新
相关电子书
更多
文娱运维技术
立即下载
《SaaS模式云原生数据仓库应用场景实践》
立即下载
《看见新力量:二》电子书
立即下载