def pos_random_mix_isntance(self, exa, region, label):
     ins = Instance(self.__dimension)
     for i in range(self.__dimension.get_size()):
         if label[i] is False:
             ins.set_feature(i, exa.get_feature(i))
         else:
             # float random
             if self.__dimension.get_type(i) == 0:
                 ins.set_feature(
                     i,
                     self.__ro.get_uniform_double(region[i][0],
                                                  region[i][1]))
             # integer random
             elif self.__dimension.get_type(i) == 1:
                 ins.set_feature(
                     i,
                     self.__ro.get_uniform_integer(region[i][0],
                                                   region[i][1]))
             # categorical random
             else:
                 ins.set_feature(
                     i,
                     self.__ro.get_uniform_integer(
                         self.__dimension.get_region(i)[0],
                         self.__dimension.get_region(i)[1]))
     return ins
Esempio n. 2
0
    def PosRandomDiscreteInstance(self, PosIns, dim, label):
        ins = Instance(dim)

        for i in range(dim.getSize()):
            if label[i] is True:
                ins.setFeature(i, PosIns.getFeature(i))
            else:
                ins.setFeature(i, self.__ro.getUniformInteger(dim.getRegion(i)[0], dim.getRegion(i)[1]))
        return ins
Esempio n. 3
0
 def RandomInstance(self, dim, region, label):
     inst = Instance(dim)
     for i in range(dim.getSize()):
         if label[i] is True:
             if dim.getType(i) is True:
                 inst.setFeature(i, self.__ro.getUniformDouble(region[i][0], region[i][1]))
             else:
                 inst.setFeature(i, self.__ro.getUniformInteger(region[i][0], region[i][1]))
     return inst
Esempio n. 4
0
 def PosRandomMixInstance(self, PosIns, dim, regi, lab):
     ins = Instance(dim)
     for i in range(dim.getSize()):
         if lab[i] is False:
             ins.setFeature(i, PosIns.getFeature(i))
         else:
             if dim.getType(i) is True: #continue
                 ins.setFeature(i, self.__ro.getUniformDouble(regi[i][0], regi[i][1]))
             else: #discrete
                 ins.setFeature(i, self.__ro.getUniformInteger(dim.getRegion(i)[0], dim.getRegion(i)[1]))
     return ins
Esempio n. 5
0
 def PosRandomMixInstance(self, PosIns, dim, regi, lab):
     ins = Instance(dim)
     for i in range(dim.getSize()):
         if lab[i] is False:
             ins.setFeature(i, PosIns.getFeature(i))
         else:
             if dim.getType(i) is True:  #continue
                 ins.setFeature(
                     i, self.__ro.getUniformDouble(regi[i][0], regi[i][1]))
             else:  #discrete
                 ins.setFeature(
                     i,
                     self.__ro.getUniformInteger(
                         dim.getRegion(i)[0],
                         dim.getRegion(i)[1]))
     return ins
Esempio n. 6
0
 def PosRandomInstance(self, dim, region, label, pos):
     ins = Instance(dim)
     for i in range(dim.getSize()):
         if label[i] is False:
             if dim.getType(i) is True:
                 ins.setFeature(
                     i,
                     self.__ro.getUniformDouble(region[i][0], region[i][1]))
             else:
                 ins.setFeature(
                     i,
                     self.__ro.getUniformInteger(region[i][0],
                                                 region[i][1]))
         else:
             ins.setFeature(i, pos.getFeature(i))
     return ins
 def pos_random_instance(self, dim, region, label, pos_instance):
     ins = Instance(dim)
     for i in range(dim.get_size()):
         if label[i] is False:
             if dim.get_type(i) == 0:
                 ins.set_feature(
                     i,
                     self.__ro.get_uniform_double(region[i][0],
                                                  region[i][1]))
             else:
                 ins.set_feature(
                     i,
                     self.__ro.get_uniform_integer(region[i][0],
                                                   region[i][1]))
         else:
             ins.set_feature(i, pos_instance.get_feature(i))
     return ins
Esempio n. 8
0
    def PosRandomDiscreteInstance(self, PosIns, dim, label):
        ins = Instance(dim)

        for i in range(dim.getSize()):
            if label[i] is True:
                ins.setFeature(i, PosIns.getFeature(i))
            else:
                ins.setFeature(
                    i,
                    self.__ro.getUniformInteger(
                        dim.getRegion(i)[0],
                        dim.getRegion(i)[1]))
        return ins