您当前的位置: 首页 >  Python

Better Bench

暂无认证

  • 1浏览

    0关注

    695博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

【ML吴恩达】2 Python的机器学习相关库libraries

Better Bench 发布时间:2020-11-19 20:54:36 ,浏览量:1

目录
  • 1 Python 的机器学习相关库
  • 2 More about scikit-learn
  • 3 scikit-learn functions

Course 课程Machine learning with python

1 Python 的机器学习相关库

(1)Numpy 更快的计算,比如提供数组、字典、函数、数据类型 (2)SCIpy 是一个数值算法和领域专用工具箱。包括信号处理、优化、统计等等,对于科研有很大的用处 (3)matplotlib 画图包,并提供2D、3D的绘图。 (4)pandas 提供了数据结构,有许多函数用于importing 、manipulation and analysis.特备是提供操作数值表、时间序列的数据结构 (5)SCIKit Learn it is a collection of algorithms and tools for machine learing .是机器学习算法和工具的集合。 在这里插入图片描述

2 More about scikit-learn

(1)Free software machine learning library免费的 (2)Classification、RegresSion and clustering algorithm拥有分析、回归、聚类算法 (3)Work with Numpy and SciPy与Numpy和SCIpy搭配如虎添翼 (4)Great documentation有文档介绍 (5)Easy to implement容易上手 在这里插入图片描述

3 scikit-learn functions

(1)转变类型

from slearn import prepeocessing
X = preprocessing.StandardScalar().fit(X).trainsform(X)

# transform raw feature vectors into a suittable form of vector for modeling

(2)划分数据集

from sklearn.model_selection import train_test_split
X_train,X_test,y_train,y_test = train_test_split(X,y,test_size = 0.33)

(3)设置算法

from sklearn import sum
clf = svm.SVC(gamma = 0.001,C = 100.)
# build a classifier using support vector classification algorithm

(4)训练设置

clf.fit(X_train,y_train)

(5)进行预测

clf.predict(X_test)

(6)计算准确度

from sklearn.metrics import confusion_matrix
print(confusion_matrix(y_test,yhat,labels = [1,0]))

(7)保存模型

import pickle
s = pickle.dumps(clf)
关注
打赏
1665674626
查看更多评论
立即登录/注册

微信扫码登录

0.0420s