Thread: [GSoC] Clustering in MADlib - status update
Week 1 - 2014/05/25
For this first week, I have written a test script that generates some simple datasets, and produces an image containing the output of the MADlib clustering algorithms.
This script can be called like this:
./clustering_test.py new ds0 -n 8 # generates a dataset called "ds0" with 8 clusters ./clustering_test.py query ds0 -o output.png # outputs the result of the clustering algorithms applied to ds0 in output.png
See ./clustering_test.py -h for all the available options.
An example of output can be found here [1].
Of course, I will keep improving this test script, as it is still far from perfect; but for now, it does approximately what I want.
For next week, I'll start working on the implementation of k-medoids in MADlib. As a reminder, according to the timeline I suggested for the project, this step must be done on May 30. Depending on the problems I will face (mostly lack of knowledge of the codebase, I guess), this might not be finished on time, but it should be done a few days later (by the end of next week, hopefully).
Attached is the patch containing everything I have done this week, though the git log might be more convenient to read.
Regards,
Maxence A.
--
06 06 66 97 00
Attachment
Week 2 - 2014/01/01
This week, I have worked on the beginning of the kmedoids module. Unfortunately, I was supposed to have something working for last Wednesday, and it is still not ready, mostly because I've lost time this week by being sick, and by packing all my stuff in preparation for relocation.
The good news now: this week is my last school (exam) week, and that means full-time GSoC starting next Monday! Also, I've studied the kmeans module quite thoroughly, and I can finally understand how it all goes on, at the exception of one bit: the enormous SQL request used to update the IterationController.
For kmedoids, I've abandoned the idea of making the loop by myself and have decided instead to stick to copying kmeans as much as possible, as it seems easier than doing it all by myself. The only part that remains to be adapted is that big SQL query I haven't totally understood yet. I've asked the help of Atri, but surely the help of an experienced MADlib hacker would speed things up :) Atri and I would also like to deal with this through a voip meeting, to ease communication. If anyone wants to join, you're welcome!
As for the technology we'll use, I have a Mumble server running somewhere, if that fits to everyone. Otherwise, suggest something!
I am available from Monday 2 at 3 p.m. (UTC) to Wednesday 4 at 10 a.m. (exam weeks are quite light).
This week, I have also faced the first design decisions I have to make. For kmedoids, the centroids are points of the dataset. So, if I wanted to identify them precisely, I'd need to use their ids, but that would mean having a prototype different than the kmeans one. So, for now, I've decided to use the points coordinates only, hoping I will not run into trouble. If I ever do, switching to ids should'nt be too hard. Also, if the user wants to input initial medoids, he can input whatever points he wants, be they part of the dataset or not. After the first iteration, the centroids will anyway be points of the dataset (maybe I could just select the points nearest to the coordinates they input as initial centroids).
Second, I'll need to refactor the code in kmeans and kmedoids, as these two modules are very similar. There are several options for this:
- One big "clustering" module containing everything clustering-related (ugly but easy option);
- A "clustering" module and "kmeans", "kmedoids", "optics", "utils" submodules (the best imo, but I'm not sure it's doable);
- A "clustering_utils" module at the same level as the others (less ugly than the first one, but easy too).
Any opinions?
Next week, I'll get a working kmedoids module, do some refactoring, and then add the extra methods, similar to what's done in kmeans, for the different seedings. Once that's done, I'll make it compatible with all three ports (I'm currently producing Postgres-only code, as it's the easiest for me to test), and write the tests and doc. The deadline for this last step is in two weeks; I don't know yet if I'll be on time by then or not. It will depend on how fast I can get kmedoids working, and how fast I'll go once I'm full time GSoC.
Finally, don't hesitate to tell me if you think my decisions are wrong, I'm glad to learn :)[0] http://git.viod.eu/viod/gsoc_2014/blob/master/reports.rst
--
06 06 66 97 00
Attachment
<div dir="ltr"><div class="gmail_extra">Hi!<br /></div><div class="gmail_extra"><br /><div class="gmail_quote">2014-06-0219:16 GMT+02:00 Hai Qian <span dir="ltr"><<a href="mailto:hqian@gopivotal.com" target="_blank">hqian@gopivotal.com</a>></span>:<br/><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1pxsolid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="font-family:arial,helvetica,sans-serif">Ilike the second option for refactoring the code. I think it is doable.<br/><br /></div><div dir="ltr"> And where is your code on Github?<br clear="all" /></div></div></blockquote></div><br/></div><div class="gmail_extra">It's not on Github, but on my own Gitlab (a self-hostedopen-source alternative to github). You can find it here [0]. I'm using two repos: one is a clone of madlib, theother contains my reports, my test script and other stuff.<br /><br />[0] <a href="http://git.viod.eu/public/">http://git.viod.eu/public/</a><br/></div><div class="gmail_extra"><br />-- <br /><div dir="ltr">MaxenceAhlouche<br />06 06 66 97 00<br /></div></div></div>
Hi all!I've pushed my report for this week on my repo [0]. Here is a copy! Attached is the patch containing my work for this week.Week 2 - 2014/01/01
This week, I have worked on the beginning of the kmedoids module. Unfortunately, I was supposed to have something working for last Wednesday, and it is still not ready, mostly because I've lost time this week by being sick, and by packing all my stuff in preparation for relocation.
The good news now: this week is my last school (exam) week, and that means full-time GSoC starting next Monday! Also, I've studied the kmeans module quite thoroughly, and I can finally understand how it all goes on, at the exception of one bit: the enormous SQL request used to update the IterationController.
For kmedoids, I've abandoned the idea of making the loop by myself and have decided instead to stick to copying kmeans as much as possible, as it seems easier than doing it all by myself. The only part that remains to be adapted is that big SQL query I haven't totally understood yet. I've asked the help of Atri, but surely the help of an experienced MADlib hacker would speed things up :) Atri and I would also like to deal with this through a voip meeting, to ease communication. If anyone wants to join, you're welcome!
As for the technology we'll use, I have a Mumble server running somewhere, if that fits to everyone. Otherwise, suggest something!
I am available from Monday 2 at 3 p.m. (UTC) to Wednesday 4 at 10 a.m. (exam weeks are quite light).
This week, I have also faced the first design decisions I have to make. For kmedoids, the centroids are points of the dataset. So, if I wanted to identify them precisely, I'd need to use their ids, but that would mean having a prototype different than the kmeans one. So, for now, I've decided to use the points coordinates only, hoping I will not run into trouble. If I ever do, switching to ids should'nt be too hard. Also, if the user wants to input initial medoids, he can input whatever points he wants, be they part of the dataset or not. After the first iteration, the centroids will anyway be points of the dataset (maybe I could just select the points nearest to the coordinates they input as initial centroids).
Second, I'll need to refactor the code in kmeans and kmedoids, as these two modules are very similar. There are several options for this:
- One big "clustering" module containing everything clustering-related (ugly but easy option);
- A "clustering" module and "kmeans", "kmedoids", "optics", "utils" submodules (the best imo, but I'm not sure it's doable);
- A "clustering_utils" module at the same level as the others (less ugly than the first one, but easy too).
Any opinions?
Next week, I'll get a working kmedoids module, do some refactoring, and then add the extra methods, similar to what's done in kmeans, for the different seedings. Once that's done, I'll make it compatible with all three ports (I'm currently producing Postgres-only code, as it's the easiest for me to test), and write the tests and doc. The deadline for this last step is in two weeks; I don't know yet if I'll be on time by then or not. It will depend on how fast I can get kmedoids working, and how fast I'll go once I'm full time GSoC.
Finally, don't hesitate to tell me if you think my decisions are wrong, I'm glad to learn :)[0] http://git.viod.eu/viod/gsoc_2014/blob/master/reports.rst
--Maxence Ahlouche
06 06 66 97 00
<div dir="ltr"><h1><font><span style="font-weight:normal">Hi! Here is my report for the last two weeks.</span></font></h1><h1><fontsize="4">Weeks 3 and 4 - 2014/06/15</font></h1><p>During my third week, I haven't had timeto work on GSoC a lot, because of my exams and my relocation (that's why I didn't deem necessary to post a report lastSunday). But last week has been much more productive, as I am now working full time!<p>I have developped an aggregatethat computes the sum of pairwise dissimilarities in a cluster, for a given medoid. Thanks to Hai and Atri, I havealso developped the main SQL function that actually computes the k-medoids. This function is still under debugging, soI have not committed it yet.<p>According to my planning, I am not on time: I should have finished working on k-medoidson Friday. When I made this timeline, I largely underestimated the time needed to get started in this project, andoverestimated the time I thought I could spend on GSoC during my exams. But things will now go much faster!<p>As for ourweekly phone call, I have lots of difficulties understanding what is said, partly because of me not being used to hearingenglish, but mostly because of low quality sound. Last time, I hardly understood half of what's been said; which isquite unfortunate, given that I'm supposed to take advices during this phone call. So I'd like to suggest an alternative:an IRC channel, for example. And for those who don't have an IRC client ready: <a class="" href="http://webchat.freenode.net/">http://webchat.freenode.net/</a>. For example, the channel #gsoc-madlib would surelybe appropriate :) Also, I've had a change in my timetable, which makes Tuesday inconvenient for this phone call. Isit possible to change the day? I'm available at this hour on Monday, Wednesday and Thursday. Of course, if this changeannoys too much people, I'll deal with Tuesday :)<p>Finally, for the coming week, I'll finish debugging k-medoids,write all the secondary functions (e.g. random inital medoids), and write the doc.<p><br /><p>Regards,<p>MaxenceA.<br clear="all" /><div class="gmail_extra"><br />-- <br /><div dir="ltr">Maxence Ahlouche<br />0606 66 97 00<br /></div></div></div>
Week 5 - 2014/06/22
This week has been full of debugging of the main SQL function. The previous week, I had been able to come up with a working function to compute a medoid for a given group of points, but since then I've struggled to integrate it with the rest of the SQL. Some errors were trivial (for example some parameters that I had written with underscores instead of using camelCase - Hai spotted this one, I think i'd never have found it by myself), others less so. But it's coming!
According to the timeline I had planned at the beginning on the project, I'm definitely late. The module I'm still writing should have been finished last week, and it's not even working yet. It seems I've been far too optimist in this timeline. For the second step, as I'll have less time than expected, I'm thinking to switch from OPTICS to DBSCAN, which at least I have fully understood (OPTICS is quite complicated). Is everyone ok with this?
Next week is the evaluation week. Hopefully I'll be allowed to continue working on this project, even though I haven't provided much result until now :p As for me, I don't have to complain: I've always been provided patience and clear answers to my questions. Only the phone calls didn't turn as good as they sounded, but this problem will be fixed at our next meeting, as we'll now use IRC!