GithubHelp home page GithubHelp logo

attention's People

Contributors

amebel avatar cuayacas7 avatar dagiopia avatar dalecassidy avatar eddiemonroe avatar ferrouswheel avatar glicerico avatar inflector avatar kasimebrahim avatar leungmanhin avatar linas avatar manisabri avatar misgeatgit avatar ngeiswei avatar noskill avatar radivarig avatar roman-khimov avatar rtreutlein avatar shujingke avatar stellarspot avatar vsbogd avatar wenwei-dev avatar yantrabuddhi avatar zariuq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

attention's Issues

Build fails on Debian sid (CMake or Boost issue?)

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(...) should not rely that objects compared by references are equal

opencog::attentionbank(AtomSpace* asp) method in AttentionBank has the following check to compare if two AtomSpaces are equal:

https://github.com/opencog/opencog/blob/802f0ec84e90db55389ee8ace40be6004a1ec9d1/opencog/attentionbank/bank/AttentionBank.cc#L249

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()

Doesn't find Doxygen

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).

Security: Multiple possible Intiger Overflows in HopfieldOptions.cc

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

  • strtol() LONG_MIN LONG_MAX
  • strtoll() LLONG_MIN LLONG_MAX
  • strtoimax() INTMAX_MIN INTMAX_MAX
  • strtoq() LLONG_MIN LLONG_MAX

OpenCogAtomTypes.cmake not found

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/.)

Stimulating atoms outside of a mind agent

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?

Segfault in ecan when using ghost

Steps to take to reproduce segfault

  1. Build and install opencog, and atomspace after running the following
cmake -DCMAKE_DISABLE_FIND_PACKAGE_Python3Interp=TRUE -DCMAKE_BUILD_TYPE=DEBUG ..
  1. Start relex by running opencog-server.sh
  2. Start cogserver using the following configuration file, load-opencog.txt (.txt extenstion is used for loading to github)
gdb -ex r --args guile -l load-opencog.txt
  1. Load ghost rules
cd /loving-ai-ghost/bin 
bash run.sh
  1. From the terminal where the cogserver is started, interact with the bot until it segfaults
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.)
...

screenshot from 2018-12-28 18-25-54

Repo states

loving-ai-ghost = a3e6f43
opencog sha = d68351c
atomspace sha = c121f0f
cogutil sha = f85718c
relex sha = 6fb3873

Reformulation of HebbianLink updating

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...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.