Skip to content
Permalink
Browse files

Change library name to ampligraph

  • Loading branch information...
chanlevan committed Feb 6, 2019
0 parents commit 3de385c15a8f21e816f3ef1958e1607882fed6eb
Showing with 6,077 additions and 0 deletions.
  1. +119 −0 .gitignore
  2. +142 −0 README.md
  3. +6 −0 ampligraph/__init__.py
  4. +10 −0 ampligraph/datasets/__init__.py
  5. +462 −0 ampligraph/datasets/datasets.py
  6. +12 −0 ampligraph/evaluation/__init__.py
  7. +171 −0 ampligraph/evaluation/metrics.py
  8. +540 −0 ampligraph/evaluation/protocol.py
  9. +12 −0 ampligraph/latent_features/__init__.py
  10. +99 −0 ampligraph/latent_features/loss_functions.py
  11. +1,324 −0 ampligraph/latent_features/misc.py
  12. +65 −0 ampligraph/latent_features/model_utils.py
  13. +727 −0 ampligraph/latent_features/models.py
  14. +53 −0 ampligraph/latent_features/pool_functions.py
  15. +27 −0 ampligraph/latent_features/score_functions.py
  16. +24 −0 docs/Makefile
  17. +6 −0 docs/_templates/autosummary/base.rst
  18. +36 −0 docs/_templates/autosummary/class.rst
  19. +7 −0 docs/_templates/autosummary/function.rst
  20. +37 −0 docs/_templates/autosummary/module.rst
  21. +29 −0 docs/ampligraph.datasets.rst
  22. +59 −0 docs/ampligraph.evaluation.rst
  23. +42 −0 docs/ampligraph.latent_features.rst
  24. +17 −0 docs/api.rst
  25. +5 −0 docs/biblio.rst
  26. +33 −0 docs/changelog.md
  27. +192 −0 docs/conf.py
  28. +22 −0 docs/contacts.md
  29. +43 −0 docs/dev.md
  30. +132 −0 docs/examples.md
  31. +6 −0 docs/generated/ampligraph.datasets.load_ICEWS.rst
  32. +6 −0 docs/generated/ampligraph.datasets.load_fb13.rst
  33. +6 −0 docs/generated/ampligraph.datasets.load_fb15k.rst
  34. +6 −0 docs/generated/ampligraph.datasets.load_fb15k_237.rst
  35. +6 −0 docs/generated/ampligraph.datasets.load_from_csv.rst
  36. +6 −0 docs/generated/ampligraph.datasets.load_from_hdt.rst
  37. +6 −0 docs/generated/ampligraph.datasets.load_from_ntriples.rst
  38. +6 −0 docs/generated/ampligraph.datasets.load_from_rdf.rst
  39. +6 −0 docs/generated/ampligraph.datasets.load_wn11.rst
  40. +6 −0 docs/generated/ampligraph.datasets.load_wn18.rst
  41. +6 −0 docs/generated/ampligraph.evaluation.create_mappings.rst
  42. +6 −0 docs/generated/ampligraph.evaluation.evaluate_performance.rst
  43. +6 −0 docs/generated/ampligraph.evaluation.generate_corruptions_for_eval.rst
  44. +6 −0 docs/generated/ampligraph.evaluation.generate_corruptions_for_fit.rst
  45. +6 −0 docs/generated/ampligraph.evaluation.hits_at_n_score.rst
  46. +6 −0 docs/generated/ampligraph.evaluation.mar_score.rst
  47. +6 −0 docs/generated/ampligraph.evaluation.mrr_score.rst
  48. +6 −0 docs/generated/ampligraph.evaluation.quality_loss_mse.rst
  49. +6 −0 docs/generated/ampligraph.evaluation.rank_score.rst
  50. +6 −0 docs/generated/ampligraph.evaluation.select_best_model_ranking.rst
  51. +6 −0 docs/generated/ampligraph.evaluation.to_idx.rst
  52. +34 −0 docs/generated/ampligraph.latent_features.ComplEx.rst
  53. +34 −0 docs/generated/ampligraph.latent_features.DistMult.rst
  54. +34 −0 docs/generated/ampligraph.latent_features.EmbeddingModel.rst
  55. +34 −0 docs/generated/ampligraph.latent_features.TransE.rst
  56. +6 −0 docs/generated/ampligraph.latent_features.absolute_margin_loss.rst
  57. +6 −0 docs/generated/ampligraph.latent_features.negative_log_likelihood_loss.rst
  58. +6 −0 docs/generated/ampligraph.latent_features.pairwise_loss.rst
  59. +6 −0 docs/generated/ampligraph.latent_features.restore_model.rst
  60. +6 −0 docs/generated/ampligraph.latent_features.save_model.rst
  61. BIN docs/img/arch.png
  62. BIN docs/img/concept_embeddings_wordnet3_1_v0_2.png
  63. BIN docs/img/kg_lp.png
  64. BIN docs/img/kg_lp_step1.png
  65. BIN docs/img/kg_lp_step2.png
  66. BIN docs/img/kg_new.png
  67. BIN docs/img/pipeline.png
  68. +157 −0 docs/index.rst
  69. +108 −0 docs/install.md
  70. +41 −0 docs/references.bib
  71. +31 −0 jenkins.sh
  72. +1 −0 requirements.txt
  73. +37 −0 setup.py
  74. 0 tests/__init__.py
  75. 0 tests/ampligraph/__init__.py
  76. 0 tests/ampligraph/datasets/__init__.py
  77. +46 −0 tests/ampligraph/datasets/test_datasets.py
  78. 0 tests/ampligraph/evaluation/__init__.py
  79. +31 −0 tests/ampligraph/evaluation/test_metrics.py
  80. +159 −0 tests/ampligraph/evaluation/test_protocol.py
  81. 0 tests/ampligraph/latent_features/__init__.py
  82. +319 −0 tests/ampligraph/latent_features/test_misc.py
  83. +185 −0 tests/ampligraph/latent_features/test_models.py
  84. +217 −0 tests/ampligraph/temporal/test_models_temp.py
@@ -0,0 +1,119 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

# C extensions
*.so

.DS_Store
._.DS_Store
docs/.DS_Store
docs/._.DS_Store


# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/

# Translations
*.mo
*.pot

# Django stuff:
*.log
.static_storage/
.media/
local_settings.py

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Jupyter Notebook
.ipynb_checkpoints

# pyenv
.python-version

# celery beat schedule file
celerybeat-schedule

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/

# Spyder project settings
.spyderproject
.spyproject

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/

# pycharm
.idea/

#chan-hdt
model
.pytest_cache
output.txt
unittest_save_and_restore_models
142 README.md
@@ -0,0 +1,142 @@
# Knowledge Graph Embedding Models


## About

Explainable Link Prediction (`ampligraph`) is a machine learning library for Relational Learning, a branch of machine learning
that deals with supervised learning on knowledge graphs.

The library includes Relational Learning models, i.e. supervised learning models designed to predict
links in knowledge graphs.

The tool also includes the required evaluation protocol, metrics, knowledge graph preprocessing,
and negative statements generator strategies.


# Installation

### Provision a Virtual Environment

**Installation using Anaconda is highly recommended.**

Create & activate Virtual Environment (conda)

```
conda create --name ampligraph python=3.6
source activate ampligraph
```

### Install TensorFlow

**CPU version**

```
pip install tensorflow
```

or you could install the version packaged with conda:

```
conda install tensorflow
```

**GPU version**

```
pip install tensorflow-gpu
```

or you could install the version packaged with conda:

```
conda install tensorflow-gpu
```


## Install the library


You can install the latest stable release of `ampligraph` with pip, using the latest wheel (0.3.0) published by Dublin Labs:
*Note this work only from within the Dublin Labs network*

```
pip install http://dubaldeweb001.techlabs.accenture.com/wheels/ampligraph/ampligraph-0.3.dev0-py3-none-any.whl
```

If instead you want the most recent development version, you can clone the repository
and install from source (this will pull the latest commit on `develop` branch).
The code snippet below will install the library in editable mode (`-e`):

```
git clone ssh://git@innersource.accenture.com/dl/ampligraph.git
cd ampligraph
pip install -e .
```


## Download the Datasets

Datasets can be downloaded from [SharePoint](https://ts.accenture.com/sites/TechLabs-Dublin/_layouts/15/guestaccess.aspx?guestaccesstoken=Uz28P2m4hWp2TEgbvFrD%2b4BiURBHVTAw0NbPBRLzWWA%3d&folderid=2_012fd581718e74e4a9305c845a1224ee1&rev=1).
Once downloaded, decompress the archives.

**You must also set the following environment variable:**

```
export AMPLIGRAPH_DATA_HOME=/YOUR/PATH/TO/datasets
```

## Sanity Check

```python
>> import ampligraph
>> ampligraph.__version__
'0.3-dev'
```

## Installing with HDT Support
[HDT](http://www.rdfhdt.org/) is a compressed type of RDF graph data. By default, the installed ampligraph library does not support loading this data type. To enable it, you must have **`gcc` with C++11 support** installed in your Linux box.

**Ubuntu**

```
sudo add-apt-repository ppa:jonathonf/gcc-7.3
sudo apt-get update
sudo apt-get install gcc-7
```

**CentOS**

Below are commands we used to install gcc 7.3.1 on CentOS 7.5:

```
sudo yum install centos-release-scl
sudo yum install devtoolset-7-gcc*
scl enable devtoolset-7 bash
```

Once finished installing gcc, you can install the ampligraph library with hdt support by:

```
pip install .[hdt]
```

## Documentation

**[Latest documentation available here](http://10.106.43.211/docs/ampligraph/dev/index.html)**


The project documentation can be built with Sphinx:

```
cd docs
make clean autogen html
```

## Tests


```
pytest -s tests
```

@@ -0,0 +1,6 @@
"""Explainable Link Prediction is a library for relational learning on knowledge graphs."""

__version__ = '0.3-dev'


__all__ = ['datasets', 'latent_features', 'evaluation']
@@ -0,0 +1,10 @@
"""Helper functions to load knowledge graphs from disk."""

from .datasets import load_from_csv, load_from_rdf, load_fb15k, load_wn18, load_fb15k_237, load_from_ntriples\
, AMPLIGRAPH_DATA_HOME, load_from_hdt, load_ICEWS, \
load_wn11, load_fb13

__all__ = ['load_from_csv', 'load_from_rdf', 'load_from_ntriples', 'load_wn11', 'load_wn18', 'load_fb15k',
'load_fb13', 'load_fb15k_237', 'load_from_hdt',
'load_wn11', 'load_fb13', 'AMPLIGRAPH_DATA_HOME']

Oops, something went wrong.

0 comments on commit 3de385c

Please sign in to comment.
You can’t perform that action at this time.