<?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>jfrank &#187; groovy</title>
	<atom:link href="http://www.joshuafrankamp.com/blog/category/groovy/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joshuafrankamp.com/blog</link>
	<description>technology and some random stuff</description>
	<lastBuildDate>Wed, 04 Jan 2012 20:29:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>RapidMiner and Machine Learning</title>
		<link>http://www.joshuafrankamp.com/blog/rapidminer-and-machine-learning/</link>
		<comments>http://www.joshuafrankamp.com/blog/rapidminer-and-machine-learning/#comments</comments>
		<pubDate>Sun, 23 Jan 2011 07:54:56 +0000</pubDate>
		<dc:creator>jfrank</dc:creator>
				<category><![CDATA[groovy]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://www.joshuafrankamp.com/blog/?p=205</guid>
		<description><![CDATA[You know what this picture tells me?

It tells me that BAC, KEY, MI, RF, SNV, and STI are related. They&#8217;re all acronyms, yes, but more than that. They are all banking stock symbols. The node that the arrow points to contains these values. All banks. The nodes on either side contain exclusively real estate holding [...]]]></description>
			<content:encoded><![CDATA[<p>You know what this picture tells me?</p>
<p><a href="http://www.joshuafrankamp.com/blog/wp-content/uploads/2011/01/graph_lg.png"><img title="graph_sm" src="http://www.joshuafrankamp.com/blog/wp-content/uploads/2011/01/graph_sm.png" alt="" width="201" height="187" /></a></p>
<p>It tells me that BAC, KEY, MI, RF, SNV, and STI are related. They&#8217;re all acronyms, yes, but more than that. They are all banking stock symbols. The node that the arrow points to contains these values. All banks. The nodes on either side contain exclusively real estate holding companies and home builders respectively.</p>
<p>This puts a huge grin on my face.</p>
<p>If you&#8217;ve talked to me in the last several months, I&#8217;ll have probably mentioned at some point that I&#8217;ve been learning some machine learning concepts. I&#8217;ve been watching and working through the examples in the Stanford machine learning <a href="http://see.stanford.edu/see/courseinfo.aspx?coll=348ca38a-3a6d-4052-937d-cb017338d7b1">course by Andrew Ng</a>. On the one hand, the course is excellent. Andrew clearly knows his stuff and teaches toward underlying theory and principle. His goals are exactly how I like to approach a new area of study; always asking why not how. The concepts are compelling but on the other hand the math is difficult for me and it is lacking the kind of &#8220;proof is in the pudding&#8221; mentality that I&#8217;m used to as a programmer. I decided that I also need to approach this topic from the practical side. I&#8217;ve just discovered <a href="http://rapid-i.com">RapidMiner</a> and have been playing with it recently.</p>
<p>My chosen problem set is stock data. I love the uncertainty inherent in the market, its a mass of data, action and reaction. One problem (an easy one to start with) that I&#8217;ve always wanted to work on is stock correlation. Simply put, stocks that are similar move together. If you have two businesses that are similar in industry and size, they will likely move together as they have similar economic environment. News that affects one is much more likely to affect the other than a third unrelated company in another industry. This relationship can be coaxed out of the data. For each stock, you should be able to calculate a web of close &#8220;neighbors&#8221; that move similarly, and moving out from there you may approach another &#8220;neighborhood&#8221; of related stocks. In machine learning this problem could be approached as a time series or as clustering. Since we don&#8217;t know the labels (names of the clusters so to speak) it&#8217;s not classification.</p>
<p><a href="http://www.joshuafrankamp.com/blog/wp-content/uploads/2011/01/folder.png"><img title="folder" src="http://www.joshuafrankamp.com/blog/wp-content/uploads/2011/01/folder.png" alt="" width="381" height="414" /></a></p>
<p>After many false starts, I grabbed some stock data and loaded it into RM with the built in jdbc tools they have. I then selected stocks for the last two years without missing data points on days where volume was greater than zero and pulled the set into a hierarchical clustering algorithm. The hierarchical clusterer uses an internal simpler one level cluster (kmeans) and applies it it recursively and in parallel. I also had some promising results with a correlation matrix which showed for example that INTC (Intel) and MU (Micron) are related much more closely than MU and KFT (Kraft).</p>
<p>Its great to be able to test out some of the things that I&#8217;ve been learning about in an environment that lets me try a lot of things in a relatively short amount of time. Up next: Better clustering algorithms, and using class labels from my clustering to train a model for prediction.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshuafrankamp.com/blog/rapidminer-and-machine-learning/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>a groovy google calendar</title>
		<link>http://www.joshuafrankamp.com/blog/a-groovy-google-calendar/</link>
		<comments>http://www.joshuafrankamp.com/blog/a-groovy-google-calendar/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 08:00:19 +0000</pubDate>
		<dc:creator>jfrank</dc:creator>
				<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.joshuafrankamp.com/blog/?p=37</guid>
		<description><![CDATA[I pushed some buttons and opened up part of my svn repository to share the code from my earlier example:
https://www.joshuafrankamp.com/svn/incubator/simpleGroovyCalendar/src/
I read up on groovy&#8217;s site, about google data support but I actually couldn&#8217;t find the referenced code anywhere&#8230; I&#8217;d like to learn more about &#8216;use&#8217; and other aop/mixin techniques.
]]></description>
			<content:encoded><![CDATA[<p>I pushed some buttons and opened up part of my svn repository to share the code from my earlier example:</p>
<p><a href="https://www.joshuafrankamp.com/svn/incubator/simpleGroovyCalendar/src/">https://www.joshuafrankamp.com/svn/incubator/simpleGroovyCalendar/src/</a></p>
<p>I read up on groovy&#8217;s site, about <a href="http://groovy.codehaus.org/Google+Data+Support">google data support</a> but I actually couldn&#8217;t find the referenced code anywhere&#8230; I&#8217;d like to learn more about &#8216;use&#8217; and other aop/mixin techniques.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshuafrankamp.com/blog/a-groovy-google-calendar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>groovy code needs viagra (it keeps shrinking)</title>
		<link>http://www.joshuafrankamp.com/blog/groovy-code-needs-viagra-it-keeps-shrinking/</link>
		<comments>http://www.joshuafrankamp.com/blog/groovy-code-needs-viagra-it-keeps-shrinking/#comments</comments>
		<pubDate>Sun, 30 Nov 2008 05:46:43 +0000</pubDate>
		<dc:creator>jfrank</dc:creator>
				<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.joshuafrankamp.com/blog/?p=32</guid>
		<description><![CDATA[The other day I was talking to some coworkers about a groovy method that I had refactored. It was one that I had pulled the guts out because I needed two forms of the same data. So I added getDaySizeList which contains most of the logic, but I still needed to get a rollup sum [...]]]></description>
			<content:encoded><![CDATA[<p>The other day I was talking to some coworkers about a groovy method that I had refactored. It was one that I had pulled the guts out because I needed two forms of the same data. So I added getDaySizeList which contains most of the logic, but I still needed to get a rollup sum from getDuration for another part of the application.</p>
<p>I knew groovy collections supported an &#8220;each&#8221; function that takes a closure. Groovy syntax allows for omission of parentheses when there is at least one argument, so it can look like this:</p>
<p>myCollection.each{ <em>closure</em> } not myCollection.each({ <em>closure</em> })</p>
<p>it would also allow you do things like:</p>
<p>myCollection.add object  (look no parens!)</p>
<p>which creeps me out right now, so I&#8217;m not going to think about it.</p>
<p>I digress&#8230; Here is my method, that I thought was a short implementation:</p>
<pre>int getDuration(){
	int hours = 0;
	getDaySizeList().each{dayHourMap -&gt; hours += dayHourMap.hours}
	return hours
}</pre>
<p>I was excited, no visible loop, just something to do &#8220;each&#8221; for the members of the collection, drilling down into the hours property of the map in each collection item, summing them into a waiting &#8220;hours&#8221; int, then returning it. Slick.</p>
<p>Barney then replied that I should have (duh) used the sum closure-taking builtin in groovy&#8230; which turns the above method into this:</p>
<pre>int getDuration(){
	return getDaySizeList().sum{it.hours}
}</pre>
<p>&#8220;it&#8221; is the default single argument to the closure.  You can see I only kept the end of the closure, to the right of the former +=.</p>
<p>Magic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshuafrankamp.com/blog/groovy-code-needs-viagra-it-keeps-shrinking/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Vacation ala Google Calendar</title>
		<link>http://www.joshuafrankamp.com/blog/vacation-ala-google-calendar/</link>
		<comments>http://www.joshuafrankamp.com/blog/vacation-ala-google-calendar/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 06:03:30 +0000</pubDate>
		<dc:creator>jfrank</dc:creator>
				<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://www.joshuafrankamp.com/blog/?p=23</guid>
		<description><![CDATA[I&#8217;ve been building a railo-hibernate-groovy fto (flex time off) vacation app in my &#8220;for fun&#8221; time at work and home. The goal is to get an application that can replace the arcane paper based system that my company currently uses.
I have most of the front end of the app done, but I needed a good [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been building a railo-hibernate-groovy fto (flex time off) vacation app in my &#8220;for fun&#8221; time at work and home. The goal is to get an application that can replace the arcane paper based system that my company currently uses.</p>
<p>I have most of the front end of the app done, but I needed a good calendar view to show the events. I decided I would use google calendars, so I wrote a little calender wrapper. Here is a snippet of the test driver class. GoogleCalendar is mine, the *Entry items are part of the api.</p>
<p>This is groovy code, not java&#8230;</p>
<pre>//omitting calendar name assumes the default users calendar
GoogleCalendar gc1 = new GoogleCalendar(username,password)
// adds an event 3 days in duration starting 3 days from now, with title and desc here
CalendarEventEntry entry = gc1.insertEvent("DELETE ME FTO","FTO",new Date()+3,new Date()+6)
gc1.deleteEvent(entry)

println("List of users owned calendars:")
for (CalendarEntry cal : gc1.getCalendars()) {
	println("\t" + cal.getTitle().getPlainText());
}

//this demonstrates the mixed constructor that is allowed in the groovy wrapper.
//i define a calendar name, and it looks it up and sets that as the calendar to work with
GoogleCalendar gc2 = new GoogleCalendar(username,password,"Web Services Team")
//adds an event 3 days in duration starting 2 days from now, with title and desc here on the WST calendar
gc2.insertEvent("Joshua FTO","FTO",new Date()+2,new Date()+5)</pre>
<p>Such fun.</p>
<p>This will allow me to have a nice visual display of everyone&#8217;s scheduled vacation calendar, and have an easy way to share it with other apps/users such as our wiki.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshuafrankamp.com/blog/vacation-ala-google-calendar/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

