tag:blogger.com,1999:blog-69239472829263242082018-06-19T14:14:56.380+02:00Entropic and Fractal IntelligenceSo called "Intelligente behaviour" can be defined in a pure thermodinamic languaje, using just "entropy". Formulaes look pretty intimidating, but once you get the idea, coding it into a working AI is quite simple.
Fractalizing the same idea takes away entropy calc form the AI and makes it work much better.Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.comBlogger84125tag:blogger.com,1999:blog-6923947282926324208.post-90746499327592615832018-06-13T20:33:00.001+02:002018-06-15T12:07:04.351+02:00Graph entropy 5: RelationsAfter some introductory posts (that you should had read first, starting <a href="http://entropicai.blogspot.com/2018/06/graph-entropy-1.html" target="_blank">here</a>) we face the main task of defining the entropy of a graph, something looking like this:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://1.bp.blogspot.com/-eEPrkPj7ryg/Wx-7vWQlsqI/AAAAAAABrJQ/JM8mQ6lZcQ4izw7lTYF2oyojyHU_Z9CcgCPcBGAYYCw/s1600/Screenshot-2018-6-12%2BPath%2Bentropy2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="359" data-original-width="367" height="313" src="https://1.bp.blogspot.com/-eEPrkPj7ryg/Wx-7vWQlsqI/AAAAAAABrJQ/JM8mQ6lZcQ4izw7lTYF2oyojyHU_Z9CcgCPcBGAYYCw/s320/Screenshot-2018-6-12%2BPath%2Bentropy2.png" width="320" /></a></div><br /><h2>Relations</h2>We will start by dividing the graph into a collection of "Relations", a minimal graph where a pair of nodes A and B are connected by an edge representing the conditional probability of both events, P(A|B):<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-ww7sN5gXGN8/WyFWQiZVPTI/AAAAAAABrJw/iqTAJ3-cibIQlhq21fQ1OuzxnXTXym-rACLcBGAs/s1600/Relation.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="413" data-original-width="253" height="320" src="https://4.bp.blogspot.com/-ww7sN5gXGN8/WyFWQiZVPTI/AAAAAAABrJw/iqTAJ3-cibIQlhq21fQ1OuzxnXTXym-rACLcBGAs/s320/Relation.png" width="196" /></a></div><br /><a name='more'></a><br /><h3>Nodes</h3>Nodes represent events: B could be "choose a random car from a parking lot" and B "the car has a gas engine inside".<br /><br />Nodes will hold two forms of entropy: a 'raw' entropy in the form of a <a href="http://entropicai.blogspot.com/2018/06/graph-entropy-3-changing-rules.html" target="_blank">H</a><a href="http://entropicai.blogspot.com/2018/06/graph-entropy-3-changing-rules.html" target="_blank"><sub>2</sub> entropy</a>, and a 'processed' entropy H as a <a href="http://entropicai.blogspot.com/2018/06/graph-entropy-3-changing-rules.html" target="_blank">H</a><a href="http://entropicai.blogspot.com/2018/06/graph-entropy-3-changing-rules.html" target="_blank"><sub>3</sub> entropy</a>:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-0kYzbCfRY-c/WyFXcXR7fFI/AAAAAAABrJ8/zQ6y0l12tsQd7xlsdNnkiX6OPyO0Czn_wCLcBGAs/s1600/Node.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="480" data-original-width="334" height="320" src="https://3.bp.blogspot.com/-0kYzbCfRY-c/WyFXcXR7fFI/AAAAAAABrJ8/zQ6y0l12tsQd7xlsdNnkiX6OPyO0Czn_wCLcBGAs/s320/Node.png" width="222" /></a></div><br />When a new node is created, raw entropy is set to 1 -so new inputs will just multiply the raw entropy as they come in- and H is then 1+log(1) = 1, so we will just initialise both to 1.<br /><br /><h3>Edges</h3><span style="font-family: inherit;">Edges represent the relation between A and B, the conditional probability of happening A given that B already happened.</span><br />This conditional probability defines an "entropy bit" of (2-p<sup>p</sup>) that will modify any entropy passing by the edge:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-1kjKUmhlRwA/WyFa1GQEmTI/AAAAAAABrKI/SQlppwZlUdYHg3qw5i1k8cF2G7wnChSUACLcBGAs/s1600/Edge.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="502" data-original-width="300" height="320" src="https://3.bp.blogspot.com/-1kjKUmhlRwA/WyFa1GQEmTI/AAAAAAABrKI/SQlppwZlUdYHg3qw5i1k8cF2G7wnChSUACLcBGAs/s320/Edge.png" width="191" /></a></div><br />Edges have three internal variables that initialise to 1 as before:<br /><br /><ul><li>P = P(A|B) is the conditional probability between A and B.</li><li>S = Input = External entropy H of the origin node A.</li><li>π' = Last value sent to end node B. </li></ul><br />When P or S change (A send a new input value S, or P is recalculated and modified externally), the edge perform those steps:<br /><br /><ul><li>π = Input value S times (2-p<sup>p</sup>).</li><li>Send Output = π/π' to end node B.</li><li>Update π' = π.</li></ul>That was all, we have defined how to calculate the entropy of a graph using two king of cellular automatons (the node and the edge) connected so they can send information down to the root node.<br /><br /><br />Being this entropy defined as a swarm of cellular automaton that autonomously send information to other automatons as required will allows us to make fast recalculation of the entropy as a probability changes or a node is added or taken from the graph, but also allows for a massive use of parallelization and distribution of big systems.<br /><br />Now that we know the method, we can revisit the '<a href="http://entropicai.blogspot.com/2018/06/graph-entropy-4-distribution-vs-graph.html" target="_blank">cars by engine example</a>' and compute the graph entropy:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-9JXz0wNdkKo/WyFf5Sepe3I/AAAAAAABrKU/u_hiQgxvROorwg7IEDXWYhcSiiFGIYR_wCLcBGAs/s1600/Screenshot-2018-6-13%2BPath%2Bentropy.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="539" data-original-width="488" height="400" src="https://3.bp.blogspot.com/-9JXz0wNdkKo/WyFf5Sepe3I/AAAAAAABrKU/u_hiQgxvROorwg7IEDXWYhcSiiFGIYR_wCLcBGAs/s400/Screenshot-2018-6-13%2BPath%2Bentropy.png" width="361" /></a></div><br />Before taking the structure of the graph into account, we calculated the entropy of the final distribution to be 1.6297, now that the internal structure is added, it raised up to 1.77, just a little higher than before, as expected.<br /><br />In the next post I will be dealing with the infamous 4th axiom of separability, just to make sure it is comparable with the standard Gibbs entropy and other kind of generalised entropies.<br /><br /><br />Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0tag:blogger.com,1999:blog-6923947282926324208.post-69324840275362931502018-06-12T15:05:00.002+02:002018-06-15T12:07:49.495+02:00Graph entropy 4: Distribution vs GraphIn previous posts, after <a href="http://entropicai.blogspot.com/2018/06/graph-entropy-1.html" target="_blank">complaining about Gibbs cross-entropy</a> and <a href="https://entropicai.blogspot.com/2018/06/graph-entopy-2-first-replacement.html" target="_blank">failing to find an easy fix</a>, I presented a <a href="https://entropicai.blogspot.com/2018/06/graph-entropy-3-changing-rules.html" target="_blank">new product-based formula for the entropy</a> of a probability distribution, but now I plan to generalise it to a graph.<br /><br />Why is it so great to have an entropy for graphs? Because distributions are special cases of graphs, but many real-world cases are not distributions, so the standard entropy can not be applied correctly on those cases.<br /><br /><h2>Graph vs distribution</h2>Let's take a simple but relevant example: there is a parking lot with 500 cars and we want to collect information about the kind of engines they use (gas engines and/or electric engines) to finally present a measurement of how much information we have.<br /><br />We will assume that 350 of them are gas-only cars, 50 are pure electric and 100 are hybrids (but we don't know this in advance).<br /><br /><h3>Using distributions</h3>If we were limited to probability distributions -as in Gibbs entropy- we would say there are three disjoint subgroups of cars ('Only gas', 'Only electric', 'Hybrid') and that the probabilities of a random car to be on one subgroup are P = {p<sub>1</sub> = 350/500 = 0.7, p<sub>2</sub> = 50/500 = 0.1, p<sub>3</sub> = 100/500 = 0.2}, so the results of the experiment of inspecting the engines of those car has an Gibbs entropy of:<br /><br /><div style="text-align: center;">H<sub>G</sub>(P) = -<span style="font-size: large;">πΊ</span>(p<sub>i</sub> Γ log(p<sub>i</sub>)) = 0.2496 + 0.3218 + 0.2302 = <b>0.818</b></div><br />If we use the new H<sub>2 </sub>and H<sub>3</sub> formula, we get a different result, but the difference is just a matter of scale:<br /><br /><div class="separator" style="clear: both; text-align: center;"></div><div style="text-align: center;">H<sub>2</sub>(P) = β(2 - p<sub>i</sub><sup>p<sub>i</sub></sup>) = 1.2209 * 1.2752 * 1.2056 = 1.8771</div><div style="text-align: center;"><br /></div><div style="text-align: center;">H<sub>3</sub>(P) = 1 + Log(1.8771) = <b>1.6297</b></div><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-Szj62AeTCdg/Wx-1h0kAkFI/AAAAAAABrI8/-uoIYSvtMsIw0veGgH43s9596jbgubjQgCLcBGAs/s1600/Screenshot-2018-6-12%2BPath%2Bentropy.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="287" data-original-width="293" src="https://3.bp.blogspot.com/-Szj62AeTCdg/Wx-1h0kAkFI/AAAAAAABrI8/-uoIYSvtMsIw0veGgH43s9596jbgubjQgCLcBGAs/s1600/Screenshot-2018-6-12%2BPath%2Bentropy.png" /></a></div><br /><a name='more'></a><br />Those entropies are incomplete: we are assuming we have three different -and totally independent- results, but this is not true, there is a hidden structure not represented in the distribution: hybrids cars are gas and electric cars at the same time.<br /><br />In other words: we say we have the same information about engines that we would have about colours (if 0.7 of the cars were red, 0.2 blue, and 0.1 green), but this is not correct as engines have an internal structure colours don't have.<br /><br /><h3>Using graphs</h3>When using graphs we will not assume we know about the existence of 'hybrid cars', instead, we will perform two independent measurements (how many of the cars have some gas engine, and how many have an electric engine) and repeat the same schema until no more information can be obtained.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-eEPrkPj7ryg/Wx-7vWQlsqI/AAAAAAABrJM/MUjpLA8ajVwsH6t9cVVscCRJ4wu02NF1wCLcBGAs/s1600/Screenshot-2018-6-12%2BPath%2Bentropy2.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="359" data-original-width="367" height="313" src="https://4.bp.blogspot.com/-eEPrkPj7ryg/Wx-7vWQlsqI/AAAAAAABrJM/MUjpLA8ajVwsH6t9cVVscCRJ4wu02NF1wCLcBGAs/s320/Screenshot-2018-6-12%2BPath%2Bentropy2.png" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"></div><br />We would initially find that 350+100 = 450 cars have a gas engine, so P(G) = 450/500 = 0.9, while 50+100 = 150 cars will have an electric one so P(E) = 150 / 500 = 0.3.<br /><br />Please note here how (0.9, 0.3) is not a distribution, as its summary is 1.2, meaning there must exists some kind of intersection between the two categories (the hybrid cars), so we are not still done with the graph.<br /><br />If now we focus on G (the 90% of the cars where a gas engine were detected) and repeat the same process, we would find that all of them have -again- a gas engine (P(G|G) = 1) but only 22% have an electric engine (P(E|G) = 100/450 = 0.222).<br /><br />Repeating the process in E (cars with an electric engine) would produce similar probabilities: P(G|E) = 0.666, P(E|E) = 1.<br /><br />Please note that, from here, no more repetitions are needed, as repeating at the two new nodes, (G|E) and (E|G), as they both are representing 'hybrid cars', will always have gas and electric engines with probabilities of 1, meaning no more info can be obtained.<br /><br />This graph is then representing everything we know about 'car engines' in the form of a tree-like structure made of two components:<br /><ul><li><b>Nodes</b> represent events: node X correspond to the event "I randomly choose a car from the parking lot", while node G represent the event "I detect a gas engine is in the car".</li><li><b>Edges</b> represent conditional probabilities of events: P(G|X) = 0.9 means "detecting a gas engine is in a car" if I first "randomly choose a car from the parking lot" is 90%.</li></ul><br />In order to define the actual entropy value for a tree-structure like this, we will perform a recursive process, starting on the upper leaf-nodes and going down to the root node, where the graph entropy will be finally obtained.<br /><br />We will first need to break the problem into its smallest components and trace a plan on how to mix small parts into bigger ones until we can finally obtain the root entropy of the graph... but it is lunch time! I will be commenting on these final calculations on a next post.<br /><br />Bon appetit!Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0tag:blogger.com,1999:blog-6923947282926324208.post-40242394597435237452018-06-11T16:13:00.001+02:002018-06-12T15:07:04.489+02:00Graph entropy 3: Changing the rulesAfter showing that the standard <a href="http://entropicai.blogspot.com/2018/06/graph-entropy-1.html" target="_blank">Gibbs cross-entropy was flawed</a> and tried to fix it with a also flawed initial formulation of <a href="http://entropicai.blogspot.com/2018/06/graph-entopy-2-first-replacement.html" target="_blank">"free-of-logs" entropy</a>, we faced the problem of finding a way to substitute a summary by a product without breaking anything important. Here we go...<br /><br />When you define an entropy as a summary, each of the terms is supposed to be a "a little above zero": small and positive π β₯0 so, when you add it to the entropy it can only slightly increase the entropy. Also, when you add a new probability term having (p=0) or (p=1), you need this new term to be 0 so it doesn't change the resulting entropy at all.<br /><br />Conversely, when you want to define an entropy as a product of terms, they need to be "a little above 1" in the form (1+π), and the terms associated with the extreme probabilities (p=0) and (p=1) can not change the resulting entropy, so they need to be exactly 1.<br /><br />In the previous entropy this π term was defined as (1-p<sub>i</sub><sup>p<sub>i</sub></sup>), and now we need something like (1+π) so why not just try with (2-p<sub>i</sub><sup>p<sub>i</sub></sup>)?<br /><br />Let us be naive again an propose the following formulas for entropy and cross-entropy:<br /><br /><div style="text-align: center;">H<sub>2</sub>(P) = β(2-p<sub>i</sub><sup>p<sub>i</sub></sup>)</div><div style="text-align: center;"><br /></div><div style="text-align: center;">H<sub>2</sub>(Q|P) = β(2-q<sub>i</sub><sup>p<sub>i</sub></sup>)</div><br />Once again it looks too easy to be worth researching, but once again I did, and it proved (well, my friend <a href="http://www.umh.es/contenido/pdi/:persona_5536/datos_es.html" target="_blank">JosΓ© MarΓa AmigΓ³</a> actually did) to be a perfectly defined generalised entropy of a really weird class, with <a href="https://epljournal.edpsciences.org/articles/epl/abs/2011/02/epl13272/epl13272.html" target="_blank">Hanel-Thurner exponents</a> being (0, 0), something never seen in the literature.<br /><br />As you can see, this new cross-entropy formula is perfectly well defined for any combination of p<sub>i</sub> and q<sub>i</sub> (in this context, we are assuming 0<sup>0</sup> = 1) and, if you graphically compare both cross-entropy terms, you find that, for <a href="https://www.wolframalpha.com/input/?i=plot+(-p*log(q))++from+q%3D0+to+1+from+p%3D0+to+1" target="_blank">the Gibbs version</a>, this term is unbounded (when q=0 the term value goes up to infinity):<br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="https://4.bp.blogspot.com/-h7bnqR-keyg/Wx5b1HC6LhI/AAAAAAABrII/InBoBT9GHswLT6C9JSR1qAU9VBntLToWACLcBGAs/s1600/cross-entropy-gibbs.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="360" data-original-width="226" height="320" src="https://4.bp.blogspot.com/-h7bnqR-keyg/Wx5b1HC6LhI/AAAAAAABrII/InBoBT9GHswLT6C9JSR1qAU9VBntLToWACLcBGAs/s320/cross-entropy-gibbs.png" width="200" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;"><span id="docs-internal-guid-9b46f84d-ee84-f891-f880-8496e10754c6" style="background-color: transparent; color: #666666; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">π</span><span style="background-color: transparent; color: #666666; font-family: "arial"; font-size: 6.6pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: sub; white-space: pre;">G</span><span style="background-color: transparent; color: black; font-family: "lato"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">(p, q) = -(p Γ log(q))</span></td></tr></tbody></table><br /><span id="docs-internal-guid-10b62b42-ee83-9b3f-5887-a56fd5aac2e8" style="background-color: transparent; clear: right; color: black; float: right; font-family: "lato"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; margin-bottom: 1em; margin-left: 1em; text-decoration: none; vertical-align: baseline; white-space: pre-wrap;"></span><br /><br />In the new multiplicative form of entropy, <a href="https://www.wolframalpha.com/input/?i=plot+(2-q%5Ep)+from+q%3D0+to+1+from+p%3D0+to+1" target="_blank">this term</a> is 'smoothed out' and nicely bounded between 1 and 2:<br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-XtogysR0I2o/Wx5cWx3w6hI/AAAAAAABrIQ/WNA_7sOWtLMH2-ztbF0EUaDI35nI9gTeQCLcBGAs/s1600/cross-entropy-H2.png" style="margin-left: auto; margin-right: auto;"><img border="0" data-original-height="360" data-original-width="322" height="320" src="https://3.bp.blogspot.com/-XtogysR0I2o/Wx5cWx3w6hI/AAAAAAABrIQ/WNA_7sOWtLMH2-ztbF0EUaDI35nI9gTeQCLcBGAs/s320/cross-entropy-H2.png" width="286" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;"><span id="docs-internal-guid-041aa503-ee85-a0a7-e039-59e93fbed221" style="background-color: transparent; color: #666666; font-family: "arial"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">π</span><span style="background-color: transparent; color: #666666; font-family: "arial"; font-size: 6.6pt; font-style: normal; font-variant: normal; font-weight: 700; text-decoration: none; vertical-align: sub; white-space: pre;">2</span><span style="background-color: transparent; color: black; font-family: "lato"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">(p, q) = (2-</span><span style="background-color: transparent; color: black; font-family: "lato"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;"><span style="background-color: transparent; color: black; font-family: "lato"; font-size: 11pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: baseline; white-space: pre;">q</span><span style="background-color: transparent; color: black; font-family: "lato"; font-size: 6.6pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: super; white-space: pre;">p</span>)</span><span style="background-color: transparent; color: black; font-family: "lato"; font-size: 6.6pt; font-style: normal; font-variant: normal; font-weight: 400; text-decoration: none; vertical-align: super; white-space: pre;"></span></td></tr></tbody></table><br /><br /><a name='more'></a><br />Just to make sure it was what it looked like, I directly -and naively- sent an email to Stefan Thurner asking for his expert opinion: surprisingly, he kindly answered me! It was a big surprise for him too, so it was official: I had quite an extrange entropy on my hands.<br /><br />The next question was whether or not this entropy had a nice replacement for the 4th axiom or, in other words, if the entropy of the Cartesian product PxQ of two independent distributions, H(P, Q), was bounded by some elegant combination of the entropies of P and Q, H(P) and H(Q).<br /><br />It turned out that I needed to modify it a little bit in order to get a decent separability property, so I defined a third generalised entropy (this is the last one, promised!):<br /><br /><div style="text-align: center;">H<sub>3</sub>(P) = 1 + log(H<sub>2</sub>(P)) = 1 + log(β(2 - p<sub>i</sub><sup>p<sub>i</sub></sup>))</div><div style="text-align: center;"><br /></div><div style="text-align: center;">H<sub>3</sub>(Q|P) = 1 + log(H<sub>2</sub>(Q|P)) = 1 + log(β(2 - q<sub>i</sub><sup>p<sub>i</sub></sup>))</div><br />If now you compare the four generator functions, one for Gibbs entropy and three more for the new multiplicative ones, you can <a href="https://www.wolframalpha.com/input/?i=Plot+(-x*Ln(x)),+(1-x%5Ex),+(2-x%5Ex),+(1%2BLn(2-x%5Ex))+from+x%3D0+to+1" target="_blank">see how related they are</a>:<br /><br /><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-dF_5O02z_mA/Wx-Ebn165DI/AAAAAAABrIg/pVoFw4XbNq8iEbMy6uVAmSffXPz3kNk0gCLcBGAs/s1600/4%2Bfunctions.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="260" data-original-width="543" src="https://4.bp.blogspot.com/-dF_5O02z_mA/Wx-Ebn165DI/AAAAAAABrIg/pVoFw4XbNq8iEbMy6uVAmSffXPz3kNk0gCLcBGAs/s1600/4%2Bfunctions.png" /></a></div><br /><br />It really didn't change much at a first glance, except that now exponents were again (1, 1) and it started to show some interesting separability properties/inequations, but the most interesting property was hidden: you could combine different distributions in a tree-like structure and still get a coherent value of entropy... it seemed to be a graph entropy instead of a distribution entropy.<br /><br />This was far from evident. You needed to define some strange combination of those two multiplicative forms of entropy, H<sub>2</sub> and H<sub>3</sub>, before you were able to see the "graph side" of it.<br /><br />In <a href="http://entropicai.blogspot.com/2018/06/graph-entropy-4-distribution-vs-graph.html" target="_blank">the next post</a> I will be showing how to define this entropy over any directed -and acyclic- graph, so we will be basically extending the concept of entropy of a distributions to a much broader audience.Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0tag:blogger.com,1999:blog-6923947282926324208.post-48778947394714712992018-06-10T23:30:00.000+02:002018-06-11T16:14:04.859+02:00Graph Entopy 2: A first replacementAs I commented on a <a href="https://entropicai.blogspot.com/2018/06/graph-entropy-1.html#more" target="_blank">previous post</a>, I found that there were cases where cross-entropy and KL-divergence were not well defined. Unluckily, in my theory those cases where the norm.<br /><br />I had two options: Not even mentioning it, or try to go and fix it. I opted for the first as I had no idea of how to fix it, but I felt I was hiding a big issue with the theory under the carpet, so one random day I tried to find a fix.<br /><br />Ideally, I thought, I would only need to replace the (p<sub>i</sub> Γ log(p<sub>i</sub>)) part with something like (p<sub>i</sub><sup>p<sub>i</sub></sup>), but it was such a naive idea I almost gave up before having a look, but I did: how different do those two functions looks like when <a href="http://www.wolframalpha.com/input/?i=plot+(-p*ln(p)),+(p%5Ep)+from+p%3D0+to+p%3D1" target="_blank">plotted on their domain interval (0, 1)</a>?<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-B1_g78pvmUo/Wx41E1Npy-I/AAAAAAABrHw/Lba8PpZdz6kHi5rxPeoOdJVY0CZs6AVBACLcBGAs/s1600/%25C3%25ADndice.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="219" data-original-width="411" height="170" src="https://2.bp.blogspot.com/-B1_g78pvmUo/Wx41E1Npy-I/AAAAAAABrHw/Lba8PpZdz6kHi5rxPeoOdJVY0CZs6AVBACLcBGAs/s320/%25C3%25ADndice.png" width="320" /></a></div>Wow! They were just mirror images one of each other! In fact, you only need a small change to match them: <a href="http://www.wolframalpha.com/input/?i=plot+(-p*ln(p)),+(1-p%5Ep)+from+p%3D0+to+p%3D1" target="_blank">(1-(p<sub>i</sub><sup>p<sub>i</sub></sup>)):</a><br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://2.bp.blogspot.com/-5vKZH9WByNo/Wx41E_9QqPI/AAAAAAABrHs/acWR-v3IWpwi3Mol4JYXoKM00lBHf3GQACEwYBhgL/s1600/%25C3%25ADndice2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="223" data-original-width="406" height="175" src="https://2.bp.blogspot.com/-5vKZH9WByNo/Wx41E_9QqPI/AAAAAAABrHs/acWR-v3IWpwi3Mol4JYXoKM00lBHf3GQACEwYBhgL/s320/%25C3%25ADndice2.png" width="320" /></a></div><div style="text-align: left;"><br /><a name='more'></a></div><div style="text-align: left;">It was even more similar after <a href="http://www.wolframalpha.com/input/?i=plot+4%2F5*(-p*ln(p)),+(1-p%5Ep)+from+p%3D0+to+p%3D1" target="_blank">using a k=4/5</a>:<br /><br /><div style="text-align: center;"><a href="https://2.bp.blogspot.com/-WJ9HOZ4-Ku0/Wx41E63-QxI/AAAAAAABrH0/FzTV84Twq44G5-3SAkD8NbAGd1p8snFSACEwYBhgL/s1600/%25C3%25ADndice3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="217" data-original-width="415" height="167" src="https://2.bp.blogspot.com/-WJ9HOZ4-Ku0/Wx41E63-QxI/AAAAAAABrH0/FzTV84Twq44G5-3SAkD8NbAGd1p8snFSACEwYBhgL/s320/%25C3%25ADndice3.png" width="320" /></a> </div></div><div style="text-align: left;"><br />So my first attempt to build a new entropy was this:</div><div style="text-align: left;"><br /></div><div style="text-align: center;">H<sub>1</sub>(P) = -k*<span style="font-size: large;">πΊ</span>(1-(p<sub>i</sub><sup>p<sub>i</sub></sup>))</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Surprisingly it proved to be a real generalised entropy with quite a standard <a href="https://epljournal.edpsciences.org/articles/epl/abs/2011/02/epl13272/epl13272.html" target="_blank">Hanel-Thurner exponents</a> of (1, 1), but it was not nicely separable, there was nothing near a 4th axiom replacement for this, so basically it was an interesting bullshit I wasted some weeks working on.</div><div style="text-align: left;"><br />After trying to find the quadrature of the circle for some time, I realised I only reverted part of the logarithmic problem: the summary <span style="font-size: large;"><span style="font-size: small;">πΊ sign should had been replaced with the original multiplication one, </span></span><span style="font-size: large;"><span style="font-size: small;">β. The entropy I was looking for was a multiplication of terms, not a summary as usually expected.</span></span></div><div style="text-align: left;"><span style="font-size: large;"><span style="font-size: small;"><br /></span></span></div><div style="text-align: left;"><span style="font-size: large;"><span style="font-size: small;">But how can you build an entropy out of multiplications and still make sense? The first three axioms of entropy had never been applied to a multiplicative form to my knowledge, so it was an uncharted landscape to explore or, who knows, just a totally waste of time.</span></span></div><div style="text-align: left;"><span style="font-size: large;"><span style="font-size: small;"><br /></span></span></div><span style="font-size: small;">We will see if I wasted my time again in <a href="https://entropicai.blogspot.com/2018/06/graph-entropy-3-changing-rules.html" target="_blank">a next post</a>. By now, just take my word on this: there was a way! </span>Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-70206956400739149822018-06-10T18:50:00.000+02:002018-06-10T23:32:00.836+02:00Graph entropy 1: The problem<br />This post is the first on a series about a new form of entropy I came across some months ago while trying to formalise <a href="https://arxiv.org/abs/1803.05049" target="_blank">Fractal AI</a>, the possible uses for it as a entropy of a graph, and how I plan to apply it to neural network learning and even to generate conscious behaviour in agents. <br /><br /><h2>Failing to use Gibbs</h2>The best formula so far accounting for the entropy of a discrete probability distribution P={p<sub>i</sub>} is the so-called Gibbs-Boltzmann-Shannon entropy:<br /><br /><div style="text-align: center;">H(P) = -k*<span style="font-size: large;">πΊ</span>(p<sub>i</sub> Γ log(p<sub>i</sub>))</div><div style="text-align: left;"><br /></div><div style="text-align: left;">In this famous formula, the set of all the possible next states of the systems is divided into a partition P with n disjoint subsets, with p<sub>i</sub> representing the probability of the next state being in the i-th element of this partition. The constant k can be anything positive so we will just assume k=1 for us.</div><div style="text-align: left;"><br /></div>Most of the times we will be interested in the cross-entropy between two distributions P={p<sub>i</sub>} and Q={q<sub>i</sub>}, or the entropy of Q given P, H(Q|P), a measure of how different they both are or, in terms of information, how much new information is in knowing Q if I already know P. <br /><br />In that case, the Gibbs formulation for the cross-entropy goes like this:<br /><br /><div style="text-align: center;">H(Q|P) = -<span style="font-size: large;">πΊ</span>(p<sub>i</sub> Γ log(q<sub>i</sub>))</div><div style="text-align: left;"><br /></div><div style="text-align: left;">Cross-entropy is the real formula defining an entropy, as the entropy of P can be defined as its own cross-entropy H(P|P), having the property of being the maximal value of H(Q|P) for all possible distributions Q.<br /><br /><div style="text-align: center;">H(P) = H(P|P) β₯ H(Q|P)</div><br />As good and general as it may looks, this formula hides a very important limitation I came across when trying to formalise the Fractal AI theory: if, for some index you have q<sub>i</sub>=0 then if p<sub>i</sub> is not zero too, the above formula is simply not defined, as log(0) is as undefined as 1/0 is.</div><a name='more'></a><br /><div style="text-align: left;">In the entropy formula for a single distribution P, this defect was not showing up, as p<sub>i</sub> was multiplying the log, making the limit as p<sub>i</sub> tends to zero to be well defined with a value of zero... but in the more general cross-entropy formula, the problem was really there.</div><div style="text-align: left;"><br /></div><div style="text-align: left;">As a mathematician I was horrified. I searched on the net for papers discussing this deep problem but was unable to find much, so I went to some DL specialists and asked them for the solution they were applying when using cross-entropy as a loss function for gradient descent, hoping to discover that there were an easy and satisfactory fix, but there wasn't! They were just replacing probabilities lower than an epsilon, with epsilon. They were clipping the offending values out of sight. Ouch!</div><br />How could it be that the two most important derivations from the concept of entropy (cross-entropy and divergence) were not well defined under the Gibbs formulation of entropy? Why was the Gibbs formulation so defective and where did the defect came from?<br /><br /><h2>The origins of entropy</h2>Any formula using the log of a probability is, in principle, flawed. Probabilities can naturally be zero, and log is not defined for zero, so using log of a probability is not actually a good idea.<br /><br />In its original form, Gibbs didn't use logarithms. Gibbs started by noticing what is known as the original form of the Gibbs inequality:<br /><br /><h3>Gibbs original inequation</h3>For any distribution P={p<sub>i</sub>}, the product β(p<sub>i</sub><sup>p<sub>i</sub></sup>) is always positive and greater-or-equal than the product β(q<sub>i</sub><sup>p<sub>i</sub></sup>) for any other distribution Q={q<sub>i</sub>}.<br /><br /><div style="text-align: center;"> β(p<sub>i</sub><sup>p<sub>i</sub></sup>) β₯ β(q<sub>i</sub><sup>p<sub>i</sub></sup>)</div><br />It was a very nice inequality as it was, but Gibbs thought he could apply logarithms on both sides without breaking the inequality and, at the same time, use it to define entropy itself, making it easy to compute the entropy of two independent system by just adding their corresponding entropies.<br /><br />He named this property of strong additivity its 4rd axiom needed for a function to be consider as an entropy, and then he proved that only his formula fitted into those four axioms.<br /><br />This step resulted in the actual form of the entropy as a summary of logarithmic terms, and is in the root of all subsequent problems with the cross-entropy. My opinion is that this 4rd axiom is not a real axiom but a somehow desirable property that is not worth the high cost we paid for it.<br /><br />Once we know the problem the cross-entropy has and the root causes, we are ready to explore other ways of measuring entropy without using logs, but it will have to be in a <a href="https://entropicai.blogspot.com/2018/06/graph-entopy-2-first-replacement.html" target="_blank">next post</a>.Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0tag:blogger.com,1999:blog-6923947282926324208.post-91981113736629463972018-03-14T15:26:00.000+01:002018-03-15T15:19:29.029+01:00Fractal AI "recipe"Now that <a href="https://entropicai.blogspot.com.es/2018/02/fractal-ai-goes-public.html" target="_blank">the algorithm is public</a> and people is trying to catch up, it can be of help -mainly to us- to have a simplistic schema of what it does, with no theories nor long formulae, nothing extra but the raw skeleton of the idea, so you can read it, get an idea, and go on with your life.<br /><br />I will try to simplify it to the sweet point of becoming... almost smoke!<br /><br /><h2><u>Ingredient list:</u></h2><ol><li>A system you can -partially- inspect to know its actual state -or part of it- as a vector.</li><li>A simulation you can ask "what will happen if system evolves from initial state X<span style="font-size: xx-small;">0</span> for a dt".</li><li>A distance between two states, so our "state space" becomes a metric space.</li><li>A number of "degree of freedom" the AI can push. </li></ol><br /><a name='more'></a>Let's comment on this ingredient list and find each ingredient counterpart in the Atari case:<br /><br /><h3>1) System</h3>This is the game you are playing. Your state is the RGB image as a vector -or the contents of the RAM, it doesn't really matter at all- that doesn't really reveal the state completely, it is just an observation of it.<br /><br />In this case our system state is discrete, each vector component is a byte from 0 to 255. But it is not important, in the rocket example the state is made of real numbers, and could be done of whatever you need (as far as you know how to define a distance).<br /><br /><h3>2) Simulation</h3>This is the OpenAI Atari environment itself: we can feed it with an state (a RAM dump in this case, regardless of being using images or RAM as observations) and ask it to make a simulation tick, so we get as output the state of the game in the next frame.<br /><br />In this case, the simulation is practically perfect, as the Atari games use to be deterministic (same situation, same reaction), but we don't ask it to be so nice, it could be non-deterministic (so trying the same simulation n times yields slightly different results each time) and the algorithm will just cope with it.<br /><br /><h3>3) Distance</h3>Given two states, let say two PNG images, what we have is a couple of vectors, so defining a distance is easy, just use the euclidean distance, but hey, you could try any other distance as far as it is... at least informative.<br /><br /><h3>4) Degrees of freedom</h3>This is the list of the state vector coordinates that the AI can play with: in our case, the nine button states from an old Atari game pad. The walkers will change them randomly as they build the paths, and the final output of the AI will be a vector of changes to be made to those state components.<br /><br />Again, they are discrete values in the Atari case, but in the rocket example they are continuous values, 'entropic forces' to be applied to the 'joysticks' positions.<br /><br /><h2><u>Parameters:</u></h2>We have only three parameters that define the 'causal cone' (the 'portion of the future') we will be scanning before deciding.<br /><br /><h3>1) Time horizon</h3>It is the 'deepth' of the scanning, the number of steps we will be looking into the future before deciding.<br /><br /><h3>2) Number of walkers</h3>How many 'random paths' we want to simulate, or how many 'states' will our fractal have.<br /><br />It is just like in a Monte Carlo simulation, but instead of being 'random, independent, linear paths' here they are 'almost random, not independent, fractal paths' (made of sections of paths glued together).<br /><br />The nice thing here is: You will need about 1000 time less fractal paths than you would need linear paths in a standard Monte Carlo approach. Apart from this, this is a Monte Carlo schema.<br /><br /><h3>3) Samples per step</h3>Each of the simulations we will need to do in order to build our paths and make a decision is said to be a 'sample' of the system. Actually, the number of samples used is auto-magically set before each step in order to make sure that all the walkers arrive to its time horizon destination, so this is just a 'safe limit' to avoid using too much computational resources.<br /><br />In the standard game play, this number of samples adjusts to the difficulty quite nicely but, whenever the game stop reacting to the press of the buttons (mainly on the new level animations) the AI will tend to use all available resources to try to control its future... it will slow down the thinking by using as many samples as possible but hey, if there is a bug hidden on the code, it will find and make use of it!<br /><br />In the case of the Atari environments, we have another two 'minor' parameters:<br /><ul><li>The 'reaction time' in frames (remember, Atari games work at 20 fps, so a reaction time of 5 means 4 decisions per second, steadily and restless).</li><li>The name of the game! I still find it magic to just write the name of a game and play it for the first time!</li></ul><br /><h2><u>Algorithm:</u></h2>So we have a Monte Carlo schema where 100 walkers are simultaneously generating 100 random paths of a given depth/length in small jumps or ticks. This far it is just standard stuff.<br /><br />An important difference to note is that, while MCTS is an exploration only algorithm that needs an additional heuristic to make the decision, FMC makes that decision in the process of scanning, as a by-product... a very useful one! <br /><br />If we should have to write a recipe for the individual walkers to follow this standard MCTS schema it would look like this:<br /><ol><li>Perturb the degrees of freedom (chose a random change to be added for each of them).</li><li>Add this perturbation to your state (actually press the buttons).</li><li>Simulate a new dt.</li><li>Go to 1 until your time t is the initial time t0 plus the desired time horizon.</li></ol>The Fractal AI does it like that:<br /><ol><li>Choose a random walker from the pool and read its state.</li><li>Calc. the distance D to your actual state.</li><li>Calc. the reward R in your actual position.</li><li>Calc. your 'Virtual reward' VR = D*R</li><li>Choose -again- a random walker from the pool and read its state.</li><li>Calc. the probability of cloning by comparing yours vs his virtual rewards.</li><li>If you opted for cloning, do it: overwrite your state with the received one, and go to 1.</li><li>Otherwise (you decided not to clone), we are in the standard Monte Carlo case: </li><li>Perturb the degrees of freedom (chose a random change to be added for each of them).</li><li>Add this perturbation to your state (actually press the buttons).</li><li>Simulate a new dt.</li><li>Go to 1 until your time t is the initial time t0 plus the desired time horizon. </li></ol>If you want to compare the paths and behaviours generated by both approaches in the same environment, an image is worth 1000 words and a video 1000 images, so watch both videos from this <a href="https://entropicai.blogspot.com.es/2015/10/maze-fractal-vs-entropic.html" target="_blank">old comparison</a>:<br /><br />Linear paths:<br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/HtYwOI-f6EY/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/HtYwOI-f6EY?feature=player_embedded" width="320"></iframe></div><br />Fractal paths:<br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/yx695HfQoMY/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/yx695HfQoMY?feature=player_embedded" width="320"></iframe></div><br /><br />There are some other small details not commented here, like using the number of samples as the stop condition or adjusting it real-time to use less samples, but they are just implementation details you can safely forget, and they are defined on the code.<br /><br /><h3>Making the decision</h3>In MCTS there are many ways to make your final decision, basically they select the maximum scoring path found, and follow it, but there are far more complicated schemes.<br /><br />In FMC making the decision is part of the whole process, and it goes like this:<br /><br /><ul><li>When a walker takes its initial decision on its first step starting in the agent state, this initial decision is stored as an 'attachment' to the walker state, so it carries a copy of this decision with it all the way.</li><li>When a walker decides to clone to another walker position, it clones its state, overwriting its initial decision with the other walker initial decision.</li><li>At the end of the cycle, when walkers reach the time horizon, the decision is just the average of the initial decisions of the resulting walkers.</li></ul><br />And that was all!Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0tag:blogger.com,1999:blog-6923947282926324208.post-53336237465999952092018-02-15T14:36:00.003+01:002018-03-15T14:58:35.773+01:00Fractal AI goes public!Today we are glad to announce that we are finally releasing the "Fractal AI" artificial intelligence framework to the public!<br /><br />This first release includes:<br /><ul><li><a href="https://arxiv.org/abs/1803.05049" target="_blank">Fractal AI: A fragile theory of intelligence</a> A nice to read small book in PDF with theory, algorithm, pseudo-code, experiments, etc.</li><li><a href="https://github.com/FragileTheory/FractalAI" target="_blank">github.com/FragileTheory/FractalAI</a> with working python code to beat almost all of the actual Atari games.</li></ul><br />We have modified Fractal AI a little so now it is more powerful than ever, in fact we have been able to beat a lot of the actual records (from state-of-the-art neural network like DQN or A3C) with about 1000 samples per strep (and remember, no learning, no adaptation to any game, same code for all of them).<br /><br />We are specially proud of beating even some absolute human world records, but hey, it was going to happen anyhow!<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/QV3DNfr0O_0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/QV3DNfr0O_0?feature=player_embedded" width="320"></iframe></div><br />This Ice Hockey game scored 64... one goal every 3 seconds or more! Human absolute record is 36, and previous AIs scored 10.5 the best, and I have an inmortal centipede running on my PC for a week, it is scoring 1,241,988 right now and has 6 extra lifes... human record is 1,301.000 and best AIs scored 25.000, so tomorrow I will kill the game if it is still alive.<br /><br /><a name='more'></a><br /><br />If you decide to test it by yourself, we kindly ask you that, should you test a new game or get a specially high score, please report back as asked in the readme.<br /><br />The parameters are few and well explained in the hit-and-run notebook example included: Name of the game, and 3 simple numbers to adjust time horizon, reaction time, and number of paths. The CPU needed at any moment auto adjusts -but you can and should hard-limit it- so you can beat some games like boxing in real time.<br /><br />The idea is making truly open science by asking the people not only to reproduce but to generate our results, and to send a video of the record so it can get certified as being legit. The score board will cite the users so you can be part of it if you feel like.<br /><br />Ah! The base code of the fractal is generic, it is not atari only, it works in any other problem you can adapt it to, continuous or discrete...<br /><br />I copy-paste here the abstract and a very preliminary score table from the <a href="https://github.com/FragileTheory/FractalAI/blob/master/README.md" target="_blank">great intro</a> <a href="https://twitter.com/Miau_DB" target="_blank">Guillem</a> has done for the release:<br /><br /><h2>Abstract</h2><a href="https://docs.google.com/document/d/13SFT9m0ERaDY1flVybG16oWWZS41p7oPBi3904jNBQM/edit?usp=sharing" rel="nofollow">Fractal AI</a> is a theory for general artificial intelligence. It allows to derive new mathematical tools that constitute the foundations for a new kind of stochastic calculus, by modelling information using cellular automaton-like structures instead of smooth functions.<br />In this repository we are presenting a new Agent, derived from the first principles of the theory, which is capable of solving Atari games several orders of magnitude more efficiently than other similar techniques, like Monte Carlo Tree Search <b>[<a href="https://github.com/FragileTheory/FractalAI#bibliography">1</a>]</b>.<br />The code provided shows how it is now possible to beat some of the current state of the art benchmarks on Atari games, using less than 1000 samples to calculate each one of the actions when MCTS uses 3 Million samples. Among other things, Fractal AI makes it possible to generate a huge database of top performing examples with very little amount of computation required, transforming Reinforcement Learning into a supervised problem.<br />The algorithm presented is capable of solving the exploration vs exploitation dilemma, while maintaining control over any aspect of the behavior of the Agent. From a general approach, new techniques presented here have direct applications to other areas such as: Non-equilibrium thermodynamics, chemistry, quantum physics, economics, information theory, and non-linear control theory.<br /><br /><br />SoTA = State of the art, the best AI to date.<br />Human = score by a game tester after 2h of playing.<br />Absolute record = human world record.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://github.com/FragileTheory/FractalAI/raw/master/assets/benchmarks.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="800" data-original-width="714" height="640" src="https://github.com/FragileTheory/FractalAI/raw/master/assets/benchmarks.png" width="570" /></a></div><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-25437915182551089532017-07-06T22:06:00.001+02:002018-06-11T16:20:08.833+02:00Retrocausality and AIRetrocausality is about physical things in the present affecting things in the past. Wow, read it twice. If it sounds to you like breaking the most basic rules of common sense and our most basic intuitions of how things work, you are right, but as weird as it sounds... somehow it makes perfect sense.<br /><br />Today I found this <a href="https://m.phys.org/news/2017-07-physicists-retrocausal-quantum-theory-future.html" target="_blank">inspiring article in phys.org</a> about retrocausality. Basically it proves that, if the time symmetry found in all known physic laws is to be accepted as a fundamental law, as it actually is, then causality must go on both directions too, so as unreal it could sound to us, macro-sized humans, it is more than plausibly retrocausality is in the very nature of our world.<br /><br />Once accepted as a possibility, it solves much of the actual issues with quantum theories: action-at-distance, non-locality, Bell theorem... and it is not more or less plausible than other alternatives, like no-time-symmetry, many-worlds or even the Copenhagen model, so by accepting one "counter-intuitive" possibility, quantum world get less intimidating. I buy it!<br /><br />Reading it reminded me of one the many variations of the Fractal AI I tried in the past, I wrote about it in the post about the <a href="http://entropicai.blogspot.com.es/2015/06/using-feynman-integrals.html" target="_blank">Feynman fractal AI</a>, a model where signal travelled back and forth in time. Here you have a naive drawing of it:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://4.bp.blogspot.com/-FgE4ByyYpQk/VYHstaM9iwI/AAAAAAAAGJI/lU1BM1M7QC4oez5e89AkqBEJSNmNmJoewCPcBGAYYCw/s1600/2015-06-17%2B23.22.14.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="536" data-original-width="1600" height="133" src="https://4.bp.blogspot.com/-FgE4ByyYpQk/VYHstaM9iwI/AAAAAAAAGJI/lU1BM1M7QC4oez5e89AkqBEJSNmNmJoewCPcBGAYYCw/s400/2015-06-17%2B23.22.14.jpg" width="400" /></a></div><br />The idea was nice and it was as smart as the "standard" fractal AI, but it could not improve it at all, it was just another way of doing the same stuff, but more complicated, so I finally drooped this idea in the bag of the almost-good ones.<br /><br /><a name='more'></a><br />Here you have a nice video of it. The different colours are just a trail of visited positions, the real action is on the black spots: <br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/9CKrJUGYgwY/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/9CKrJUGYgwY?feature=player_embedded" width="320"></iframe></div><br />Would it be possible to build neuronal networks that relay on this concept for learning as you use them, NN without a separate learning phase, where signals arrived at different time-shifts could interact? Well, it makes sense to me, as, when a signal gets the incorrect answer, we are actually penalising its past actions by reducing the weight of previously visited neuronal paths.<br /><br />I am aware LSTM NN basically do that, but I think about a basic model that use it at the most basic levels, and where learning is not based on any gradient but in past actions of wrongly processed signals.<br /><br />I just find it the natural way to go... but if and only if the universe has a T-symmetry!Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-69125359382508844822017-06-28T13:24:00.000+02:002018-06-11T16:20:31.129+02:00Solved atari gamesThe list of environments from <a href="https://gym.openai.com/">OpenAI</a> that we have already played so far is steadily growing, so I had to made a list to keep track of them. Here we keep and share this growing list, along with it scorings and how it compares with the "second-best" algorithm in the OpenAI gym.<br /><br />For the interested people: We base all on our work on the "<a href="https://physics.aps.org/articles/v6/46">Causal Entropic Forces</a>" by <a href="http://www.alexwg.org/">Alexander Wissner-Gross</a> and apply the ideas outlined in the <a href="http://entropicai.blogspot.com.es/2017/06/fractal-optimising-first-paper.html">G.A.S. algorithm</a>. We are not actually learning in any way, so all games are independent from each other and first-ever played game is as godd as the 100th game.<br /><br />First, we list the already finished environments. They include 100 games played and an official scoring in OpenAI gym as the average of those 100 games:<br /><br />1. <a href="https://gym.openai.com/evaluations/eval_NDkU4oVNTDy6pME9ytMJeg">Atari - MsPacman-ram-v0</a>: average score of <b>11.5k</b> vs <a href="https://gym.openai.com/evaluations/eval_HnfEWxEQcKMMLYYASEyYQ">9.1k</a> (x1.2)<br /><br />This was the first env. to be finished and uploaded, so it represent our <a href="http://entropicai.blogspot.com.es/2017/06/openai-first-record.html">first official record</a>. We decided to use the "ram" version (instead of the image version) because it is irrelevant for our algorithm but not for a more standard approach, so we had an extra punch.<br /><br />The main issue here was a dead Pacman takes about 15 frames to be noticeable on screen (there is a short animation) so you need to think in advance at least those 15 frames (ticks) in order to start detecting death.<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/QZvl5JqDaxQ/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/QZvl5JqDaxQ?feature=player_embedded" width="320"></iframe></div><br /><a name='more'></a><br /><br /><br /> 2. <a href="https://gym.openai.com/evaluations/eval_dJjksNFuSGKPSYPv09JWdg">Atari - Qbert-ram-v0</a>: avg. score of <b>18.4k</b> vs <a href="https://gym.openai.com/evaluations/eval_wUIAxbU8TZSMppySFNd3w">4.2k</a> (x4.3)<br /><br />Next one was Qbert, just because it solved quickly. Here action is not so fast, once you decide to jump left, it takes a considerable amount of frames for the decision to complete so you can take a second decision. That is why, in this case, we scan one frame every two (Pacman used all frames).<br /><br />Note: One "frame" is internally composed of 2 consecutive frames as the atari screen seems to use an interlaced schema (odd frames only fill odd lines, line in PAL or SECAM tv standards).<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/j0w7fuoJuD0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/j0w7fuoJuD0?feature=player_embedded" width="320"></iframe></div><br /><br />The rest of the cases have not completed the mandatory 100 games, it takes too long to make it (Guillem's laptop is causing about 1.3% of the actual global warming ;-) so they do not have an official scoring. Instead, I will use the aprox. average of completed games.<br /><br /><br />3. <a href="https://gym.openai.com/evaluations/eval_i1hcB1bESbO20DNCtSVYw">Atari - MsPacman-v0</a>: avg. score (4 games) of <b>~9k</b> vs <a href="https://gym.openai.com/evaluations/eval_8Wwndzd8R62np8CxVQWEeg">6.3k</a> (x1.4)<br /><br /><div class="separator" style="clear: both; text-align: left;">Our <a href="http://entropicai.blogspot.com.es/2017/06/fractal-vs-pack-man.html">first ever test</a> was done on this environment. After 4 games the results where too evident to waste more CPU (adding more resources we could beat it at any level we wish, at the expense of CPU time) so we moved on to the "ram" version to explore.</div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/WtCbFWcWwcM/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/WtCbFWcWwcM?feature=player_embedded" width="320"></iframe></div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;"><br /></div>4. <a href="https://gym.openai.com/evaluations/eval_iyQTuphhQ1tNxQd9h5JjQ">Atari - Tennis-ram-v0</a>: avg. score (1 game) of <b>~8</b> vs <a href="https://gym.openai.com/evaluations/eval_xqEMDSmsQFmOcgZtZVMF2w">0.01</a> (x800)<br /><br />This time it is quite difficult to compare with others algorithms, as beating the embeded "old days AI" is quite complicated for a general algorithm (it was designed to play against human level players after all): most of the algorithms in OpenAI scored just 0.0, and only one was able to marginally win (due to the biased scoring system of picking the best 100 episodes, so the more you play, the higest your score gets).<br /><br />Scoring x800 times as good as the second one is, in this case, just meaning "I am the fisrt and only algorithm actually solving it, so you can not compare me". <br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/8NLaNJhxkVA/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/8NLaNJhxkVA?feature=player_embedded" width="320"></iframe></div><br /><br />5. <a href="https://gym.openai.com/evaluations/eval_bNB0Dcr2RQG8zLVKkXg">Atari - VideoPinball-ram-v0</a>: avg. score (21 games) of <b>~500k</b> vs <a href="https://gym.openai.com/evaluations/eval_bsrJ1DkPQSOZoMCPihM3AA">28k</a> (x17.8)<br /><br />The CPU power we applied here made the AI almost unbeatable, with about +50% it would never die. <br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/SmSTW4RHjr0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/SmSTW4RHjr0?feature=player_embedded" width="320"></iframe></div><br /><br />6. <a href="https://gym.openai.com/evaluations/eval_RjbC9jQtSz2u3LF7shKZxQ">Classic Control - CartPole-v0:</a> avg. score (10 games) of 0.0 vs <a href="https://gym.openai.com/evaluations/eval_0z8gR2gRJCME6KNUdO9yg">0.0</a> (x1)<br /><br />This one is not froman atari game, so not really in the list, but is a classic example we wanted to share anyhow.<br /><br />The scoring here is weird, you only need to survive for a given amount of time (about 4 seconds) to get 200 points and win this game. You solved the game when the average of the last 100 games is above 195 points, and the number of games/episodes you played before those 100 "good ones" is your showed score.<br /><br />So a score of 0.0 means that your first 100 games averaged above 195 and the game was cosidered solved. You can not get more that this, so here the absolute record was already reached. <br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/ImpsGX-IbC8/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/ImpsGX-IbC8?feature=player_embedded" width="320"></iframe></div><br />That is all by now, I will be updating this post to reflect any new acomplishment in our quest to solve as many environments form OpenAI as we can.<br /><br /><br />Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com8tag:blogger.com,1999:blog-6923947282926324208.post-20520987390815203492017-06-18T15:26:00.002+02:002017-06-27T14:41:49.532+02:00OpenAI first record!We have just submitted our first official scoring on <a href="https://gym.openai.com/">OpenAI gym</a> for the atari game "<a href="https://gym.openai.com/envs/MsPacman-ram-v0">MsPackMan-ram-v0</a>" based on RAM (so you do not see the screen image, instead you "see" a 128 KB RAM dump).<br /><br />Our just <a href="https://gym.openai.com/evaluations/eval_NDkU4oVNTDy6pME9ytMJeg">submitted algorithm "Fractal AI"</a> played 100 consecutive games -the minimum allowed for an official scoring- and get an average score for the best 10 games of <b>11543 +/- 492</b>, well above previous record of 9106 +/- 143, so we are actually #1 on this particular atari game:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://gym.openai.com/evaluations/eval_NDkU4oVNTDy6pME9ytMJeg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="816" data-original-width="1024" height="255" src="https://1.bp.blogspot.com/-2TJ6IMiR22M/WUZ52t50dyI/AAAAAAABFTc/0BwFpZUeE2MoMP9y0zHj8sNyZHu3iXXaQCLcBGAs/s320/Captura%2Bde%2Bpantalla%2B2017-06-18%2B14.42.14.png" width="320" /></a></div><a href="https://gym.openai.com/evaluations/eval_NDkU4oVNTDy6pME9ytMJeg"></a><br /><a name='more'></a><a href="https://gym.openai.com/evaluations/eval_NDkU4oVNTDy6pME9ytMJeg"><br /></a>Previous record by <a href="https://gym.openai.com/evaluations/eval_HnfEWxEQcKMMLYYASEyYQ">MontrealAI</a> achieved an average scoring of 9106 +/- 143 after playing about <b>300k consecutive games</b>. When you inspect its learning ratio, you notice how different our approach is:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-mSNKoGO5xwQ/WUZ6aWyl1UI/AAAAAAABFUM/QQLYqRCdiRg8e6QRfiI-1NT-8GNqaeGtQCLcBGAs/s1600/Captura%2Bde%2Bpantalla%2B2017-06-18%2B14.41.59.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="816" data-original-width="1024" height="255" src="https://3.bp.blogspot.com/-mSNKoGO5xwQ/WUZ6aWyl1UI/AAAAAAABFUM/QQLYqRCdiRg8e6QRfiI-1NT-8GNqaeGtQCLcBGAs/s320/Captura%2Bde%2Bpantalla%2B2017-06-18%2B14.41.59.png" width="320" /></a></div><br />As you can see, it is a pure "Learning algorithm", meaning that it starts with zero knowledge and a also near-zero scoring, and as it learns from more games, it gets better and better scoring, so after learning from 300.000 games, it can achieve scores of about 9.000 points.<br /><br />In contrast, Fractal AI is a pure-intelligence algorithm, it doesn't learn at all by its own (on its simpler incarnation), so to get better scoring, you need more thinking power (more CPU or a better implementation).<br /><br />If we super-impose both graphs, this difference is quite evident:<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-Cq_nV5Le944/WUZ8BtnjqxI/AAAAAAABFWM/818XZ_8C1OQFa-B___K5HIQS0vrwW59IACLcBGAs/s1600/MixedPackMan.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="298" data-original-width="1327" height="140" src="https://3.bp.blogspot.com/-Cq_nV5Le944/WUZ8BtnjqxI/AAAAAAABFWM/818XZ_8C1OQFa-B___K5HIQS0vrwW59IACLcBGAs/s640/MixedPackMan.png" width="640" /></a></div><div class="separator" style="clear: both; text-align: center;"></div>The X-axis is a problem here, 100 vs 300k makes Fractal AI's graph to "compact" into a single vertical line on the left-most limit, but it cast a realistic image of the situation: Fractal AI, with the amount of CPU allowed (converted into number of walkers and ticks used to think) consistently ranges in the 5k - 20k, with some peaks here and there, but it doesn't get better with expertise like learning ones.<br /><br />Adding learning is, of course, the next step, as it would make the algorithm orders of magnitude better (given it time) and faster (learning allows as to cut down number of walkers over time saving most of the CPU needed without learning), but until then, we will try to beat some more atari games and other OpenAI environments we already worked on in the past (but never submitted) like the pole or the hill climbing classic control ones.<br /><br /><b>Update</b>: <a href="https://gym.openai.com/evaluations/eval_bNB0Dcr2RQG8zLVKkXg">Qbert</a> also has official score now (27/6/2017)!Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com16tag:blogger.com,1999:blog-6923947282926324208.post-55774338325416566882017-06-15T19:11:00.000+02:002017-06-15T19:21:21.690+02:00Fractal optimising, a first paperThe fractal "family" of algorithms actually started as a <a href="http://entropicai.blogspot.com.es/2015/05/fractal-function-optimization.html">very naΓ―ve</a> optimising algorithm: after all, intelligence is just about maximising a certain "utility function", so they are quite related.<br /><br />Once the fractal AI was done, the optimisation facet was again re-visited with a much <a href="http://entropicai.blogspot.com.es/2016/02/serious-fractal-optimizing.html">more promissing results</a> to later abandon it again.<br /><br />And finally, with the help of our friend <a href="http://www.umh.es/contenido/pdi/:persona_5536/datos_es.html">JosΓ© MarΓa AmigΓ³</a> from the Miguel Hernandez University, we wrote an article about this fractal algorithm we named "GAS" (namely for "<a href="https://arxiv.org/abs/1705.08691">General Algorithmic Search</a>" but it was actually for the capitals on our names, <a href="https://twitter.com/Miau_DB">Guillem</a>, AmigΓ³ and Sergio) and compared it against other similar ones out there (Basin hopping, Descent evolution and Cuckoo search).<br /><br /><a name='more'></a><br /><br />The paper is already out in <a href="https://arxiv.org/abs/1705.08691">arXiv</a> but a big publication rejected it because 10 particles Lennard-Jones only accounts for a 20 variables optimisation, and for todays standard, it happends that less than hundreds of variables is just not so interesting... anyhow, this is my first ever paper, so I am very glad.<br /><br />A second paper could be released sometime if we re-visit the issue again, I have some nice ideas about dealing with big L-J clusters, so who knows, it may even work!Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-79225635795128239002017-06-08T20:09:00.003+02:002017-06-27T14:36:46.082+02:00Fractal VS Pack-ManLast week my friend <a href="https://twitter.com/miau_db">Guillem</a> adapted the fractal AI for the <a href="https://gym.openai.com/envs#atari">OpenAI Atari games</a> (OpenAI is a "gym" for AIs), in particular he focused on "<a href="https://gym.openai.com/envs/MsPacman-v0">Ms Pack Man</a>", an environment labeled as "unsolved" as I write this.<br /><br />Yesterday the work was almost done and the first videos came out of the pipeline and, to be honest, the results have stonished me, it worked out far beyond my always-optimistic high spectations.<br /><br />So here is the video that made me so happy yesterday:<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/WtCbFWcWwcM/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/WtCbFWcWwcM?feature=player_embedded" width="320"></iframe></div><br /><a name='more'></a><br /><br />Just to put it in context: Your algorithm is only capable of "seeing" the game screen, and has the ability to push (or not) any of the four buttons available. Nothing more. Out from this mere information, build an algorithm that presses the buttons "intelligently" so the game's score gets as high as you can, as soon as you can. Pretty hard.<br /><br />After adapting our algorithm to the atari APIs, we set a very modest fractal of only 105 walkers and allowed it to only "see" 2 seconds in the future. Not much to be fair.<br /><br />The algorithm does not understand what the purpose of the game is, how many players are on the screen or anything about the game itself, nothing, just the images of the game as a raw integer array, and the corresponding score (smartly extracted for the screen shots).<br /><br />The algorithm is able to score as much as 20.000 points and solve four screens without previous training. Surely, with more walkers and more seconds it could beat by far this scoring, but this is not where the power of the idea lies.<br /><br />If you use those "pretty good games" as examples to train a standard neuronal network, you could make it learn much faster than todays methods based on random games.<br /><br />Inversely, if this trained neuronal network could be used by the fractal AI to be smarter by "learning" form the past decisions, its "efficiency" could drastically jump spme prders of magnitude (the example above is not using any neuronal network).<br /><br />And we have built a nice circular procces: better games examples means a better neuronal network, that in turn means a better fractal AI, that will generate even better games, that will make the NN smarter, and so on.<br /><br />The tests on this strange mix are already being ran, and my expectation sub-routines are disabled until tomorrow.<br /><br /><b>Update (27/06/2017)</b>: It is going to take more than a day, so in the meanwhile, here you have some other atari games played from OpenAI. All of them were played from the ram dump and, of course, without any trainig. For comparation purpouses, I am including the average score from the Fractal AI games vs the second "best-so-far" algorithm on OpenAI:<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/j0w7fuoJuD0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/j0w7fuoJuD0?feature=player_embedded" width="320"></iframe> </div><div class="separator" style="clear: both; text-align: center;"><a href="https://gym.openai.com/evaluations/eval_dJjksNFuSGKPSYPv09JWdg">Qbert-ram-v0</a> (184k vs 4k)</div><br /><br /><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/8NLaNJhxkVA/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/8NLaNJhxkVA?feature=player_embedded" width="320"></iframe></div><div style="text-align: center;"><a href="https://gym.openai.com/evaluations/eval_iyQTuphhQ1tNxQd9h5JjQ">Tennis-ram-v0</a> (8 vs 0.01)</div><div style="text-align: center;"><br /></div><div style="text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/SmSTW4RHjr0/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/SmSTW4RHjr0?feature=player_embedded" width="320"></iframe></div><div style="text-align: center;"><a href="https://gym.openai.com/evaluations/eval_bNB0Dcr2RQG8zLVKkXg">VideoPinball-ram-v0</a> (500k vs 20k)</div><div style="text-align: center;"><br /></div>Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com6tag:blogger.com,1999:blog-6923947282926324208.post-77256237322161897042017-03-03T17:36:00.002+01:002017-06-12T13:27:28.750+02:00Imperfect informationIn the actual incarnation of the fractal AI, we need to supply it with its exact state, all the interactions with environment (the simulation) and the potential function, hand crafted, to be followed. This is know as having "perfect information".<br /><br />Having perfect information of any system is just not feasible, so my models are not usable in real environments, with real drones, moving real motors, as all of them are unknow for us and we will have just some sensor's outputs as our information.<br /><br />This week I have visited the <a href="http://retecog2013.unizar.es/">Cognitive Sciencies research team at Zaragoza University</a> as a guest for a short but intense seminary about my fractal inteligence algoritms in an effort to team with them here and there, but they really emphasized on the sensorial approach -imperfect information case- in order to make our works compatible.<br /><br /><a name='more'></a><br /><br />So I have been thinking on how the actual fractal AI can be reduced to having only a number of sensor of the world around -and its on internal state- and some motors or actuators to work with. May be I will have it adapted in a couple of months, as I already have an easy way to properly do it, but it doesn't fit on the margins of this book ;)<br /><br />The idea is basically to mimic how a baby learns how to use his muscles to move around just form the information it gets from some sensor, in a continuous proccess of trial-and-error as you move around randomly, learning so, with time, the correct/optimal behaviour just emerges.<br /><br />I will be posting news about it as I develope the idea into real code and make some new videos of new-born rockets with only some distance sensors around it as they learn to fly themselves.<br /><br />BTW, there will be a long video of the first session of the seminary -the other two sessions were more informal and were not recorded- where I explain the fractal inteligence at deep. I will also publish the presentation (I need to translate it to english first) along with a big doc I have crafted with all the theory and pseudo-code I use, so you could produce your own fractal AIs in the same level -or even higher, as it includes the fractal memory schema, something I have not showed on videos on this blog- than the ones you have seen in the latest videos. Also the python code we use to work on some OpenAI problems will be released. <br /><br />So keep tuned!Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-11143632716296479822016-09-08T22:38:00.002+02:002017-06-12T13:27:50.235+02:00Generating consciousnessOne week ago I wrote <a href="http://entropicai.blogspot.com.es/2016/08/what-is-consciousness.html">this post</a> about an insight on what could "consciousness" be like, and I imagined it as something not-so hard to gasp as we always thought. Today I come back with a "pseudo-code" version of it on my mind.<br /><br />Those new ideas have come along with an effort in our company to port the fractal algorithm into a distributed, highly scalable architecture. A work in progress that is already producing a great speed-up in our tests.<br /><br />This new architecture allows me to play with big groups of fractals diseminated over a network of PCs, all doing the same decision work in paralell, to later join all their findings and take a "collegiated" decision.<br /><br />More interestingly, I can now "pack" some fractals to work as one big fractal and replicate it endlessly to build a tree of cooperating fractals as a nice way to distribute work over the PCs on the network.<br /><br />But how to arrange them to distribute the work even more efficiently? By building it as a "fractal of fractals", a tree of fractals whose structure evolves dynamically as you use it, to finally form a nice tree-like fractal that adapts its form to live in the environment you gave to it.<br /><br /><a name='more'></a><br /><br />This new bigger structure, even when used as a static tree-like graph (easier to build on real life PCs) has the power of generating not only intelligence, but consciousness.<br /><br />To understand wath this consciousness is, we need to zoom this big fractal tree-like structure from a detailed close-up up to the bigger picture.<br /><br />At a microscope level, the fractal is made up of "states" of the system. A "future" the agent is imagining when thinking is just a possible future state that we make evolve in time to form the fractal structure, but the very tip of this future is just an state, a "position" of our agent.<br /><br />This initial node of the fractal only knows how to simulate itself to tell us where the agent will be after a little time step pass. If you should calculate this evolution using physics, you should find the feasible change in the state that would make the entropy (of the whole system, the universe) grow at a higher speed (if the 2nd law of thermodynamics is to be assumed). You could think of it as a decision problem: the system have to decide where to go in order to maximize the entropy of the universe.<br /><br />Now we have a "small" fractal as the one I use for intelligence: a tree-like structure that evolves in time, having on each of its tips -final nodes- a feasible future state.<br /><br />The effect of this new structure is quite similar to the one seen before: it aims to maximize an entropy again, but calculated after a time horizon, and by doing so, instead of having a "physically correct behaviour", we get an "intelligent behaviour". Kind of magic.<br /><br />But this fractal is goal-less so it can only generate the simpliest form of intelligence: the "Common sense". To make it trully intelligent, you need to add a goal and modify the entropy formula to take it into account (basically by tampering with the ergodic principle a little).<br /><br />As far as you only supply one goal, the fractal can add it to the entropy formula and generate an intelligent behaviour in the agent aimed to try to full-fill your (his?) goal.<br /><br />That is really *all* an intelligence can make at this level: maximize one goal intelligently in a really generic way.<br /><br />But wait, in my code and videos I manage to make the agents to follow a set of simultaneous -and conflicting- goals, like keep energy high, keep health high, get the rocks into the cave, etc. How?<br /><br />Well, I just add them together into a single super-goal and ask the AI to follow only this one. Easy trick.<br /><br />The problem here is that the mix of goals is made up by apply a well-choosen relative strength for each of the goals. May be I need to set them to 90% important for "keep energy high" and only 10% for the health and nothing for the rest in order to survive on hostile environments, as when the food is not so abundant. These vector of weigths for the different goals you have is kind of an art to set manually, as it defines the "personality" of the agent, and you really need a brave agent to survive in some environments, while a gentle one may work better in a more kind environmet.<br /><br />I tried many times to automatically adjust those coefs by using the fractal I had, but finally I understood that this fractal could never achive this. Anyhow, I added a "master volume" so I could modify how "temperamental" was the agent (as opposed to "common sense" only, that occurs at volume level zero), the "risk control" module, a nice heuristic that prevent the AI to forget about safety and just go straight into the food.<br /><br />But if now zoom out again and watch the full fractal, a "fractal of fractals of future states", you would see again a tree-like structure like before, but now nodes seems bigger as there is a whole fractal of futures inside.<br /><br />Now comes the magic: each node of this super-fractal represent a whole previous fractal, even with its own values for the goal strenghts if I wish... so I can "play" with slightly different personalities -adding noise into the initial goal mix- and compare the resulting small-fractals produced after a decision is beign made.<br /><br />To compare between to fractals I need a new super-goal that will signal the best fractal gowth among all the fractals that forms oure super-fractal, and this goal is aimed to maximize how "beautifull" the fractal is... yes, it sounds crazy, but it is the way I do it manually: try some goal strengths, record a small video, repeat with another goal mix, compare videos... the right choice always produce the most pleasant tree structure, one that seems more "alive" and fresch than the others.<br /><br />I call this the "leafy coficient" some times, others the "enlightment coeficient" (as it seems to me that thinking with these kind of good-looking fractals is the actual key for enlightment) but the winner was the "cat coefficient", as the more cats a video has, the more visits it receive (quite a silly winner I must admit, but now it is a meme in my head).<br /><br />Using this "cat coef" as the potential (and euclidean distance over the goal strenght coefs vector) I can make grow this "fractal of fractals" exactly in the same way the small-one did, except that now its pourpouse, apart of taking the best decisions, is also to decide how to change its "personality" to adapt, wich goals should have a the higher priority over time.<br /><br />So physics was about deciding where will simulation move the agent (physical laws) forming a line in time, intelligence is a one-level fractal that decides where to go -pushing over the degrees of freedom of the system, the "agent's joysticks"- in order to maximize a goal over long periods of time, while consciousness is a two-levels fractal, self-similar with the previous one, that apart from helping take the right decisions, can change the goal-mix in real time to better adapt its personality to the situations and the future to come.<br /><br />I don't spect to be playing with "consciousness" in the next few months, it is not needed for the problems I am working on, but as the new structure of the code is so perfect for what I need, adding it should be even easy to code, at least using an "static tree" model.Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com11tag:blogger.com,1999:blog-6923947282926324208.post-53431939360404171412016-08-01T14:23:00.002+02:002017-07-04T16:01:52.548+02:00What is Consciousness?Some days ago I wrote a little about <a href="http://entropicai.blogspot.com.es/2015/09/fractal-algorithm-basics.html">how this fractal AI works</a>, it was not too detailed and the really important details were intentionally left unsolved. I promise to fill the gaps in short for you to be able to try the fractals by your self, but not now.<br /><br />Today I want to give an overview of how the "complete fractal AI algorithm" could look like in some months, the ideas I am actually working on, and specially some random thoughts about consciousness.<br /><br />The part I am now working at is about how to add memory to the fractal AI. This far, fractal AI was totally memory-less, meaning it does not learn from experience at all. I now call this an pure instinct-drive or intuitive mind. When you ask something to this AI, it thinks on the problem from scratch, and gives you an answer that is good enough for evolving in this medium with intelligence, a "real time " decision making algorithm good enough for many task.<br /><br />But while driving a rocket on a difficult environment is hard but can be done with just an intuitive fractal AI, most NP-hard problems -problems where the time needed to solve it grows exponentially with the size of the problem to be solved- are usually not so easy to solve just with pure intelligence, usually you need something more to guide the intuition.<br /><br /><a name='more'></a><br /><br /><h3>Memory fractal</h3>Trying to solve one of those hard problems I came into the conclusion that I needed to let the algorithm to play with the problem for a time so it could somehow memorise those decisions that, in retrospective, proved to be right over time, and use all those memories to help the AI decide better and better as more experiences were stored and processed.<br /><br />I could solve the problem with a simplified version of this idea, now I am working in generalising the method used into a truly fractal model of memory that will work in conjunction with the "memory-less" AI: The memory-less AI will create those memories, and the memories will help the AI by showing it paths of successive decisions that, in similar circumstances, worked fine. It acts as a new goal the AI have to follow, a goal that bases its potential in how similar this state is with those in memories, and on how good or dab those memories were.<br /><br />I can not show you anything about it as it is not coded on the rocket case (I use the rockets as my general case, as it is a really complete problem to test new ideas) and the preliminary use I am making of it is still not working OK. Basically I need to use a fractal model of memory instead of the more classical one I am using now, until then, I only have clues on how it should work out.<br /><br />But I can tell you something interesting: My "perfect fractal", what I called the "<a href="http://entropicai.blogspot.com.es/2015/06/using-feynman-integrals.html">Feynman fractal</a>" as it allowed time travelling (Feynman integrals or Feynman diagrams allows particles and paths to travel time reversed or not, and both directions are equally important), is actually equivalent to a memory fractal if the memory is really coded as another form of fractal.<br /><br />It doesn't work as I spected at all, futures does not need to actually travel back in time, instead, recalling past memories and using them to decide makes the same effect and are much simpler to manage mentally and in the code than a complex <a href="http://entropicai.blogspot.com.es/2015/10/two-ways-fractal-first-approach.html">time travelling fractal</a>.<br /><br /><h3>Consciousness</h3>Ah! The holly Grial of AI, consciousness! I always dream some day, after I could deeply understand the fractal mind, I could naturally see what consciousness really is. I spected it to be some surprisingly twist to the fractal structure, like time travelling, but in some magic way I could not imagine.<br /><br />But now I think it may not be such a dramatic thing after all, instead it may be just a simple way to modify the internal parameters used in the fractal AI as it is used, a way to change your mind own working parameters to accommodate what is to come.<br /><br />Although the idea is still half-baked in my mind, the following "real brain" example could clarify it a little:<br /><br />Your intelligence, being it a neuronal network or not, uses some "scale of values" to measure how good or bad something is. For instance, feeling hunger could have a relative importance to your intelligence of 0.34, while begin thirsty may well be a little more important, 0.65 for instance.<br /><br />That is your normal "scale of values", the one that serves you well in everyday life. But imagine you need to travel a long river crossing a desolated region. Your mind will probably decide to lower the importance of water and raise the importance of food, as it can foresee that the lack of food will be the real problem during your journey.<br /><br />This process is actually not making you smarter, or using memories to guide you through the river course, instead is fine-tuning you internal thinking params so the resulting behaviour is more probably going to save your life.<br /><br />A process that modify all the inner params of an AI to better adapt to the changing environment is, as I now see it, a proto-form of consciousness, and generalising the process to fuse with the actual fractal AI could not only make it 100% parameter-less but, given enough intelligence and memory, make what we recognise as "consciousness" to slowly emerge in the agent behaviour.<br /><br />So my bet is: the fewer hidden params exists in your AI algorithm that the algorithm itslef can not evaluate and change if needed, the more conscious your algorithm will be. It is not an easy trck to have an AI that can change its own working at will, but this is the way I will try to go after the summer time.<br /><br />As a side note, black-box algorithm like a neuronal network would prove harder to dress up with the "emperor new clothes" of consciousness?Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com3tag:blogger.com,1999:blog-6923947282926324208.post-74020555505939141052016-05-06T19:35:00.005+02:002017-06-12T13:31:49.070+02:00Pathfinding problemIn my first contact with <a href="http://www.lifl.fr/~talbi/">professor Talbi</a> he proposed me to try to solve the <a href="https://en.wikipedia.org/wiki/Pathfinding">Pathfinding</a> general problem with my algorithms, as the examples I showed in my talk were quite similar to solving it.<br /><br />The Pathfinding problem consist in finding the shortest path from point A to B and it is useful not only in programming robots to go here and there, many other problem relates to finding this path.<br /><br />So I borrowed time here and there to prepare a couple of videos and yesterday I have a second meeting with him to show the videos along with the real-time example where the agent follows the mouse. Here you have the video I prepared for the meeting:<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/AoiGseO7g1I/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/AoiGseO7g1I?feature=player_embedded" width="320"></iframe></div> <br /><a name='more'></a><br />There is a very nice way to solve it when the points are limited to some "cities" and special points (cross-roads) and you can only move from points by using "roads". In this case you are finding the shortest path over a directed graph, like in a GPS navigation app where you can only go from one cross-road to another using the exiting roads sections, the beautiful and simple <a href="https://en.wikipedia.org/wiki/Dijkstra's_algorithm">Dijsktra's algorithm</a>.<br /><br />The other case when the pathfinding problem can be solved is when the geometry of the zones where you can walk is simple and you can triangulate it so the allowed-to-walk area is fully covered with non-overlapping triangles. In this case you have the <a href="https://en.wikipedia.org/wiki/Any-angle_path_planning">Any-angle path planning</a> algorithm.<br /><br />But in my code, there is no need for the areas to be triangulated, the frontiers can be quite rough or even fuzzy, like in the video, where I added gray areas where the agent can walk, but at a cost (he dislike being on gray areas).<br /><br />As you can see, the power of the algorithm is based on the space scanning, the fractal is able to cover the whole space quite easily, while at the same time, concentrate in the more promising paths until the end point is reached.<br /><br />At the end of the video, the energy of the "robot" was very low, there was no gas to make another go, so I halted it and added energy drops along the paths. As there is a "keep energy level high" goal always on in my agents, it detects the drops and change the path so he can feed and refill the energy tank.<br /><br />So the "shortest path" is not exactly the path being found, instead it is managing a set of goals and trying to find a path where all of them are maximised at the same time, a multi-objective friendly path.<br /><br />Before going to sleep I prepared a second video where a rocket and a robot try to find the shortest path while avoiding collisions as they cause damage (and a "keep health level high" is also in the pack). The collaborative code is not 100% done, strange things happens with 3 or 4 agents that need revisiting, but two agents was ok for the actual implementation:<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/R61FRUf-F6M/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/R61FRUf-F6M?feature=player_embedded" width="320"></iframe></div><br />Basically, the fractal AI I am using is quite capable of solving this problem (given enough CPU and time) in a continuous way -in this case- but also a complete path can be extracted easily form any iteration of the algorithm that reaches the point B if needed.<br /><br />Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-89408933249192398872016-04-29T19:47:00.000+02:002017-06-12T13:30:34.622+02:00Paretto frontiersLast Thursday professor <a href="http://www.lifl.fr/~talbi/">El-Ghazali Talbi</a> from Lille University hold a <a href="http://cio.umh.es/2016/04/21/conferencia-del-prof-dr-el-ghazali-talbi.html">talk about metaheuristic classification</a> and his unified framework <a href="https://en.wikipedia.org/wiki/Paradiseo">ParadisEO</a> to deal with it on the<a href="http://cio.umh.es/"> Elx University Miguel Hernandez CIO</a>, and after the talk (I enjoyed it a lot and learn things a was supposed to already know and some more!) I had a little time to explain my latest fractal methods and show some of the videos I had been producing about them.<br /><br />There was some debate after the talks about the classification itself and the Pareto frontier way of working on multi objective optimisation problems.<br /><br />Basically, actual approaches try to maximise all the functions at the same time, if possible, and if not, then obtain the optimum solution for any weighted combination of those functions, so for any possible combination you get a point, and all those points form the "Pareto Frontier" of the problem.<br /><br /><a name='more'></a><br /><br />It is true that, if you know the Pareto frontier, it is then easy to find the solution for your function combination of choice, but, in my opinion, trying to find this frontier prior to setting those weigths is making the problem quite more complex than it was initially.<br /> <br />Why? Having a frontier is far more powerful that finding a single point in it! Yep, but frontiers are dangerous geometric objects as Mandelbrot showed us: if you try to get the frontier of the Mandelbrot set using Pareto based approaches, you will probably fail, or you will need thousand of CPU working together, just to find out the frontier can be too fuzzy to decide on it.<br /><br />Non fractal problems also can (and use to) have complex Pareto frontiers, just consider hundreds of mundane functions to be maximised, and you will be into some serious troubles: how to mix them, how to find the frontier... all this get really hard.<br /><br />Consider instead using directly the formula that generates this frontier to sheek for the point on it that maximises your combination of functions: quite simpler and faster. In the case of Mandelbrot, this is just a line of code. The difference in complexity from the formula itself to the frontier it generates, is just immense, but more important, the difficulty of solving the same problem one way or the other can also be immense.<br /><br />The actual problem with that is we don't have a model that, using the "generating formula" of the frontier, can properly scan the state space seeking for the optimum directly, and finding it (this point is important!). Then we break the problem into parts we can deal with and combine them somehow to find the general solution, the Pareto frontier of the problem.<br /><br />The lack of such a method is actually forcing us to try to solve a quite more complex problem, a problem I think is only academic, in with several functions needs to be maximised at he same time.<br /><br />Thinking on real problems, you always can pinpoint a single functions that really extract the thing to be maximised, at least I can always imagine one.<br /><br />For instance, imagine a company hires you to optimise it robotic factory.You can break the problem into a set of different problems, where all of them needs to be maximised: keep energy cost low, keep robot repairs low, keep production high... if you stop here your analysis, you can think you have a multi-objective problem that needs a Pareto frontier to be calculated before going any further.<br /><br />But none of those are the company goal, the company what to have profits, so the profit is the only goal in the real world, and all the other sub-goals are only academic.<br /><br />A method that used only the long term profit after taking a given decision to ponder witch option to take at every moment, a continuous decision maker, is needed but nonexistent to the date.<br /><br />Can all problems been considered as single-function optimisation? I think so. Consider your brain: for every problem it faces, it always uses a single function to maximise while deciding: how good I would feel in the future. The feeling is make makes us want to go up and work, as having money and being useful make us feel better in the long term as compared to staying at bed. As simplistic as it may sound, we only have one goal in life!<br /><br />I think my fractal (well, it is really a vitamined evolutionary algorithm, but "fractal" or "entropic" are far better namings!) can fill that hole and be used as a tool to directly seek for the solution without any a priori study of the problem (such as finding an aproximate Paretto frontier).<br /><br />The small problem here is my method doesn't fit professor Talbi classification exactly (I think it amazed him a little), it is a little "out of the box", but not for that much, so I plan to integrate the fractal algorithm (the most simple one, no multi-agent for instance) on his <a href="https://en.wikipedia.org/wiki/Paradiseo">ParadisEO</a> framework for metaheuristic, so we can really find out if it will fill any hole.Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-59498888906091266212016-04-28T17:37:00.002+02:002017-06-12T13:42:40.957+02:00Understanding the mining example<div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: left;">My friend Samuel (<a class="ProfileCard-screennameLink u-linkComplex js-nav" data-aria-label-part="" data-send-impression-cookie="true" href="https://twitter.com/Samuel__GP">@<span class="u-linkComplex-target">Samuel__GP</span></a>) suggested me -in a comment- to try to explain how simple the idea used is compared with the rich an efficient behaviours it produces on the rocket, and it is not easy, but I will try...</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">So first have a look at this video:</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/HLbThk624jI/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/HLbThk624jI?feature=player_embedded" width="320"></iframe></div><br /><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">The goal of the player is to pick up rocks with it's hook and then take them to the deploy area (the small circle filled with a grid). Once the rock is there, the hook releases and you can not trap the rock again until it leaves the big circle. In that moment, the rocket will try to catch it again and so on.</div><div class="separator" style="clear: both; text-align: left;"></div><a name='more'></a><br /><br /><div class="separator" style="clear: both; text-align: left;">Something important to keep in mind: the hook is attached to the rocket with a rubber band, a rubber band is an oscillator, and in this case the oscillator movements are forced on one end, so the hook trajectories will follow a Lorentz's chaotic attractor... so it is a really hard task to plan in advance!</div><div class="separator" style="clear: both; text-align: left;"><br /></div><div class="separator" style="clear: both; text-align: left;">Pay attention to the variety of strategies that the rocket will use to full-fill its goal: it will pull from the rope, bounce the rock against the walls or even its body, or stretcth the rubber band using obstacles to beam the hook straight to the rock:</div><br />You may think a lot of work was needed to plan the movements prior to start the recording, a lot of code to control risk and so on, but it is not the case at all.<br /><br />99.9% of all the code is just "base code": the simulation of your system is 80% (I coded it from scratch... old school way) and 19.9% is the general fractal AI, the same code I would use for any other case, so there is nothing in all this code about doing this or that that relates to our particular "mining rocket" case.<br /><br />In fact, with this 99.9% of "base code" the AI could make the system (the rocket in this case, but you can change it with any other simulable system at hand) to survive indefinitely by flying around gracely and avoiding dangerous bottle-necks, without any other thing to care except keep on existing. This is the "common sense"part of the algorithm, and you can not switch it off like in some humans.<br /><br />The 0.1% of the code that I had to implement to get all those rich behaviours to emerge was just defining "how good" a given situation was, as a real non-negative number. Zero is reserved for the worst of the cases: the rocket is dead (or, in a more general case, you are out of the potential function's domain) while numbers above zero mean "I would like to be on that state this much", so you can compare and decide if a future outcome is better or worst than another.<br /><br />I call this number the "state potential" as it relates to an scalar physic field, like electric or gravitational potentials, that you could call "utility" or "gain" in your particular case.<br /><br />The actual potential used is like this:<br /><br />-Decide where -a 2D position- you want to get with your hook: if the hook is empty, the target point is the position of the nearest rock around, but if a rock is already on the hook, then the target point is the deploy area (the small circle).<br /><br />-Compare you initial distance to the rock with the distance form your future position.<br /><br />-If you get 20% nearer to the rock, the potential of this future state is 0.2<br /><br />-If you are more distant that initially, potential is set to a small number, let say 0.000001<br /><br />That is all, add this simple potential formula into the general fractal AI that is controlling the rocket so it keeps on existing, and the AI will "automagically" find all those strategies and change its behaviour to follow them.<br /><br />Now I will show you a second video where you can watch the "debug traces" showing where futures evolved under the command of the AI.<br /><br />To understand what you see, keep an eye on the colors of the traces: gray traces correspond to the rocket position on each futures, the more into the future, the darker. It is not important today, as we only care about the hook position, but helps you detect when the situation gets dangerous, as in those moments, gray paths seems to "collapse" (there is a "risk meter" on the upper-left corner, in %).<br /><br />Green lines are the ones to watch: they represent the future positions of the hook. When the hook changes state (from empty to holding a rock or, inversely, when the rock is deployed) the traces get red, so it is good when the traces change color as it means the rocket is doing the job.<br /><br />Some times the red traces become blue: this is more the good, as it means, in this future, the AI is able to trap a rock (green to red transition) and then take it into the deploy area (green to blue). A hat trick.<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/cyibNzyU4ug/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/cyibNzyU4ug?feature=player_embedded" width="320"></iframe></div><br /><br /><br /><br /><br />In the previous videos where the rockets were basically collecting energy drops to survive and trying to avoid damaging the hull, the potential formula was even more simple:<br /><br />Potential = Health level * Energy level.<br /><br />This small change makes the rocket to behave like a bee collecting nectar or like an asteroid miner.<br /><br />So that is all, only one potential function makes the whole difference and makes the behaviour to totally mutate.<br /><br />If you get the right potential formula, the fractal will make the rocket perform whatever you need of it.Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-3175455601894934192016-04-18T13:04:00.002+02:002017-06-12T13:39:18.857+02:00Entropic AI using ExcelSome days ago, Raul Perez (<a href="https://twitter.com/raulperezrpm" target="_blank">@raulperezrpm</a>) kindly <span id="goog_1851717176"></span><span id="goog_1851717177"></span>contacted me on twitter to comment about my <a href="http://entropicai.blogspot.com.es/2015/03/video-of-talk-at-murcia-university.html" target="_blank">first talk on entropic intelligence</a>, and just two days later, I received a video from him of the entropic algorithm working inside Excel macros! <br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/Y1WvqRvyLnk/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/Y1WvqRvyLnk?feature=player_embedded" width="320"></iframe></div><br /><a name='more'></a><br /><br />With the corresponding permision from RaΓΊl Perez, you have the excel document ready for download on the <a href="http://entropicai.blogspot.com.es/p/blog-page.html" target="_blank">Download area</a> or clicking <a href="http://www.hcsoft.net/sergio/karts/ENTROPICA%20V1.xlsm" target="_blank">here V1</a> or <a href="http://www.hcsoft.net/sergio/karts/ENTROPICA%20V2.xlsm">here V2</a>.<br /><br />I can not comment about his code as I don't use/have/plan to have excel on my PC, but LibreOffice was able to open and run it (but the track was not properly detected, surely filled cells are not detected in the same way).<br /><br />RaΓΊl, thanks a lot for your interest and specially for sharing your expertise on the blog! <br /><br /><u><b>Update</b>:</u><br /><br />RaΓΊl sent me a new version (V2) with more circuits and the hability to show the traces of the futures as it is thinking. Translating from his email:<br /><br />"Now you have 3 sheets, one with Montmelo Circuit (Barcelona), another with a leberinth and another with a open place. Three diferent scenarios to try the objetc!<br /><br />Pushing PLAY will ask you if you wish to see the trail of the kart or the trails of the futures as it build them. Tracks can be hand-modified by filling o clearing cells with color.<br /><br />If someone were interested in the code, click on "Programmer" tab (not sure it is the right name) then "Visual Basic". Objects code is in the class module "Object" while the algorithm itself is in the module named "Entropica".Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0tag:blogger.com,1999:blog-6923947282926324208.post-34364539109350796082016-04-09T21:12:00.002+02:002017-06-12T13:43:01.065+02:00Emotional linksAdaptive foraging, or the ability to harvest and collect items, is the main test-bed for swarm intelligences, as it resemble real life problems and mimic interesting social behaviours like ants and bees swarms.<br /><br />So I am adapting my fractal AI code to deal with this problem, and as a first result, here I show you a video with only one agent (quite a small swarm!) so I can test if the new gadgets works OK.<br /><br />The rocket now have a hook that will trap asteroids as a magnet. The hook is connected to the rocket with a rubber band, making the rocket-hook structure quite difficult to manage.<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/xKSbssLKqF4/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/xKSbssLKqF4?feature=player_embedded" width="320"></iframe></div><br /><a name='more'></a><br /><br />The goal is to go out there and trap asteroids, then take them to a deploy area, and start over again, but keep in mind that the life goes on, and the fuel will deplete soon, so it also have to take care of itself and try to keep health and energy levels high, as it always do.<br /><br />The idea behind the simulation is simple: the hook has its own feelings -or a potential if you wish- so when it gets near an asteroid, potential will increase and it will feel "happy". This happiness transmits up to the host rocket, as hooks has no degree of freedom to use it with. As a result, rocket wants to be happy and make the hook happy too, resulting in a "inherited goal" that makes the rocket work hard doing what the hook likes more to do: collect asteroids.<br /><br />Springs here act as the same time as physical links and emotional ones. To better understand the idea, imagine you want to learn some dance but you are a total mesh: one trick is to use sticks to keep you feet and arms always at the same distance from the teacher's ones, so you will dance as a puppet.<br /><br /><div class="separator" style="clear: both; text-align: center;"><a href="https://3.bp.blogspot.com/-w7zil1xamXI/VwlOcnsy-fI/AAAAAAAAGa4/49NWfZo3xZMyw29SRkl7icUPg2E76TwWA/s1600/dancing.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://3.bp.blogspot.com/-w7zil1xamXI/VwlOcnsy-fI/AAAAAAAAGa4/49NWfZo3xZMyw29SRkl7icUPg2E76TwWA/s320/dancing.jpg" width="320" /></a></div><br />But once you are starting to learn the dance, you will need to eventually try without this help, so you would change those "physical springs" with emotional ones: you imagine the links are still there like "ghost springs", but springs with emotions that feel horrible (and cry loud) if you compress or stretch them. If you are emotionally connected with the springs (you dislike when they scream and cry) then you can "feel" the spring state as part of your own feelings, and it will make you try to follow the teachers movements in order to avoid springs "pain".<br /><br />A more "Tarantino" way to imagine it is like this: virtual springs are attached to your arms and feet using fishing hooks, and you move just trying to avoid pain. I am sure you will now learn fast, even if the springs and hooks are just in your mind!<br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-KKY8cTeeECc/VwlTi6qmR9I/AAAAAAAAGbI/eXMqdFt8SGgJyAadO3jW6HiUdNKccrAKg/s1600/hook.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="208" src="https://1.bp.blogspot.com/-KKY8cTeeECc/VwlTi6qmR9I/AAAAAAAAGbI/eXMqdFt8SGgJyAadO3jW6HiUdNKccrAKg/s320/hook.jpg" width="320" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Ouch!</td></tr></tbody></table><br /><br />In this video, springs are both physical and emotional, but the emotional part is not related to the spring tensions or forces but instead on the final end's position. The idea is the same, but using a different formula for the spring potential.Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-2649838724069546562016-04-09T02:09:00.000+02:002018-03-13T11:22:32.550+01:00Are maths the real languaje of nature?I have just had a <strike>vision</strike> random thought I wanted to share before going to bed: What if mathematics were not the real basement of real world physics? What if the laws of nature are not really physicals laws written in pure maths as we all have naively assumed? Can physics be rethink in a absolutely different way?<br /><br />I think there exists a way to describe all known physics without using any mathematical formula, a way to describe what a "wave equation" really is without using mathematically defined fields of any kind, just using algorithmics, in fact using just a single, small and compact algorithm.<br /><br /><a name='more'></a><br />OK, it sounds crazy, but I have been dealing with this idea back when I coded the "<a href="http://entropicai.blogspot.com.es/2015/06/quantum-fractal-simulator.html" target="_blank">Fractal quantum simulator</a>", well, a naive sketch of it. I realized I could use a fractal growth algorithm, applied over a big amount of simple particles following a simple loop, that made physical properties into the forming "clouds" of those particles. I thougth it was curious and that I should come back to this code some day.<br /><br />Watch a couples of videos to have a taste on the idea: Particles are in the middle of each cloud (indeed they are in the center of masses of the clouds), while sparks/walkers evolve around them randomly interacting, but without using forces of any kind, just entanglements, teleportation, random moves, etc... (like in a vitamined Conway's game of life).<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/fZ6yv9IWgTg/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/fZ6yv9IWgTg?feature=player_embedded" width="320"></iframe> </div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"> <iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/Ue9XnhV1fUo/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/Ue9XnhV1fUo?feature=player_embedded" width="320"></iframe></div><br />But the universe as we know is really doing exactly that! And it is not using mathematics at any moment, by the way...<br /><br /><h4>The thermodynamic naive example</h4>To understand the real idea, let me first use a simpler and more daily example: thermodynamic laws doesn't exists, and the maths used are useles in the underlaying reality.<br /><br />Presure is a thermodynamic main concept, but we discovered later that it really were the millions of molecules in the cloud of gas that, individually, cuased small forces by just colliding in unpredictable -to our scale of time and distances- trajectories that used just simple Newtownian laws, but in such a big number that it was more practical to stick to the fake laws that worked well... again at our sclae of time and distances.<br /><br /><h4>The quantum way</h4>Think on quantum computers. Make the smallest one you can that still works, or just think this should exists. You have a "spark". It would be smaller that a photon, or not even have a size at all. This spark would be the smallest particle possible, the one that makes all the other things just by running the code they... are? in a big enough group of sparks.<br /><br />The code it should run would be the simpliest program you could code for that quantum computer the spark is. I always think on Mandelbrot set to imagine that code: a simple line of code that generates a increible complex figure you can zoom in and out and explore ad infinitum, full of similar but not repeating structures. This is the kind of code that, when made the quantum way, could generate a fractal universe like ours.<br /><br />Now place a big amount of those "computer" together and switch them on (actually they are always on and consume no energy). Their programs will make them interact here and there and form connections, building a complex network of such computers. Some sparks would become "switch" of the net, more connected that the average. Those switches could represent photons, gluons, and so on. Those "switches" or fat sparks, by still running the same original code, woud form "hubs" of hiper-connected nodes, a even more connected spark that mostly connect "switches" spark. They could be fermions, electrons, etc.<br /><br />But here you don't have a CPU to run the code, RAM to store values and screen dots to show the results: those sparks are all those things at the same time. Connections made by spark in the network are the RAM, the code they individually run, when used at the same time inside this net of inter-connections is the CPU, and the hubs big enough for our measurement abilities are the dots on the screen, the particles.<br /><br />Those new "hubs" continue on building even more complex structures as same program runs over "hub" nodes, creating atoms, then simple molecules, complex molecules, life, intelligence, consciousness and, who knows, something even bigger in some more CPU time.<br /><br /><h4>More than a philosofic idea?</h4>And the question I would like you to think about and comment is: is there any known and used physical concept that could never be described by maths, any maths, except in a probabilistic averaging form (like in the thermodynamic example)?<br /><br />My bet is: wave equation. What is really happening down there that, from our scale can only by understood probabilistically?<br /><br />And more interesting: can the algorithm used by those hypothetical sparks be described, simulated, and used to fill the gaps that the math-based laws of physics will never fill, like the nature of this new "quatum presure", the wave equation?<br /><br />I have dreamt many nights with that algorithm, draw plenty of versions of it, and played near of it with some fractal algorithms, and I feel some one will find it and say: WTF, only this short code?<br /><br />No, I don't have this algorithm nor a clear idea of it, nor I know for sure it does exists, but it could be such a definitive and elegant solution, such a doable thing even if it sounds crazy today, and it is so inexpensive to think about it, that I bet this algorithm will be found some glorious day.<br /><br />What I can tell you is that, the deeper I get into the my fractal algorithms, the easier it seems to me that some day some one will find this golden algorithm, the smallest one generating the most complex structures ever: The algorithmic seed of our actual fractal universe.<br /><br />And that was all, folks, I started to write this post being 48 years old and now I am 49. Happy birthday to me!Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com3tag:blogger.com,1999:blog-6923947282926324208.post-8312482667443491542016-02-16T22:16:00.000+01:002017-06-12T13:37:01.278+02:00Folding proteins with a fractalYesterday I posted about <a href="http://entropicai.blogspot.com.es/2016/02/serious-fractal-optimizing.html" target="_blank">the fractal algorithm adapted to function optimising</a>, the test I showed was nice, but dealing with a 2D function is not so great if you plan to go big.<br /><br />After that Guillem forgot to go home and stayed coding a little more at the office. This morning the algorithm was able to load test proteins and try to fold them by minimising the Lennard-Jones potential of the cluster. He sleept in the sofa!<br /><br />Here you see it folding a 5 atoms "protein":<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/4l9Y2yuzBTY/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/4l9Y2yuzBTY?feature=player_embedded" width="320"></iframe></div><br /><a name='more'></a><br />It was intially able to deal with only 5 atoms proteins, so we spent the day adapting the algorithm to this new problem, and after everything seemed to be in the right place the fractal can now easily find the optimum folding of a 11 atoms test protein in about 10 minutes (the code is running on only one core of an intel i7 by now).<br /><br />The progression of the error (in those cases the optimum folding and its potential is public) is fantastic at first glance and we plan to check some more complicated molecules tomorrow.<br /><br />The key here is that this fractal algorithm can be greatly improved by making it to run parallelized over a cuda GPU, so this boost in speed could allow us to fold medium sized proteins on a standard PC some near future. Porting it to Tensor Flow will be mandatory.<br /><br />In the video above, on the top you see a couple of 2D projections of the molecule. In red, the known best positions, in blue, actual best found. Red starts will be taken away in next video because only distances are important, not the absolute positions, so blues never go on top of reds anyhow.<br /><br />Bottom left you see the error in orders of magnitud, so when it get to -6 error is about 0.000001.<br /><br />And now the 11 atoms example:<br /><br /><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/Z3zLxDWpfXk/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/Z3zLxDWpfXk?feature=player_embedded" width="320"></iframe></div><br />Before going nuts with tensor flow we will continue a little more by adding more atoms just to find out how well it scales up, but folding 11 atoms is actually a hard challenge as you need to optimise a 11x3 = 33 dimensions -and quite complicated- real function.<br /><br />I can not resist showing you a couple of shoots of the "folding protein" process: <br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="https://1.bp.blogspot.com/-fIdkpXsxbO0/VsOOFbfKX5I/AAAAAAAAGGc/Xyzax-2csMk/s1600/GuillemFolding.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://1.bp.blogspot.com/-fIdkpXsxbO0/VsOOFbfKX5I/AAAAAAAAGGc/Xyzax-2csMk/s400/GuillemFolding.jpg" width="298" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Guillem with his face of molecule folding kid</td></tr></tbody></table><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="https://3.bp.blogspot.com/-QlbQ3WAOBZ4/VsOOJbflDAI/AAAAAAAAGGg/02qAQc34vjw/s1600/SergioFolding.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://3.bp.blogspot.com/-QlbQ3WAOBZ4/VsOOJbflDAI/AAAAAAAAGGg/02qAQc34vjw/s400/SergioFolding.jpg" width="280" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Sergio drawing fractals while Guillem does the actual work</td></tr></tbody></table><br /><br /><br />Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com2tag:blogger.com,1999:blog-6923947282926324208.post-57643656058687063522016-02-15T18:02:00.002+01:002017-06-15T19:14:57.962+02:00Serious fractal optimizing<a href="https://twitter.com/Miau_DB">Guillem Duran</a>, my friend and college from twitter, is now full-time at work with me at converting the "one way" fractal algorithm used in my latest AI into a "serious" general optimising algorithm in python: given a function, find its global (as opposed to local) maximum -or minimum- value it can get on its entire domain -the points on the state space where the function is defined.<br /><br />Last week we finished the conversion, so we are just starting to benchmark it against other "state of the art" similar algorithms, but to have a first view of the you have a preliminar video here:<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/kSyae8URr54/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/kSyae8URr54?feature=player_embedded" width="320"></iframe></div><br /><a name='more'></a><br />In this video above you see the new algorithm dealing with a hard 2D function called "egg holder". The function is a nightmare to optimise: it has a lot of local maximums, some very distant, and all very similar on its max f(x) value, so getting stuck on a local maximum is quite easy.<br /><br /><br />As you can see, this hypnotic video is divided in five windows showing different information on the process.<br /><br /><h4>Window #1 (upper-left)</h4>This is exactly what the algorithm is doing. You see a dot on each point where the algorithm is reading the function value (in this example, it reads 200 values per tick or "epoch"). Lines are meant to reflect the cases in witch one of those 200 points decide to move to the location of other node (clone), so you can see how points in a zone can jump to another zone if it thinks it is more interesting to search there.<br /><br /><h4>Window #2 (upper right)</h4>Here you see the function being optimised interpolated form the function reads the algorithm is done so far. Those points are not used in the algorithm so we have kept them just to make this nice drawing.<br /><br /><h4>Window #3 (centre)</h4>Here you see the locations where the function has been read by the algorithm (coloured depending on their f(x) value) and the points being read now (on black), so you can see how the seeking of the best point is performed.<br /><br />A red start in the upper right <strike>left</strike> corner shows the optimum point, notice how it is placed in the frontier of the domain, making it even more difficult to find.<br /><br /><h4>Window #4 (bottom left)</h4>Graph of the absolute error (distance to the known optimum function value).<br /><br /><h4>Window #5 (bottom right)</h4>Number of ticks ("epoch" in the video) from the last time you update the best-so-far candidate. We try to keep this number below 50 by automatically adjusting some internal parameters.<br /><br />From this point we plan to benchmark it against basin hopping and simulated annealing algorithms on some other hard 2D functions, and then jump into more difficult tasks as folding some easy proteins (minimising Lennard-Jones potentials) and finding Pareto frontiers for multi-objective optimisation.<br /><br />If the algorithm proves capable of solving those kind of problems "easily" may be we have something powerful at our hands.Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0tag:blogger.com,1999:blog-6923947282926324208.post-15620078369638873622015-12-25T20:09:00.004+01:002017-06-12T13:37:58.565+02:00Fractal AI collaborationControlling an arbitrary complex agent so it behaves "intelligently" by using the thermodynamic concept of causal entropic forces is possible by using an special kind of fractal decision tree, the "<a href="http://entropicai.blogspot.com.es/2015/10/the-one-way-fractal-ai.html" target="_blank">One Way</a>" fractal algorithm I have commented here before.<br /><br />But controlling a group of agents in a intelligent way is not that simple. I always managed to make several agents to evolve at the same time in the same environment, but it was done just by giving each agent its own personal intelligence, while considering the rest of the agents as mobile parts of the environment: obstacles to be avoided to survive.<br /><br />Here is a real "swarm intelligence" controlling a group of agents as one:<br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/J9kW1lhT06A/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/J9kW1lhT06A?feature=player_embedded" width="320"></iframe></div><br /><a name='more'></a><br />Making a swarm of agents -a group of rockets for instance- to behave intelligently as a group needs, in some way, to consider the group itself as another agent, a special agent in a higher level of abstraction that can push the individual agents to change its standard behaviours so the group of agents, its structure, follow a "multi agent" goal.<br /><br />This can not be achieved by just adding a clever individual goal to all the involved players, they need to act as a intelligent structure before you can send them to solve a collaborative task. The structure formed by the sum of all the agents' states is in fact a new kind of multi-sate that defines an intelligent agent formed by a group of also intelligence agents. A fractal tree of intelligence layers.<br /><br />The power of the idea presented here lies on the ability to break a complex problem into smaller pieces. Imagine a group of individual "fingers" acting as a solid hand with its own will and goals, then eight of those hands acting as a single octopus, and then a group of several octopuses receiving high level orders like "bring this object here". This algorithm will take all those layers of goals and trigger individual actions on all the fingers so the whole structure seems to be acting as a single intelligent being doing whatever it takes to safely bring the object here. We do not talk about individuals cooperating for a common goal but to treat the problem as layers of intelligent agents acting as a single one.<br /><br />I present here a couple of preliminary videos showing my first attempts to accomplish the task with a fractal AI. I have focused in making a group of rockets to fly in a given formation, so the inner work was about defining a reliable potential for a given structure formed by several agents.<br /><br />In the first video showed above, a semi-rigid star-shaped structure was simulated where every rocket occupy a given position in the structure (the ideal distance between rockets are pre-set).<br /><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: center;"></div><br />The red lines you see in the video seem to act as springs or rubber bands physically connecting the agents, but they don't really exists on the simulation. The forces they seem to apply over the players are "causal entropic forces", they make the agents to prefer going to the positions where the imaginary springs would pull them to. They just love to be there.<br /><br />The biggest problem with that formation "multi-goal" was the fact that the relative positions of the players were too tightly defined so they moved as a solid object. You clearly notice it when the formation get trapped in big holes or keep circling around a black obstacle. But to make the structure more stable you will need to find a balance between keeping formation and picking up energy from the environment to keep you alive: individual goals and global goals needs to balanced before mixing.<br /><br />In the next video you can see a more advanced (but lees spectacular) formation potential based on "water waves": if you imagine the space filled with water and then drop a stone on each player position, the circular waves that form will mix into an interference pattern of high and low zones. The height of those mixed waves defines an scalar potential field, and making the fractal to follow this potential leads to an "amorphous crystal net" of agents.<br /><br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/tLsu0On61CI/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/tLsu0On61CI?feature=player_embedded" width="320"></iframe></div><br />The circles show the zones where the potential generated by each player's position will be higher, so the formation goal is to keep agents over the others circles as much as possible. As you can see, each player has several concentric circles representing waves of different sizes, so if you can not be in the first circle, your second option is to try to touch the second one and so on.<br /><br />The potential generated by each player is <a href="http://www.wolframalpha.com/input/?i=%28+0.8+%2B+%281-0.8%29+*+%28%28sin%28PI%2F2*x%29%29^2+*+%282%2F%28x%2B1%29%29%29+%29^2++from+x%3D0+to+x%3D6" target="_blank">this function of the distance</a> (using as unit distance the agent size) and follow that formulation:<br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://1.bp.blogspot.com/-dRpRgMBYS7k/Vnq-FyAw-JI/AAAAAAAAF74/IXguMv871v4/s1600/Waves.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="253" src="https://1.bp.blogspot.com/-dRpRgMBYS7k/Vnq-FyAw-JI/AAAAAAAAF74/IXguMv871v4/s400/Waves.png" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">P = (0.8 + (1-0.8) * ((Sin(PI/2*d))^2 * (2/(d+1))) )^2.0</td></tr></tbody></table><br />The key idea here is that different distance-to-potential formulations can lead to sophisticated group behaviour like formations, but more imaginative ways of defining the structure potential could have the power to make them follow any order you wish.<br /><br />The next step will be adding more usefull group-goals so they all can play group games like keeping a ball up in the air without touching the walls, for instance, but ultimately it serves as a solid algorithm for controlling complex robots (or group of robots) easily and make them work on any task, as far as we can convert it into a potential field for the fractal to maximize.<br /><br />Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0tag:blogger.com,1999:blog-6923947282926324208.post-74537385275087958692015-10-29T23:34:00.000+01:002017-06-12T13:39:01.332+02:00Time traveling fractal AI, a first approachFinding a way for the fractal futures to be able to travel back in time, as in Feynman diagrams and integrals, has proved to be a little tricky, but I feel I am quite near to solve it.<br /><br />In the mean time, I want to share a "dead end" try to accomplish this by using succesive layers of futures sended to the future in different succesive times, so they act as a serie of concentric wave fronts that travels to the future reinforcing each other.<br /><br />Let start by showing a nice video of this idea at work:<br /><br /><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen="" class="YOUTUBE-iframe-video" data-thumbnail-src="https://i.ytimg.com/vi/9CKrJUGYgwY/0.jpg" frameborder="0" height="266" src="https://www.youtube.com/embed/9CKrJUGYgwY?feature=player_embedded" width="320"></iframe></div><br /><a name='more'></a><br /><br />In the avobe video you see how those 5 layers are sprung from the players position one after the other. First one is colored in yellowm then orange, than red, and finally, the last one, is black.<br /><br />The idea did work to some extent: using 5 layers of 100 futures, for instance, did a better job than sending 100 futures in the "one way fractal" style, but it didn't really improved too much when copared to a sigle "one way" wave of 5x100 = 500 futures, you I have to admit that the graphics formed with the first are much nicer than it were in the one way version.<br /><br />So I just share it here because the output is beautyful. A good reason to do it.<br /><br />Black point can ask the others how it is in the future, so their decision are much more efficient. So you will see how black point easily win the race. But they are so good, some time, in the turns, they all crash, and then reincarnate in the red or orange or yellow ones, that are more conservative as they know less about theirs futures.<br /><br />So first layers act as backups for the super powered black points.<br /><br />The resulting images resemble a fire bolt traveling the maze, leaving a rainbow colored trail that makes the video even nicer...<br /><br />But this is not a real "Feynamn " or "two ways" fractal, as futures are not allowed to travel back in time, just to pass some information to near front waves living in a small "slice of time" of, in the video, 0.5 seconds.<br /><br />A new version is on its way to solve this by forming "lighting strikes" instead of fire bolts. This will be the real "back in time traveling" version of the fractal, the "Feynman" or "two ways" one, but its output will never be this beautiful, you will just see semi-random rays casted from the player showing you the best path in front of you.<br /><br />Uglier but much more usefull and efficient I hope!<br /><br />Bonus: I spect the new version to generate someting like that:<br /><br /><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody><tr><td style="text-align: center;"><a href="http://2.bp.blogspot.com/-zt7RI3AJxSc/VjKiJxOAoDI/AAAAAAAAFuA/d0vKnuue3Fs/s1600/Lightning_Bolt_out_of_Blue_July_12_2009.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="263" src="https://2.bp.blogspot.com/-zt7RI3AJxSc/VjKiJxOAoDI/AAAAAAAAFuA/d0vKnuue3Fs/s400/Lightning_Bolt_out_of_Blue_July_12_2009.jpg" width="400" /></a></td></tr><tr><td class="tr-caption" style="text-align: center;">Sorry, source unknow. Site "FloridaLighting.com" is dead</td></tr></tbody></table>Sergio Hernandezhttps://plus.google.com/107797149522609875320noreply@blogger.com0