[Home]RoboRumble/LRP

Robo Home | RoboRumble | Changes | Preferences | AllPages

Linear Regression Plot

The excellent Java Applet by Kawigi plotting a bots RoboRumble performance.

See the plot for a given bot by clicking the "graph" link from the rankings table: /CurrentRankings

Some interesting graphs:



May seems a stupid question, but, what is the blue line, and the 4 quadrants?
I can guess that on the X axis there is the expected score and on the Y the difference between expected and actual score.
But what the blue line is supposed to mean? -- Simonech

You are correct on the X axes and Y axes scales - the Blue line is a best-fit straight line through the data. if it has a negative gradient slopes downhill (left to right) I believe it would indicate that the movement for the bot is stronger than the gun. A positive gradient would indicate a good gun is being let down by relativley poor movement. -- Paul

I just added some labels to the axes, maybe it will make it more clear, maybe not. You'll notice that the range on the problem bot index is 100, even though for most pairings that's absolutely impossible (if you're expected to get 50% of the score against a certain bot, you won't have a PBI of 100 against them unless you get 150% of the total score). But it's still theoretically possible, if DT got shut out by ad.last.Bottom, for instance. -- Kawigi

Again, great work. Maybe you could also print the line's equation, or just the slope factor. Also, it would be nice if the dots were color coded from red (PBI<0) to green (PBI>0). A white background would also look better, imho. ;) -- ABC

The background is white on my screen. (Explorer Mac). PBI is coded as the amplitude already, in'it? I would like to see a figure of how many pairings in the mouse over details. -- PEZ

Yeah, PBI is already > 0 if it's above the horizontal gray line and < 0 if it's below the line. Maybe if they were color coded based on your actual %score against them (you'd get a sort of diagonal rainbow effect I think). The background isn't set right now, so the white or gray is a browser default. I think maybe setting the background to white and have a gray border may be the way to go when I get more time for tweaking (PEZ and I got it working when PEZ should have been sleeping and I should have been writing a paper, so I need to get back to that). Printing the slope and other interesting statistical data is still quite possible. I thought it might be interesting to put an extra pair of horizontal line representing your standard deviation range. -- Kawigi

Here i am back from vacations, and u people been quite busy, ain't? Great job with that LRP, Kawigi! I just didn't understood Paul's explanation 'bout the blue line gradient (it doesn't means that i doubt about it, i have faith on master's words). Can't u explain the math basis on it? -- Axe

It's not really based on maths. Simply put, an uphill slope (+ve gradient) means you are doing better against poor bots than good bots, a -ve slope is the other way round. Movement is more important against good bots, and targetting against poor bots, so you can tell which is better in your bot by looking at the line. It's not maths, it just happens to be how the bots are. -- Tango

Gahh, edit conflict! Kawigi if you're interested in standard deviation formulas for linear regression:

slope_deviation = sqrt((n * sum(y^2) - (sum(y))^2 - a * (n * sum(xy) - sum(x) * sum(y))) / (n-2) * (n * sum(x^2) - (sum(x))^2))

and the error on the b intercept, although it's not of any use:

intercept_deviation = slope_deviation * sqrt(sum(x^2) / n)

-- Vuen

Actually it was a conscious descision to not include the std dev lines. Kawigi and I thought the graph was crowded enough as it is. -- PEZ

Ah, yeah, that's a good idea. I don't really see how they are of any use anyway, because it would basically be saying the same thing as the specialization index. Anyway, I threw together a submit page to view your bot's graph, but the wiki doesn't allow me to put a form here. This is the html. Is it possible to get this to work on a wiki page?

 <form method="get" action="http://rumble.robowiki.net/lrp" enctype="application/x-www-form-urlencoded">
  Enter your bot's name and version number: <input type="text" name="name" size="20"><br>
  Enter the rumble type (such as roborumble or minirumble): <input name="game" size="20" value="roborumble"><br>
  <input type="submit" value="View LRP" name="submit">
 </form>

-- Vuen

Not on the wiki. But it could be a html page of it's own. Upload it to your download account (or anywhere on the web I guess) and it should work. However, the plan in my and Kawigi's head is to add a link to the Ranking table and/or the Details sheet. I think it will be easier to use.

Axe, even if you would have just blinked you would have missed it. Kawigi put the applet together in a few minutes. The thing that took time was to give it the context it needs to be allowed to read the details sheet. (It actually parses the raw html of that page! Maybe not the most stable way to do it but it works for now. =)

-- PEZ

Hey, are you calling my XMLReader that I wrote a year and a half ago unstable? j/k - it crashes on <?xml version="1.0" encoding="UTF-8"?> because I never told it about question-mark-y tags.

Maybe it would make sense to put Vuen's form on the lrp script? -- Kawigi

I would never call your XMLReader unstable of course. =) I meant that it could be sensitive to changes in the structure of the details sheet table. Yes, indeed put that form on the lrp page. But I still think it should be something you can click open directly from either the details sheet or the ranking table. Can an applet read the html on the page it is living? Then it would make sense to place the applet on the details sheet itself. -- PEZ

It could certainly be made to read the page it is on, although I don't remember if it can find out the exact URL or not (I suspect it can). I just added a modified version of Vuen's form on http://rumble.robowiki.net/lrp so you can try it out. I don't think the form is in any way a substitute from having a link on the rankings table, although putting it on the details sheet table might be space consuming. -- Kawigi

Nice! When talked about reading the page the applet is on I meant the downloaded html. I wouldn't like if opening the details page would request the page twice. I'll look at adding those links to the ranking table. --- PEZ

Some of you might have already noticed. But now the rankings table holds a column of links to each bots LRP graph. Vuen's plot form still is very usable when you want to plot an old version of a bot. -- PEZ

I would like to have the plotted bots name and version number visible in the graph. There's room for it in the upper right I think. -- PEZ

I can't see the graphs, I get a grey rectangle and in the bottomline of IE the error: 'load: class LinearRegressionPlot? not found'. Any clues ? -- GrubbmGait

Are you using the links on the rankings table or are you clicking links on this page? The rumble is temporarily running on my pc at home... If you haven't already, try the links on the rankings table. I have updated the servlet to use the temporary location of the LRP applet. -- PEZ

I am using the ones on the rankings table. -- GrubbmGait

No real clue then... Maybe you can try with FireFox? You won't regret trying that web browser even if it doesn't help you see those graphs. -- PEZ

It is not a big deal, I know I have an awfully imbalanced bot with a Specialization Index of approx 270 (v 0.7 Mini). It probably will be solved when the final server is up. B.t.w, do you know of any bot with a higher Specialization Index ? Maybe a ranking of the 10 most worse SI's would be nice ;-) -- GrubbmGait


Is there any chance that the LRP graphs will be active again in the near future? --GrubbmGait


I've decided to devote 1 hour of my computer's processing time every 2 days to calculate LRP graphs.

Here's a sneak peek of what's going to be uploaded to my server:

LRP graph for voidious.Dookious 1.462:

--Nfwu

Uploads complete:

http://lrp.xm.com/lrp/BotNameHere 0.1.jpg

Rolling over the dots displays the name of the bot, actual score, PBI, and number of battles.

Something tells me that several improvements can be made.

  1. Bigger Graphs
  2. Bigger Dots
  3. Color coded dots maybe?

What do you guys think? --Nfwu

The link on that page is not working for me in either FireFox or Safari (Mac OS X). Could you post a link to a bot/version page? (I could deduce the filename format from there...) Anyway, I'd really love to see some in depth statistics like this for the RoboRumble ratings. I might need some explanation on exactly what it means, though =) -- Voidious

Sure:

http://lrp.xm.com/lrp/voidious.Dookious 1.462.jpg
There are some explainations on the page itself.

Dookious' graph means that Dookious is doing very slightly worse against top bots compared to bottom bots.

Quoting Paul,

You are correct on the X axes and Y axes scales - the Blue line is a best-fit straight line through the data. if it has a negative gradient slopes downhill (left to right) I believe it would indicate that the movement for the bot is stronger than the gun. A positive gradient would indicate a good gun is being let down by relativley poor movement. -- Paul

If Paul's assumptions are correct (they usually are =) ) the graph could also mean Dookious has just about a gun and movement for it's raiting, and the movement is only very slightly less effective than it's gun. -- Nfwu

My host's FTP server was complaining about 900+ files in one directory, so here is a new graph format. The mouse-over functionality is gone (look up about 50k per bot), but the graphs are now bigger (600x600), the dots are also bigger (5 pixels radius), and everything is in a nice picture (JPG format). I've also chopped down the y axis from -50 to +50 PBI to -30 to +30 PBI. Just ask for anything else you'll like to see (like linear regression, SD, or whatever). --Nfwu

Cool, thanks for the explanations. It'd be neat if we could have these graphs linked to from the RoboRumble rating pages (I know they used to link LRPs...), either by linking to your server or running the scripts from the RoboRumble server - wouldn't you say? Out of curiosity, what language did you write it in? -- Voidious

I wanted to write this in Java, but it didn't have the automation functions that I wanted. I wrote it in an automation langauge - AutoIt?(http:\\www.autoitscript.com\). The source is biased towards my computer setup (like, built-in location of FTP client, Vector to JPG converter), but can be changed if someone wants it. --Nfwu

Neat, I see the line is already being draw on top of the dots, any way the axis can join it(as the dots are big enough they show through, and the axis is used to reference the line). --Chase-san

I woun't mind getting a copy, I will translate it into php for me (and anyone who wants it) use. That way I can get statistics whenever I need them (and son can anyone else, etc). I might be able to drop it onto my server maybe(but that thing is already under alot of load with 2 forums, a wiki, a main site, and all the misc stuff that is going on with it). --Chase-san

I sucessfully wrote a Java version of one of the modules - convertion of saved html data to bmp image. Avaliable here:

[JavaCalc.zip]

You'll need to download your ratings details page with a download manager or File>Save As... in your browser, and use that as input. --Nfwu

404, not found --Chase-san

Thanks for that - i didn't realize that the transfer failed. Corrected the link. --Nfwu

Hmm, cool, shouldn't be to hard to convert this to php at all, in fact it seems rather simular (I might be able to directly copy and paste parts of it). --Chase-san

Okay, here it is, http://jad.tfsnewworld.com/lrp/ , you can enter name and game tabs to target it whatever you want correctly. However its still unfinished and keeping it there to long will wreck havok on my server(as people will use a unfinished product). It does it completely dynamic at this point, meaning it will rate whats currently shown in the rumble. Try to keep usage low. Its not done, I know I have some pressing matters that need my attention.

Please don't spam it! Also for example, don't try finding Shadow in the nanorumble, its just not there.

Example: http://jad.tfsnewworld.com/lrp/?game=nanorumble&name=chase.o.Orbit%200.1

--Chase-san

@Chase-san: You've got the extreme problem/unproblem bot counts the wrong way round.

Also, is it possible to send over the source so that others can host it (to reduce stress on you server)? --Nfwu

Okay, sure, once I get home i'll fix the problem bot listing, and parse in the two missing statistics and post the source for all to see. Its simular to the source you posted for me, it requires php 5 and the GD plugin for it (most php packages come with it so no worries). I might even add in a +30, -30, 0% and a 100% where they belong on the graph. I am thinking on a few more improvements but they require some more thought on my part. Such as transforming it into a image map that displays information when you hover over a respective dot (like name, score, expected score, and pb index). --Chase-san

;;Some things from original source: (in AutoIt, btw)
;;b4 loop
FileWriteLine($HandleOut, '<img src="'&$CmdLine[2]&".gif"&'" usemap="#BotMap"></img>')
$imgmap = "<MAP NAME='BotMap'>"
;;during
$TEXT = StringFormat("%s (PBI:%#.1f, Score:%#.1f) : %i Battle(s)", $OppName, $PBIndex, $ScoreVsOpp, $battlesVsOpp)
$imgmap &= StringFormat('<AREA ALT="%s" SHAPE=CIRCLE COORDS="%i,%i,4">', $TEXT, $XPOS, $YPOS)
IF ;;Is problem bot;; Then FileWriteLine($HandleOut, "Extreme PB: "&$TEXT)
;;after
$imgmap &= "</MAP>"
FileWriteLine($HandleOut, $imgmap)

Just may help. -- Nfwu

Sorry fell asleep after getting home, it was a long day. That code doesn't really help (php is simular but is entirely different in most respects). Here is the source for what I have up there now: http://jad.tfsnewworld.com/lrp/source.txt . Have at it, if I come up with new versions i'll update the script and make a new source file.

Is the top -30 or +30 (if its +30 then my problem bot indexing was right). --Chase-san

http://thekandieman.com/nfwu/lrp.php?game=roborumble&name=techdude.Carruthers%201.2.2

	imagestring($graph, 2, 5,   305, "0%  ", $black);
	imagestring($graph, 2, 570, 305, "100%", $black);
	imagestring($graph, 2, 305, 5,   "+30 ", $black);
	imagestring($graph, 2, 305, 580, "-30 ", $black);

The above graph for the buggy version of Carruthers shows that your PB Indexing is now correct. =)

The above PHP snippet shows the values for the ends the axises(?) of the graph.

	$tempPos = strpos($inputData,'<p><b>Specialization Index = ')+29;
		$specialIndex = substr($inputData, $tempPos, strpos($inputData, '</b></p>')-$tempPos);
	$tempPos = strpos($inputData,'<p><b>Momentum = ')+17;
		$momentum = substr($inputData, $tempPos, strpos($inputData, '<p>Expected')-$tempPos-10);

And here's another PHP snippet to finish the parsing job off. -- Nfwu

Oh, and btw, it'll take up less bandwidth if the folowing lines are changed to:

//At the top:
$boturl = "http://rumble.fervir.com/rumble/RatingDetails?game=$robotGame&name=$robotName&compare=false";
//And at the bottom:
header("Content-type: image/gif");
imagegif($graph); //Just discovered that GIF uses 34KB and PNG uses 213KB for a typical graph.

To do the Image Map, you'll have to embed the image into a html file and return that. Use MIME Multipart or data: URIs.

http://en.wikipedia.org/wiki/MIME

Do a search on Base 64 encoding and Image Embedding... the wrap this with a map. EG:

 <img src="data:data:image/png;base64,THIS_IS_THE_EMBEDDED_IMAGE_IN_BASE_64_FORMAT" usemap="#botmap"></img>
<map name="botmap"><AREA ....> .... </map>

-- Nfwu

My last message didn't sound as nice as I had intended it to be. Sorry if anyone saw it. Nfwu, I had already had all that planned, I had a reason for some of those things (honestly I forgot to switch the compare type over). GIF have limited number of colors, didn't wanna take the chance of causing problems that way, so I used my favorite format, png. --Chase-san

Sorry for sounding as if you were unexperienced (ref.: revision 63), but it's hard to convey the full meaning through words alone. =) That's why I use smilies. =) j/k

I was bored and had an hour to spare (It being the holidays over here =) ), and as for that image map you were talking about, how are you going to do it? I'm just curious, as I'm still relatively unexperienced in PHP (I taught myself PHP 4 months ago), and yes, I'm the kind that likes long boring speaches that are about topics that I'm interested in. =) Take you're time, there's no need to rush, it isn't urgent, and I don't expect people to have as much time as I seem to do. ;) --Nfwu

Well for the image map I would have a dual-layered system so to speak, the first part sections it all into arrays and is on a html base. It then parses the data it needs and makes it into a image-map, then it sends the dot-locations to the second-layer for rendering, as such it would have a image tag calling a php file that would be the image. This way the data only needs to be run through once, instead of twice. It would probably use either a POST(not sure how on this one), GET(e.g. on the url line) or a cookie to send the data to the second layer. Then I use my ability in html/css to create a hover command for each of the sections of the imagemap (so that such that the information either hovers over where the mouse is, or are displayed below the image(which is easier)).

As for the compare system I mentioned in the otehr revision, clicking on a dot would bring up a new page with a comparison on it, where the bot that you originally had displayed would be graphed again, then lines would be drawn from those points to smaller points (which represent the same bot for the seconardy comparison robot). So basically everything the stats can show, and more.

Any questions?

--Chase-san

Nope, crystal clear. =) -- Nfwu

I just finished, and here it is, I think most bot authors will find this alot more helpful then the graph alone. When your mouse hovers over a dot, it will display the information for that bot below the image. I will probably later make a click display the information, if it doesn't work, get Opera (the web browser), then it will. This shows me my axis are just a tad off, but that is easily fixed (next version). So have fun, and again no spamming it, as this version uses more bandwidth. I have also made some optimizations to a few of the equations to hopefully speed it up. Its still png as I think gif looks nasty with thier yellowish background(i'm not colorblind in the least). --Chase-san

Okay, were on a new host now and have a boatload more bandwidth. the site for my lrp is http://chase.tfsnewworld.com/lrp, enjoy. This is also the reason my bots haven't bee downloading lately (if you have had such a problem). --Chase-san

How come when I click on the Graphs link in the rankings it says 'link not found'...? --Starrynte

I have a new lrp directory for yhou, this time its shorter, http://lrp.csdgn.org , yah the service is still at the old directory aswell, so yah, use it if you like. We should put a reference of this on the new server, I still need to fix a few bugs in the script. --Chase-san

Hmm, not only do the dots not work in Firefox, but when don't work in WebKit? (what Safai uses) either which is pretty good about standards (I'm using a lightweight browser called Midori using the latest build of WebKit?, and it completely passes the nice Acid3 test). Hmm, I may look into debugging the scripting here to work with non Opera browsers some time... I'll follow up here if I figure something out -- Rednaxela

Its all serverside, and compiling up a copy of thier sourcecode to run takes some major detication (well done), so it should work unless the browsers don't support base64 encoded images (which... is part of the Acid3) and image maps (which we're used back in 1995). Though... it seems my javascript might be off. Even if the imagemapped name doesn't work the image should atleast display. Flipping open a copy of firefox I have (Opera is and will always be my main browser).. it works, note the names no longer work it seems, not even on Opera (ergo its my fault there). I have been meaning to fix a display bug that causes the lines to be 1 pixel off anyway. I'll run a test with Opera, Firefox and Safari when i'm done. Thanks for bringing this up. --Chase-san

Whoops, hah, well I feel silly, I was trying to get an element by an id that it doesn't have (it had it as a name), changing it to a id fixed that, and I fixed some internal errors in the script, know to work again on Opera 9.5 Beta (b9841), Firefox 2.0.0.12, and Safari 3.1 (525.13.3) for Windows. Also the source.txt has also been updated to reflect the changes. --Chase-san

I meant the names before actually, the image itself worked fine. Anyways, yeah the names are working nicely, so thanks for the fix there! Now I can just hope for the RoboRumble server to get it's graph links updated some century :) -- Rednaxela

repeating Nfwu's working (at least for me) copy (so i can find it if i lose the bookmark), http://thekandieman.com/nfwu/lrp.php?game=roborumble&name=<bot>%20<version>; --Starrynte

It seems http://lrp.csdgn.org is broken, however http://www.csdgn.org/lrp/ works still (odd, i'll look at it), if that fails at some point in the future try http://www.tfsnewworld.com/csdgn/lrp (its an automatically updating mirror of my new site). --Chase


Robo Home | RoboRumble | Changes | Preferences | AllPages
Edit text of this page | View other revisions
Last edited September 20, 2008 8:30 EST by Chase (diff)
Search: