-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChannelsIpAmountConversion.py
39 lines (32 loc) · 1.04 KB
/
ChannelsIpAmountConversion.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import os
import time
import _pickle as pickle
from itertools import islice
import numpy as np
import matplotlib.pyplot as plt
def main():
myDirectory = "ChannelsIPs/"
f = open("ChannelsIPs/channelsUniqueIPsAmount.train.txt", "rb")
channelsUniqueIPsAmount = pickle.load(f)
f.close()
f = open("myPickler/channelsDict.train.txt", "rb")
myDict = pickle.load(f)
f.close()
x = []
y = []
for channel in channelsUniqueIPsAmount:
f = myDict[channel][1] / myDict[channel][0]
conversion = np.around(f, decimals=5)
x.append(channelsUniqueIPsAmount[channel])
y.append(conversion)
plt.plot(x, y, 'r.')
plt.xlabel("Unique IP Amount")
plt.ylabel("Conversion ")
name = "train.txt"
plt.title("ChannelsIPAmountConversion." + name + ".png")
plt.tight_layout(h_pad=0, pad=0.4)
fig = plt.gcf()
fig.set_size_inches(10, 10, forward=True)
plt.grid(True)
plt.savefig(myDirectory + "ChannelsIPAmountConversion." + name + ".png")
main()