Advertisement
Guest User

Untitled

a guest
Jan 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. impact = 1
  2. p_opt = 0
  3. while X_test.empty==False:
  4. while impact < 25:
  5. for s in samp:
  6. instance = X_test[:1]
  7. instance['samp'] = s
  8. dt_pred = dt.predict(instance);
  9. print(" for sampling rate is " + str(s) + "% predicted loss is: " + str(dt_pred))
  10. if dt_pred[0] < impact:
  11. if s > p_opt:
  12. p_opt = s
  13. else:
  14. print("for traffic of " + str(int(instance['vm'])) + " vms:" + " and " + str(int(instance['bps_expected'])) +" Mbps " +"use sampling rate of " + str(p_opt) + "%")
  15. list_opt=[int(instance['vm'].get_values()),int(instance['bps_expected'].get_values()),p_opt]
  16. full_opt = np.vstack([full_opt,list_opt])
  17. full_opt = pd.DataFrame(full_opt, columns =['vm','bps','p_opt'])
  18. full_opt.to_csv('true_p_impact'+str(impact))
  19. impact +=1
  20. p_opt = 0
  21. print
  22. 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