def __init__(self, data, interval_type=ClassIntervalType.ROOT): f = [] for d in data: f.append(float(d)) data = f DataSet.__init__(self, data) self.interval_type = interval_type if self.interval_type != ClassIntervalType.THREESIGMA: self.class_interval = self.calc_class_interval(interval_type, self.min, self.max, self.n); self.construct_bins(self.min, self.max, self.class_interval, False); else: sigma_span = 6 min = self.mean - self.stdev * (sigma_span / 2) max = self.mean + self.stdev * (sigma_span / 2) self.class_interval = self.calc_class_interval(ClassIntervalType.THREESIGMA, min, max, sigma_span) self.construct_bins(min, max, self.class_interval, True) self.fill_bins() self.sort_bins() total = 0 for bin in self.bins: total = total + bin.count() self.bin_contents_count = total
def __init__(self, inp, target): """Initialize an empty supervised dataset. Pass `inp` and `target` to specify the dimensions of the input and target vectors.""" DataSet.__init__(self) if isscalar(inp): # add input and target fields and link them self.addField('input', inp) self.addField('target', target) else: self.setField('input', inp) self.setField('target', target) self.linkFields(['input', 'target']) # reset the index marker self.index = 0 # the input and target dimensions self.indim = self.getDimension('input') self.outdim = self.getDimension('target')
def __init__(self, inp, target): """Initialize an empty supervised dataset. Pass `inp` and `target` to specify the dimensions of the input and target vectors.""" DataSet.__init__(self) if isscalar(inp): # add input and target fields and link them self.addField('input', inp) self.addField('target', target) else: self.setField('input', inp) self.setField('target', target) self.linkFields(['input', 'target']) # reset the index marker self.index = 0 # the input and target dimensions self.indim = self.getDimension('input') self.outdim = self.getDimension('target')
def __init__(self, statedim, actiondim): """ initialize the reinforcement dataset, add the 3 fields state, action and reward, and create an index marker. This class is basically a wrapper function that renames the fields of SupervisedDataSet into the more common reinforcement learning names. Instead of 'episodes' though, we deal with 'sequences' here. """ DataSet.__init__(self) # add 3 fields: input, target, importance self.addField('state', statedim) self.addField('action', actiondim) self.addField('reward', 1) # link these 3 fields self.linkFields(['state', 'action', 'reward']) # reset the index marker self.index = 0 # add field that stores the beginning of a new episode self.addField('sequence_index', 1) self.append('sequence_index', 0) self.currentSeq = 0 self.statedim = statedim self.actiondim = actiondim # the input and target dimensions (for compatibility) self.indim = self.statedim self.outdim = self.actiondim
def __init__(self, statedim, actiondim): """ initialize the reinforcement dataset, add the 3 fields state, action and reward, and create an index marker. This class is basically a wrapper function that renames the fields of SupervisedDataSet into the more common reinforcement learning names. Instead of 'episodes' though, we deal with 'sequences' here. """ DataSet.__init__(self) # add 3 fields: input, target, importance self.addField('state', statedim) self.addField('action', actiondim) self.addField('reward', 1) # link these 3 fields self.linkFields(['state', 'action', 'reward']) # reset the index marker self.index = 0 # add field that stores the beginning of a new episode self.addField('sequence_index', 1) self.append('sequence_index', 0) self.currentSeq = 0 self.statedim = statedim self.actiondim = actiondim # the input and target dimensions (for compatibility) self.indim = self.statedim self.outdim = self.actiondim