Artificial Intelligence pipeline with OpenCog

Parth Mudgal
3 min readMay 4, 2017

--

Opencog foundation is aiming to bring Artificial General Intelligence to realisation. I found Opencog after recently training my first neural network for solving the “hello world” problem of NLP: tweet sentiment analysis.

First, the outcome of the experiment of building the neural network, for me, was the insight to the approach of neural networks, which I would state as follows:

  • Convert every input into a long vector of numbers (padded if inputs are varying in length) (word vectors for example)
  • feeding that vector to a chain of functions (some procedural, some recursive). these are the layers of neurons, drawing analogy with a “hash the key(vector) to get the object”
  • Instead of relying on getting the same object back, we are relying on generating a hash function to converge the input(high dimension) to one output(very low dimension).

This approach seems to work very well in video/audio data, but applying neural networks in NLP feels like going backward because we are effectively losing information/knowledge in the process (and thus we cannot explain why we come to an output from the NN in NLP scenarios).

Opencog framework

Opencog initially seemed to be one of the “old AI attempts” which, in our neural network age, looks too much work from a developer’s point of view (compared to a “train your first sentiment analysis pipeline today”).

Opencog has been working in this direction since 2008, trying out a lot of different approaches in different parts of the AI pipeline, developing a lot of interesting pieces in parallel, which are finally supposed to connect and act as one (think of power rangers calling their zords). Initially it might not make sense or feel awkward when you have to connect a Dinosaur, a Dragon, another Dinosaur, a Lion, a Bird and a Tiger, but makes sense when seen finally together.

This is a very mild introduction to the pieces, and ways in which you can use the pieces individually.

Atomspace

Atomspace

  • is the database for storing knowledge(word predicate object) as hypergraphs.
  • has a query language to query the space, like a query language “sql” for mysql/postgres.
  • also has an inbuilt rule engine

Each of these are relatively huge systems in themselves. But the good thing is Opencog repo is loaded with a lot of READMEs and useful scripts for the curious.

Current client implementations work over socket/rest.

Relex

Relex is the “more than just a dependency parser” as a service engine, which is a combination of using data from the following sources

  • libgetopt-java (GNU getopt)
  • Link Parser
  • WordNet 3.0
  • JWNL Java wordnet library
  • OpenNLP tools (optional, but recommended)
  • W3C OWL (optional)

Link grammar is one of the most basic dependency for relex. It is worth a read.

Moses

Moses is the machine learning tool, which works with atomspace and can learn things (more in the sense where we currently use “a neural network learned a function”), but does not use neural network

Opencog

And opencog (the framework itself) is to combine all of the projects meaningfully which can see, listen, understand, talk and probably control the machine if deployed inside a robot.

There are a lot of sub-projects in the opencog github repo which try out different directions for opencog, eg a python client, a rest api, docker images (quickest way to get started)

Consider this write up as a very incomplete introduction to Opencog. This doesn’t even cover the tip of the iceberg.

--

--