<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Toni Cebrián</title>
	<atom:link href="http://www.tonicebrian.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.tonicebrian.com</link>
	<description>Software engineer working on Data Mining hoping to create true A.I.</description>
	<lastBuildDate>Thu, 23 Feb 2012 09:55:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Parser combinators in Scala</title>
		<link>http://www.tonicebrian.com/2012/02/23/parser-combinators-in-scala/</link>
		<comments>http://www.tonicebrian.com/2012/02/23/parser-combinators-in-scala/#comments</comments>
		<pubDate>Thu, 23 Feb 2012 08:59:19 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=361</guid>
		<description><![CDATA[Lately, I&#8217;ve been writing some matrix factorization code for a video recommender system. I&#8217;m a big fan of Test Driven Development but it is a technique that is difficult for me to apply to the numerical or algorithmic domain. In order to make sure that the code I write is correct what I&#8217;m doing is the Oracle [...]]]></description>
			<content:encoded><![CDATA[<p>Lately, I&#8217;ve been writing some <a href="http://research.yahoo.com/files/ieeecomputer.pdf">matrix factorization</a> code for a video recommender system. I&#8217;m a big fan of Test Driven Development but it is a technique that is difficult for me to apply to the numerical or algorithmic domain. In order to make sure that the code I write is correct what I&#8217;m doing is the Oracle Test Pattern (I&#8217;m sure there is a correct name for this but I&#8217;m not able to find it right now). The idea is to have a reference implementation that solves the exact problem you are trying to solve. In my case, that reference implementation does not exists but I&#8217;m writing a straightforward unoptimized version of the script in Python using the Numpy libraries. That will be my ground truth when comparing results with the highly optimized parallel Scala version of the algorithm.</p>
<h3>The problem</h3>
<p>So the problem is that I&#8217;m working interactively coding the algorithm in an iPython session and I&#8217;m getting results of this kind</p>
<pre class="brush: python; title: ; notranslate">
In [4]: x
Out[4]:
matrix([[ 0.03893565, -0.35836827, -2.06492572,  1.49773613, -1.01988835,
         -0.20590096, -0.19658741],
        [ 0.43055155,  1.07532444,  0.89299596, -1.070371  , -0.24015718,
          0.04521229, -1.39209522],
        [-0.4482701 ,  0.15201451, -1.42824771,  1.13859559,  0.66432642,
          0.51184435,  0.52637519],
        [-0.26518471, -1.14331753, -1.15492029, -0.27501194,  1.73750282,
         -1.4118682 ,  0.14701005],
        [-1.6577536 , -0.0781593 , -0.01558478,  0.67277257, -0.07249647,
          0.70946581, -0.82349608]])
</pre>
<p>and I would like to just copy and paste this string and use it as the expected value in my Scala tests. That would involve to remove &#8220;matrix&#8221;, all the &#8220;[" and "]&#8220;, substitute them for their Array() equivalents and put an <strong>F</strong> at the end of each number denoting that it is a Float. Too much work.</p>
<h3>The solution</h3>
<p>If there is an area where functional languages shine is in creating DSLs. More specifically creating an <a href="http://martinfowler.com/bliki/InternalDslStyle.html">internal DSL</a> that looks more like an <a href="http://martinfowler.com/bliki/DomainSpecificLanguage.html">external DSL</a>. In Scala you can use the <a href="http://www.scala-lang.org/api/current/scala/util/parsing/combinator/Parsers.html">Parser Combinator libraries</a> that are part of the Scala&#8217;s core libraries. Such parser will be something like</p>
<pre class="brush: scala; title: ; notranslate">
class PyMatrixParser extends JavaTokenParsers {
  def matrix:Parser[Array[Array[Float]]] = &quot;matrix([&quot; ~&gt; repsep(row,&quot;,&quot;) &lt;~ &quot;])&quot; ^^ (_.toArray)
  def row:Parser[Array[Float]] = &quot;[&quot;~&gt; repsep(floatingPointNumber,&quot;,&quot;) &lt;~ &quot;]&quot; ^^ (_.map(_.toFloat).toArray)
}
</pre>
<p>using this parser is then just a matter of</p>
<pre class="brush: scala; title: ; notranslate">
val parser = new PyMatrixParser
val scalaMatrix = parser.parseAll(parser.matrix, theStringMatrix).get
</pre>
<p>quite good result for just 2 lines of code defining the parser.</p>
<p>This is the quick overview for those not familiar with Scala&#8217;s syntax</p>
<ul>
<li>Every String that is found where a Scala Parser was meant to be, is automatically transformed into a constant parser that matches that exact string. So for instance,<em>&#8220;matrix([&#8220;</em>gets converted into a parser by one of the implicits in the parser combinators libraries.</li>
<li><em>rep(row,&#8221;,&#8221;)</em> takes two parsers as parameters and means that parser #1 will be repeated 0 or more times interleaved by parser #2</li>
<li>The parser combinators<em> &#8220;~>&#8221;</em> and <em>&#8220;<~"</em> denote that the parser pointed by the arrow must be keep as the result of the parsing while the parser pointed by the tail must be discarded. This is helpful for combining two parser where one of them is just ornamental.</li>
<li>floatingPointNumber is a parser provided by the library that parses float point string representations</li>
<li>Each parser returns either the parsed string or a more complex Scala structure, like for instance, a list of strings in the case of <em>rep(parser1,parser2)</em>. Those results are sent to a parser transformator (the<em> ^^</em> operator) that works on the parser results and generates the true parsing result. In the example, first we create an array of Floats, and then an Array of Arrays of Floats that represent my matrix.</li>
</ul>
<p>Really cool feature that has spared me a lot of grunt work by just writing two lines of code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2012/02/23/parser-combinators-in-scala/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Scala project template (SBT 0.11.2)</title>
		<link>http://www.tonicebrian.com/2012/02/15/scala-project-template-sbt-0-11-2/</link>
		<comments>http://www.tonicebrian.com/2012/02/15/scala-project-template-sbt-0-11-2/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 08:00:31 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[sbt]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[scalatests]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=342</guid>
		<description><![CDATA[Some months ago I wrote a post about setting up a Scala project with SBT. SBT has evolved and the new version differs from the 0.7.7 instructions. There is a Github repository with the updated version for SBT 0.11.2. Download the sbt jar and create the script as it is explained here Create the project [...]]]></description>
			<content:encoded><![CDATA[<p>Some months ago <a href="http://www.tonicebrian.com/2011/05/02/simple-scala-project-step-by-step">I wrote a post</a> about setting up a Scala project with SBT. SBT has evolved and the new version differs from the 0.7.7 instructions. There is a <a href="https://github.com/tonicebrian/sbt-project-template">Github repository</a> with the updated version for SBT 0.11.2.</p>
<ol>
<li>Download the sbt jar and create the script as it is explained <a href="https://github.com/harrah/xsbt/wiki/Getting-Started-Setup">here</a></li>
<li>Create the project folder
<pre class="brush: bash; title: ; notranslate">
mkdir sbt-project-template
cd sbt-project-template
</pre>
</li>
<li>Create the project definition with the <em>build.sbt</em> file that must reside in the project&#8217;s root directory
<pre class="brush: scala; title: ; notranslate">
name := &quot;TestProject&quot;

version := &quot;1.0-SNAPSHOT&quot;

organization := &quot;com.example&quot;

scalaVersion := &quot;2.9.1&quot;

libraryDependencies += &quot;org.scalatest&quot; %% &quot;scalatest&quot; % &quot;1.7.1&quot; % &quot;test&quot;
</pre>
<p>Blank lines in between are important. Don&#8217;t remove them.</li>
<li>Let’s write some classes and tests in order to check that everything is OK. First create the class under test in <em>src/main/scala/Calc.scala</em>
<pre class="brush: scala; title: ; notranslate">
package com.example

object Calc {
    def add(x:Int, y:Int) : Int = x + y
}
</pre>
</li>
<li>Now, create a test in src/test/scala/CaltTest.scala that checks that the class is working as expected
<pre class="brush: scala; title: ; notranslate">
package com.example.test

import com.example.Calc
import org.scalatest.Suite

class CalcTest extends Suite {

    def testAddition() {
        assert(4 === Calc.add(2,2))
    }
}
</pre>
</li>
<li>Now just check that tests pass by doing
<pre class="brush: bash; title: ; notranslate">
sbt clean test
</pre>
<p>you should see something like this:</p>
<pre class="brush: bash; title: ; notranslate">
[info] Loading project definition from /home/cebrian/GIT/sbt-project-template/project
[info] Set current project to TestProject (in build file:/home/cebrian/GIT/sbt-project-template/)
[success] Total time: 0 s, completed 14-feb-2012 23:29:30
[info] Updating {file:/home/cebrian/GIT/sbt-project-template/}default-4639fd...
[info] Resolving org.scala-lang#scala-library;2.9.1 ...
[info] Resolving org.scalatest#scalatest_2.9.1;1.7.1 ...
[info] Done updating.
[info] Compiling 1 Scala source to /home/cebrian/GIT/sbt-project-template/target/scala-2.9.1/classes...
[info] Compiling 1 Scala source to /home/cebrian/GIT/sbt-project-template/target/scala-2.9.1/test-classes...
[info] CalcTest:
[info] - testAddition
[info] Passed: : Total 1, Failed 0, Errors 0, Passed 1, Skipped 0
[success] Total time: 7 s, completed 14-feb-2012 23:29:37
</pre>
</li>
</ol>
<p>Simpler than before.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2012/02/15/scala-project-template-sbt-0-11-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CSV parser in C++ with Boost and Template Metaprogramming</title>
		<link>http://www.tonicebrian.com/2011/12/28/csv-parser-in-c-with-boost-and-template-metaprogramming/</link>
		<comments>http://www.tonicebrian.com/2011/12/28/csv-parser-in-c-with-boost-and-template-metaprogramming/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 16:00:03 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[boost]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[csv]]></category>
		<category><![CDATA[templates]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=318</guid>
		<description><![CDATA[One common situation when analyzing big chunks of data is to parse big CSV files with a record structure on each line. That is, all lines conform to a fixed schema where each line represents a record and each record has several columns of different types. Your objective is to parse and fill a data structure like this [...]]]></description>
			<content:encoded><![CDATA[<p>One common situation when analyzing big chunks of data is to parse big CSV files with a record structure on each line. That is, all lines conform to a fixed schema where each line represents a record and each record has several columns of different types. Your objective is to parse and fill a data structure like this</p>
<pre class="brush: cpp; title: ; notranslate">
struct foo {
    int a;
    std::string b;
    double c;
};
</pre>
<p>for each record. All the information needed for such parsing is in this data structure so I wondered whether I could write a program when you pass that type information and the parsing is done automatically for you. This is my first attempt at getting a flexible and fast CSV parser in C++. It is hosted in <a href="https://github.com/tonicebrian/csv_iterator">Github</a>.</p>
<h2>Design</h2>
<p>When parsing CSV files the common usage pattern is to iterate through each line and perform a given action on each record. No need for a big CSV container or something similar, so the best approach is to write a class that acts as an iterator. When derreferencing the iterator it will return the provided data structure filled with parsed data from the current line. </p>
<p>An iterator is associated to a container but in this case, it will be constructed accepting an <em>std::istream</em> representing the CSV file. By accepting this istream we will be able to parse strings using the <em>std::stringstream</em> class, regular files, or compressed files using the <a href="http://www.boost.org/doc/libs/1_48_0/libs/iostreams/doc/index.html">Boost Iostream library</a>.</p>
<p>The iterator must have all the common operators for it to interoperate with the STL algorithms seamlessly. The empty constructor will mark the iterator&#8217;s end-of-range position that coincides with the end of file. A typical use case will be to have some code like this:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;fstream&gt;
#include &lt;boost/tuple/tuple.hpp&gt;
#include &lt;csv_iterator.hpp&gt;

using namespace boost::tuples;
typedef tuple&lt;int,std::string,double&gt; record;

void myFunc(const record&amp; value){
    // Your code here
}

int main(int argc, const char *argv[])
{
    // Example of csv_iterator usage
    std::ifstream in(&quot;myCsvFile.csv&quot;);
    csv::iterator&lt;record&gt; it(in);

    // Use the iterator in your algorithms.
    std::for_each(it, csv::iterator&lt;record&gt;(), myFunc);

    return 0;
}
</pre>
<p>for parsing CSV files like this:</p>
<pre class="brush: bash; title: ; notranslate">
1,hola,3.14
2,adios,2.71
</pre>
<h2>Implementation</h2>
<p>For obtaining the values on each line, the library uses the <a href="http://www.boost.org/doc/libs/1_48_0/libs/tokenizer/index.html">Boost Tokenizer library</a>. From a string you create a tokenizer that splits the input string by the character delimiter that by default is the comma. It also takes care of escaping characters. Accessing the different tokens is granted by the tokenizer by providing a token iterator.</p>
<pre class="brush: cpp; title: ; notranslate">
using namespace boost;
typedef tokenizer&lt;escaped_list_separator&lt;char&gt; &gt; Tokens;
Tokens tokens(currentLine);
// Tokens can be accessed using tokens.begin() and tokens.end() iterators
</pre>
<p>Once we have the strings representing different values we have to parse and convert them into a type. Bad data format exceptions happen here and can be spotted earlier. For parsing using an unified approach the library uses the <a href="http://www.boost.org/doc/libs/1_48_0/doc/html/boost_lexical_cast.html">Boost Lexical Cast Library</a>. This library provides a uniform and portable interface for doing text conversions</p>
<pre class="brush: cpp; title: ; notranslate">
int myInt = boost::lexical_cast&lt;int&gt;(&quot;5&quot;);
double myDouble = boost::lexical_cast&lt;double&gt;(&quot;3.14&quot;);
</pre>
<p>For the record data structure the library uses the <a href="http://www.boost.org/doc/libs/1_48_0/libs/tuple/doc/tuple_users_guide.html">Boost Tuple Library</a> that provides a Plain &#8220;old&#8221; Data Structure for storing the record fields. Moreover this class provides some template infrastructure that helps in the metaprogramming trick that follows.</p>
<h3>Template metaprogamming</h3>
<p>For our library the number of columns and the datatype is implicit in the record type. Our algorithm for parsing is basic, depending on the field type, parse the Nth string accordingly, and assign the result to the Nth field. Repeat for all the record fields. This <a href="http://en.wikipedia.org/wiki/Polymorphism_(computer_science)#Parametric_polymorphism">parametric polymorphism</a> must be combined with the dynamic access of the string tokenization. The former can be obtained in C++ using <a href="http://en.wikipedia.org/wiki/Template_metaprogramming">Template metaprogramming</a>. The code that makes the trick is this one</p>
<pre class="brush: cpp; title: ; notranslate">
template&lt;class Tuple, int N &gt;
    struct helper {
        static void fill(Tuple&amp; tuple, strIt&amp; it, strIt&amp; end){
            using namespace boost::tuples;
            typedef typename element&lt;length&lt;Tuple&gt;::value-N-1,Tuple&gt;::type value_type;
            checkIteratorRange(it,end);
            get&lt;length&lt;Tuple&gt;::value-N-1&gt;(tuple) = boost::lexical_cast&lt;value_type&gt;(it-&gt;c_str());
            ++it;
            helper&lt;Tuple,N-1&gt;::fill(tuple,it,end);
        }
    };

template&lt;class Tuple&gt;
    struct helper&lt;Tuple, 0&gt; {
        static void fill(Tuple&amp; tuple, strIt&amp; it, strIt&amp; end){
            using namespace boost::tuples;
            typedef typename boost::tuples::element&lt;length&lt;Tuple&gt;::value-1,Tuple&gt;::type value_type;
            checkIteratorRange(it,end);
            boost::tuples::get&lt;length&lt;Tuple&gt;::value-1&gt;(tuple) = boost::lexical_cast&lt;value_type&gt;(it-&gt;c_str());
            ++it;
        };
    };

template&lt;class Tuple&gt;
    struct filler {
       static void fill(Tuple&amp; tuple, strIt&amp;&amp; it,strIt&amp;&amp; end){
            checkIteratorRange(it,end);
            helper&lt;Tuple, boost::tuples::length&lt;Tuple&gt;::value-1&gt;::fill(tuple,it,end);
        }
    };
</pre>
<p>Yes, C++ syntax sucks!! But basically what we are doing here is a common pattern of functional programming, <a href="http://en.wikipedia.org/wiki/Tail_call">tail recursion</a>. We define structures that contain static functions. The <b>filler</b> structure just initializes the recursive call by instantiating an instance of the <strong>helper</strong> paremeterized structure setting the length recursion to the number of fields in the tuple. This structure has to be specialized for the 0 value in order for the recursion to stop. All this functionality is done behind the curtain by the compiler (compilation time increases when using template metaprogramming) but the generated code will be something very similar to this pseudocode:</p>
<pre class="brush: cpp; title: ; notranslate">
boost::tuples::get&lt;0&gt;(tuple) = (casting_here)*it;
++it;
boost::tuples::get&lt;1&gt;(tuple) = (casting_here)*it;
++it;
boost::tuples::get&lt;2&gt;(tuple) = (casting_here)*it;
++it;
</pre>
<p>almost identical to the code we would have written by hand. The compiler is the one who knows how many fields our structure has at compile time and generates as many efficient instructions as needed.</p>
<h2>Conclusion</h2>
<p>I wanted to stretch my programming muscles by coding a generic, flexible and fast CSV parser in C++ using template metaprogramming. The generic and flexible parts of the task have been accomplished but not the performance objectives. Although the library is fast enough for most tasks, it isn&#8217;t in a scenario of Big Data parsing big files. The tokenizer iterator is incurring a performance penalty each time I try to derreference it, since it creates and allocates memory for a <em>std::string</em> each time we invoke <em>*it</em>. This memory allocation is a performance drain doing useless work because we need this information only for parsing and getting a value, but the string is discarded thereafter. It would be better to perform an in-place parsing using the string allocated when reading the lines of the file. To that end it will be enlightening in the future to try this same exercise with more performant string libraries like the <a href="http://www.partow.net/programming/strtk/index.html">C++ String Toolkit</a> and see the differences in performance.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2011/12/28/csv-parser-in-c-with-boost-and-template-metaprogramming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementing LDA</title>
		<link>http://www.tonicebrian.com/2011/11/28/implementing-lda/</link>
		<comments>http://www.tonicebrian.com/2011/11/28/implementing-lda/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 16:56:06 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Data Mining]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[bayesian]]></category>
		<category><![CDATA[lda]]></category>
		<category><![CDATA[MCMC]]></category>
		<category><![CDATA[research]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=302</guid>
		<description><![CDATA[Lately I was playing with Latent Dirichlet Allocation (LDA) for a project at work. If for whatever reason you need to implement such algorithm perhaps you will save some time reading the walkthrough I did. First you must be sure that LDA is the algorithm you are looking for. From a corpus of documents you [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">Lately I was playing with Latent Dirichlet Allocation (<a title="LDA" href="http://en.wikipedia.org/wiki/Latent_Dirichlet_allocation" target="_blank">LDA</a>) for a project at work. If for whatever reason you need to implement such algorithm perhaps you will save some time reading the walkthrough I did.</p>
<p>First you must be sure that LDA is the algorithm you are looking for. From a corpus of documents you will get K lists with words from your documents in them with a number assigned to each word denoting the relevance of the given word in the lists. Each list represents a topic, and that would be your topic description, no fancy words like &#8220;Computers&#8221;, &#8220;Biology&#8221; or &#8220;Life meaning&#8221;, just a set of words that a human must interpret. You could always assign a single name by picking the most prominent word in the list or treating the list as a valued vector and comparing it against a <em>canonical topic description</em>. So take a look at the first examples in <a href="http://www.cs.princeton.edu/~blei/kdd-tutorial.pdf">this presentation</a> and get inspired.<img class="aligncenter" title="LDA Bayesian Model" src="http://upload.wikimedia.org/wikipedia/commons/4/4d/Smoothed_LDA.png" alt="" width="395" height="195" /></p>
<p>OK so you need some code to test how this method behaves with your particular data. The first thing to try is the <a href="http://cran.r-project.org/web/packages/topicmodels/index.html">topicmodels</a> package from the <a href="http://www.r-project.org/">R</a>   statistical software package. This can give you an idea of the method and try to use it in a more serious Java application by means of the <a href="http://mallet.cs.umass.edu/">Mallet library</a>.</p>
<p>But say that you need to create your own implementation because Java horrifies you or because you need a parallel version or whatever the reason. The first thing you have to do is to choose the inference method of your model between <strong>variational methods</strong> or <strong>gibbs sampling</strong>.<a href="http://www.phontron.com/blog/?p=24"> This post</a> will give you some ideas for picking the right method for your particular problem. The original papers picked the variational approach but I went through the Gibbs sampling method because I found <a href="http://dbgroup.cs.tsinghua.edu.cn/wangyi/lda/lda.pdf">this paper</a> where all the mathematical derivations are nailed down. That way I was able to fully understand the method and at the same time being sure that my implementation was right and sound.  If you need more guidance, take a look at <a href="http://www.arbylon.net/projects/LdaGibbsSampler.java">this simple implementation</a> for getting an idea of the main functions and data structures you&#8217;ll have to code.</p>
<p>Once you have your code written you will have to check whether it is correct or not. The example in <a href="http://www.pnas.org/content/101/suppl.1/5228.full.pdf">this paper</a> using pixel positions and pixel intensities instead of words and word counts is very illustrating and will show visually the correctness of your implementation. Once you have your algorithm up and running perhaps you want to scale it up to more machines, so you could benefit from reading <a href="http://www.ics.uci.edu/~asuncion/pubs/JMLR_09.pdf">this paper  </a>and taking also a look at this <a href="http://blog.smola.org/post/6359713161/speeding-up-latent-dirichlet-allocation">blog post</a> from <a href="http://alex.smola.org/">Alex Smola</a> and their <a href="https://github.com/shravanmn/Yahoo_LDA">distributed implementation of LDA</a> on Github.</p>
<p>Happy coding!!!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2011/11/28/implementing-lda/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting started with JAGS for Bayesian Modelling</title>
		<link>http://www.tonicebrian.com/2011/09/13/getting-started-with-jags-for-bayesian-modelling/</link>
		<comments>http://www.tonicebrian.com/2011/09/13/getting-started-with-jags-for-bayesian-modelling/#comments</comments>
		<pubDate>Tue, 13 Sep 2011 14:30:44 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Data Mining]]></category>
		<category><![CDATA[bayesian]]></category>
		<category><![CDATA[JAGS]]></category>
		<category><![CDATA[MCMC]]></category>
		<category><![CDATA[R]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=250</guid>
		<description><![CDATA[In the past if you wanted to do some Bayesian Modelling using a Gibbs sampler you had to rely on Winbugs but it isn&#8217;t open source and it only runs in Windows. The JAGS project started as a full feature alternative for the Linux platform. Here are some instructions for getting started First install the [...]]]></description>
			<content:encoded><![CDATA[<p>In the past if you wanted to do some Bayesian Modelling using a Gibbs sampler you had to rely on <a href="http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/contents.shtml">Winbugs</a> but it isn&#8217;t open source and it only runs in Windows. The <a href="http://mcmc-jags.sourceforge.net/">JAGS project</a> started as a full feature alternative for the Linux platform. Here are some instructions for getting started</p>
<p>First install the required dependencies. In my Ubuntu 11.04, is something like:</p>
<pre class="brush: bash; title: ; notranslate">
sudo apt-get install gfortran liblapack-dev libltdl-dev r-base-core
</pre>
<p>For Ubuntu 11.04 you have to install JAGS from sources, but it seems that this version will be packaged in the next Ubuntu release. Download the software from <a href="http://sourceforge.net/projects/mcmc-jags/">here</a> and install.</p>
<pre class="brush: bash; title: ; notranslate">
tar xvfz JAGS-3.1.0.tar.gz
cd JAGS-3.1.0
./configure
make
sudo make install
</pre>
<p>Now fire R and install the interface package rjags</p>
<pre class="brush: bash; title: ; notranslate">
$ R
...
&gt; install.package(&quot;rjags&quot;,dependencies=TRUE)
</pre>
</pre>
<p>Now let's do something interesting (although pretty simple). Let's assume we have a stream of 1s and 0s with an unknown proportion of each one. From R we can generate such distribution with the command</p>
<pre class="brush: bash; title: ; notranslate">
&gt; points &lt;- floor(runif(1000)+.4)
</pre>
<p>that generates a distribution with roughly 40% of 1s and 60% of 0s. So, our stream consists of a sequence of 0s and 1s generated using the <emph>uniform(phi)</emph> distribution where the <emph>phi</emph> parameter equals 0.4. </p>
<p>If we don't know this parameter and we try to learn it, we can assume that this parameter has prior uniform in the range [0,1] and thus the model that describes this scenario in the Winbugs language is</p>
<pre class="brush: bash; title: ; notranslate">
model
{
    phi ~ dunif(0,1);
    y ~ dbin(phi,N);
}
</pre>
<p>In this model N and y are known, so we provide this information in order to estimate our unknown parameter <emph>phi</emph>. We create the model and query the resulting parameter distribution:</p>
<pre class="brush: bash; title: ; notranslate">
&gt; result &lt;- list(y=sum(points), N=1000)
&gt; result
$y
[1] 393

$N
[1] 1000

&gt; library(rjags)
Loading required package: coda
Loading required package: lattice
linking to JAGS 3.1.0
module basemod loaded
module bugs loaded
&gt; myModel &lt;- jags.model(&quot;model.dat&quot;, result)
Compiling model graph
   Resolving undeclared variables
   Allocating nodes
   Graph Size: 5

Initializing model

&gt; update(myModel, 1000)
  |**************************************************| 100%
&gt; x &lt;- jags.samples(myModel, c('phi'), 1000)
  |**************************************************| 100%
&gt; x
$phi
mcarray:
[1] 0.3932681

Marginalizing over: iteration(1000),chain(1) 

&gt;
</pre>
<p>So the inferred value of <emph>phi</emph> is 0.3932. One interesting thing in Bayesian statistics is that it does not estimate points, but probabilistic distributions over the parameters. We can see how the <emph>phi</emph> parameter was estimated by examining the Monte Carlo Chain and the distribution of the generated values during the simulation</p>
<pre class="brush: bash; title: ; notranslate">
&gt; chain &lt;- as.mcmc.list(x$phi)
&gt; plot(chain)
</pre>
<p><a href="http://www.tonicebrian.com/blog/wp-content/uploads/2011/09/chain.png"><img src="http://www.tonicebrian.com/blog/wp-content/uploads/2011/09/chain.png" alt="" title="Monte Carlo Chain for the phi parameter" width="640" height="480" class="aligncenter size-full wp-image-259" /></a><br />
Where we can see that the values for phi in the chain were centered around the 0.4, the true parameter value. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2011/09/13/getting-started-with-jags-for-bayesian-modelling/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>My working environment with Xmonad</title>
		<link>http://www.tonicebrian.com/2011/09/05/my-working-environment-with-xmonad/</link>
		<comments>http://www.tonicebrian.com/2011/09/05/my-working-environment-with-xmonad/#comments</comments>
		<pubDate>Mon, 05 Sep 2011 09:00:16 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[X11]]></category>
		<category><![CDATA[xmonad]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=226</guid>
		<description><![CDATA[Fire a terminal, fire another terminal and tail some logs, open your browser and point to the web page you are developing, open your IDE and open three or four tabs with the code you suspect is causing the bug, put some breakpoints, alt-tab to the first terminal start your system under test, connect your [...]]]></description>
			<content:encoded><![CDATA[<p>Fire a terminal, fire another terminal and tail some logs, open your browser and point to the web page you are developing, open your IDE and open three or four tabs with the code you suspect is causing the bug, put some breakpoints, alt-tab to the first terminal start your system under test, connect your debugging IDE to your system, perform some operations to your browser, catch the breakpoint, switch back and forth the code tabs, etc&#8230; This daily routine common to most developers, involves grabbing the mouse, arranging some windows, and switching context continuously. This creates a cognitive overload and a lack of productivity because developers are doing tasks not directly related to the task at hand.</p>
<p>This is the reason I don&#8217;t use Gnome any more and I&#8217;ve switched to <a href="http://xmonad.org/" target="_blank">Xmonad</a> a tiling window manager that can be controlled almost exclusively with the keyboard. With this fully configurable window manager, I can move, resize, minimize, arrange, customize all the visible windows, move windows between workspaces, all with my hands not leaving the keyboard.The only thing I have not been able to accomplish is having the UrgentHook working for Skype. The Linux version of Skype fails to set the WM_URGENT X11 event when a new chat opens, and if I&#8217;m not in that workspace I don&#8217;t get any notification besides the bell. Still thinking about a good workaround, any ideas?</p>
<p>Here is a screenshot of xmonad in action with  some applications in it,</p>
<p style="text-align: center;"><a href="http://www.tonicebrian.com/blog/wp-content/uploads/2011/09/Xmonad-pantallazo-e1315159682886.png"><img class="aligncenter size-medium wp-image-231" title="Xmonad screenshot" src="http://www.tonicebrian.com/blog/wp-content/uploads/2011/09/Xmonad-pantallazo-300x187.png" alt="" width="300" height="187" /></a></p>
<p>If you plan to install Xmonad in your computer, use version 0.10 or superior because it solves some nasty problems with Java applications. In case it is not yet ready for your favourite distribution, follow <a href="https://sites.google.com/site/jifengstechcollection/linux/xmonad" target="_blank">these instructions</a>. In order to have this configuration working, just write the following 3 files:</p>
<ul>
<li>.<em>xsession</em> with the programs you need to start when the session begins (network manager, batery manager, etc&#8230;). Put it in your $HOME dir.</li>
<li>.<em>xmobarrc</em> with the configuration of your handy <a href="http://gorgias.mine.nu/xmobar/" target="_blank">textual status bar</a> . Put it in your $HOME</li>
<li><em>xmonad.hs</em> with the configuration of the window manager itself. Put it under $HOME/.xmonad</li>
</ul>
<p><strong>xmonad.hs</strong> is a pure Haskell file for configuring the window manager, no XML, not another fancy configuration language. Some comments to the configuration file</p>
<ul>
<li><strong>lines 23-26</strong>, send Thunderbird and Skype to their dedicated workspaces</li>
<li><strong>line 29</strong>, name the workspaces</li>
<li><strong>lines 32-50</strong>, define new key combinations, for navigating the tiling windows, send windows to background and toggle between the tiled arrangement and focusing the whole screen into one window</li>
<li><strong>lines 52-55</strong>, define how I want the windows to be arranged. Basically, create a specific configuration for Skype in its dedicated workspace, and for the rest of workspaces, don&#8217;t hide the menu, allow navigation with the cursors and minimize unwanted windows.</li>
<li><strong>lines 57-77</strong>, ensemble the main xmonad window manager with the desired configuration. Spawn the status bar, and append the predefined layouts, keybindings and window hooks. Redefine some keys and fool Java setting the name of the Window Manager to LG3D in order to avoid problems with focus.</li>
</ul>
<pre class="brush: scala; title: ; notranslate">
import XMonad
import XMonad.Hooks.DynamicLog
import XMonad.Hooks.ICCCMFocus
import XMonad.Hooks.ManageDocks
import XMonad.Util.Run(spawnPipe)
import XMonad.Util.EZConfig(additionalKeys)
import System.IO
import XMonad.Hooks.ManageHelpers
import XMonad.Hooks.UrgencyHook
import XMonad.Hooks.SetWMName
import XMonad.Layout.Minimize
import XMonad.Layout.WindowNavigation
import XMonad.Layout.ToggleLayouts
import XMonad.Layout.IM as IM
import XMonad.Layout.PerWorkspace
import XMonad.Layout.Reflect
import XMonad.Layout.Grid
import Data.Ratio ((%))

import qualified Data.Map as M

-- Send applications to their dedicated Workspace
myManageHook = composeAll
                [ className =? &quot;Skype&quot;         --&gt; doShift &quot;4:skype&quot;,
                  className =? &quot;Thunderbird&quot;   --&gt; doShift &quot;2:mail&quot;
                ]

-- Name the workspaces
myWorkspaces = [&quot;1:dev&quot;,&quot;2:mail&quot;,&quot;3:web&quot;,&quot;4:skype&quot;,&quot;5:media&quot;, &quot;6:office&quot;] ++ map show [7..9]

-- Add new Keys
newKeys x = M.union (keys defaultConfig x) (M.fromList (myKeys x))

myKeys conf@(XConfig {XMonad.modMask = modm}) =
              [
              -- Minimize a window
                ((modm, xK_z),               withFocused minimizeWindow)
              , ((modm .|. shiftMask, xK_z), sendMessage RestoreNextMinimizedWin  )
              -- Window navigation with cursors
              , ((modm,                 xK_Right), sendMessage $ Go R)
              , ((modm,                 xK_Left ), sendMessage $ Go L)
              , ((modm,                 xK_Up   ), sendMessage $ Go U)
              , ((modm,                 xK_Down ), sendMessage $ Go D)
              , ((modm .|. controlMask, xK_Right), sendMessage $ Swap R)
              , ((modm .|. controlMask, xK_Left ), sendMessage $ Swap L)
              , ((modm .|. controlMask, xK_Up   ), sendMessage $ Swap U)
              , ((modm .|. controlMask, xK_Down ), sendMessage $ Swap D)
              -- Togle Fullscreen
              , ((modm,                 xK_f    ), sendMessage ToggleLayout)
              ]

-- Define the default layout
skypeLayout = IM.withIM (1%7) (IM.And (ClassName &quot;Skype&quot;)  (Role &quot;MainWindow&quot;)) Grid
normalLayout = windowNavigation $ minimize $ avoidStruts $ onWorkspace &quot;4:skype&quot; skypeLayout $ layoutHook defaultConfig
myLayout = toggleLayouts (Full) normalLayout

-- Main executable
main = do
    xmproc &lt;- spawnPipe &quot;xmobar /home/cebrian/.xmobarrc&quot;
    xmonad $ withUrgencyHook NoUrgencyHook $ defaultConfig
        { manageHook = manageDocks &lt;+&gt; myManageHook &lt;+&gt; manageHook defaultConfig
        , keys = newKeys
        , workspaces = myWorkspaces
        , layoutHook = myLayout
        , logHook = takeTopFocus &gt;&gt; dynamicLogWithPP xmobarPP
                        { ppOutput = hPutStrLn xmproc
                        , ppTitle = xmobarColor &quot;green&quot; &quot;&quot; . shorten 50
                        , ppUrgent = xmobarColor &quot;yellow&quot; &quot;red&quot; . xmobarStrip
                        }
        , modMask = mod4Mask     -- Rebind Mod to the Windows key
        , terminal = &quot;terminator&quot;
        , startupHook = setWMName &quot;LG3D&quot;
        } `additionalKeys`
        [ ((controlMask .|. shiftMask, xK_l), spawn &quot;xscreensaver-command -lock&quot;)
        , ((controlMask, xK_Print), spawn &quot;sleep 0.2; scrot -s&quot;)
        , ((0, xK_Print), spawn &quot;scrot&quot;)
        ]
</pre>
<p><strong>.xsession</strong></p>
<pre class="brush: bash; title: ; notranslate">
#!/bin/bash

xrdb -merge .Xresources

# Configure xrandr for multiple monitors
# External output may be &quot;VGA&quot; or &quot;VGA-0&quot; or &quot;DVI-0&quot; or &quot;TMDS-1&quot;
EXTERNAL_OUTPUT=&quot;VGA-0&quot;
INTERNAL_OUTPUT=&quot;LVDS&quot;
# EXTERNAL_LOCATION may be one of: left, right, above, or below
EXTERNAL_LOCATION=&quot;left&quot;

# In case I want to have both monitors on
case &quot;$EXTERNAL_LOCATION&quot; in
       left|LEFT)
               EXTERNAL_LOCATION=&quot;--left-of $INTERNAL_OUTPUT&quot;
               ;;
       right|RIGHT)
               EXTERNAL_LOCATION=&quot;--right-of $INTERNAL_OUTPUT&quot;
               ;;
       top|TOP|above|ABOVE)
               EXTERNAL_LOCATION=&quot;--above $INTERNAL_OUTPUT&quot;
               ;;
       bottom|BOTTOM|below|BELOW)
               EXTERNAL_LOCATION=&quot;--below $INTERNAL_OUTPUT&quot;
               ;;
       *)
               EXTERNAL_LOCATION=&quot;--left-of $INTERNAL_OUTPUT&quot;
               ;;
esac
xrandr | grep $EXTERNAL_OUTPUT | grep &quot; connected &quot;

if [ $? -eq 0 ]; then
    xrandr --output $INTERNAL_OUTPUT --off --output $EXTERNAL_OUTPUT --auto
    # Alternative command in case of trouble:
    # (sleep 2; xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --auto $EXTERNAL_LOCATION) &amp;
else
    xrandr --output $INTERNAL_OUTPUT --auto --output $EXTERNAL_OUTPUT --off
fi

trayer --edge top --align right --SetDockType true --SetPartialStrut true --expand true --width 15 --height 12 --transparent true --tint 0x000000 &amp;

xscreensaver -no-splash &amp;

# Allow nautilus to take care of plugin USB drives and Dropbox icons
nautilus --no-desktop -n &amp;

if [ -x /usr/bin/nm-applet ] ; then
   nm-applet --sm-disable &amp;
fi

if [ -x /usr/bin/gnome-power-manager ] ; then
   sleep 1
   gnome-power-manager &amp;
fi

/usr/bin/gnome-volume-control-applet &amp;
dropbox start &amp;

exec /home/cebrian/.cabal/bin/xmonad
</pre>
<p><strong>.xmobarrc</strong></p>
<pre class="brush: plain; title: ; notranslate">
Config { font = &quot;-*-Fixed-Bold-R-Normal-*-13-*-*-*-*-*-*-*&quot;
       , bgColor = &quot;black&quot;
       , fgColor = &quot;grey&quot;
       , position = TopW L 85
       , commands = [ Run Cpu [&quot;-L&quot;,&quot;3&quot;,&quot;-H&quot;,&quot;50&quot;,&quot;--normal&quot;,&quot;green&quot;,&quot;--high&quot;,&quot;red&quot;] 10
                    , Run Memory [&quot;-t&quot;,&quot;Mem: &lt;usedratio&gt;%&quot;] 10
                    , Run Swap [] 10
                    , Run Date &quot;%a %b %_d %Y %H:%M:%S&quot; &quot;date&quot; 10
                    , Run StdinReader
                    ]
       , sepChar = &quot;%&quot;
       , alignSep = &quot;}{&quot;
       , template = &quot;%StdinReader% }{ %cpu% | %memory% * %swap%    &lt;fc=#ee9a00&gt;%date%&lt;/fc&gt;&quot;
       }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2011/09/05/my-working-environment-with-xmonad/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Maximal clique enumeration using C++0x and the STL</title>
		<link>http://www.tonicebrian.com/2011/08/29/maximal-clique-enumeration-using-c0x-and-the-stl/</link>
		<comments>http://www.tonicebrian.com/2011/08/29/maximal-clique-enumeration-using-c0x-and-the-stl/#comments</comments>
		<pubDate>Mon, 29 Aug 2011 09:01:00 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[graph]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=211</guid>
		<description><![CDATA[Lately I&#8217;ve started to take a look at how parallelism is being done in a pure functional language like Haskell and their related technologies Haskell in the Cloud and Data Parallel Haskell. As a proof of concept and in order to better learn those techniques, I want to parallelize the Bron-Kerbosch algorithm that returns the [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve started to take a look at how parallelism is being done in a pure functional language like Haskell and their related technologies <a href="http://research.microsoft.com/en-us/um/people/simonpj/papers/parallel/remote.pdf" target="_blank">Haskell in the Cloud</a> and <a href="http://www.haskell.org/haskellwiki/GHC/Data_Parallel_Haskell" target="_blank">Data Parallel Haskell</a>. As a proof of concept and in order to better learn those techniques, I want to parallelize the <a href="http://en.wikipedia.org/wiki/Bron%E2%80%93Kerbosch_algorithm" target="_blank">Bron-Kerbosch algorithm</a> that returns the set of maximal <a href="http://en.wikipedia.org/wiki/Clique_%28graph_theory%29" target="_blank">cliques</a> in a graph.The Bron-Kerbosch algorithm in pseudocode is something like this:</p>
<pre class="brush: python; title: ; notranslate">
function bronKerbosch()
compsub = []
cand = V
not = []
cliqueEnumerate(compsub, cand, not)
</pre>
<p>and the <em>cliqueEnumerate</em> function in pseudo-code:</p>
<pre class="brush: python; title: ; notranslate">
function cliqueEnumerate(compsub, cand, not)
if cand = [] then
    if not = [] then
        Output compsub
else
    fixp = The vertex in cand that is connected to the greatest number of other vertices in cand
    cur_v = fixp
    while cur_v != NULL do
        new_not = All vertices in not that are connected to cur_v
        new_cand = All vertices in cand that are connected to cur_v
        new_compsub = compsub + cur_v
        cliqueEnumerate(new_compsub, new_cand, new_not)
        not = not + cur_v
        cand = cand - cur_v
        if there is a vertex v in cand that is not connected to fixp then
           cur_v = v
        else
           cur_v = NULL
</pre>
<p>This pseudocode is from the paper, <a href="http://www.sciencedirect.com/science/article/pii/S0743731509000082" target="_blank"><em>A scalable, parallel algorithm for maximal clique enumeration</em></a></p>
<p><br title="star, open" />I have written a first version of this algorithm in Haskell but, as a baseline and because I wanted to test the new features of the new C++0x standard, I&#8217;ve written this algorithm in C++ making extensive use of the STL and the lambdas. I forgot how verbose C++ is but the addition of the keyword <strong>auto</strong> and the lambdas has somehow alleviated it a little. </p>
<pre class="brush: cpp; title: ; notranslate">
void Graph::cliqueEnumerate(const vector&lt;int&gt;&amp; compsub,
                     vector&lt;int&gt; cand,
                     vector&lt;int&gt; cnot,
                     vector&lt;vector&lt;int&gt; &gt;&amp; result) const {

    // Function that answer whether the node is conected
    if(cand.empty()){
        if(cnot.empty()){
            // New clique found
            result.push_back(compsub);
        }
    } else{
        int fixp = findFixP(cand);
        int cur_v = fixp;

        while(cur_v != -1){
            vector&lt;int&gt; new_not;
            vector&lt;int&gt; new_cand;
            vector&lt;int&gt; new_compsub;

            // Auxiliar lambda function
            auto isConected =[cur_v,this](int x) {
                const vector&lt;int&gt;&amp; edges = this-&gt;getEdges(x);
                return find(edges.begin(), edges.end(), cur_v) != edges.end();
            }; 

            // Compose new vector
            // Avoid performance bottlenecks by reserving memory before hand
            new_compsub.reserve(compsub.size()+1);
            new_not.reserve(cnot.size());
            new_cand.reserve(cand.size());
            copy_if(cnot.begin(),cnot.end(),back_inserter(new_not),isConected);
            copy_if(cand.begin(),cand.end(),back_inserter(new_cand),isConected);
            copy(compsub.begin(), compsub.end(), back_inserter(new_compsub));
            new_compsub.push_back(cur_v);

            // Recursive call
            cliqueEnumerate(new_compsub, new_cand, new_not, result);

            // Generate new cnot and cand for the loop
            cnot.push_back(cur_v);
            cand.erase(find(cand.begin(),cand.end(),cur_v));

            // Last check
            auto v = find_if(cand.begin(),
                             cand.end(),
                             [fixp,this](int x) {
                                const vector&lt;int&gt;&amp; edges = this-&gt;getEdges(x);
                                return find(edges.begin(), edges.end(), fixp) == edges.end();
                             });

            // Obtain new cur_v value
            if(v != cand.end()) cur_v = *v;
            else break;
        }
    }
}
</pre>
<p>and the helper function <em>findFixP</em> is:</p>
<pre class="brush: cpp; title: ; notranslate">
int Graph::findFixP(vector&lt;int&gt; cand) const {
    vector&lt;int&gt; connections;
    connections.resize(cand.size());

    // This is necessary for the set_intersection function
    sort(cand.begin(),cand.end());

    // Auxiliar lambda function
    auto intersection = [&amp;cand, this](int x) -&gt; int {
        const vector&lt;int&gt;&amp; x_edges = this-&gt;getEdges(x);
        vector&lt;int&gt; intersection;

        set_intersection(x_edges.begin(), x_edges.end(),
                         cand.begin(), cand.end(),
                         back_inserter(intersection));
        return intersection.size();
    };

    // Create an auxiliar vector with the intersection sizes
    transform(cand.begin(),cand.end(),connections.begin(),intersection);

    // Find the maximum size and return the corresponding edge
    vector&lt;int&gt;::const_iterator it1, it2,itmax;
    int max = -1;
    itmax = cand.end();
    for(it1=cand.begin(),it2=connections.begin(); it1!=cand.end(); ++it1,++it2){
        if(max &lt; *it2){
            max = *it2;
            itmax = it1;
        }
    }
    if(itmax == cand.end()) return -1;
    else return *itmax;
    }
}
</pre>
<p>For this function my first attempt was to write it using the <em>std::max_element</em> function, but I was worried that since the function we pass isn&#8217;t a transformation of the data but a comparison function (<em>less</em>), I was worried that on each comparison the set_intersection would be computed redundantly on each step.</p>
<p>There can be, for sure, room for improvement (any C++ guru in the audience?), but I&#8217;m pretty satisfied with the obtained implementation. It reads almost as the pseudocode. I think this is because I first wrote the Haskell version and the C++ has the functional flavor in it. Would I write first the C++ version and there would be for sure lots of nasty loops and array indexes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2011/08/29/maximal-clique-enumeration-using-c0x-and-the-stl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Comparison of IDEs for Scala development</title>
		<link>http://www.tonicebrian.com/2011/05/16/comparison-of-ides-for-scala-development/</link>
		<comments>http://www.tonicebrian.com/2011/05/16/comparison-of-ides-for-scala-development/#comments</comments>
		<pubDate>Mon, 16 May 2011 08:30:49 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[ide]]></category>
		<category><![CDATA[intellij]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[sbt]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=185</guid>
		<description><![CDATA[Although all my coding is done using Vim for editing and console tools for compiling, IDEs are the best alternative for other tasks like debugging or refactoring code. Since I&#8217;m exploring the Scala ecosystem I&#8217;ve done some research about which IDE best suits my coding requirements. Those are: Unobtrusive SBT integration. As I said, I [...]]]></description>
			<content:encoded><![CDATA[<p>Although all my coding is done using <a href="http://www.vim.org/" target="_blank">Vim</a> for editing and console tools for compiling, IDEs are the best alternative for other tasks like debugging or refactoring code. Since I&#8217;m exploring the Scala ecosystem I&#8217;ve done some research about which IDE best suits my coding requirements. Those are:</p>
<ul>
<li>Unobtrusive SBT integration. As I said, I will use the IDE for debugging from time to time, and thus it should not interfere with the command line + Vim ecosystem.</li>
<li>The IDE must mix Java and Scala code in the project without any problem</li>
<li>Enable debugging of Scala applications</li>
<li>Provide refactoring of Scala code</li>
</ul>
<p>The IDEs under test will be <a href="http://www.eclipse.org/" target="_blank">Eclipse</a>, <a href="http://netbeans.org/index.html" target="_blank">Netbeans</a> and <a href="http://www.jetbrains.com/idea/index.html" target="_blank">IntelliJ</a></p>
<h2>Eclipse Helios (3.6.2)</h2>
<p>After downloading Eclipse, the first thing to do is to install the <a href="http://www.scala-ide.org/" target="_blank">Scala plugin</a> and the<a href="https://github.com/musk/SbtEclipsify" target="_blank"> SBT plugin</a>. The Scala plugin is installed into the IDE itself but the SBT plugin has to be added into the SBT plugins section in <em>project/plugins/YourProjectPlugins.scala</em>. Putting IDE information in my project&#8217;s build instructions is something I don&#8217;t like at all. The plugin needs that you add the trait <em>Eclipsify</em> to your project definition, so this goes against the &#8220;Unobtrusive SBT integration&#8221;. In summary, the installation needs that you put</p>
<pre class="brush: scala; title: ; notranslate">
 lazy val sbtEclipsify = &quot;de.element34&quot; % &quot;sbt-eclipsify&quot; % &quot;0.4.0&quot;
</pre>
<p>in your <em>project/plugins/YourProjectPlugins.scala </em>file and to add the import and mix the trait in your <em>project/build/TestProject.scala</em> file<em> </em></p>
<pre class="brush: scala; title: ; notranslate">
 i﻿mport sbt._
import de.element34.sbteclipsify._

class TestProject(info: ProjectInfo) extends DefaultProject(info)
                                     with Eclipsify
{
...
}
</pre>
<p>In order to create the Eclipse project files, just fire sbt, and perform</p>
<pre class="brush: bash; title: ; notranslate">
sbt
&gt; update
&gt; eclipse
</pre>
<p>Now we can open the project and it looks like:</p>
<p style="text-align: left;"><a href="http://www.tonicebrian.com/blog/wp-content/uploads/2011/05/Eclipse.png"><img class="aligncenter size-large wp-image-192" title="Scala project with Eclipse" src="http://www.tonicebrian.com/blog/wp-content/uploads/2011/05/Eclipse-300x224.png" alt="" width="300" height="224" /></a>Thinks that I miss:</p>
<ul>
<li>No console integration with SBT</li>
<li>Test are not recognized as such and thus, if you are debugging your unit tests you are out of luck.</li>
<li>Refactoring capabilities are very much limited (I was not able to find the simplest one, rename a class)</li>
</ul>
<h2>Netbeans (7.0)</h2>
<p>The first thing is to install the Scala support for Netbeans grabbing the plugin from <a href="http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=36598" target="_blank">here</a>. The <a href="https://github.com/remeniuk/sbt-netbeans-plugin" target="_blank">SBT plugin for Netbeans</a> includes a processor that allows you to create project skeletons within the sbt console. But the general functioning of the plugin is similar to the Eclipse one, you have to modify your project definition for running it. Follow instructions in <a href="https://github.com/remeniuk/sbt-netbeans-plugin" target="_blank">Running the plugin</a>.</p>
<p>The project looks like this in Netbeans.</p>
<p><a href="http://www.tonicebrian.com/blog/wp-content/uploads/2011/05/NetBeans-IDE-7.0-Scala.png"><img class="aligncenter size-medium wp-image-198" title="NetBeans IDE 7.0-Scala" src="http://www.tonicebrian.com/blog/wp-content/uploads/2011/05/NetBeans-IDE-7.0-Scala-300x235.png" alt="" width="300" height="235" /></a>Issues with Netbeans:</p>
<ul>
<li>Netbeans uses internally SBT for all the compilation tasks, so this is a plus.</li>
<li>Although you can run SBT commands with the console, they are detached from the whole IDE. For instance, you can run the test phase but the IDE won&#8217;t stop in the breakpoints.</li>
<li>And the other way round does not work either. If you Right-click in a test, Netbeans complains that some classes can not be found.</li>
<li>Refactoring is full supported and it can perform usual code modifications. Great!!</li>
</ul>
<h2>IntelliJIDEA (10.0.3 Community Edition)</h2>
<p>Again, first install the IDEA <a href="http://confluence.jetbrains.net/display/SCA/Scala+Plugin+for+IntelliJ+IDEA" target="_blank">Scala plugin</a> (can be downloaded going to <em>File-&gt;Settings-&gt;Plugins</em>). The <a href="https://github.com/mpeltonen/sbt-idea" target="_blank">SBT plugin </a>that generates an IDEA project from our SBT project is better than the previous ones. Although it can be used as a normal SBT plugin in case all our team were using the IntelliJ IDE, its main advantage is that it can be used as a SBT processor. SBT processors are complementary to SBT plugins, but they are invoked on a per user basis instead of a per project like plugins do. They are thus unobtrusive and leaves no IDE traces in our project definition. Just write</p>
<pre class="brush: bash; title: ; notranslate">

sbt

&gt; *sbtIdeaRepo at http://mpeltonen.github.com/maven/
&gt; *idea is com.github.mpeltonen sbt-idea-processor 0.4.0

&gt; update

&gt; idea
</pre>
<p>Now we have our project files in the directory. Screenshots of the IntelliJ code editing panels and debugging capabilities.</p>
<p style="text-align: left;"><a href="http://www.tonicebrian.com/blog/wp-content/uploads/2011/05/IntelliJ-IDEA-10.0.3-Scala.png"><img class="size-medium wp-image-201 aligncenter" title="IntelliJ IDEA 10.0.3-Scala" src="http://www.tonicebrian.com/blog/wp-content/uploads/2011/05/IntelliJ-IDEA-10.0.3-Scala-300x263.png" alt="" width="300" height="263" /></a> <a href="http://www.tonicebrian.com/blog/wp-content/uploads/2011/05/IntelliJ-IDEA-10.0.3-Debugging-Scala.png"><img class="size-medium wp-image-202 aligncenter" title="IntelliJ IDEA 10.0.3 - Debugging Scala" src="http://www.tonicebrian.com/blog/wp-content/uploads/2011/05/IntelliJ-IDEA-10.0.3-Debugging-Scala-300x210.png" alt="" width="300" height="210" /></a>So in general IntelliJ has all what I was looking for</p>
<ul>
<li>Unobtrusive SBT support by means of an SBT processor</li>
<li>Coding and refactoring capabilities for the Scala and Java language</li>
<li>Debugging of full Scala projects or just one unit test</li>
<li>Full SBT console integration in the IDE.</li>
</ul>
<h2>Conclusion</h2>
<p>So, the winner is clearly the IntelliJ IDE and a second place for Netbeans. I&#8217;ve never liked Eclipse and this time it was no exception.</p>
<p>Just one caveat. As I said I will use the IDE just a 10 percent of my time and thus this research has not been exhaustive. I fired up the three IDEs, followed basic instructions for Scala and SBT support and when things did not work as expected I&#8217;ve done a minimal work trying to fix it. It does not pay for me. So, If you think that I was wrong in one of the IDEs or that just a little tweak could recover one of the evaluations, I will be glad hearing your comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2011/05/16/comparison-of-ides-for-scala-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Scala project step-by-step</title>
		<link>http://www.tonicebrian.com/2011/05/02/simple-scala-project-step-by-step/</link>
		<comments>http://www.tonicebrian.com/2011/05/02/simple-scala-project-step-by-step/#comments</comments>
		<pubDate>Mon, 02 May 2011 09:30:24 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[jenkins]]></category>
		<category><![CDATA[sbt]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[scalatests]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=164</guid>
		<description><![CDATA[BE AWARE!!! This post refers to an old SBT version, check the new one &#160; Recently I have started a project that will be coded in Scala. Here I leave some instructions for setting up the the scala project that uses sbt for project management and creates unit tests with scalatests. This entry follows the [...]]]></description>
			<content:encoded><![CDATA[<h3><strong>BE AWARE!!! This post refers to an old SBT version, <a href="http://www.tonicebrian.com/2012/02/15/scala-project-template-sbt-0-11-2/">check the new one</a></strong></h3>
<p>&nbsp;</p>
<p>Recently I have started a project that will be coded in Scala. Here I leave some instructions for setting up the the scala project that uses <strong>sbt</strong> for project management and creates unit tests with scalatests. This entry follows the structure of <a href="http://www.paulbutcher.com/2010/04/scala-2-8-0-rc1-sbt-and-scalatest-step-by-step/" target="_blank">this post</a> but introduces some changes and improvements.</p>
<ol>
<li><a href="http://code.google.com/p/simple-build-tool/wiki/Setup" target="_blank">Install sbt</a></li>
<li>Create a new project
<pre class="brush: bash; title: ; notranslate">
$ mkdir test-project
$ cd test-project/
$ sbt
Project does not exist, create new project? (y/N/s) y
Name: TestProject
Organization: com.example
Version [1.0]:
Scala version [2.7.7]: 2.9.0
sbt version [0.7.4]: 0.7.7
</pre>
</li>
<li>First we need to install a sbt plugin that collects test results and creates a xUnit report for using in a Continuous Integration Server like Jenkins. Details of that plugin can be found <a href="http://henkelmann.eu/2010/11/14/sbt_hudson_with_test_integration" target="_blank">here</a>. Create the file <em>project/plugins/TestProjectPlugins.scala</em> that instructs sbt to download the junit_xml_listener plugin.
<pre class="brush: scala; title: ; notranslate">
import sbt._

class TestProjectPlugins(info: ProjectInfo) extends PluginDefinition(info) {
    val repo = &quot;Christoph's Maven Repo&quot; at &quot;http://maven.henkelmann.eu/&quot;
    val junitXml = &quot;eu.henkelmann&quot; % &quot;junit_xml_listener&quot; % &quot;0.2&quot;
}
</pre>
</li>
<li>Once we have the configuration for getting the plugin, create the project dependencies and include the new listener into the available ones by overriding the defaults. So, create a build configuration file in <em>project/build/TestProject.scala </em>like:
<pre class="brush: scala; title: ; notranslate">
import sbt._
import eu.henkelmann.sbt.JUnitXmlTestsListener

class TestProject(info: ProjectInfo) extends DefaultProject(info) {
   val scalatest = &quot;org.scalatest&quot; %% &quot;scalatest&quot; % &quot;1.6.1&quot; % &quot;test&quot;

   //create a listener that writes to the normal output directory
   def junitXmlListener: TestReportListener = new JUnitXmlTestsListener(outputPath.toString)
   //add the new listener to the already configured ones
   override def testListeners: Seq[TestReportListener] = super.testListeners ++ Seq(junitXmlListener)
}
</pre>
</li>
<li>Now, we have the project setup in place. Let&#8217;s write some classes and tests in order to check that everything is OK. First create the class under test in <em>src/main/scala/Calc.scala</em>
<pre class="brush: scala; title: ; notranslate">
package com.example

object Calc {
    def add(x:Int, y:Int) : Int = x + y
}
</pre>
</li>
<li>Now, create a test in <em>src/test/scala/CaltTest.scala</em> that assures that the class is working as expected
<pre class="brush: scala; title: ; notranslate">
package com.example.test

import com.example.Calc
import org.scalatest.Suite

class CalcTest extends Suite {

    def testAddition() {
        assert(4 === Calc.add(2,2))
    }
}
</pre>
</li>
<li>Now just test that tests pass by doing
<pre class="brush: bash; title: ; notranslate">
sbt clean-plugins
sbt clean
sbt update
sbt test
</pre>
<p>you should see something like this:</p>
<pre class="brush: bash; title: ; notranslate">
$ sbt test
[info] Building project test 1.0 against Scala 2.9.0
[info]    using TestProject with sbt 0.7.7 and Scala 2.7.7
[info]
[info] == compile ==
[info]   Source analysis: 0 new/modified, 0 indirectly invalidated, 0 removed.
[info] Compiling main sources...
[info] Nothing to compile.
[info]   Post-analysis: 3 classes.
[info] == compile ==
[info]
[info] == test-compile ==
[info]   Source analysis: 0 new/modified, 0 indirectly invalidated, 0 removed.
[info] Compiling test sources...
[info] Nothing to compile.
[info]   Post-analysis: 1 classes.
[info] == test-compile ==
[info]
[info] == copy-test-resources ==
[info] == copy-test-resources ==
[info]
[info] == copy-resources ==
[info] == copy-resources ==
[info]
[info] == test-start ==
[info] == test-start ==
[info]
[info] == com.example.test.CalcTest ==
[info] CalcTest:
[info] - testAddition
[info] - testAdditionWithJavaObject
[info] == com.example.test.CalcTest ==
[info]
[info] == test-complete ==
[info] == test-complete ==
[info]
[info] == Test cleanup 1 ==
[info] Deleting directory /tmp/sbt_b7e36ab4
[info] == Test cleanup 1 ==
[info]
[info] == test-finish ==
[info] Passed: : Total 2, Failed 0, Errors 0, Passed 2, Skipped 0
[info]
[info] All tests PASSED.
[info] == test-finish ==
[info]
[info] == test-cleanup ==
[info] == test-cleanup ==
[info]
[info] == test ==
[info] == test ==
[success] Successful.
[info]
[info] Total time: 1 s, completed 24-ago-2011 15:40:26
[info]
[info] Total session time: 2 s, completed 24-ago-2011 15:40:26
[success] Build completed successfully.
</pre>
</li>
</ol>
<p>The test reports are located in <em>target/scala_*/test-reports/*.xml. </em>I have setup a Mercurial project with all this code for fast start up, check it out <a href="https://bitbucket.org/ancechu/sbt-scalatests-example" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2011/05/02/simple-scala-project-step-by-step/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>People I will closely follow in 2011</title>
		<link>http://www.tonicebrian.com/2010/11/29/people-i-will-closely-follow-in-2011/</link>
		<comments>http://www.tonicebrian.com/2010/11/29/people-i-will-closely-follow-in-2011/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 09:00:32 +0000</pubDate>
		<dc:creator>tonicebrian</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[people]]></category>
		<category><![CDATA[research]]></category>

		<guid isPermaLink="false">http://www.tonicebrian.com/?p=130</guid>
		<description><![CDATA[No one works in isolation. Everybody is looking for inspiration, ideas or exemplifying careers in his field. Specially in the technological field, we stand on the shoulders of giants. Those who follow are my giants for the next year, they are programmers, researchers or professors and they are working on one field of interest to [...]]]></description>
			<content:encoded><![CDATA[<p>No one works in isolation. Everybody is looking for inspiration, ideas or exemplifying careers in his field. Specially in the technological field, <em>we stand on the shoulders of giants</em>. Those who follow are my giants for the next year, they are programmers, researchers or professors and they are working on one field of interest to me. Here they are:</p>
<div id="attachment_132" class="wp-caption alignright" style="width: 132px"><a href="http://lemire.net"><img class="size-full wp-image-132  " title="Daniel Lemire" src="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/profile2008_152.jpg" alt="" width="122" height="122" /></a><p class="wp-caption-text">Daniel Lemire</p></div>
<p><a href="http://lemire.me/blog/">Daniel Lemire</a> is a Canadian university professor working in the field of Recommender Systems. I first heard about him when researching high performance recommender systems I stumbled upon his simple yet effective <a href="http://en.wikipedia.org/wiki/Slope_One">Slope One</a> recommender algorithm. However, lately he has been actively discussing in his blog about the inner workings of the scientific community, the peer review process and the validity of the University model as the best way to disseminate scientific knowledge in an age with zero costs for accessing information. I find those posts very stimulating.</p>
<div id="attachment_134" class="wp-caption alignleft" style="width: 117px"><a href="http://www.inference.phy.cam.ac.uk/mackay/"><img class="size-full wp-image-134" title="David MacKay" src="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/DavidMacKayC150.jpg" alt="" width="107" height="120" /></a><p class="wp-caption-text">David MacKay</p></div>
<p><a href="http://www.inference.phy.cam.ac.uk/mackay/">David MacKay</a> is a professor at the Inference Group in the University of Cambridge. His book about <a href="http://www.inference.phy.cam.ac.uk/mackay/itila/">Information Theory</a> is one of the best written ones I have read. It exposed me to <a href="http://en.wikipedia.org/wiki/Gaussian_process">Gaussian Processes</a> in a clear and understandable way for the first time. But not only for his research quality, David is remarkable because is a professor that does not live in his ivory tower. He is able to apply his research to help the impaired with the <a href="http://www.inference.phy.cam.ac.uk/dasher/">Dasher project</a>. Data mining and information theory for the greater good. And as an extra bonus his interest on tackling the global warming from a <a href="http://www.withouthotair.com/">scientific point of view</a> is very inspiring and necessary in an age when corporations dictate agenda. And all his publications freely accessible to everyone.</p>
<div id="attachment_138" class="wp-caption alignright" style="width: 130px"><a href="http://www.cs.berkeley.edu/~jordan/"><img class="size-full wp-image-138" title="Michael I. Jordan" src="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/jordan_small.jpg" alt="" width="120" height="180" /></a><p class="wp-caption-text">Michael I. Jordan</p></div>
<p><a href="http://www.cs.berkeley.edu/~jordan/">Michael I. Jordan</a> is a difficult search term in the Internet <img src='http://www.tonicebrian.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . He is a professor in Berkeley working on machine learning and one of the first proponents of <a href="http://www.amazon.com/gp/product/0262600323?ie=UTF8&amp;tag=tonicebrianco-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0262600323">Bayesian Networks</a><img style="border: none !important; margin: 0px !important;" src="http://www.assoc-amazon.com/e/ir?t=tonicebrianco-20&amp;l=as2&amp;o=1&amp;a=0262600323" border="0" alt="" width="1" height="1" /> as learning models. Although I don&#8217;t know his work very well, a friend, whose opinion I value a lot, recommended him as the <em>Midas of research</em>. Everything he publishes becomes a hit after a couple of years. So a sure bet to ride.</p>
<p><a href="http://measuringmeasures.com/"></a></p>
<div id="attachment_141" class="wp-caption alignleft" style="width: 154px"><a href="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/brad-blog.jpg"><img class="size-full wp-image-141" title="Bradford Cross" src="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/brad-blog.jpg" alt="" width="144" height="144" /></a><p class="wp-caption-text">Bradford Cross</p></div>
<p><a href="http://measuringmeasures.com/">Bradford Cross</a> is the only non academic in this list. He is co-founder and head of research of <a href="http://flightcaster.com/">FlightCaster</a>, a small startup that predicts flight delays using Statistical Learning techniques. He presents the right balance between engineering and research that appeals to me the most. He can write posts about using Clojure for <a href="http://measuringmeasures.com/blog/2010/11/8/mining-the-web-with-clojure.html">Mining the web</a> or using it for managing <a href="http://measuringmeasures.com/blog/2009/12/16/flightcaster-supports-clojure.html">Hadoop and Cascade instances</a> or write excellent <a href="http://measuringmeasures.com/blog/2010/3/12/learning-about-machine-learning-2nd-ed.html">posts</a> about the best way to self-learn Statistical Learning Theory.</p>
<p><a href="http://yann.lecun.com/"></a></p>
<div id="attachment_146" class="wp-caption alignright" style="width: 132px"><a href="http://yann.lecun.com/"><img class="size-full wp-image-146" title="Yann LeCun" src="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/ylc-thumb.jpeg" alt="" width="122" height="161" /></a><p class="wp-caption-text">Yann LeCun</p></div>
<p><a href="http://yann.lecun.com/">Yann LeCun</a> and <a href="http://www.cs.toronto.edu/~hinton/">Geoffrey Hinton</a> are two researchers that started in the early 90&#8242;s doing work on Neural Networks.  If you have taken any course on Neural Networks you probably have seen mentioned the 10 digit character recognition dataset and how NN are used for learning it. This dataset was compiled by LeCun. In this decade, they have realized the limitations of the Neural Network architectures and they are now working in a new area of Machine Learning called <a href="http://deeplearning.net/">Deep Learning</a>. In deep learning architectures, the learning agents are chained in layers that work with low level data to provide information to upper layers, which in time are using this information as low level input. The ambitious goal is to generate true Artificial Intelligence, so worth checking if they succeed or not.</p>
<div id="attachment_152" class="wp-caption alignleft" style="width: 160px"><a href="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/juergen2010genova110+58.gif"><img class="size-thumbnail wp-image-152" title="Jürgen Schmidhuber" src="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/juergen2010genova110+58-150x110.gif" alt="" width="150" height="110" /></a><p class="wp-caption-text">Jürgen Schmidhuber</p></div>
<div id="attachment_153" class="wp-caption alignleft" style="width: 160px"><a href="http://www.hutter1.net/"><img class="size-thumbnail wp-image-153" title="Marcus Hutter" src="http://www.tonicebrian.com/blog/wp-content/uploads/2010/11/MarcusHutter-150x150.jpg" alt="" width="150" height="150" /></a><p class="wp-caption-text">Marcus Hutter</p></div>
<p><a href="http://www.idsia.ch/~juergen/">Jürgen Schmidhuber</a> and <a href="http://www.hutter1.net/">Marcus Hutter</a>. Hutter was working under the supervision of the Schmidhuber in a <a href="http://www.idsia.ch/~juergen/unilearn.html">Theory of Universal Learning Machines</a> that tries to unify Algorithmic Learning Theory with Reinforcement Learning. As the name points, this theory aims at building a universal problem solver and thus true AI. <a href="http://www.amazon.com/gp/redirect.html?ie=UTF8&amp;location=http%3A%2F%2Fwww.amazon.com%2Fs%3Fie%3DUTF8%26tag%3Dwwwcanoniccom-20%26index%3Dblended%26link_code%3Dqs%26field-keywords%3Duniversal%2520artificial%2520intelligence%26sourceid%3DMozilla-search&amp;tag=tonicebrianco-20&amp;linkCode=ur2&amp;camp=1789&amp;creative=390957">Marcus&#8217; book</a><img style="border: none !important; margin: 0px !important;" src="https://www.assoc-amazon.com/e/ir?t=tonicebrianco-20&amp;l=ur2&amp;o=1" border="0" alt="" width="1" height="1" /> has been sitting in my reading pile for a long time. It is a difficult read because the book rapidly moves into layers of abstraction when it is supposed to be explaining learning algorithms, but anyway I feel a strange attraction to this book and I will surely read it in the future.</p>
<p>So this is my Hall of Fame for 2011. Lots of reading and learning.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.tonicebrian.com/2010/11/29/people-i-will-closely-follow-in-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

