-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeature.py
More file actions
37 lines (26 loc) · 734 Bytes
/
Copy pathfeature.py
File metadata and controls
37 lines (26 loc) · 734 Bytes
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
import pandas as pd
import numpy as np
import math
tr_data = pd.read_csv('clicks_train.csv',nrows=21785433)
#train_df = pd.concat(tr_data,ignore_index=True)
print(len(tr_data))
positive_vectors = []
negative_vectors = []
#for i in tr_data:
# print i
for m,n,i in zip(tr_data['display_id'],tr_data['ad_id'],tr_data['clicked']):
if i == 1:
ids = []
ids.append(m)
ids.append(n)
positive_vectors.append(ids)
else:
nids = []
nids.append(m)
nids.append(n)
negative_vectors.append(nids)
#print(negative_vectors)
train_data_dict = {-1: np.array(negative_vectors),
1: np.array(positive_vectors)
}
print(train_data_dict)