Skip to main content

Library for Implementation of the dataless Neural Network for range of NP-hard problems

Project description

Dataless

PyPI version License: MIT Python Versions

Dataless is a python library implementation of the dataless neural network. This concept was introduced by the Alkhouri et.al in this work. This concept is mounmental achievement, as the work introduces a way to formulate the NP-hard problems as a differentiable function.

Formulation of the NP-hard problems in differentiable representation is a big deal, as it allows for gradient based optimizations, or backpropogation in other words. Thus, giving rise to the concept of dataless Neural Network (dNN). The conept of dNN is rigorously expanded by sangram K. Jena, in range of his work. Jena provided theoretical background of dNN for range of NP-hard problems.

In this library, implementation of those problems is also provided.


Overview

The dataless library, takes a graph and solve the graph for a particular NP-hard problem.

The dataless library expects networkx type graphs, which are either stored in pickle format generated directly on the run time. The neural network uses Adam optimizer with \alpha value of 0.5, combination of which is necessary to avoid the local minima during convergence.

dNN is converging the f(\theta) using backpropogation, and following equation shows forward pass of the dNN.

f(\theta)


Getting Started

Dataless library is fairly intuitive. In the first step install the library directly from PyPI:

pip install dataless

Library has a top level dNN object, and can be imported as follows.

from dataless.dNN import dNN 

dNN object the following parameters which can be defined on the runtime.

dNN(prob_type:str='mdds', graph:nx.Graph=None, use_random:bool=False, nodes:int=None, edges:List[(int, int)]=None, edge_prob:float=0.5)

Dataless library right now support dNNs for the following problems.

prob_type Acronym
mdds Minimum Disjunctive Dominating Set
mlds Minimum Liar's Dominating Set
dissoc Dissociation Set
dom Dominating Set
kcol K Coloring
veds Vertex Edge Dominating Set

graph:nx.Graph expects a graph from the networkx library. It is important to note that if the graph is in the format of a file then first the file must be read and graph should be extracted and then passed into the dNN object.

use_random:bool this parameter is used to generate a random gnp graph using the networkx library if set to true. If this parameter is set to true, then nodes:int is required. The nodes will be the number of vertices and edges:List[(int, int)] is a list of tuples, showing the edges between the vertices.

edge_prob:float is the edge probability which will be used to generate the random graph containing nodes vertices. If the edges then the generated graph will not be random.

dnn.solve(params={
    "selection_criteria": 0.5,
    "learning_rate": 0.0001,
    "max_steps": 100000,
    "runtime": False,
    "store_graph": False,
    "theta_init": [],
    "out_dir": 'output'
})

solve() is the top level method, which will start the training loop of the dNN. the interface of the method also accepts optional **kwargs, In the above it is defined as params and has the above default values.

The training loop of the dNN also the early stopping implemented with the patience of 5, the minima value of the f(\theta) is considered as the metric, if its value does not decreases for 25000 iterations then the dNN training stops, and the code follows with the post-training steps.

dnn.plot()

plot() provide a quick way to visualize the graph.

plot

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

dataless-2.0.2.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

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

dataless-2.0.2-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file dataless-2.0.2.tar.gz.

File metadata

  • Download URL: dataless-2.0.2.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for dataless-2.0.2.tar.gz
Algorithm Hash digest
SHA256 80a0fd47d1579e7e8e29287598c2ac2ae5a8eb5a56ea368c6e53a0d097bb1228
MD5 1ab7600014b13a6cb783357e5422eb83
BLAKE2b-256 35892574eb1d6db3bc1b39cb82d70e91027e3effa494312a2470c33c07405e33

See more details on using hashes here.

File details

Details for the file dataless-2.0.2-py3-none-any.whl.

File metadata

  • Download URL: dataless-2.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.15

File hashes

Hashes for dataless-2.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cd06fc5696e0847fc6d95aebc69033abc4c767338bf681188378881066feb403
MD5 6c4a3a86cf5d7a1c053423a316eaad63
BLAKE2b-256 8d7c2991fd5b7d94c5a1a6664c775d3bf6e8fb5be5dbe7bf5ea090b00dedf0b4

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