<p>Check my project ImSim at sf.net: <a href="http://sourceforge.net/projects/imsim" rel="nofollow">http://sourceforge.net/projects/imsim</a> Actually it's just a very short, simple and single script in <strong>Python</strong>. It can be adjusted for the purpose of clusterizing very easily.<br>
P.S. Remove resizing from it -- I guess you need not it.<br>
P.P.S. Surely you know PIL library.</p>

CC BY-SA 3.0
2011-04-13T23:03:06.773Z
I checked out your code, but I see you are only computing simple statistics for each image and then comparing them based on that. So its not really a full-fledged clustering algorithm... Still, it may prove useful, thanks!
pajton
CC BY-SA 3.0
2011-04-13T23:11:28.217Z
heh :-) You are too quick on judging. It's not a "simple" statistics - it's a spatial distribution statistics. And remember one thing: more complex you do your way - worse results you get (but usually this slipped unnoticed - nothing to compare to - and you keep on nourishing idea that you chose the best approach).
trg787
CC BY-SA 3.0
2011-04-14T12:51:39.283Z
I agree that the simpliest ideas are often the best. Sorry, I may have been too quick - I do not know what is spatial distribution. What it is?
pajton
CC BY-SA 3.0
2011-04-14T12:58:40.283Z
Never mind, all is Ok.
trg787
CC BY-SA 3.0
2011-04-14T13:05:05.317Z
[Never mind, all is Ok] Spatial in my case is: I divide a pic into 5 horiz stripes and 5 vert stripes, calculate total intensities (or luminosities) in each stipee... well, my script is very straightforward. Note that dividing the pic into squares will produce worse result. 5 & 5 is optimal, more granularity -- and pheeeww, your upper lip moves up and you frown (sorry I'm a bit in a kind of frivolic/poetric mood)
trg787
CC BY-SA 3.0
2011-04-14T13:15:21.500Z
and again, when you ask for "the best way of clustering", actually you ask "how and what number can be calculated and assigned to such and such objects?" "Clustering" is the second thing and just a bombastic word, "K-mean" etc sounds cool. But it's only a word. 100 kids can be clustering by color of eyes, or by their age. Back to our moutons, I suggest you to check my script and to see maybe what I assigned (a numerical 2D array) to a pic is exactly what you need, now you forget abt pics, and have at your hands only bare numbers, which you hafta clusterize in whatever you like way:
trg787
CC BY-SA 3.0
2011-04-14T13:27:47.973Z
Yes, I know that first you select (or compute) some features of the image and then operate on those numbers only. But do you think that choice of clustering algorithm is of no importance (or very little important)? Also, why dividing into stripes is better than taking individual pixels?
pajton
CC BY-SA 3.0
2011-04-14T13:36:48.590Z
it will be needless overhead + it will blur and smash result. Also forget abt colors for good -- all must be grayscaled, also forget abt quadratic, cubic, correlation, hystogramms etc stuff. Suppose you already put 50 pics into 30 buckets. Now new pic enter the scene. You cmp it to some avg value for each bucket, find the diff between the pic and bucket #next and put this pic into the closest to it bucket in terms of their values
trg787
CC BY-SA 3.0
2011-04-13T22:45:19.637Z
2011-04-13T22:45:19.637Z
trg787
<p>I am working on letter recognition program. I have a text and divide it into letters, every single letter is written to separate file. </p>

<p>Now I want to apply a clustering algorithm to these images to divide letters into classes. Ideally each cluster would correspond to single letter (this is not possible, because some letter patterns like "ri" or "ff" are classified as one letter by my text-dividing algorithm, but I'll address that later). The images contain some noise, as the text is scanned and also not every letter is at the center of the image: some are slightly shifted. </p>

<p>I am quite new to machine learning. Could you advise me on the choice of clustering algorithm? Which would give the best results in this case?</p>

<p>PS.: I am using python for this project, so any algorithms that have implementation in python (even partial) are of particular interest to me.</p>

CC BY-SA 3.0
2011-04-13T22:45:01.650Z
this question is on the border of what is deemed within scope for this site. you might want to ask around on stats.SE or on metaoptimize.com
Suresh Venkat
CC BY-SA 3.0
2011-04-13T23:01:05.400Z
Thanks, I posted on metaoptimize as well. Unfortunately my question is too simple for cstheory and too theoretical for stackoverflow.
pajton
CC BY-SA 3.0
2011-04-14T03:39:46.407Z
stats.stackexchange.com is also a good place, but I can tell you right now that your question is not very well formed.
Suresh Venkat
<machine-learning><clustering>
Clustering of letters - what approach would give the best results?
pajton
# Clustering of letters - what approach would give the best results?

(Asked by: username_0 on 2011-04-13)

I am working on letter recognition program. I have a text and divide it into letters, every single letter is written to separate file.

Now I want to apply a clustering algorithm to these images to divide letters into classes. Ideally each cluster would correspond to single letter (this is not possible, because some letter patterns like "ri" or "ff" are classified as one letter by my text-dividing algorithm, but I'll address that later). The images contain some noise, as the text is scanned and also not every letter is at the center of the image: some are slightly shifted.

I am quite new to machine learning. Could you advise me on the choice of clustering algorithm? Which would give the best results in this case?

PS.: I am using python for this project, so any algorithms that have implementation in python (even partial) are of particular interest to me.

**Tags:** machine-learning, clustering

> **Comments:**
> **username_1**: this question is on the border of what is deemed within scope for this site. you might want to ask around on stats.SE or on metaoptimize.com  
> **username_0**: Thanks, I posted on metaoptimize as well. Unfortunately my question is too simple for cstheory and too theoretical for stackoverflow.  
> **username_1**: stats.stackexchange.com is also a good place, but I can tell you right now that your question is not very well formed.  

---

## 1 answers

### Answer by username_2 on 2011-04-13. Score: 1

Check my project ImSim at sf.net: <http://sourceforge.net/projects/imsim> Actually it's just a very short, simple and single script in **Python**. It can be adjusted for the purpose of clusterizing very easily.  
P.S. Remove resizing from it -- I guess you need not it.  
P.P.S. Surely you know PIL library.

> **Comments:**
> **username_0**: I checked out your code, but I see you are only computing simple statistics for each image and then comparing them based on that. So its not really a full-fledged clustering algorithm... Still, it may prove useful, thanks!  
> **username_2**: heh :-) You are too quick on judging. It's not a "simple" statistics - it's a spatial distribution statistics. And remember one thing: more complex you do your way - worse results you get (but usually this slipped unnoticed - nothing to compare to - and you keep on nourishing idea that you chose the best approach).  
> **username_0**: I agree that the simpliest ideas are often the best. Sorry, I may have been too quick - I do not know what is spatial distribution. What it is?  
> **username_2**: Never mind, all is Ok.  
> **username_2**: [Never mind, all is Ok] Spatial in my case is: I divide a pic into 5 horiz stripes and 5 vert stripes, calculate total intensities (or luminosities) in each stipee... well, my script is very straightforward. Note that dividing the pic into squares will produce worse result. 5 & 5 is optimal, more granularity -- and pheeeww, your upper lip moves up and you frown (sorry I'm a bit in a kind of frivolic/poetric mood)  
> **username_2**: and again, when you ask for "the best way of clustering", actually you ask "how and what number can be calculated and assigned to such and such objects?" "Clustering" is the second thing and just a bombastic word, "K-mean" etc sounds cool. But it's only a word. 100 kids can be clustering by color of eyes, or by their age. Back to our moutons, I suggest you to check my script and to see maybe what I assigned (a numerical 2D array) to a pic is exactly what you need, now you forget abt pics, and have at your hands only bare numbers, which you hafta clusterize in whatever you like way:  
> **username_0**: Yes, I know that first you select (or compute) some features of the image and then operate on those numbers only. But do you think that choice of clustering algorithm is of no importance (or very little important)? Also, why dividing into stripes is better than taking individual pixels?  
> **username_2**: it will be needless overhead + it will blur and smash result. Also forget abt colors for good -- all must be grayscaled, also forget abt quadratic, cubic, correlation, hystogramms etc stuff. Suppose you already put 50 pics into 30 buckets. Now new pic enter the scene. You cmp it to some avg value for each bucket, find the diff between the pic and bucket #next and put this pic into the closest to it bucket in terms of their values  

---

