On Apr 6, 10:43 pm, Carl Banks pavlovevide...@gmail.com wrote:
MooMaster wrote:
So I'm reading in values from a file, and for each column I need to
dynamically discover the range of possible values it can take and
quantize if necessary. This is the solution I've come up with:
code
def
On Apr 7, 12:40 am, Peter Otten __pete...@web.de wrote:
Peter Otten wrote:
MooMaster wrote:
Now we can't calculate a meaningful Euclidean distance for something
like Iris-setosa and Iris-versicolor unless we use string-edit
distance or something overly complicated, so instead we'll use a
MooMaster wrote:
Now we can't calculate a meaningful Euclidean distance for something
like Iris-setosa and Iris-versicolor unless we use string-edit
distance or something overly complicated, so instead we'll use a
simple quantization scheme of enumerating the set of values within the
column
Peter Otten wrote:
MooMaster wrote:
Now we can't calculate a meaningful Euclidean distance for something
like Iris-setosa and Iris-versicolor unless we use string-edit
distance or something overly complicated, so instead we'll use a
simple quantization scheme of enumerating the set of
On Apr 7, 12:38 am, Peter Otten __pete...@web.de wrote:
MooMaster wrote:
Now we can't calculate a meaningful Euclidean distance for something
like Iris-setosa and Iris-versicolor unless we use string-edit
distance or something overly complicated, so instead we'll use a
simple quantization
Carl Banks wrote:
On Apr 7, 12:38 am, Peter Otten __pete...@web.de wrote:
MooMaster wrote:
Now we can't calculate a meaningful Euclidean distance for something
like Iris-setosa and Iris-versicolor unless we use string-edit
distance or something overly complicated, so instead we'll use a
Carl Banks wrote:
import collections
import itertools
def createInitialCluster(fileName):
fixedPoints = []
# quantization is a dict that assigns sequentially-increasing
numbers
# to values when reading keys that don't yet exit
quantization =
andrew cooke and...@acooke.org wrote:
Carl Banks wrote:
import collections
import itertools
def createInitialCluster(fileName):
fixedPoints = []
# quantization is a dict that assigns sequentially-increasing
numbers
# to values when reading keys that don't yet exit
Carl Banks wrote:
MooMaster wrote:
So I'm reading in values from a file, and for each column I need to
dynamically discover the range of possible values it can take and
quantize if necessary. This is the solution I've come up with:
[snip]
#harvested from
just playing around - doesn't work with 3.0 due to lack of pattern binding
(which i think is coming back in 3.1?)
from collections import defaultdict
from itertools import count
def mkdict(): return defaultdict(count().next)
...
converters = defaultdict(mkdict)
def to_float((i, s)):
...
R. David Murray wrote:
[...]
try:
dimensions.append(float(s))
except:
dimensions.append(float(quantization[s]))
No, no, no; never use a bare except! :)
can you explain why? i can't think of any reason why the code would be
better catching a specific exception.
as a general
andrew cooke wrote:
R. David Murray wrote:
[...]
try:
dimensions.append(float(s))
except:
dimensions.append(float(quantization[s]))
No, no, no; never use a bare except! :)
can you explain why? i can't think of any reason why the code would be
better catching a specific
On Tue, 7 Apr 2009 at 09:01, andrew cooke wrote:
R. David Murray wrote:
[...]
try:
dimensions.append(float(s))
except:
dimensions.append(float(quantization[s]))
No, no, no; never use a bare except! :)
can you explain why? i can't think of any reason why the code would be
MRAB wrote:
andrew cooke wrote:
R. David Murray wrote:
[...]
try:
dimensions.append(float(s))
except:
dimensions.append(float(quantization[s]))
No, no, no; never use a bare except! :)
can you explain why? i can't think of any reason why the code would be
better catching a
A similar discussion has already occurred, over 4 years ago:
http://groups.google.com/group/comp.lang.python/browse_thread/thread/b806ada0732643d/5dff55826a199928?lnk=gstq=list+in+place#5dff55826a199928
Nevertheless, I have a use-case where such a discussion comes up. For
my data mining class I'm
MooMaster wrote:
So I'm reading in values from a file, and for each column I need to
dynamically discover the range of possible values it can take and
quantize if necessary. This is the solution I've come up with:
code
def createInitialCluster(fileName):
#get the data from the file
16 matches
Mail list logo