Mercurial > pylearn
diff pmat.py @ 115:01aa97a2212d
removed dependency to plearn
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Wed, 07 May 2008 12:19:36 -0400 |
parents | d6d42a0c1275 |
children | 9330d941fa1f |
line wrap: on
line diff
--- a/pmat.py Wed May 07 12:18:11 2008 -0400 +++ b/pmat.py Wed May 07 12:19:36 2008 -0400 @@ -36,13 +36,6 @@ #import numarray, sys, os, os.path import numpy.numarray, sys, os, os.path -pyplearn_import_failed = False -try: - from plearn.pyplearn.plearn_repr import plearn_repr, format_list_elements -except ImportError: - pyplearn_import_failed = True - - def array_columns( a, cols ): indices = None @@ -422,25 +415,6 @@ def __len__(self): return self.length - if not pyplearn_import_failed: - def __str__( self ): - return plearn_repr(self, indent_level=0) - - def plearn_repr( self, indent_level=0, inner_repr=plearn_repr ): - # asking for plearn_repr could be to send specification over - # to another prg so that will open the .pmat - # So we make sure data is flushed to disk. - self.flush() - - def elem_format( elem ): - k, v = elem - return '%s = %s' % ( k, inner_repr(v, indent_level+1) ) - - options = [ ( 'filename', self.fname ), - ( 'inputsize', self.inputsize ), - ( 'targetsize', self.targetsize ), - ( 'weightsize', self.weightsize ) ] - return 'FileVMatrix(%s)' % format_list_elements( options, elem_format, indent_level+1 ) if __name__ == '__main__': pmat = PMat( 'tmp.pmat', 'w', fieldnames=['F1', 'F2'] )