本文整理汇总了Python中Data.data方法的典型用法代码示例。如果您正苦于以下问题:Python Data.data方法的具体用法?Python Data.data怎么用?Python Data.data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.data方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compile_and_resample
# 需要导入模块: import Data [as 别名]
# 或者: from Data import data [as 别名]
def compile_and_resample(rs_factor, path):
""" Will compile all of the data for a given simulation run and save
all of it including individual metrics trends. Will also return
a saved version of the compiled data
return - compiled data object
"""
#keep track of all the data
all_data = []
#first list all of the dirs
dirs = os.listdir(path)
num_sims = 0#keep track of the names
names = []
for i in range(0, len(dirs)):
d = dirs[i]
if(os.path.isdir(path + d)):
#find the data.txt and load this form a file
info = Data.data()
loaded = True
try:
info.load(path + d + "\\data.txt")
except IOError:
loaded = False
print(path + d, loaded)
if(loaded):
#append this to the data list
all_data.append(info)
names.append(d)
#increment this count
num_sims += 1
#Now for each of the data sets only take every r_s timepoint
d = Data.data()
#add all fo the measurements to this
print('Copying measurements...')
ml = all_data[0].get_measurement_list()
for i in range(0, len(ml)):
d.add_measurement(ml[i])
print(ml[i])
for i in range(0, num_sims):
#get the data object
info = all_data[i]
#get all its samples (ie.e time-points)
sl = info.get_sample_list()
#add these measurements with the sample ID
for j in range(0, len(sl)):
#gte it measurement list
ml = info.get_measurement_list()
#see if it matches the resampleing factor
if(j % rs_factor == 0):
#get the measurement associated with this data
ms = info.get_sample(sl[j])
#get the name
name = names[i] + "_" + sl[j]
## print("Processing...")
## print(name)
#add this as a sample
d.add_sample(name)
#Now for all of these measurements,
#add them to the new data set
for k in range(0, len(ml)):
d.set_data(name, ml[k], ms[k])
#save the heat map
d.save(path + "compiled_data.txt")
#normalize
d.normalize_measurements()
#tranpose the measurements
d.transpose_measurments_and_samples()
d.save_heat_map(path)
#cluster
d.save_clustered_heat_map(path)
#return it
return d
示例2: for
# 需要导入模块: import Data [as 别名]
# 或者: from Data import data [as 别名]
if self.NMS_IOU(cls_collect[i], cls_collect[j]) > cfg.NMS_threshold:
cls_collect[i] = [(x + y) / 2.0 for (x, y) in zip(cls_collect[i], cls_collect[j])]
del cls_collect[j]
for each_result in cls_collect:
final_result.append(
[each_result[1], each_result[2], each_result[3] - each_result[1], each_result[4] - each_result[2],
cls_ind, each_result[0]])
return final_result
if __name__ == '__main__':
train = True
if train:
net = Net.Alexnet(is_training = True)
data = Data.data()
solver = Solver(net, data, is_training = True)
solver.train()
else:
net = Net.Alexnet(is_training=False)
data = Data.data()
solver = Solver(net, data, is_training=False)
solver.predict()