本文整理汇总了Python中dataset.DataSet.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python DataSet.__init__方法的具体用法?Python DataSet.__init__怎么用?Python DataSet.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dataset.DataSet
的用法示例。
在下文中一共展示了DataSet.__init__方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import __init__ [as 别名]
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
示例2: __init__
# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import __init__ [as 别名]
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')
示例3: __init__
# 需要导入模块: from dataset import DataSet [as 别名]
# 或者: from dataset.DataSet import __init__ [as 别名]
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