Skip to main content

建立在分解模型之上的用于数据融合的 Python 模块。

项目描述

特拉维斯

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)

并将新对象转换为由融合器引起的潜在空间:

>>> 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 查看哈希

已上传 source