生物医学CURIE表示法
- class BiomedicalCURIERepresentation(identifiers: Sequence[str], cache: TextCache | None = None, **kwargs)[来源]
-
基于生物医学CURIEs的数据集的文本表示。
每个实体的标签和描述通过
pyobo获取,使用pykeen.nn.utils.PyOBOCache并通过TextRepresentation进行编码。示例用法:
from pykeen.datasets import get_dataset from pykeen.models import ERModel from pykeen.nn import BiomedicalCURIERepresentation from pykeen.pipeline import pipeline import bioontologies # Generate graph dataset from the Monarch Disease Ontology (MONDO) graph = bioontologies.get_obograph_by_prefix("mondo").squeeze(standardize=True) triples = (edge.as_tuple() for edge in graph.edges) triples = [t for t in triples if all(t)] triples = TriplesFactory.from_labeled_triples(np.array(triples)) dataset = Dataset.from_tf(triples) entity_representations = BiomedicalCURIERepresentation.from_dataset( dataset=dataset, encoder="transformer", ) result = pipeline( dataset=dataset, model=ERModel, model_kwargs=dict( interaction="distmult", entity_representations=entity_representations, relation_representation_kwargs=dict( shape=entity_representations.shape, ), ), )
— 名称: 生物医学CURIE文本编码
初始化表示。
- Parameters:
标识符 (序列[str]) – 由类解析的ID,例如,wikidata ID。对于
WikidataTextRepresentation, 生物医学实体表示为紧凑的URI(CURIEs)对于BiomedicalCURIERepresentation缓存 (TextCache | 无) – 一个预先实例化的文本缓存。如果为None,则使用
cache_cls来实例化一个。kwargs – 传递给
TextRepresentation.__init__()的额外基于关键字的参数