Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- impact = 1
- p_opt = 0
- while X_test.empty==False:
- while impact < 25:
- for s in samp:
- instance = X_test[:1]
- instance['samp'] = s
- dt_pred = dt.predict(instance);
- print(" for sampling rate is " + str(s) + "% predicted loss is: " + str(dt_pred))
- if dt_pred[0] < impact:
- if s > p_opt:
- p_opt = s
- else:
- print("for traffic of " + str(int(instance['vm'])) + " vms:" + " and " + str(int(instance['bps_expected'])) +" Mbps " +"use sampling rate of " + str(p_opt) + "%")
- list_opt=[int(instance['vm'].get_values()),int(instance['bps_expected'].get_values()),p_opt]
- full_opt = np.vstack([full_opt,list_opt])
- full_opt = pd.DataFrame(full_opt, columns =['vm','bps','p_opt'])
- full_opt.to_csv('true_p_impact'+str(impact))
- impact +=1
- p_opt = 0
- print
- X_test = X_test.drop(X_test.loc[(X_test['vm'] == int(instance['vm'].get_values())) & (X_test['bps_expected'] == int(instance['bps_expected'].get_values()))].index)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement