Friday 11 February 2011

A softer way of life

Soft computing course: completed! A sparkling 30/30 cum laude closes an astonishing and inspiring experience.

I chose this course primarly because of simulated annealing and neural networks, for I studied these techniques in a very formal way (cybernetics) and from a philosophic point of view (epistemology). I was interested into a more concrete approach, and I found it here. But there was much more!

I discovered a wide range of special neural networks, Hopfield's and Kohonen's in particular, which show several interesting capabilities that I'd like to experiment soon. I finally studied the infamous back-propagation, able to learn non-linearly separable tasks, and that was good. But despite my initial expectations, these weren't the most interesting parts.  

Genetic algorithms, for instance. It's funny to think of data structures "sharing genetic material", maybe discriminating partners according to their own sexual tastes (Booker's model), with their children being subject to random mutations. Well, believe it or not, but that funny stuff works! My experimental data clearly say that GA are a strong and robust way to tackle NP problems. The drawback is the difficulty of modeling the solutions' search space by using simple codified strings. Moreover, genetic algorithms can find a global optimum for a specific problem, but not whole classes.

So, here comes the Genetic Programming. Yep, double upper case here. Whereas the GA were funny because of data sharing genetic information, what we have here are copulating programs... so nice! Massive derivation trees create brand new offspring generation after generation, letting new abilities to emerge and spontaneously losing the useless (a process called automatic feature selection). The way GP works  immediatly calls for a LISP implementation, and that's what I tried to do... even though I'm still stuck on a pure functional, recursive crossover function.

In the end, my personal favourite model, whose I dedicated my blog to: the Particle Swarm Optimization. Yeah, triple upper case. As I wrote in the past, I love the spectrum of emergent behaviours this bunch of simple coordinates show. Just like Conway's game of life, there seems to be some kind of unpredictable lifeforms inside the model, and that is cool. Moreover, it can be quickly extended:


This example is an interesting kind of PSO that prof. Vanneschi proposed, named Multiswarm Repulsive PSO (or MRPSO). It features more than just one swarm living on different "islands", all looking for the same global optimum. After some generation, best individuals are cloned and replace the worst ones by migrating to the next island. Moreover, on some island, the particles run away from the best individual, instead of following its "pheromones trails". This approach solves two possible drawbacks of PSO: the lack of diversity and the tendancy that individuals show of blindly following the leader, thus keeping away from interesting unknown zones of the search space. The boost of performance is stunning, and still there's a lot of space for inventing new ways to improve it!

Wednesday 9 February 2011

"Impariamo il C", un corso collaborativo

Qualche settimana fa ho dato via ad un piccolo esperimento sul forum di NGI. Si tratta di un micro-corso di programmazione C di stampo collaborativo: una breve lezione "frontale" discussa con la community.

L'approccio che seguo è bottom-up: son voluto partire dalle minuzie (cioé il ferro, quella che viene chiamata architettura dell'elaboratore) e risalire lentamente, introducendo un piccolo tassello aggiuntivo ad ogni lezione. Naturalmente, tutto scritto in maniera easy, con molte metafore, illustrazioni ed esercizietti.

Perché proprio il C? Beh, perché è la base dei linguaggi imperativi. In fondo, praticamente tutti i linguaggi non funzionali e non logici sono dialetti del C. Una volta imparata la logica, poi ci si può spostare su altri contesti senza paura, dai sistemi embedded alle web-application, passando per il mondo emergente del GPGPU computing.

Queste sono le "lezioni" effettuate finora:
  1. installazione dell'IDE, cenni di architettura degli elaboratori
  2. sintassi del C, programmazione strutturata
  3. ancora sulla sintassi, i tipi di dato, le variabili
  4. variabili parte seconda: gli array
  5. introduzione delle funzioni
  6. operatori aritmetici e logici
  7. costrutti di selezione
  8. costrutti di iterazione
  9. ancora sull'iterazione
  10. array multipli e struct
  11. ricorsione
  12. ancora ricorsione, memoria (record attivazione, heap, stack, ecc), introduzione dei puntatori
  13. le liste e l'allocazione di memoria (malloc)
  14. accenni dei costi asintotici, e ancora liste
Cercherò di tenere aggiornato l'indice. Il corso, per ora, ha un discreto séguito anche se abbiamo subito molti "abbandoni", vuoi per l'incapacità dell'insegnante, vuoi perché la programmazione C può essere rognosa (molti son saltati giù con la ricorsione, chissà perché!).

Come sosteneva Schoenberg, anche il maestro impara nell'insegnare all'allievo. Trasmettendo il C sto scoprendo aspetti che proprio cui non avevo mai prestato attenzione o di cui ignoravo completamente l'esistenza. Per esempio, ho reagito in maniera un po' scomposta alla scoperta che sia sizeof che la virgola sono operatori in C, e in particolare la virgola (grazie ACray!) che in base alle situazioni può avere una semantica che definire balzana è usare un eufemismo. Il C non finisce mai di stupire.

Tuesday 8 February 2011

Realizzi di esser stato d'aiuto quando...

...trovi il tuo blog linkato nelle dispense di due università americane (Central Florida e Central Connecticut). Nice!

Il mio post sul workaround per far funzionare Dev-CPP sotto Vista (dio maledica Microsoft per le sue trovate balzane) è diventato un po' il fix de facto in giro per internet, e ha portato più traffico e commenti delle altre centinaia di post che ho realizzato, anche quelle probabilmente più utili come l'implementazione di Aho-Corasick in PHP (la prima open-source, afaik).

Quest'ultima è un fenomeno interessante, in quanto mi ha provocato solamente un'ondata di spam pornografico nei commenti... in giapponese. Qualcuno deve aver linkato il post su un sito del sol levante (che non riesco a recuperare), e da lì è partito un assalto che, dopo quasi un anno, non accenna ad arrestarsi.

Wednesday 2 February 2011

UNIMIB.IT on Webometrics: new strong performance

Webometrics publishes, in a biannual fashion, a ranking of universities' websites, produced by a formula that takes into account the size of the site, the number of downloadable documents, the visibility online and the number of google scholar entries. We still have a positive trend and during the latter half we went up 145 positions!

Milano-Bicocca's ranking during the years; the lower, the better


Once again Milano-Bicocca pays for the size of the site, intended as the "number of pages recovered on four different search engines". We have a lot of information spread in too many satellite websites, like faculties and departments.

A very positive score comes from Google Scholar indicator: Bicocca-related research documents have grown a lot during the latter years: in 2007 we were in 682th position, now we have reached the 277th. It's a very good result, probably due to the introduction of BOA service, despite the fact that Milano-Bicocca is one of the youngest universities.

Since this january, Milano-Bicocca is featured in the Top-500 ranking, placing in the 477th position and widening Italy's slice a little bit.