-
Notifications
You must be signed in to change notification settings - Fork 0
/
scratch.py
45 lines (29 loc) · 903 Bytes
/
scratch.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
40
41
42
43
44
45
import pickle
import json
import pprint
import random
# with open("results/clean", "r") as f:
# data = json.load(f)
# for i in range(8400):
# print(len(data["feature"][i]))
with open("results/raw_data", "rb") as infile:
data = pickle.load(infile)
with open("results/notated_clean", "w") as outfile:
json.dump(data, outfile)
# def chunkIt(seq, num):
# avg = len(seq) / float(num)
# out = []
# last = 0.0
# while last < len(seq):
# out.append(seq[int(last):int(last + avg)])
# last += avg
# return out
# conc = [random.randint(0, 100) for i in range(1000)]
# altconc = [sum(x) for x in chunkIt(conc, 70)]
# print("len conc:", len(conc))
# print("len altconc:", len(altconc))
"""
NOTES
Class - website classification value, first item in 'label' tuple
Instance - nth time that website was visited, second item in 'label' tuple
"""