跳转到主要内容

一个基于因子模型的Python数据融合模块。

项目描述

Travis

scikit-fusion是一个基于最近集体潜在因子模型的Python数据融合模块。

依赖关系

scikit-fusion在Python 3下进行了测试,可以工作。

构建软件所需的相关依赖项是Numpy >= 1.7,SciPy >= 0.12,PyGraphviz >= 1.3(仅用于绘制数据融合图)和Joblib >= 0.8.4。

安装

此软件包使用distutils,这是安装Python模块的默认方式。要在您的家目录中安装,请使用

python setup.py install --user

在Unix/Linux上为所有用户安装

python setup.py build
sudo python setup.py install

开发模式使用

python setup.py develop

用法

让我们生成三个描述不同对象类型的随机数据矩阵

>>> import numpy as np
>>> R12 = np.random.rand(50, 100)
>>> R13 = np.random.rand(50, 40)
>>> R23 = np.random.rand(100, 40)

接下来,我们定义我们的数据融合图

>>> from skfusion import fusion
>>> t1 = fusion.ObjectType('Type 1', 10)
>>> t2 = fusion.ObjectType('Type 2', 20)
>>> t3 = fusion.ObjectType('Type 3', 30)
>>> relations = [fusion.Relation(R12, t1, t2),
                 fusion.Relation(R13, t1, t3),
                 fusion.Relation(R23, t2, t3)]
>>> fusion_graph = fusion.FusionGraph()
>>> fusion_graph.add_relations_from(relations)

然后共同推断潜在数据模型

>>> fuser = fusion.Dfmf()
>>> fuser.fuse(fusion_graph)
>>> print(fuser.factor(t1).shape)
(50, 10)

之后,可能会有新数据到达

>>> new_R12 = np.random.rand(10, 100)
>>> new_R13 = np.random.rand(10, 40)

为此,我们定义融合图

>>> new_relations = [fusion.Relation(new_R12, t1, t2),
                     fusion.Relation(new_R13, t1, t3)]
>>> new_graph = fusion.FusionGraph(new_relations)

然后将新对象转换为由fuser引起的潜在空间

>>> transformer = fusion.DfmfTransform()
>>> transformer.transform(t1, new_graph, fuser)
>>> print(transformer.factor(t1).shape)
(10, 10)

scikit-fusion附带了一些工作数据融合场景

>>> from skfusion import datasets
>>> dicty = datasets.load_dicty()
>>> print(dicty)
FusionGraph(Object types: 3, Relations: 3)
>>> print(dicty.object_types)
{ObjectType(GO term), ObjectType(Experimental condition), ObjectType(Gene)}
>>> print(dicty.relations)
{Relation(ObjectType(Gene), ObjectType(GO term)),
 Relation(ObjectType(Gene), ObjectType(Gene)),
 Relation(ObjectType(Gene), ObjectType(Experimental condition))}

项目详情


下载文件

下载适用于您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。

源代码分布

scikit-fusion-0.2.1.tar.gz (6.8 MB 查看哈希值)

上传时间 源代码

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面