<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Peter Gelderbloem on Medium]]></title>
        <description><![CDATA[Stories by Peter Gelderbloem on Medium]]></description>
        <link>https://medium.com/@petergelderbloem?source=rss-fb60e4eeb73c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*wuHAkIoZ8v9gh426.</url>
            <title>Stories by Peter Gelderbloem on Medium</title>
            <link>https://medium.com/@petergelderbloem?source=rss-fb60e4eeb73c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:13:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@petergelderbloem/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[TicTacToe like an AI (part II)]]></title>
            <link>https://medium.com/@petergelderbloem/tictactoe-like-an-ai-part-ii-4f10cc800c07?source=rss-fb60e4eeb73c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4f10cc800c07</guid>
            <category><![CDATA[games]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[ai]]></category>
            <dc:creator><![CDATA[Peter Gelderbloem]]></dc:creator>
            <pubDate>Sat, 30 Jun 2018 12:04:35 GMT</pubDate>
            <atom:updated>2018-06-30T12:06:31.730Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://medium.com/@petergelderbloem/tictactoe-like-an-ai-part-1-8157798842d2">TicTacToe like an AI (part 1)</a></p><h3>Search Tree space too big</h3><p>In our previous approach we expanded the search tree until we reached an end game state to determine the value of intermediate states. It turns out that for all but the most trivial cases this approach is too expensive in computational time and space. We have to find ways to cope with an exponentially expanding search space.</p><h3>Cutting down search space</h3><h4>Heuristics</h4><p>This involves using a heuristic to calculate the value of a state that does not require knowledge of subsequent end states. This means we don’t have to traverse the tree all the way to the end states to know whether an intermediate state is good or not</p><h4>Iterative deepening</h4><p>This involves limiting how deep the search goes. Effectively multiple searches are done, each one a level deeper than the one before until end states are reached or until you hit the depth limit</p><h4>Alphabeta pruning</h4><p>Eliminating sections of the tree that cannot possibly give us more information is another strategy for cutting down the search space. Given two nodes to navigate, if one of them is obviously worse than the other, there is no point in evaluating the children of the one that cannot give a better solution</p><h4>Problem-specific way to cut down search space</h4><p>Some problems have a search space that is symmetrical and that allows us to treat positions in the search space mirrored by a symmetry axis as having a similar value.</p><p>In tic tac toe edges and corners are effectively equivalent. You can think of this as rotating the board around the center. The following all have similar value</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*mwcpbcXYxpmNbH6KgMgDAw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*rA7D_7Ix8BsRy54M2kZgnw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*bO6pEokxyVYNCCuPGKucPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*gLXfWnf27_yPF1-JA1F9aA.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4f10cc800c07" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Supervised learning tasks in Keras]]></title>
            <link>https://medium.com/@petergelderbloem/supervised-learning-tasks-in-keras-b8e712e91752?source=rss-fb60e4eeb73c------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8e712e91752</guid>
            <category><![CDATA[keras]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[neural-networks]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Peter Gelderbloem]]></dc:creator>
            <pubDate>Wed, 04 Apr 2018 06:45:40 GMT</pubDate>
            <atom:updated>2018-04-04T21:46:27.586Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Supervised learning tasks in Keras</strong></p><p>Basic supervised learning can be achieved with layers of type Dense. The output layer and compile parameters define the type of supervised learning your network is defined as doing.</p><p>Code template:</p><p>model.add(layers.Dense(x, activation=a)</p><p>model.compile(optimizer=’rmsprop’,loss=l, metrics=[m])</p><p>Fill in values from table as appropriate to the task you are undertaking</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9d5815a29e69e410f672f2fc27178b8/href">https://medium.com/media/e9d5815a29e69e410f672f2fc27178b8/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8e712e91752" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[TicTacToe like an AI (part 1)]]></title>
            <link>https://medium.com/@petergelderbloem/tictactoe-like-an-ai-part-1-8157798842d2?source=rss-fb60e4eeb73c------2</link>
            <guid isPermaLink="false">https://medium.com/p/8157798842d2</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[games]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Peter Gelderbloem]]></dc:creator>
            <pubDate>Sun, 28 May 2017 21:48:00 GMT</pubDate>
            <atom:updated>2018-06-30T12:07:26.991Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_TZ7BHwmMXRs83tQeYs7A.gif" /><figcaption>Minimax algorithm in action</figcaption></figure><blockquote>“AI is programming a computer to do the right thing when you don’t know for sure what the right thing is” — Peter Norvig</blockquote><p><a href="https://medium.com/@petergelderbloem/sudoku-like-an-ai-fc8cc6ee9b73">As I mentioned before</a>, a mainstay of Artificial Intelligence is the idea of constructing a problem space and using search to find a solution. For most interesting problems, the space can be so large that searching it would take more time than is available in the universe so we apply “tricks” to cut down on how much of the space we have to search.</p><p><strong>Adversarial search strategies</strong> are used in multi-agent environments where two or more agents are in competition a.k.a. games. The most common games studied in AI are deterministic, turn-taking, two-player, winner-takes-all games in fully observable environments.</p><p>The search space can naturally be expressed as a tree structure, with a child node generated to represent the result of each action permissible by the game rules from the state represented by the parent node. For turn-based games each level of the tree shows the possible outcomes for a specific player’s turn. Leaf nodes represent game endings.</p><h3>Minimax algorithm</h3><p>A player MAX can safely assume that the opponent MIN will always make an optimal decision. MIN’s optimal decision corresponds to the action that will give MAX the worst outcome. This way we cover the worst case scenario and ensure that our algorithm is guaranteed to give the best result.</p><p>The tree is navigated with depth-first search.</p><p>We assign a score to leaf nodes (game endings) depending on the outcome</p><ul><li>1 if MAX wins</li><li>-1 if MIN wins</li><li>0 if the players draw</li></ul><p>This score is propagated to a parent node once all it’s children’s values have been determined. For a MAX node the value is the max of it’s children, For a MIN node the value is the minimum of it’s children to reflect that the opponent will choose the best move from their perspective.</p><p>The visualization at the top shows only a section of the search tree from Tic Tac Toe as the full tree gets pretty big, making it difficult to follow what is happening. The size of the search tree also means that computing the optimal move can be time-consuming, or even downright intractable, with minimax without some modifications. I will cover these in part II.</p><p>The nodes with &gt; are MAX nodes and &lt; are MIN nodes. Ass soon as we reach a leaf node we know the score and this gets propagated up from children to parent according to MIN/MAX nature of parent as soon as all the children’s score is known</p><p>Proceed to Part II:</p><p><a href="https://medium.com/@petergelderbloem/tictactoe-like-an-ai-part-ii-4f10cc800c07">https://medium.com/@petergelderbloem/tictactoe-like-an-ai-part-ii-4f10cc800c07</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8157798842d2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Sudoku like an AI]]></title>
            <link>https://medium.com/@petergelderbloem/sudoku-like-an-ai-fc8cc6ee9b73?source=rss-fb60e4eeb73c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc8cc6ee9b73</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Peter Gelderbloem]]></dc:creator>
            <pubDate>Sun, 30 Apr 2017 21:10:08 GMT</pubDate>
            <atom:updated>2017-05-02T05:42:17.110Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*jKOm_Ia6yaNgrksVZu8dzA.gif" /><figcaption>AI Sudoku</figcaption></figure><p>I am doing the <a href="https://www.udacity.com/ai">Udacity Artificial Intelligence Nanodegree</a> and one of the first projects is to build an Artificial Intelligence that can solve Sudoku puzzles.</p><p>The essential idea is to search the space of possible Sudoku solutions and to constrain the size of this space by propagating the constraints implied by the rules of Sudoku from solved(or close to solved) squares to unsolved squares. The main Sudoku constraints are that every row, column and sub-square has to contain all 9 digits in only one of its boxes.</p><h4>Concepts</h4><ul><li><strong>Box</strong>: A single sudoku element, that can contain only one digit.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*CgjyHbRiR4XRk83Jdp0sDQ.png" /></figure><ul><li><strong>Unit</strong>: A sudoku unit consists of 9 boxes. In a solved sudoku, each unit contains all the digits 1–9, one per box. A unit can be a row, a column or a sub-square(sometimes diagonals are also considered units)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*nmDapO_D7Qmw32qA5pIuDw.png" /><figcaption>Square Unit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*ibJQp4EP_VJngJEBenj1xQ.png" /><figcaption>Column Unit</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*hDVe9ckSqhPkovSrli6edQ.png" /><figcaption>Row Unit</figcaption></figure><ul><li><strong>Peer</strong>: a single box can have peers, a peer being any other box that is in the same unit as the box under consideration.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*sa_MgRnndEM9Ir-KXG4sjw.png" /><figcaption>Peers of highlighted box</figcaption></figure><ul><li><strong>Solved block</strong>: A block with the correct value filled in.</li><li><strong>Unsolved block</strong>: A block for which the correct value has not been determined yet.</li></ul><h4>Strategies</h4><ul><li><strong>Main sequence</strong></li></ul><p>Start off assigning all possible values to all unsolved blocks. Apply the strategies <strong>Eliminate</strong>, <strong>Only Choice </strong>and, if necessary <strong>Naked Twins</strong>.</p><p>If at this point every block has one value assigned to it, stop as you have found a solution.</p><p>If not, and all blocks still have values assigned to them, find an unsolved block with the least amount of possible values assigned to it. For each possible value that can be assigned to this block, make a copy of the sudoku and apply the Main Sequence to it.</p><p>If you have any blocks with all possible values eliminated, you have failed to find a solution using this copy of the sudoku and one of your other copies will hold the solution.</p><ul><li><strong>Strategies</strong></li></ul><ol><li><strong>Eliminate:</strong> For each solved box, remove the value assigned to it from its peers’ list of possible values list.</li><li><strong>Only choice: </strong>Check each box’s possible values list. If a box <em>A</em> has one value <em>X</em> in its list that none of its peers have in their possible values list, then assign <em>X</em> to <em>A </em>which will make it into a solved box.</li><li><strong>Naked Twins: </strong>Look for peers that have two (or more) values that are identical. You can now remove the possible values of these Naked Twin boxes from all their peers not in the Naked Twin relationship.</li></ol><p>You should now be able to systematically solve most sudoku puzzles out there, like a machine!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc8cc6ee9b73" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>