opencog / attention Goto Github PK
View Code? Open in Web Editor NEWOpenCog Attention Allocation Subsystem
License: Other
OpenCog Attention Allocation Subsystem
License: Other
The build of "attention" module fails on the current Debian sid:
(snip)
-- Configuring done
CMake Error at opencog/attention/CMakeLists.txt:8 (ADD_LIBRARY):
Target "attention" links to target "Boost::system" but the target was not
found. Perhaps a find_package() call is missing for an IMPORTED target, or
an ALIAS target is missing?
CMake Error at opencog/attention/CMakeLists.txt:8 (ADD_LIBRARY):
Target "attention" links to target "Boost::filesystem" but the target was
not found. Perhaps a find_package() call is missing for an IMPORTED
target, or an ALIAS target is missing?
(snip)
Modifying FIND_PACKAGE
in CMakeLists.txt
to something like FIND_PACKAGE(Boost REQUIRED COMPONENTS system filesystem)
fixes this, but I'm not sure this is the way to go. The current version of CMake in sid is 3.16.3, Boost is 1.71.0.3.
opencog::attentionbank(AtomSpace* asp) method in AttentionBank has the following check to compare if two AtomSpaces are equal:
This can fail if one AtomSpace is deleted and immediately after that the second one is created.
because the the new AtomSpace can be created with the same memory address as the previous one.
I encountered it in the Python test that can or can't fail depending with each address the new AtomSpace is created:
(note that the opencog/opencog#3549 pull request is required to run the test)
import unittest
from unittest import TestCase
from opencog.type_constructors import *
from opencog.utilities import initialize_opencog, finalize_opencog
from opencog.bank import AttentionBank, af_bindlink
class AttentionBankTest(TestCase):
def setUp(self):
self.atomspace = AtomSpace()
initialize_opencog(self.atomspace)
def tearDown(self):
finalize_opencog()
del self.atomspace
def test_get_handles_by_av_different_as1(self):
attention_bank = AttentionBank(self.atomspace)
node1 = ConceptNode("node1")
attention_bank.set_sti(node1, 2.0)
atoms = attention_bank.get_atoms_by_av(1.0, 4.0)
self.assertEqual(1, len(atoms))
def test_get_handles_by_av_different_as2(self):
attention_bank = AttentionBank(self.atomspace)
node2 = ConceptNode("node2")
attention_bank.set_sti(node2, 2.0)
atoms = attention_bank.get_atoms_by_av(1.0, 4.0)
self.assertEqual(1, len(atoms))
if __name__ == '__main__':
unittest.main()
CMake doesn't find Doxygen at build time. In CMakeLists,txt, a line SUMMARY_ADD("Doxygen" "Code documentation" DOXYGEN_FOUND)
exists, but no FIND_PACKAGE(Doxygen)
.
opencog/examples/hopfield/HopfieldOptions.cc , uses and calls for atoi() multiple times (197, 200, 203, 204, 207...)
In the case of atoi, if the input recieved is not checked, the resulting number can exceed the expected range -- causing integer or stack overflows.
If source is untrusted (meaning recieved from user-input), check both minimum and maximum with INT_MAX and INT_MIN for ints, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended).
Using these to map variables while calling for atoi() would be nice
TARGET_LINK_DIRECTORIES
added into CMakeLists.txt
by commit 15c7faa is absent for CMake versions below 3.13. In particular it is incompatible with CMake 3.10 which is installed by ocpkg
script in Ubuntu 18.04 and opencog-deps
image.
I'm trying to build the latest commit (87d4367) of attention with the latest commits of cogutil (b07b41b2eaf01627c78b27f1f28bb09ef7086f8e), atomspace (ed1d316a44ddca5791712ebdc291770905a72f05), and cogserver (c8ad85fef446819e6bd711f0791887a5aa6a41f9). The build almost immediately aborts:
/gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -S/tmp/guix-build-attention-0-1.87d4367.drv-0/source -B/tmp/guix-build-attention-0-1.87d4367.drv-0/build --check-build-system CMakeFiles/Makefile.cmake 0
/gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_progress_start /tmp/guix-build-attention-0-1.87d4367.drv-0/build/CMakeFiles /tmp/guix-build-attention-0-1.87d4367.drv-0/build/CMakeFiles/progress.marks
make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/CMakeFiles/SCM_CONFIG.dir/build.make opencog/CMakeFiles/SCM_CONFIG.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/CMakeFiles/SCM_CONFIG.dir/DependInfo.cmake --color=
Scanning dependencies of target SCM_CONFIG
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/CMakeFiles/SCM_CONFIG.dir/build.make opencog/CMakeFiles/SCM_CONFIG.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[2]: Nothing to be done for 'opencog/CMakeFiles/SCM_CONFIG.dir/build'.
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
[ 0%] Built target SCM_CONFIG
make -f opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build.make opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/DependInfo.cmake --color=
Scanning dependencies of target COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build.make opencog/attentionbank/CMakeFiles/COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E copy /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank/scm//attention-bank.scm /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/scm//opencog/attention-bank.scm
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
[ 0%] Built target COPY_TO_LOAD_PATH_IN_BUILD_DIR_FROM__tmp_guix-build-attention-0-1.87d4367.drv-0_source_opencog_attentionbank
make -f opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build.make opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/depend
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
cd /tmp/guix-build-attention-0-1.87d4367.drv-0/build && /gnu/store/iz9500ssxcqlyr74hg1jq10ycrh42yq1-cmake-minimal-3.15.1/bin/cmake -E cmake_depends "Unix Makefiles" /tmp/guix-build-attention-0-1.87d4367.drv-0/source /tmp/guix-build-attention-0-1.87d4367.drv-0/source/opencog/attentionbank/types /tmp/guix-build-attention-0-1.87d4367.drv-0/build /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/types /tmp/guix-build-attention-0-1.87d4367.drv-0/build/opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/DependInfo.cmake --color=
Scanning dependencies of target attention_atom_types
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make -f opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build.make opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/build
make[2]: Entering directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[2]: *** No rule to make target '/gnu/store/a21dzdwc2xvyz8wmlkq16jw0x34wpwrm-attention-0-1.87d4367/share/opencog/cmake/OpenCogAtomTypes.cmake', needed by 'opencog/attentionbank/types/atom_types.h'. Stop.
make[2]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:439: opencog/attentionbank/types/CMakeFiles/attention_atom_types.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-attention-0-1.87d4367.drv-0/build'
make: *** [Makefile:155: all] Error 2
command "make" failed with status 2
This line here:
make[2]: *** No rule to make target '/gnu/store/a21dzdwc2xvyz8wmlkq16jw0x34wpwrm-attention-0-1.87d4367/share/opencog/cmake/OpenCogAtomTypes.cmake', needed by 'opencog/attentionbank/types/atom_types.h'. Stop.
shows that OpenCogAtomTypes.cmake, which is provided by atomspace is somehow expected to be found in the current project's target directory.
(Guix installs every package to its own prefix directory under /gnu/store/...-name-version/
.)
Currently atoms can only be stimulated with in an Agent class instance. Is there any particular reason for this design choice? What is the disadvantage of making stimulus attribute of an Atom class and stimulation a method defined by the AtomSpace class?
cmake -DCMAKE_DISABLE_FIND_PACKAGE_Python3Interp=TRUE -DCMAKE_BUILD_TYPE=DEBUG ..
opencog-server.sh
gdb -ex r --args guile -l load-opencog.txt
cd /loving-ai-ghost/bin
bash run.sh
scheme@(guile-user)> (ghost "hi")
[2018-12-28 10:23:55:845] [INFO] [say] (|happy,3| Hi ! My name is Sophia. What's yours ?)
...
...
scheme@(guile-user)> (ghost "amen")
[2018-12-28 10:24:11:434] [INFO] [say] (|happy,.7,5| Good to meet you , amen ! Thanks so much for taking the time to come and talk with me today.)
...
loving-ai-ghost = a3e6f43
opencog sha = d68351c
atomspace sha = c121f0f
cogutil sha = f85718c
relex sha = 6fb3873
Assuming InverseHebbianLinks are removed, it should be possible to simplify/modify HebbianLink updating as follows.
...
Update of
s_hebbAB
could happen as follows, I think.
When A is chosen for importance updating, then: If A is in the AF,
The following steps are done for each B in the AF...
If no link
HebbianLink A B
exists, then one is created with
s = SimpleTV(1, 1/(1+k))
If a link
L=HebbianLink A B
already exists, then its truth value is merged (revised) with the
value SimpleTV(1, 1/(1+k))
Also, if after revision we have s>s_AF, then the LTI of the link L
should be increased by an amount LTISmallIncrement (which should cause
an equal amount of LTI to get taken from the central bank). This is
because the link is more interesting if it has a higher truth value,
assuming it's higher than the expected value s_AF.... Probably the
STI of the link L should be increased in a comparable way....
The following steps are done for each B that is not in the AF, for
which there exists a link
L = HebbianLink A B
-- The truth value of the link L is revised (merged) with the
SimpleTruthValue (0,1/(1+k)) where k>>1 is a "personality parameter"
-- If s > s_AF, then
------the LTI of the link L is decreased by an amount
LTISmallDecrement (which should cause an equal amount of LTI to get
put into the central bank). This is because the link is less
interesting if it has a lower truth value (given that its strength is
greater than expected... it's now becoming less greater than
expected...)
------ If, after revision, s<s_AF, then the LTI of the link L is
decreased by a ratio LTIBigDecrement. This is because the link is
now really, really uninteresting (it's a HebbianLink between two Atoms
that co-occur in the AF slightly less than would be expected at random
... booorrring...)
-- If s < s_AF ( so s is conceptually "inverse hebbian"), then
------the LTI of the link L is increased by an amount
LTISmallIncrement (which should cause an equal amount of LTI to get
put into the central bank). This is because the tweak in truth value
has made the link MORE surprising, not less...
At some future time, the new ECAN updating equations as expressed in http://wiki.opencog.org/w/New_ECAN_Equations should be implemented
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.