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)
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
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