Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#5 printing a classification results => bug

open
nobody
None
5
2005-05-20
2005-05-20
Anonymous
No

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

Discussion