Example #1
0
 def __init__(self, data=[]):
     UserList.__init__(self)
     self.feature_no  = None
     self.name        = None
     self.class_omega = None
     self.init_precomputed()
     self.classadmin = pylib_basics.name_number_hash()
     for i in data:
         self.append(i)        
Example #2
0
 def __init__(self, data=[]):
     UserList.__init__(self)
     self.feature_no = None
     self.name = None
     self.class_omega = None
     self.init_precomputed()
     self.classadmin = pylib_basics.name_number_hash()
     for i in data:
         self.append(i)
Example #3
0
    def __init__(self, rep, classadmin=pylib_basics.name_number_hash()):
        self.classadmin = classadmin
        if type(rep) == StringType:
            tmp = rep.split(":")
            tmp = map(string.strip, tmp)
            tmp[1] = tmp[1].split(",")
            tmp[1] = map(string.strip, tmp[1])
        else:
            assert type(rep) == TupleType
            assert len(rep) == 3 or len(rep) == 4
            tmp = rep

        assert type(tmp[1]) == ListType
        self.id = tmp[0]
        self.features = map(atofeatureval, tmp[1])
        if len(tmp) == 3:
            self.tclass = self.classadmin.insert(tmp[2])
        else:
            self.tclass = None
Example #4
0
 def __init__(self,
              rep,
              classadmin = pylib_basics.name_number_hash()):        
     self.classadmin = classadmin
     if type(rep) == StringType:
         tmp = rep.split(":");
         tmp = map(string.strip, tmp)
         tmp[1] = tmp[1].split(",")
         tmp[1] = map(string.strip, tmp[1])
     else:
         assert type(rep) == TupleType
         assert len(rep) == 3 or len(rep)==4
         tmp = rep
         
     assert type(tmp[1]) == ListType
     self.id       = tmp[0]
     self.features = map(atofeatureval,tmp[1])
     if len(tmp)==3:
         self.tclass = self.classadmin.insert(tmp[2])
     else:
         self.tclass = None