Skip to main content

A set of python modules for applying knowledge graph embedding on tabular data

Project description

Vectograph

Vectograph is an open-source software library for applying knowledge graph embedding approaches on tabular data. To this end, Vectograph enables users to converts tabular data into RDF knowledge graph and apply KGE approaches.

Installation

Installation from source

1) git clone https://github.com/dice-group/Vectograph.git
2) conda create -n temp python=3.6.2 # Or be sure that your have Python => 3.6.
3) conda activate temp
4) python ontolearn/setup.py install
# After you receive this Finished processing dependencies for OntoPy==0.0.1
5) python -c "import vectograph"

Installation via pip

pip install vectograph

Usage

import pandas as pd
from sklearn.pipeline import Pipeline
from vectograph.transformers import ApplyKGE, KGCreator

path_of_folder = '/.../data_files/'
tabular_csv_data_name = 'example'  
df = pd.read_csv(path_of_folder + tabular_csv_data_name + '.csv', index_col=0, low_memory=False)
####################################
#### Data Preprocessing ####
####################################
kg_path = path_of_folder + tabular_csv_data_name
pipe = Pipeline([('createkg', KGCreator(path=kg_path)),
                 ('embeddings', ApplyKGE(params={'kge': 'Conve',  # Distmult,Complex,Tucker,Hyper, Conve
                                                 'embedding_dim': 10,
                                                 'batch_size': 256,
                                                 'num_epochs': 10}))])

model = pipe.fit_transform(X=df.select_dtypes(include='category'))
print(model)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vectograph-0.0.2.tar.gz (21.4 kB view hashes)

Uploaded Source

Built Distribution

vectograph-0.0.2-py3-none-any.whl (20.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page