The following code doesnt seem to work with pyml 0.6.3
------------------------------------
n = 100
d = 1000
m = RandomArray.random( ( n, d ) )
l = []
for i in range( n ) :
if m[ i, 0 ] < 0.5 :
l.append( "1" )
else :
l.append( "-1" )
s = PyML.svm.SVM()
dataSet = PyML.datafunc.SparseCDataSet( X = m, L = l )
s.train( dataSet )
r = s.test( dataSet, stats=True )
print r
------------------------------------
I get the following error message :
Traceback (most recent call last):
File "testPyML2.py", line 37, in ?
print r
File
"/home/jess/progs/lib/python2.4/site-packages/PyML/assess.py",
line 1179, in __repr__
rep.append(ClassificationResults.__repr__(self))
File
"/home/jess/progs/lib/python2.4/site-packages/PyML/assess.py",
line 905, in __repr__
rep.extend( self.formatConfusionMatrix() )
File
"/home/jess/progs/lib/python2.4/site-packages/PyML/assess.py",
line 938, in formatConfusionMatrix
math.ceil(math.log10(MLab.max(MLab.max(self.confusionMatrix))))+1))
TypeError: only rank-0 arrays can be converted to
Python scalars.
Commenting the printing line leads to no error message