Skip to main content

PyNeuraLogic is a framework which combines relational and deep learning.

Project description

PyNeuraLogic

PyPI version License

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.5.tar.gz (31.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

neuralogic-0.0.5-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file neuralogic-0.0.5.tar.gz.

File metadata

  • Download URL: neuralogic-0.0.5.tar.gz
  • Upload date:
  • Size: 31.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for neuralogic-0.0.5.tar.gz
Algorithm Hash digest
SHA256 a40bb815212840eb8e78ee423ae0e9e7b1d82e1c5eb7034d09534689735c9b95
MD5 3b359eca3dedfb77e2dee9ac54a5e306
BLAKE2b-256 0b556a14d7fe7174e91317fce9b36a4a652138a3ada63e615a5aea17b1565742

See more details on using hashes here.

File details

Details for the file neuralogic-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: neuralogic-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4

File hashes

Hashes for neuralogic-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 2daafaec552789ffcfd3c1bf3ee887ce194e174fe49adedb7ba605dcfd7e3714
MD5 fa48b42d03411c29e5081feeb9217638
BLAKE2b-256 3b1dcf39f01c8dff19c3e7609a46ddb02fb5c0b1f88d983d2d6ac110b04d6fbb

See more details on using hashes here.

Supported by

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