您当前的位置: 首页 >  数据分析

qianbo_insist

暂无认证

  • 0浏览

    0关注

    399博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

数据分析工具

qianbo_insist 发布时间:2021-03-20 19:58:28 ,浏览量:0

介绍数据分析工具

1 scipy 向量,物理 傅里叶 矩阵计算

scipy.cluster 向量计算/Kmeans scipy.constants 物理和数学常量 scipy.fftpack 傅立叶变换 scipy.integrate 积分程序 scipy.interpolate 插值 scipy.io 数据输入输出 scipy.linalg 线性代数程序 scipy.ndimage n维图像包 scipy.odr 正交距离回归 scipy.optimize 优化 scipy.signal 信号处理 scipy.sparse 稀疏矩阵 scipy.spatial 空间数据结构和算法 scipy.special 特殊的数学函数 scipy.stats 统计

sklearn

线性回归 岭回归 支持向量机 svm 决策树 随机森林回归

panda

cvs 的读入工具

numpy

矩阵计算

tensorflow

卷积神经网络工具

cafe openpose

姿态分析

dlib

人脸识别 svm

opencv

1 .svm 自带手写识别 2. 一般贝叶斯分类器 (Normal Bayes Classifier) 3. K-近邻 (K-NearestNeighbors) 4. 支持向量机 (Support Vector Machines) 5. 决策树 (Decision Trees) 6. 提升(Boosting) 7. 梯度提高树(Gradient Boosted Trees) 8. 随机树 (Random Trees) 9. 超随机树 (Extremely randomized trees) 10. 期望最大化 (Expectation Maximization) 11. 神经网络 (Neural Networks)

例子->sklearn
import numpy as np
import matplotlib.pyplot as plt
###########1.数据生成部分##########
def f(x1, x2):
  y = 0.5 * np.sin(x1) + 0.5 * np.cos(x2) + 3 + 0.1 * x1
  return y
def load_data():
  x1_train = np.linspace(0,50,500)
  x2_train = np.linspace(-10,10,500)
  data_train = np.array([[x1,x2,f(x1,x2) + (np.random.random(1)-0.5)] for x1,x2 in zip(x1_train, x2_train)])
  x1_test = np.linspace(0,50,100)+ 0.5 * np.random.random(100)
  x2_test = np.linspace(-10,10,100) + 0.02 * np.random.random(100)
  data_test = np.array([[x1,x2,f(x1,x2)] for x1,x2 in zip(x1_test, x2_test)])
  return data_train, data_test
train, test = load_data()
x_train, y_train = train[:,:2], train[:,2] #数据前两列是x1,x2 第三列是y,这里的y有随机噪声
x_test ,y_test = test[:,:2], test[:,2] # 同上,不过这里的y没有噪声
###########2.回归部分##########
def try_different_method(model):
  model.fit(x_train,y_train)
  score = model.score(x_test, y_test)
  result = model.predict(x_test)
  plt.figure()
  plt.plot(np.arange(len(result)), y_test,'go-',label='true value')
  plt.plot(np.arange(len(result)),result,'ro-',label='predict value')
  plt.title('score: %f'%score)
  plt.legend()
  plt.show()
###########3.方法选择##########
####3.1决策树回归####
from sklearn import tree
model_DecisionTreeRegressor = tree.DecisionTreeRegressor()
####3.2线性回归####
from sklearn import linear_model
model_LinearRegression = linear_model.LinearRegression()
####3.3SVM回归####
from sklearn import svm
model_SVR = svm.SVR()
####3.4KNN回归####
from sklearn import neighbors
model_KNeighborsRegressor = neighbors.KNeighborsRegressor()
####3.5随机森林回归####
from sklearn import ensemble
model_RandomForestRegressor = ensemble.RandomForestRegressor(n_estimators=20)#这里使用20个决策树
####3.6Adaboost回归####
from sklearn import ensemble
model_AdaBoostRegressor = ensemble.AdaBoostRegressor(n_estimators=50)#这里使用50个决策树
####3.7GBRT回归####
from sklearn import ensemble
model_GradientBoostingRegressor = ensemble.GradientBoostingRegressor(n_estimators=100)#这里使用100个决策树
####3.8Bagging回归####
from sklearn.ensemble import BaggingRegressor
model_BaggingRegressor = BaggingRegressor()
####3.9ExtraTree极端随机树回归####
from sklearn.tree import ExtraTreeRegressor
model_ExtraTreeRegressor = ExtraTreeRegressor()
###########4.具体方法调用部分##########
try_different_method(model_DecisionTreeRegressor)
关注
打赏
1663161521
查看更多评论
立即登录/注册

微信扫码登录

0.0392s