Isn’t this just splendid?
Grouping Human Kind
Tuesday, 22nd Apr 2008 at 01:12 (fun stuff, informatics)
Tags: gets you thinking, joke, t-shirts
Were you ever in the desperate need to know all primes below 1000?
Friday, 31st Aug 2007 at 12:08 (informatics, technical stuff)
Tags: primes, programming, python, scripting
In Python calculating primes can be done with a one-liner using functional programming concepts lambda function, map(), reduce() and filter():
# Primes <1000 print filter(None,map(lambda y:y*reduce(lambda x,y:x*y!=0,map(lambda x,y=y: y%x, range(2,int(pow(y,0.5)+1))),1), range(2, 1000)))[/sourcecode] To try this out on a system with python installed in a terminal/console/... type python. In the command prompt showing up paste the line, hit enter and you'll get: <code>[2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]</code>Update: Thanks to <a href="http://wordpress.com/blog/2007/09/03/posting-source-code/">Matt</a> and <a href="http://en.forums.wordpress.com/topic.php?id=6435&page&replies=9#post-111641">Mark</a> the code snippet now can look much <a href="http://faq.wordpress.com/2007/09/03/how-do-i-post-source-code/">nicer</a>: # Primes <1000 print filter(None, map(lambda y: y*reduce(lambda x,y: x*y!=0, map(lambda x,y=y: y%x, range(2, int(pow(y, 0.5)+1))),1),range(2,1000)))[/sourcecode] Update: Not quite as accurate (compare start of the sequence, 3 is missing) but <a href="http://www.python.org/doc/current/tut/node7.html#SECTION007130000000000000000">much shorter</a> using another formula and filter() and lambda techniques only: filter(lambda x: x % 2 != 0 and x % 3 != 0, range(2, 1000))
[5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]
Some usefull resources for help coding in C
Tuesday, 28th Aug 2007 at 09:12 (diploma thesis, informatics)
Tags: programming, science
- c-faq.com
- The C Library Reference Guide
- Selected Help on the ANSI C Programming Language
- GNU C Operators and Punctuators, Language Extensions, Language Keywords
- The ANSI C Standard Library
- A Bin-Hex-Dec-Oct Converter or an interactive conversion table
- Online scientific calculator or another one
Further reading:
- Demystifying The Restrict Keyword
- C Guide – Short but explaining, in depth Tutorial on C
One Step further towards Diplom Thesis
Saturday, 2nd Jun 2007 at 22:05 (audio, diploma thesis, informatics, music, technical stuff)
Tags: acoustic fingerprinting, digital music, hifi
While doing yet again a search for companies or institutes, i.e. a attendant, possibly related to what I’m looking for (automated music similarity analysis) I got one big step forward finding projects at the Fraunhofer IDMT (Institute Digital Media Technologies) that sound really interesting. What I’m interested in is doing some sort of wave form analysis and find different characteristics, different descriptive measures that make two music pieces “sound similar” independent of genre, same artist or whatever and those that make two other pieces different. Most interesting would be to derive them from how we humans would decide it which, of course, is not always deterministic, i.e. fuzzy. The long term dream would be to have an automate find the right music for a given emotional atmosphere, e.g. candle lite dinner, BBQ, reception event…
- SoundsLike — Sounds like it comes close to what I’m interested in; derived from AudioID fingerprinting mechanism.
- GenreID — more the category based approach similar to acoustic fingerprinting. Still interesting, though.
- Query by Humming — Finding music tracks by humming the characteristic melody. But what exactly is characteristic to a certain track?
- Semantic HiFi — interesting project; combines multiple tools to have the stereo generate personalized playlists on demand via call by voice, interacts with other media devices. Reads very promising. The project itself went from 2003-2006. And what’s really interesting is a cooperation with, among others, the University of Pompeu Fabra, Barcelona, Spain.
I also could imagine automated adjustment of volume level by sound level in the room if actually it’s wise and no feedback effekt takes place, e.g. at a cockail party: conversation louder -> music louder -> conversation louder… - Retrieval and Recommendation Tools — just the attempt I’m looking for.
I also stumbled upon news that the mp3 format has been enhanced to encode surround sound information while only enlarging file size by about 10% (see also mpegsurround.com). And secondly an attempt to use P2P to legally ship music content and to utilize it to encourage people to by the better quality version called Freebies.
Learning Learning: Neuroinformatics / Data Mining Link Collection
Monday, 28th May 2007 at 10:36 (informatics)
Tags: neuroinformatics, neuroscience, programming
Since I’m currently studying for my next oral diploma exam on “introduction to neural information processing” (called Neuroinformatics and Data Mining) there are, of course, some Internet references of interest (mainly German):
- lecturer’s / examiner’s slides (DE)
- Scriptum on Grundstudium.info (DE)
- David Kiesel’s Book (DE)
- NeuronalesNetz.de, an overview (DE)
- Demo I of Kohonen Self-Organizing Feature Map/Self-Organising Maps or Demo II (ball-catching cart, DE)
- GNGDemo on different algorithms, e.g. SOM, Hard Competitive
- K-Means vs. Fuzzy K-Means Demo. It also has a demo on dendrogram demonstrated deploying with HAC (Hierarchical Agglomerative Clustering) algorithms such as single-linkage.
- DemoGNG, implementing diverse learning methods
- 2 more demos for K-Means and Fuzzy K-Means including very good explanation for each algorithm (links at the top)
- diverse articles at wikipedia (German and English) varying from overviews on ANN/KNN and Data Mining (DE, EN) to detailed ones, e.g. on RBF Networks.
- some advanced reading and examples at Peltaron, developer of synaptic.
- Tutorial on PCA, examples incl.
Books I recommend:
A Classic: Raúl Rojas: “Theorie der neuronalen Netze.” First print published 1993 at Springer-Verlag, Berlin. ISBN: 3540563539 or it’s english version “Neural Networks” (Rojas says: “The English version is almost a new book”) ISBN: 3540605053. I only read the german version, so far. This I can recommend as it’s language is easily understandable which helps in the learning process. I gives a good overview over established neural modells without loosing details. It’s more on the theoretic side, though.
Detlef Nauck et all.: “Neuronale Netze und Fuzzy-Systeme.” Published at Vieweg 1993. ISBN: 3528052651. Even though it reads Fuzzy-Systems in the title about the first half of the book introduces artificial and biological neural methods in a quite practical manner. It gives many easy and basic examples helping to understand the principles, pros and cons of the many approaches.