{"action":"created","issue":{"url":"https://api.github.com/repos/opencog/opencog/issues/1279","labels_url":"https://api.github.com/repos/opencog/opencog/issues/1279/labels{/name}","comments_url":"https://api.github.com/repos/opencog/opencog/issues/1279/comments","events_url":"https://api.github.com/repos/opencog/opencog/issues/1279/events","html_url":"https://github.com/opencog/opencog/issues/1279","id":58036443,"number":1279,"title":"Merge function in SimpleTruthValue.cc does not implement the right math","user":{"login":"bgoertzel","id":5907804,"avatar_url":"https://avatars.githubusercontent.com/u/5907804?v=3","gravatar_id":"","url":"https://api.github.com/users/bgoertzel","html_url":"https://github.com/bgoertzel","followers_url":"https://api.github.com/users/bgoertzel/followers","following_url":"https://api.github.com/users/bgoertzel/following{/other_user}","gists_url":"https://api.github.com/users/bgoertzel/gists{/gist_id}","starred_url":"https://api.github.com/users/bgoertzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgoertzel/subscriptions","organizations_url":"https://api.github.com/users/bgoertzel/orgs","repos_url":"https://api.github.com/users/bgoertzel/repos","events_url":"https://api.github.com/users/bgoertzel/events{/privacy}","received_events_url":"https://api.github.com/users/bgoertzel/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"misgeatgit","id":2872565,"avatar_url":"https://avatars.githubusercontent.com/u/2872565?v=3","gravatar_id":"","url":"https://api.github.com/users/misgeatgit","html_url":"https://github.com/misgeatgit","followers_url":"https://api.github.com/users/misgeatgit/followers","following_url":"https://api.github.com/users/misgeatgit/following{/other_user}","gists_url":"https://api.github.com/users/misgeatgit/gists{/gist_id}","starred_url":"https://api.github.com/users/misgeatgit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/misgeatgit/subscriptions","organizations_url":"https://api.github.com/users/misgeatgit/orgs","repos_url":"https://api.github.com/users/misgeatgit/repos","events_url":"https://api.github.com/users/misgeatgit/events{/privacy}","received_events_url":"https://api.github.com/users/misgeatgit/received_events","type":"User","site_admin":false},"milestone":null,"comments":24,"created_at":"2015-02-18T07:37:37Z","updated_at":"2015-02-22T03:27:50Z","closed_at":null,"body":"Currently the merge function for SimpleTruthValue appears to merge old and new TVs via choosing the one with the highest confidence.   This is not a good formula.   A host of better, simple formulas for this are given in the PLN book.   See e.g. section 5.10.2 where the formula for merging (s1, n1) with (s2,n2) is given as:\r\n\r\ns = s1 w1 + s2 w2, where w1 = n1 /(n1 +n2), w2 = n2 / (n1+n2)\r\n\r\nn = n1 + n2 - c min(n1,n2)\r\n\r\nc is a parameter between 0 and 1 ....  Ideally there would be a version of merge taking c as a parameter, and then a version using a default value for c (which could be c=0 or c=.2 or whatever...)\r\n\r\nThe STV uses (s,c) where c = n /(n+k), where n is the count...\r\n\r\nGetting this merge function right is important because without it we can't use SimpleTruthValue to accumulate frequency information about data."},"comment":{"url":"https://api.github.com/repos/opencog/opencog/issues/comments/75417481","html_url":"https://github.com/opencog/opencog/issues/1279#issuecomment-75417481","issue_url":"https://api.github.com/repos/opencog/opencog/issues/1279","id":75417481,"user":{"login":"bgoertzel","id":5907804,"avatar_url":"https://avatars.githubusercontent.com/u/5907804?v=3","gravatar_id":"","url":"https://api.github.com/users/bgoertzel","html_url":"https://github.com/bgoertzel","followers_url":"https://api.github.com/users/bgoertzel/followers","following_url":"https://api.github.com/users/bgoertzel/following{/other_user}","gists_url":"https://api.github.com/users/bgoertzel/gists{/gist_id}","starred_url":"https://api.github.com/users/bgoertzel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgoertzel/subscriptions","organizations_url":"https://api.github.com/users/bgoertzel/orgs","repos_url":"https://api.github.com/users/bgoertzel/repos","events_url":"https://api.github.com/users/bgoertzel/events{/privacy}","received_events_url":"https://api.github.com/users/bgoertzel/received_events","type":"User","site_admin":false},"created_at":"2015-02-22T03:27:50Z","updated_at":"2015-02-22T03:27:50Z","body":"Looks like more good material for the wiki site ;p ;)\n\nOn Sun, Feb 22, 2015 at 3:18 AM, Linas Vepštas <notifications@github.com>\nwrote:\n\n> Re: elegance: Large parts of the code work with atoms n a very klunky way;\n> many programmers seem unaware that there is a simpler way. Thus, I see\n> oceans of this style:\n>\n> Handle hSomeReallyLongName = as.addNode(CONCEPT_NODE, \"stuff\");\n> Handle hSomeReallySimilarName = as.addNode(CONCEPT_NODE, \"more stuff\");\n>\n> std::vector<Handle> handleset;\n> handleset.push_back(hSomeReallyLongName);\n> handleset.push_back(hSomeReallySimilarName);\n> Handle hSomeNameForListLink = as.addLink(LIST_LINK, handleset);\n>\n> // Do it again for PredicateNode and EvaluationLink\n>\n> The non-klunky way to do this is:\n>\n> as.addLink(LIST_LINK,\n>    as.addNode(CONCEPT_NODE, \"stuff\"),\n>    as.addNode(CONCEPT_NODE, \"more stuff\")\n> );\n>\n> which is three lines of readable code instead of 3 unreadable lines. One\n> can even do better: locally, just write\n>\n> #define an as.addNode\n> #define al as.addLink\n>\n> then\n>\n> al(LIST_LINK,\n>    an(CONCEPT_NODE, \"stuff\"),\n>    an(CONCEPT_NODE, \"more stuff\")\n> );\n>\n> if you need to set TV's:\n>\n> al(LIST_LINK,\n>    an(CONCEPT_NODE, \"stuff\")->hmerge(tva),\n>    an(CONCEPT_NODE, \"more stuff\")->hmerge(tvb)\n> )->hmerge(tvc);\n>\n> hmerge() is just like merge, except that it returns a handle, so you can\n> keep working with handles.\n>\n> —\n> Reply to this email directly or view it on GitHub\n> <https://github.com/opencog/opencog/issues/1279#issuecomment-75387631>.\n>\n\n\n\n-- \nBen Goertzel, PhD\nhttp://goertzel.org\n\n\"The reasonable man adapts himself to the world: the unreasonable one\npersists in trying to adapt the world to himself. Therefore all progress\ndepends on the unreasonable man.\" -- George Bernard Shaw\n"}}