Пример #1
0
 def load_matlab(cls, fname):
     """Create a dataset by reading a Matlab file containing one variable
     called 'data' which is an array of nSamples * nFeatures + 1 and
     contains the class in the first column."""
     from mlabwrap import mlab  #@UnresolvedImport
     d = mlab.load(fname)
     return cls(d.data[:, 0], d.data[:, 1:])
Пример #2
0
 def load_matlab(cls, fname):
     """Create a dataset by reading a Matlab file containing one variable
     called 'data' which is an array of nSamples * nFeatures + 1 and
     contains the class in the first column."""
     from mlabwrap import mlab #@UnresolvedImport
     d = mlab.load(fname)
     return cls(d.data[:, 0], d.data[:, 1:])
Пример #3
0
    def loadMATdata(self, fname):
        """ read Matlab file containing one variable called 'data' which is an array
            nSamples x nFeatures+1 and contains the class in the first column """
        from mlabwrap import mlab  #@UnresolvedImport
        from numpy import float
        d = mlab.load(fname)
        self.nSamples = d.data.shape[0]
        x = []
        y = []
        for i in range(self.nSamples):
            label = int(d.data[i, 0])

            x.append(d.data[i, 1:].astype(float).tolist())
            y.append([float(label)])
        self._setDataFields(x, y)
Пример #4
0
    def loadMATdata(self, fname):
        """ read Matlab file containing one variable called 'data' which is an array
            nSamples x nFeatures+1 and contains the class in the first column """
        from mlabwrap import mlab #@UnresolvedImport
        from numpy import float
        d=mlab.load(fname)
        self.nSamples = d.data.shape[0]
        x = []
        y = []
        for i in range(self.nSamples):
            label = int( d.data[i,0] )


            x.append( d.data[i,1:].astype(float).tolist())
            y.append( [ float(label) ] )
        self._setDataFields(x,y)