def loadSVMdata(self, fname):

        x = []
        y = []
        nFeatMax = 0
        for line in open(fname, 'r').readlines():
            # format is:
            # <class>  <featnr>:<featval>  <featnr>:<featval> ...
            # (whereby featnr starts at 1)
            if not line: break
            line = line.split()
            label = float(line[0])


            feat = []
            nextidx = 1
            for r in line[1:]:
                # construct list of features, taking care of sparsity
                (idx, val) = r.split(':')
                idx = int(idx)
                for _ in range(nextidx, idx):
                    feat.append(0) # zzzzwar hier ein bug??
                feat.append(float(val))
                nextidx = idx + 1
            nFeat = len(feat)
            if nFeatMax < nFeat: nFeatMax = nFeat

            x.append(feat)
            y.append([ label ])
            self.nSamples += 1

        for xi in x:
            while len(xi) < nFeatMax:
                xi.append(0.)

        self._setDataFields(x, y)
read svm sparse format from file 'fname' (with labels only)
dataset/ETHPy150Open pybrain/pybrain/pybrain/tools/svmdata.py/SVMData.loadSVMdata