使用持久性代码本表示持久性图
perscode的Python项目详细描述
个人代码
基于Persistence Codebooks for Topological Data Analysis的持久图矢量化方法。
用法
importperscodeimportnumpyasnp# generate diagramsdiagrams=[np.random.rand(100,2)for_inrange(20)]fordiagramindiagrams:diagram[:,1]+=diagram[:,0]# N is the size of the vectors# normalize is a Bool to whether or not normalize the output vectorpbow=perscode.PBoW(N=3,normalize=False)wpbow=perscode.wPBoW(N=3)# n_subsample is an int or None. If none all points will be used when calculating GMMs.spbow=perscode.sPBoW(N=10,n_subsample=None)# vectorize diagramspbow_diagrams=pbow.transform(diagrams)wpbow_diagrams=wpbow.transform(diagrams)spbow_diagrams=spbow.transform(diagrams)# for PVLAD and stable PVLADpvlad=perscode.PVLAD(N=3)spvlad=perscode.sPVLAD(N=3)pvlad_diagrams=pvlad.transform(diagrams)spvlad_diagrams=spvlad.transform(diagrams)
待办事项
- [X]在wpbow和spbow中实现将集群中心作为参数传递的选项。
- [X]实施PVLAD
- [X]执行SPVLAD
- []实施pfv
- [X]对wpbow、spbow、spvlad类实现可选的加权子采样。