-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun.py
63 lines (53 loc) · 2.52 KB
/
run.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
import tr
import sentiment
import pre
import os
import itertools
if __name__ == '__main__':
domain = []
domain.append("books")
domain.append("kitchen")
domain.append("dvd")
domain.append("electronics")
# training the PBLM model in order to create structure aware
#input:
# shared representation for both source domain and target domain
# first param: the source domain
# second param: the target domain
# third param: number of pivots
# fourth param: appearance threshold for pivots in source and target domain
# fifth param: the embedding dimension
# sixth param: maximum number of words to work with
# seventh param: maximum review length to work with
# eighth param: hidden units number for the PBLM model
#output: the software will create corresponding directory with the model
tr.train_PBLM(domain[0], domain[1], 500, 10, 256, 10000, 500, 256)
# training the sentiment cnn using PBLM's representation
# shared representation for both source domain and target domain
# this phase needs a corresponding trained PBLM model in order to work
# first param: the source domain
# second param: the target domain
# third param: number of pivots
# fourth param: maximum review length to work with
# fifth param: the embedding dimension
# sixth param: maximum number of words to work with
# seventh param: hidden units number for the PBLM model
# eighth param: the number of filters for the CNN
# ninth param: the kernel size for the CNN
# output: the results file will be created in the same directory
# of the model under the results directory in the "cnn" dir
sentiment.PBLM_CNN(domain[0], domain[1], 500, 500, 256, 10000, 256, 250, 3)
# training the sentiment cnn using PBLM's representation
# shared representation for both source domain and target domain
# this phase needs a corresponding trained PBLM model in order to work
# first param: the source domain
# second param: the target domain
# third param: number of pivots
# fourth param: maximum review length to work with
# fifth param: the embedding dimension
# sixth param: maximum number of words to work with
# seventh param: hidden units number for the PBLM model
# eighth param: hidden units number for the lstm model
# output: the results file will be created in the same directory
# of the model under the results directory in the "lstm" dir
sentiment.PBLM_LSTM(domain[0], domain[1], 500, 500, 256, 10000, 256, 256)