Giter Club home page Giter Club logo

2-scikit-learn-intro's Introduction

利用Scikit Learn机器学习模块进行建模和预测

这里我们学习Scikit Learn的安装和基本操作,并且尝试通过Scikit Learn对秒 级股票价格数据进行预测。

下载本章实例程序

下载本章节实例程序和数据,只需执行下面操作:

git clone https://github.com/real-time-machine-learning/2-scikit-learn-intro

安装配置软件环境

我们假设读者在Ubuntu或者Mac环境下进行学习。下面的步骤可以供Windows用户 参考,但可能需要稍作修改。

安装Python3

在Ubuntu 下面安装Python 3,只需执行下面操作:

sudo apt-get install python3 python3-pip python3-dev build-essential libffi6 libffi-dev

在Mac下利用Homebrew 安装Python 3,只需执行下面操作:

brew install python3

Windows用户……安装一下Ubuntu好吗?

安装Scikit Learn

这里我们通过Python的Pip配置文件的方法安装Scikit Learn。在后面的Docker学 习中,我们可以看到这样的配置方法非常利于自动化Docker操作。

sudo pip3 install -r requirements.txt

如果一切顺利,上面操作完成以后,我们可以启动Python3并且调用Pandas

python3 
>>> import sklearn 

Scikit Learn基本操作

本章具有多个实例模块:

  • digits-knn.py: 使用K-最近邻估计对扫描数字数据进行分类
  • digits-linear-regression.py: 使用逻辑回归对扫描数字数据进行分类
  • iris-pipeline.py: 使用pipeline对Iris鲜花数据进行分类
  • stock-model.py: 使用Scikit Learn对股价变化进行预测建模

鸣谢

感谢下面各位为本代码提出宝贵意见和指正:


《实时机器学习实战》 彭河森、汪涵

2-scikit-learn-intro's People

Contributors

hesenp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

2-scikit-learn-intro's Issues

拆分训练集和测试集时抛出TypeError

## 拆分训练集和测试集
X_train = X_digits[:.9 * n_samples]
y_train = y_digits[:.9 * n_samples]
X_test = X_digits[.9 * n_samples:]
y_test = y_digits[.9 * n_samples:]

.9 * n_samples 应该改成 int(.9 * n_samples),转成Integer类型。才能避免以下错误。

Traceback (most recent call last):
  File "digits-knn.py", line 15, in <module>
    X_train = X_digits[:.9 * n_samples]
TypeError: slice indices must be integers or None or have an __index__ method

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.