PyNeuraLogic is a framework which combines relational and deep learning.
Project description
PyNeuraLogic
Documentation | Examples | Papers
PyNeuraLogic is a framework built on top of NeuraLogic which combines relational and deep learning.
General
Supported backends (WIP):
Getting started
Prerequisites
To use PyNeuraLogic, you need to have installed the following prerequisites.
Python >= 3.7
Java 1.8
Installation
To install PyNeuraLogic's latest release from the PyPI repository, use the following command.
$ pip install neuralogic
How to use
None of the following backends are included in PyNeuraLogic's installation. You have to install the ones that you are planning to utilize manually.
With PyTorch Geometric
With DyNet
import dynet as dy
from neuralogic import data
from neuralogic.dynet import NeuraLogicLayer
dataset = data.XOR # Use one of the default datasets in the project in the/datasets/ folder
layer = NeuraLogicLayer(dataset.weights) # Create an instance of NeuraLogicLayer with weights from the dataset
trainer = dy.AdamTrainer(layer.model, alpha=0.001)
for sample in dataset.samples: # Learn on each sample
dy.renew_cg(immediate_compute=False, check_validity=False)
label = dy.scalarInput(sample.target)
graph_output = layer.build_sample(sample)
loss = dy.squared_distance(graph_output, label)
loss.forward()
loss.backward()
trainer.update()
With Deep Graph Library
Development
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
neuralogic-0.0.4.tar.gz
(33.5 kB
view hashes)
Built Distribution
neuralogic-0.0.4-py3-none-any.whl
(46.2 kB
view hashes)
Close
Hashes for neuralogic-0.0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74495694e386a53eb51c6937e7caf1d2c5777d60a9efd5f7e9db3a0530d53267 |
|
MD5 | 645bb25c7b2dd3791190b33f5f44c5a8 |
|
BLAKE2b-256 | b4c090c6b56d5de09aede10d2a50b07561a7f098c513a22daac900c05c74cb32 |