大数据支持的数据集洞见

编程入门 行业动态 更新时间:2024-10-12 05:53:37

大<a href=https://www.elefans.com/category/jswz/34/1771445.html style=数据支持的数据集洞见"/>

大数据支持的数据集洞见

1、数据集

本次心率数据在少量设备情况下,在几天的数据量已经达到了上几百万数据,如何从中找到有用的,并且规划出元数据来进行实验和分析是最终目的。需要做的是:
1 数据清除
2 数据规划元数据
3 数据分析和洞见
4 实验

前面很多文章和实验都表明我们要制作一个数据集是非常困难的,数据库里面的数据只是一个存储集合,谈不上大数据集合。如下表所示,将数据集导入csv文件,并做过滤

我们的数据集和应将type类型变为元数据字段:
1 心率
2 呼吸
3 安静系数
4 是否辗转
最后一个是结果

心率呼吸安静系数是否辗转结果
67143500
64133510
561214611

1.2 心率和呼吸以及安静系数的关系

1 呼吸渐渐缓和,安静系统线性提高,心率降低,表明即将入睡,但是入睡的点并不是非常精确的,无论是"熟睡",“浅睡”,都是我们自己的定义,偏差依理解不同,但误差并不会很多。
2 呼吸增多,安静系数降低,心率缓慢增加,辗转发生,表示出睡,这是我自己的定义,但并不表示就是一定醒过来。

1.3 使用线性分类实验

import numpy as np
import sklearn.cluster as sc
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import svm
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler            # 导入sklearn包的相应模块
# 安静系数 心率均值
X = np.array([[35,64], [53,67],[120,70],[150,67],[178,54]])
Y = np.array([0,0,0,1,1])clf = Pipeline((("scaler",StandardScaler()),("linear_svc",svm.LinearSVC(C=1,loss="hinge")),
))
clf.fit(X,Y)
print (clf.predict([[123,62]]))     
print (clf.predict([[135,52]]))     
print (clf.predict([[140,52]]))     
print (clf.predict([[110,60]]))    
print (clf.predict([[120,60]])) 
print (clf.predict([[35,60]])) 

结果如下:
(base) python testheart.py
[1]
[1]
[1]
[1]
[1]
[0]
svc
可见线性分类在数据量非常小的情况下没有非常好的明确的界限,最后一个值因远低于均值,所以被分类为零。

1.3 使用svc和svr

import numpy as np
import sklearn.cluster as sc
import matplotlib.pyplot as plt
import pandas as pd
from sklearn import svm
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler            # 导入sklearn包的相应模块
#安静系数 心率均值
X = np.array([[35,64], [53,67],[120,70],[150,67],[178,54]])
Y = np.array([0,0,0,1,1])clf = Pipeline((("scaler",StandardScaler()),("linear_svc",svm.LinearSVC(C=1,loss="hinge")),
))
clf.fit(X,Y)
print (clf.predict([[123,62]]))     
print (clf.predict([[135,52]]))     
print (clf.predict([[140,52]]))     
print (clf.predict([[110,60]]))    
print (clf.predict([[120,60]])) 
print (clf.predict([[35,60]])) print("svc\n")
clf = svm.SVC()                    
clf.fit(X,Y)
print (clf.predict([[123,62]]))     
print (clf.predict([[135,52]]))     
print (clf.predict([[140,52]]))     
print (clf.predict([[110,60]]))    
print (clf.predict([[120,60]]))    
#print (clf.support_vectors_)       # 查看支持向量
#print (clf.support_)               # 查看支持向量类别
#print (clf.n_support_)             # 查看每个类别支持向量个数clf=svm.SVR()print("svr\n")
clf.fit(X,Y)
print (clf.predict([[123,62]]))     
print (clf.predict([[135,52]]))     
print (clf.predict([[140,52]]))     
print (clf.predict([[110,60]]))    
print (clf.predict([[120,60]])) 

结果
(base) python testheart.py
[1]
[1]
[1]
[1]
[1]
[0]
svc

[0]
[1]
[1]
[0]
[0]
svr

[0.26229048]
[0.47259546]
[0.55099675]
[0.09001326]
[0.2214764]

可见svc方法的结果和输入的值非常符合,但svc基于libsvm, 训练复杂度较高,数据量变大时,速度和效率会下降很多。而svr也是和svc类似,数据比较符合,但训练复杂度较高。

2、结论

1 、在大数据下,需要更多地仔细观察数据,梳理数据,并且输出更多的小数据集,在大量的实验下得出结论

更多推荐

大数据支持的数据集洞见

本文发布于:2024-03-23 21:39:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1743133.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!