大图和时间序列分析工具集—Spartan2
先上Github链接!!!:Welcome to spartan2
1 简介
大图和时间序列是用户在线行为(例如社交媒体、购物、应用程序)、金融(例如股票交易、银行转账)、物联网网络(例如传感器读数、智能电网)和医疗保健(例如心电图、 光体积描记、呼吸电感体积描记)等领域的表示。
Spartan2 是关于大图和时间序列数据挖掘算法的集合,可用于高效地解决三个基本任务:异常检测、预测和汇总
,由中科院计算所团队开发。
2 安装(常见问题解决)
2.1 Spartan2安装具体请看 Welcome to spartan2中 READMA步骤
2.2 常见问题
-
Microsoft Visual C++ 14.0 is required
- 解决方法1:去官网下载Visual Studio(费时)
- 解决方法2:Microsoft Visual C++ 14.0 is required解决方法
链接中包含安装所需的所有文件
-
spyder 4.0.1 requires xxxx
解决办法:pip install xxxx,如第三行:pip install jedi == 0.14.1 -
Cannot uninstall ‘llvmlite’
解决办法:进入anaconda3→Lib→site-packages-site-packages,找到llvmlite-0.23.1-py3.6.egg-info,直接删掉
3 Dense subgraph检测实践
在大图中进行Dense subgraph检测的算法有Fraudar、HoloScope、EigenSpokes等,下面根据Spartan2中的live-tutorials应用EigenPulse算法进行实验
3.1 EigenPulse
一种实时检测滑动窗口激增的流算法
3.1 Abstract
Spartan2提出了一个带有滑动窗口的行增广矩阵来对流图进行建模,并设计了 AugSVD 算法以进行计算和内存高效的奇异分解
3.2 Code
用到的相关数据在spartan2中有:spartan2-tutorials
import spartan as st
import gzip
f = gzip.open("./Desktop/Spartan2_Data/test_beer.tensor.gz")
Function loadTensorStream()
tensor_stream = st.TensorStream(f, col_idx = [0,1,2,3], col_types=[int,int,int,int], sep=',', mappers={},hasvalue=True)
Run EigenPulse as a single model
param_dict={'window':20, 'stride':10, 'l':20, 'b':10,'item_idx':1,'ts_idx':2}
eigenpulse = st.EigenPulse(tensor_stream, **param_dict)
res, densities = eigenpulse.run()
out:
st.drawEigenPulse(densities)
out:
Run EigenPulse from anomaly detection task
f = gzip.open("./Desktop/Spartan2_Data/test_beer.tensor.gz")
tensor_stream = st.TensorStream(f, col_idx = [0,1,2,3], col_types=[int,int,int,int], sep=',', mappers={},hasvalue=True)
ad_model = st.AnomalyDetection.create(tensor_stream, st.ADPolicy.EigenPulse, 'eigenpulse',**param_dict)
res, densities = ad_model.run()
out:
3.2 Fraudar
FRAUDAR is an algorithm for catching fraudulent blocks in graph datasets (e.g. a review graph, Twitter follow graph, etc.) in a camouflage-resistant way.
Spartan 链接:spartan2-tutorials/Fraudar
3.3 Holoscope
HoloScope is topology-and-spike aware fraud detection. HoloScope detect a subgraph of highly constrast suspicousness on topological, temporal, and categorical (e.g. rating score, topic, tag) infomation.
Spartan 链接:spartan2-tutorials/Holoscope
End
Welcome to spartan2中还有很多高效的大图和时间序列数据挖掘算法,可以收藏(Fork)(✪ω✪)