目录
相关文章
DataScience:数据生成之在原始数据上添加小量噪声进而实现构造新数据
DataScience:数据生成之在原始数据上添加小量噪声进而实现构造新数据实现
数据生成之在原始数据上添加小量噪声进而实现构造新数据
输出结果
1. [6.8, 7.0, 7.2, 7.8, 8.0, 8.2, 8.4, 8.6, 8.8, 9.0] 2. [7.2, 7.0, 7.0, 7.4, 8.2, 8.0, 8.0, 8.8, 8.8, 9.2]
1. [60, 65, 70, 75, 80, 85, 90, 95] 2. [63.88, 65, 68.06, 71.12, 81.94, 83.06, 86.12, 96.94]
设计思路
1. import numpy as np 2. lists_avg = np.mean(lists_temp) 3. mid_float = round(lists_avg/20,3) 4. # print(lists_avg,mid_float) 5. 6. lists_f = [-mid_float*2,-mid_float,-mid_float, 0,0,0, mid_float,mid_float,2*mid_float,3*mid_float] 7. lists_float = [round(a,2) for a in lists_f] 8. # print(lists_float) 9. 10. one_f = random.sample(lists_float, 1)[0] 11. # print(one_f) 12. 13. 14.