SlideShare a Scribd company logo
Anatoly Belikov
abelikov@singularitynet.io
Introduction to
OpenCog
2
$ https://github.com/singnet/
opencog-workshops
$
3
CogPrime
4
CogPrime
5
Use cases
• Chatbots
• Bioinformatics
• Unsupervised language learning
• Visual Question Answering VQA
• …
6
Atomspace - graph database
Hypergraph database designed to be primarily used as a
storage of explicit, declarative knowledge
Hypergraph defines programming language - Atomese
Has a number of associated mechanisms:
pattern matching, unified rule engine, moses
7
Types of data in atomspace: Atoms
Atom
LinkNode
8
Types of data in atomspace: Values
StringValue LinkValueFloatValue
TruthValue
9
Atomspace - API introduction
Python:
>> from opencog.atomspace import AtomSpace, types
>> atomspace = AtomSpace()
Scheme:
scheme> (use-modules (opencog))
scheme> (define atomspace (cog-new-atomspace))
10
Pattern matcher examples
$ docker run -p8888:8888  -it demo-opencog
/home/relex/opencog-intro-master/
notebook.sh
$ http://localhost:8888/notebooks/and-
link-example.ipynb
11
Loading and storing
Load scheme file from scheme or python:
>> scheme_eval(atomspace, '(load-from-path “atomspace.scm")')
Indexed by atom type and name
Use PostgreSQL as backend storage
12
13
14
Nodes examples
scheme@(guile-user)> (ConceptNode "Test")
scheme@(guile-user)> (VariableNode "X")
scheme@(guile-user)> (PredicateNode "is-red")
15
Links examples: ListLink
>>> lst1 = ListLink(ConceptNode("red"),
VariableNode("$X"),
ConceptNode("blue"))
>>> print(str(lst1))
(ListLink
(ConceptNode "red")
(VariableNode "$X")
(ConceptNode "blue")
)
16
TruthValue
> from opencog.atomspace import TruthValue
> tv = TruthValue(0.5, 0.92)
P(Heads) = 0.5, .3
> ConceptNode(“Heads”).tv = tv
17
18
19
BindLink and pattern matcher
BindLink

<variables> - optional

  <pattern to match>

  <rewrite term>
Pattern example:
ListLink(ConceptNode("red"),
      VariableNode("$X"),
        ConceptNode("blue"))
20
21
22
23
24
25
26
Unified Rule Engine
Inference engine based on graph rewriting rules.
Allows to perform declarative inference.
Rules and data defined in the same language - atomese
Can do backward and forward chaining
27
Unified Rule Engine
Inference in first-order logic
Automatic differentiation
Graphical models
Probabilistic logic inference
Fuzzy logic inference
...
28
29
30
Running backward chainer
> request =
InheritanceLink(ConceptNode("Socrates"),
               ConceptNode("mortal"))
> tr = AtomSpace() # trace atomspace
> rule_base = ConceptNode("PLN") # rules to use
> chainer = BackwardChainer(atomspace, rule_base,
  request,
  trace_as=tr)
> chainer.do_chain()
> print(chainer.get_results())
31
Defining problem
> InheritanceLink(ConceptNode("Socrates"),
ConceptNode("man")).tv =
TruthValue(0.97, 0.92)
> InheritanceLink(ConceptNode("man"),
ConceptNode("mortal")).tv =
TruthValue(0.98, 0.94)
InheritanceLink(ConceptNode("Socrates"),
ConceptNode("mortal")).tv = ???
32
Result
> (SetLink
(InheritanceLink (stv 0.9508 0.828)
(ConceptNode(“Socrates”),
(ConceptNode("mortal"))
33
Rule structure:
BindLink

<variables>

AndLink

<premise-1>

...

<premise-n>

<conclusion-pattern>
34
Calculate conclusion with ExecutionOutputLink
ExecutionOutputLink

GroundedSchemaNode <formula-name>

List
<conclusion-pattern>
<other arguments>
35
36
Deduction rule example
premise
A -> B
B -> C
Ergo: A -> C
condition = AndLink(BA, CB)
BA = InheritanceLink(var_b, var_a)
CB = InheritanceLink(var_c, var_b)
rewrite = ExecutionOutputLink(
GroundedSchemaNode("scm: deduction-formula"),
ListLink(CA, CB, BA))
deduction_link = BindLink(condition, rewrite)
37
38
39
40
41
42
BindLink the query was answered with
(ExecutionOutputLink
(GroundedSchemaNode "scm: deduction-formula")
(ListLink
(InheritanceLink (stv 0.9508 0.828)
(ConceptNode "Socrates")
(ConceptNode "mortal")
)
(InheritanceLink
(ConceptNode "Socrates")
(VariableNode "$B")
)
(InheritanceLink
(VariableNode "$B")
(ConceptNode "mortal")
)))
(AndLink
(InheritanceLink
(VariableNode "$B")
(ConceptNode "mortal")
)
(NotLink
(IdenticalLink
(ConceptNode "Socrates")
(ConceptNode "mortal")
)
)
(InheritanceLink
(ConceptNode "Socrates")
(VariableNode "$B")
))
43
Running VQA demo from the docker image
$ docker pull opencog/vqa
$ wget https://s3-us-west-2.amazonaws.com/
abelikov/data-small.tar.gz && tar -xvf data-
small.tar.gz
$ docker run  -v `pwd`/data:/home/relex/projects/
data -p 8889:8888 -it demo-opencog
44
45
46
47
Building VQA with OpenCog
Building blocks:
Atomspace for storing facts about world
Link-Grammar + RelEx for text processing
Faster-RCNN for bounding box and feature extraction
Our neural network models for classification
Unified rule engine and pattern matcher for computing answers
48
VQA pipeline overview
How many animals are there?
PatternMatcherVQA
(python)
atomspace
Relex + link-grammar
(java)
Pattern matcher
49
Knowledge base
atomspace
(InheritanceLink (stv 0.795 0.71)
(ConceptNode "van") (ConceptNode "vehicle"))
(InheritanceLink (stv 0.576 0.525)
(ConceptNode "van") (ConceptNode "auto"))
50
VQA pipeline: text processing
sentence => link-grammar => relex => template => query
51
Taking a look at link-grammar
linkparser> How many zebras are there?
Found 22 linkages (6 had no P.P. violations)
Linkage 1, cost vector = (UNUSED=0 DIS=
2.00 LEN=8)
+------------------Xp-----------------+
+----------->WV---------->+ |
+->Ws--+--H-+--Dmc-+--Spx-+--Pp--+ |
| | | | | | |
LEFT-WALL how many zebras.n are.v there.r ?
(S how many zebras.n
(VP are.v
(PP there.r))
?)
52
How link-grammar works?
Link-grammar has predefined dictionary or words associated with allowed link types.
(word: link types) pairs define what type of links can be attached to which word and
from which side.
Also number of global rules for example that links cannot cross each other.
Check the rules:
github.com/opencog/link-grammar/blob/master/data/en/4.0.dict
53
RelEx
Dependency parser that built on graph rewriting rules
Operates on graph built from link-grammar parse
Adds new semantic links between words
Relex parse for “How many zebras are there?”:
_predadj(zebra, there)
_quantity(zebra, _$qVar)
54
Vertices attributes of relex sentence graph
pos(be, verb)
penn-POS(be, VBP)
pos(there, adj)
tense(there, present)
penn-POS(there, JJ)
HYP(there, T)
QUERY-TYPE(_$qVar,
how_much)
penn-POS(_$qVar, CD)
pos(how, adv)
penn-POS(how, RB)
pos(?, punctuation)
noun_number(zebra, plural)
pos(zebra, noun)
penn-POS(zebra, NNS)
pos(_$qVar, adj)
55
Query example
Is the dog black?
_predadj(A, B)::_predadj(dog, black)
(conj-bc (AndLink

(InheritanceLink (VariableNode "$X") (ConceptNode "BoundingBox"))

(EvaluationLink (GroundedPredicateNode "py:runNeuralNetwork")
(ListLink (VariableNode "$X") (ConceptNode "dog")) )

(EvaluationLink (GroundedPredicateNode "py:runNeuralNetwork")
(ListLink (VariableNode "$X") (ConceptNode "black")) ))

)
56
Image processing
Bounding Boxes & features
Faster-RCNN
57
Bounding boxes => atomspace
ConceptNode("BoundingBox1")
ConceptNode("BoundingBox2")
ConceptNode("BoundingBox3")
Bounding Boxes & features
atomspace
58
Bounding boxes => atomspace
> (InheritanceLink
(ConceptNode("BoundingBox1")
(ConceptNode("BoundingBox"))
59
Use of URE and pattern matcher for queries
•URE allows to use declarative approach for computing answers
•We use fuzzy logic rules to compute truth value of queries
60
61
Integrating opencog with neural networks
Stay tuned!
Passing arbitrary python objects between ExecutionOutputLinks
Allows to express computation graph as pytorch expression
Allows to integrate and update ontologies
62
Resources
wiki.opencog.org/
github.com/opencog/
github.com/singnet/semantic-vision
blog.singularitynet.io
63

More Related Content

What's hot

groovy rules
groovy rulesgroovy rules
groovy rulesPaul King
 
Gpars concepts explained
Gpars concepts explainedGpars concepts explained
Gpars concepts explained
Vaclav Pech
 
JVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's TricksJVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's Tricks
Doug Hawkins
 
Rust "Hot or Not" at Sioux
Rust "Hot or Not" at SiouxRust "Hot or Not" at Sioux
Rust "Hot or Not" at Sioux
nikomatsakis
 
Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup
Claudio Capobianco
 
OracleCode One 2018: Java 5, 6, 7, 8, 9, 10, 11: What Did You Miss?
OracleCode One 2018: Java 5, 6, 7, 8, 9, 10, 11: What Did You Miss?OracleCode One 2018: Java 5, 6, 7, 8, 9, 10, 11: What Did You Miss?
OracleCode One 2018: Java 5, 6, 7, 8, 9, 10, 11: What Did You Miss?
Henri Tremblay
 
ikh331-06-distributed-programming
ikh331-06-distributed-programmingikh331-06-distributed-programming
ikh331-06-distributed-programmingAnung Ariwibowo
 
Parsing JSON Really Quickly: Lessons Learned
Parsing JSON Really Quickly: Lessons LearnedParsing JSON Really Quickly: Lessons Learned
Parsing JSON Really Quickly: Lessons Learned
Daniel Lemire
 
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Mr. Vengineer
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
Peter Eisentraut
 
Guaranteeing Memory Safety in Rust
Guaranteeing Memory Safety in RustGuaranteeing Memory Safety in Rust
Guaranteeing Memory Safety in Rust
nikomatsakis
 
bluespec talk
bluespec talkbluespec talk
bluespec talk
Suman Karumuri
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
Azul Systems, Inc.
 
Vavr Java User Group Rheinland
Vavr Java User Group RheinlandVavr Java User Group Rheinland
Vavr Java User Group Rheinland
David Schmitz
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOS
Susan Potter
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
julien.ponge
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011julien.ponge
 
Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
Domenico Briganti
 
Java_practical_handbook
Java_practical_handbookJava_practical_handbook
Java_practical_handbook
Manusha Dilan
 

What's hot (20)

groovy rules
groovy rulesgroovy rules
groovy rules
 
Gpars concepts explained
Gpars concepts explainedGpars concepts explained
Gpars concepts explained
 
JVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's TricksJVM Mechanics: Understanding the JIT's Tricks
JVM Mechanics: Understanding the JIT's Tricks
 
Rust "Hot or Not" at Sioux
Rust "Hot or Not" at SiouxRust "Hot or Not" at Sioux
Rust "Hot or Not" at Sioux
 
Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup Rust Intro @ Roma Rust meetup
Rust Intro @ Roma Rust meetup
 
OracleCode One 2018: Java 5, 6, 7, 8, 9, 10, 11: What Did You Miss?
OracleCode One 2018: Java 5, 6, 7, 8, 9, 10, 11: What Did You Miss?OracleCode One 2018: Java 5, 6, 7, 8, 9, 10, 11: What Did You Miss?
OracleCode One 2018: Java 5, 6, 7, 8, 9, 10, 11: What Did You Miss?
 
ikh331-06-distributed-programming
ikh331-06-distributed-programmingikh331-06-distributed-programming
ikh331-06-distributed-programming
 
Parsing JSON Really Quickly: Lessons Learned
Parsing JSON Really Quickly: Lessons LearnedParsing JSON Really Quickly: Lessons Learned
Parsing JSON Really Quickly: Lessons Learned
 
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)Bridge TensorFlow to run on Intel nGraph backends (v0.4)
Bridge TensorFlow to run on Intel nGraph backends (v0.4)
 
Programming with Python and PostgreSQL
Programming with Python and PostgreSQLProgramming with Python and PostgreSQL
Programming with Python and PostgreSQL
 
Guaranteeing Memory Safety in Rust
Guaranteeing Memory Safety in RustGuaranteeing Memory Safety in Rust
Guaranteeing Memory Safety in Rust
 
bluespec talk
bluespec talkbluespec talk
bluespec talk
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
Vavr Java User Group Rheinland
Vavr Java User Group RheinlandVavr Java User Group Rheinland
Vavr Java User Group Rheinland
 
From Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOSFrom Zero to Application Delivery with NixOS
From Zero to Application Delivery with NixOS
 
Java 7 JUG Summer Camp
Java 7 JUG Summer CampJava 7 JUG Summer Camp
Java 7 JUG Summer Camp
 
Java 7 at SoftShake 2011
Java 7 at SoftShake 2011Java 7 at SoftShake 2011
Java 7 at SoftShake 2011
 
Jersey Guice AOP
Jersey Guice AOPJersey Guice AOP
Jersey Guice AOP
 
分散式系統
分散式系統分散式系統
分散式系統
 
Java_practical_handbook
Java_practical_handbookJava_practical_handbook
Java_practical_handbook
 

Similar to OpenCog Developer Workshop

Data Types/Structures in DivConq
Data Types/Structures in DivConqData Types/Structures in DivConq
Data Types/Structures in DivConq
eTimeline, LLC
 
Introduction to Boost regex
Introduction to Boost regexIntroduction to Boost regex
Introduction to Boost regex
Yongqiang Li
 
Extracting data from text documents using the regex
Extracting data from text documents using the regexExtracting data from text documents using the regex
Extracting data from text documents using the regex
Steve Mylroie
 
Machine Learning on Code - SF meetup
Machine Learning on Code - SF meetupMachine Learning on Code - SF meetup
Machine Learning on Code - SF meetup
source{d}
 
NOSQL and Cassandra
NOSQL and CassandraNOSQL and Cassandra
NOSQL and Cassandrarantav
 
Modern C++
Modern C++Modern C++
Modern C++
Richard Thomson
 
Collections forceawakens
Collections forceawakensCollections forceawakens
Collections forceawakens
RichardWarburton
 
Optimizing Tcl Bytecode
Optimizing Tcl BytecodeOptimizing Tcl Bytecode
Optimizing Tcl BytecodeDonal Fellows
 
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali ZaidiNatural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Databricks
 
BarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformationsBarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformations
walkmod
 
Measuring maintainability; software metrics explained
Measuring maintainability; software metrics explainedMeasuring maintainability; software metrics explained
Measuring maintainability; software metrics explained
Dennis de Greef
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
Mike Brevoort
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기
경주 전
 
Real-Time Big Data with Storm, Kafka and GigaSpaces
Real-Time Big Data with Storm, Kafka and GigaSpacesReal-Time Big Data with Storm, Kafka and GigaSpaces
Real-Time Big Data with Storm, Kafka and GigaSpaces
Oleksii Diagiliev
 
The operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzerThe operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzer
Andrey Karpov
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
Michiel Borkent
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Susan Potter
 
Logic programming a ruby perspective
Logic programming a ruby perspectiveLogic programming a ruby perspective
Logic programming a ruby perspective
Norman Richards
 
Echtzeitapplikationen mit Elixir und GraphQL
Echtzeitapplikationen mit Elixir und GraphQLEchtzeitapplikationen mit Elixir und GraphQL
Echtzeitapplikationen mit Elixir und GraphQL
Moritz Flucht
 
Seattle Scalability Meetup 6-26-13
Seattle Scalability Meetup 6-26-13Seattle Scalability Meetup 6-26-13
Seattle Scalability Meetup 6-26-13
specialk29
 

Similar to OpenCog Developer Workshop (20)

Data Types/Structures in DivConq
Data Types/Structures in DivConqData Types/Structures in DivConq
Data Types/Structures in DivConq
 
Introduction to Boost regex
Introduction to Boost regexIntroduction to Boost regex
Introduction to Boost regex
 
Extracting data from text documents using the regex
Extracting data from text documents using the regexExtracting data from text documents using the regex
Extracting data from text documents using the regex
 
Machine Learning on Code - SF meetup
Machine Learning on Code - SF meetupMachine Learning on Code - SF meetup
Machine Learning on Code - SF meetup
 
NOSQL and Cassandra
NOSQL and CassandraNOSQL and Cassandra
NOSQL and Cassandra
 
Modern C++
Modern C++Modern C++
Modern C++
 
Collections forceawakens
Collections forceawakensCollections forceawakens
Collections forceawakens
 
Optimizing Tcl Bytecode
Optimizing Tcl BytecodeOptimizing Tcl Bytecode
Optimizing Tcl Bytecode
 
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali ZaidiNatural Language Processing with CNTK and Apache Spark with Ali Zaidi
Natural Language Processing with CNTK and Apache Spark with Ali Zaidi
 
BarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformationsBarcelonaJUG2016: walkmod: how to run and design code transformations
BarcelonaJUG2016: walkmod: how to run and design code transformations
 
Measuring maintainability; software metrics explained
Measuring maintainability; software metrics explainedMeasuring maintainability; software metrics explained
Measuring maintainability; software metrics explained
 
Node.js - async for the rest of us.
Node.js - async for the rest of us.Node.js - async for the rest of us.
Node.js - async for the rest of us.
 
.gradle 파일 정독해보기
.gradle 파일 정독해보기.gradle 파일 정독해보기
.gradle 파일 정독해보기
 
Real-Time Big Data with Storm, Kafka and GigaSpaces
Real-Time Big Data with Storm, Kafka and GigaSpacesReal-Time Big Data with Storm, Kafka and GigaSpaces
Real-Time Big Data with Storm, Kafka and GigaSpaces
 
The operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzerThe operation principles of PVS-Studio static code analyzer
The operation principles of PVS-Studio static code analyzer
 
ClojureScript for the web
ClojureScript for the webClojureScript for the web
ClojureScript for the web
 
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
Scalaz By Example (An IO Taster) -- PDXScala Meetup Jan 2014
 
Logic programming a ruby perspective
Logic programming a ruby perspectiveLogic programming a ruby perspective
Logic programming a ruby perspective
 
Echtzeitapplikationen mit Elixir und GraphQL
Echtzeitapplikationen mit Elixir und GraphQLEchtzeitapplikationen mit Elixir und GraphQL
Echtzeitapplikationen mit Elixir und GraphQL
 
Seattle Scalability Meetup 6-26-13
Seattle Scalability Meetup 6-26-13Seattle Scalability Meetup 6-26-13
Seattle Scalability Meetup 6-26-13
 

Recently uploaded

Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Product School
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
Frank van Harmelen
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
g2nightmarescribd
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
Product School
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Inflectra
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
Ana-Maria Mihalceanu
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
Laura Byrne
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 

Recently uploaded (20)

Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdfFIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
FIDO Alliance Osaka Seminar: Passkeys and the Road Ahead.pdf
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
Generating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using SmithyGenerating a custom Ruby SDK for your web service or Rails API using Smithy
Generating a custom Ruby SDK for your web service or Rails API using Smithy
 
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
AI for Every Business: Unlocking Your Product's Universal Potential by VP of ...
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualitySoftware Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered Quality
 
Monitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR EventsMonitoring Java Application Security with JDK Tools and JFR Events
Monitoring Java Application Security with JDK Tools and JFR Events
 
The Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and SalesThe Art of the Pitch: WordPress Relationships and Sales
The Art of the Pitch: WordPress Relationships and Sales
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 

OpenCog Developer Workshop

  • 5. 5 Use cases • Chatbots • Bioinformatics • Unsupervised language learning • Visual Question Answering VQA • …
  • 6. 6 Atomspace - graph database Hypergraph database designed to be primarily used as a storage of explicit, declarative knowledge Hypergraph defines programming language - Atomese Has a number of associated mechanisms: pattern matching, unified rule engine, moses
  • 7. 7 Types of data in atomspace: Atoms Atom LinkNode
  • 8. 8 Types of data in atomspace: Values StringValue LinkValueFloatValue TruthValue
  • 9. 9 Atomspace - API introduction Python: >> from opencog.atomspace import AtomSpace, types >> atomspace = AtomSpace() Scheme: scheme> (use-modules (opencog)) scheme> (define atomspace (cog-new-atomspace))
  • 10. 10 Pattern matcher examples $ docker run -p8888:8888  -it demo-opencog /home/relex/opencog-intro-master/ notebook.sh $ http://localhost:8888/notebooks/and- link-example.ipynb
  • 11. 11 Loading and storing Load scheme file from scheme or python: >> scheme_eval(atomspace, '(load-from-path “atomspace.scm")') Indexed by atom type and name Use PostgreSQL as backend storage
  • 12. 12
  • 13. 13
  • 14. 14 Nodes examples scheme@(guile-user)> (ConceptNode "Test") scheme@(guile-user)> (VariableNode "X") scheme@(guile-user)> (PredicateNode "is-red")
  • 15. 15 Links examples: ListLink >>> lst1 = ListLink(ConceptNode("red"), VariableNode("$X"), ConceptNode("blue")) >>> print(str(lst1)) (ListLink (ConceptNode "red") (VariableNode "$X") (ConceptNode "blue") )
  • 16. 16 TruthValue > from opencog.atomspace import TruthValue > tv = TruthValue(0.5, 0.92) P(Heads) = 0.5, .3 > ConceptNode(“Heads”).tv = tv
  • 17. 17
  • 18. 18
  • 19. 19 BindLink and pattern matcher BindLink
 <variables> - optional
   <pattern to match>
   <rewrite term> Pattern example: ListLink(ConceptNode("red"),       VariableNode("$X"),         ConceptNode("blue"))
  • 20. 20
  • 21. 21
  • 22. 22
  • 23. 23
  • 24. 24
  • 25. 25
  • 26. 26 Unified Rule Engine Inference engine based on graph rewriting rules. Allows to perform declarative inference. Rules and data defined in the same language - atomese Can do backward and forward chaining
  • 27. 27 Unified Rule Engine Inference in first-order logic Automatic differentiation Graphical models Probabilistic logic inference Fuzzy logic inference ...
  • 28. 28
  • 29. 29
  • 30. 30 Running backward chainer > request = InheritanceLink(ConceptNode("Socrates"),                ConceptNode("mortal")) > tr = AtomSpace() # trace atomspace > rule_base = ConceptNode("PLN") # rules to use > chainer = BackwardChainer(atomspace, rule_base,   request,   trace_as=tr) > chainer.do_chain() > print(chainer.get_results())
  • 31. 31 Defining problem > InheritanceLink(ConceptNode("Socrates"), ConceptNode("man")).tv = TruthValue(0.97, 0.92) > InheritanceLink(ConceptNode("man"), ConceptNode("mortal")).tv = TruthValue(0.98, 0.94) InheritanceLink(ConceptNode("Socrates"), ConceptNode("mortal")).tv = ???
  • 32. 32 Result > (SetLink (InheritanceLink (stv 0.9508 0.828) (ConceptNode(“Socrates”), (ConceptNode("mortal"))
  • 34. 34 Calculate conclusion with ExecutionOutputLink ExecutionOutputLink
 GroundedSchemaNode <formula-name>
 List <conclusion-pattern> <other arguments>
  • 35. 35
  • 36. 36 Deduction rule example premise A -> B B -> C Ergo: A -> C condition = AndLink(BA, CB) BA = InheritanceLink(var_b, var_a) CB = InheritanceLink(var_c, var_b) rewrite = ExecutionOutputLink( GroundedSchemaNode("scm: deduction-formula"), ListLink(CA, CB, BA)) deduction_link = BindLink(condition, rewrite)
  • 37. 37
  • 38. 38
  • 39. 39
  • 40. 40
  • 41. 41
  • 42. 42 BindLink the query was answered with (ExecutionOutputLink (GroundedSchemaNode "scm: deduction-formula") (ListLink (InheritanceLink (stv 0.9508 0.828) (ConceptNode "Socrates") (ConceptNode "mortal") ) (InheritanceLink (ConceptNode "Socrates") (VariableNode "$B") ) (InheritanceLink (VariableNode "$B") (ConceptNode "mortal") ))) (AndLink (InheritanceLink (VariableNode "$B") (ConceptNode "mortal") ) (NotLink (IdenticalLink (ConceptNode "Socrates") (ConceptNode "mortal") ) ) (InheritanceLink (ConceptNode "Socrates") (VariableNode "$B") ))
  • 43. 43 Running VQA demo from the docker image $ docker pull opencog/vqa $ wget https://s3-us-west-2.amazonaws.com/ abelikov/data-small.tar.gz && tar -xvf data- small.tar.gz $ docker run  -v `pwd`/data:/home/relex/projects/ data -p 8889:8888 -it demo-opencog
  • 44. 44
  • 45. 45
  • 46. 46
  • 47. 47 Building VQA with OpenCog Building blocks: Atomspace for storing facts about world Link-Grammar + RelEx for text processing Faster-RCNN for bounding box and feature extraction Our neural network models for classification Unified rule engine and pattern matcher for computing answers
  • 48. 48 VQA pipeline overview How many animals are there? PatternMatcherVQA (python) atomspace Relex + link-grammar (java) Pattern matcher
  • 49. 49 Knowledge base atomspace (InheritanceLink (stv 0.795 0.71) (ConceptNode "van") (ConceptNode "vehicle")) (InheritanceLink (stv 0.576 0.525) (ConceptNode "van") (ConceptNode "auto"))
  • 50. 50 VQA pipeline: text processing sentence => link-grammar => relex => template => query
  • 51. 51 Taking a look at link-grammar linkparser> How many zebras are there? Found 22 linkages (6 had no P.P. violations) Linkage 1, cost vector = (UNUSED=0 DIS= 2.00 LEN=8) +------------------Xp-----------------+ +----------->WV---------->+ | +->Ws--+--H-+--Dmc-+--Spx-+--Pp--+ | | | | | | | | LEFT-WALL how many zebras.n are.v there.r ? (S how many zebras.n (VP are.v (PP there.r)) ?)
  • 52. 52 How link-grammar works? Link-grammar has predefined dictionary or words associated with allowed link types. (word: link types) pairs define what type of links can be attached to which word and from which side. Also number of global rules for example that links cannot cross each other. Check the rules: github.com/opencog/link-grammar/blob/master/data/en/4.0.dict
  • 53. 53 RelEx Dependency parser that built on graph rewriting rules Operates on graph built from link-grammar parse Adds new semantic links between words Relex parse for “How many zebras are there?”: _predadj(zebra, there) _quantity(zebra, _$qVar)
  • 54. 54 Vertices attributes of relex sentence graph pos(be, verb) penn-POS(be, VBP) pos(there, adj) tense(there, present) penn-POS(there, JJ) HYP(there, T) QUERY-TYPE(_$qVar, how_much) penn-POS(_$qVar, CD) pos(how, adv) penn-POS(how, RB) pos(?, punctuation) noun_number(zebra, plural) pos(zebra, noun) penn-POS(zebra, NNS) pos(_$qVar, adj)
  • 55. 55 Query example Is the dog black? _predadj(A, B)::_predadj(dog, black) (conj-bc (AndLink
 (InheritanceLink (VariableNode "$X") (ConceptNode "BoundingBox"))
 (EvaluationLink (GroundedPredicateNode "py:runNeuralNetwork") (ListLink (VariableNode "$X") (ConceptNode "dog")) )
 (EvaluationLink (GroundedPredicateNode "py:runNeuralNetwork") (ListLink (VariableNode "$X") (ConceptNode "black")) ))
 )
  • 56. 56 Image processing Bounding Boxes & features Faster-RCNN
  • 57. 57 Bounding boxes => atomspace ConceptNode("BoundingBox1") ConceptNode("BoundingBox2") ConceptNode("BoundingBox3") Bounding Boxes & features atomspace
  • 58. 58 Bounding boxes => atomspace > (InheritanceLink (ConceptNode("BoundingBox1") (ConceptNode("BoundingBox"))
  • 59. 59 Use of URE and pattern matcher for queries •URE allows to use declarative approach for computing answers •We use fuzzy logic rules to compute truth value of queries
  • 60. 60
  • 61. 61 Integrating opencog with neural networks Stay tuned! Passing arbitrary python objects between ExecutionOutputLinks Allows to express computation graph as pytorch expression Allows to integrate and update ontologies
  • 63. 63