-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.py
218 lines (207 loc) · 5.52 KB
/
settings.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# import model
from .model.linear_regression import LinearReg
from .model.mine import Mine
from .model.mine_entropy import Mine_ent
from .model.kraskov import Kraskov
from .model.cart_regression import cartReg
from .model.ShannonKDE import ShanKDE
from .model.hellingerDiv import hellingerDiv
from .model.tsallisDiv import tsallisDiv
from .model.chiSqDiv import chiSqDiv
from .model.renyiDiv import renyiDiv
from .model.klDiv import klDiv
from .model.condShannonEntropy import condShanEnt
from .data.bimodal import BiModal
from .data.gaussian import Gaussian
from .data.uniform import Uniform
import math
import os
from datetime import datetime
cpu = 1
batch_size=300
prefix_name = "MMI/Output/main_{0}/".format(datetime.now())
# ground truth is plotted in red
model = {
# 'Linear Regression': { # model name, for plotting the legend
# 'model': LinearReg( # initialize the object
# cvFold=3
# ),
# 'color': 'blue' # for plotting
# },
# 'Kraskov': {
# 'model': Kraskov(
# discrete_features='auto',
# n_neighbors=3,
# random_state=None
# ),
# 'color': 'green'
# },
# 'LOO Shannon KDE': {
# 'model': ShanKDE(
# numPart='loo',
# numAvgPart=1,
# correctBound=False,
# Low=1e-5,
# Upp=math.inf,
# doAsympAnalysis=False,
# alpha=0.5
# ),
# 'color': 'magenta'
# },
# 'LOO hellingerDiv': {
# 'model': hellingerDiv(
# numPart='loo',
# numAvgPart=1,
# correctBound=False,
# Low=1e-5,
# Upp=math.inf,
# doAsympAnalysis=False,
# alpha=0.5
# ),
# 'color': 'cyan'
# },
# 'LOO tsallisDiv': {
# 'model': tsallisDiv(
# numPart='loo',
# numAvgPart=1,
# correctBound=False,
# Low=1e-5,
# Upp=math.inf,
# doAsympAnalysis=False,
# alpha=0.5
# ),
# 'color': 'yellow'
# },
# 'LOO chiSqDiv': {
# 'model': chiSqDiv(
# numPart='loo',
# numAvgPart=1,
# correctBound=False,
# Low=1e-5,
# Upp=math.inf,
# doAsympAnalysis=False,
# alpha=0.5
# ),
# 'color': 'black'
# },
# 'LOO renyiDiv': {
# 'model': renyiDiv(
# numPart='loo',
# numAvgPart=1,
# correctBound=False,
# Low=1e-5,
# Upp=math.inf,
# doAsympAnalysis=False,
# alpha=0.5
# ),
# 'color': 'green'
# },
# 'LOO klDiv': {
# 'model': klDiv(
# numPart='loo',
# numAvgPart=1,
# correctBound=False,
# Low=1e-5,
# Upp=math.inf,
# doAsympAnalysis=False,
# alpha=0.5
# ),
# 'color': 'orange'
# },
# 'LOO condShanEnt': {
# 'model': condShanEnt(
# numPart='loo',
# numAvgPart=1,
# correctBound=False,
# Low=1e-5,
# Upp=math.inf,
# doAsympAnalysis=False,
# alpha=0.5
# ),
# 'color': 'pink'
# },
# 'Cart Reg': {
# 'model': cartReg(
# cvFold=3
# ),
# 'color': 'pink'
# },
# 'MINE_direct': {
# 'model': Mine(
# lr=1e-4,
# batch_size=batch_size,
# patience=int(20),
# iter_num=int(2e+3),
# log_freq=int(100),
# avg_freq=int(10),
# ma_rate=0.01,
# verbose=False,
# prefix=prefix_name,
# objName='Dir'
# ),
# 'color': 'orange'
# },
'MINE_entropy': {
'model': Mine_ent(
lr=1e-3,
batch_size=batch_size,
patience=int(200),
iter_num=int(2e+4),
log_freq=int(100),
avg_freq=int(10),
ma_rate=0.01,
verbose=False,
prefix=prefix_name,
objName='Ent'
),
'color': 'purple'
}
}
n_samples = batch_size * 20
# rhos = [0, 0.2, 0.4, 0.6, 0.8, 0.85, 0.9, 0.95, 0.99, 0.999 ]
rhos = [0.99 ]
variables = [3, 4, 5, 6, 7]
widths = list(range(10))
varName = 'correlation'
data = {
'BiModal': {
'model': BiModal,
'kwargs': [ # list of params
{
'n_samples':n_samples,
'mean1':0,
'mean2':0,
'rho1': rho,
'rho2': -rho,
'varName': varName,
'varValue': rho
} for rho in rhos
],
'varying_param_name': 'rho1', # the parameter name which denotes the x-axis of the plot
'x_axis_name': 'correlation',
},
# 'Gaussian': {
# 'model': Gaussian,
# 'kwargs': [
# {
# 'n_samples':n_samples,
# 'mean1':0,
# 'mean2':0,
# 'rho': rho,
# 'varName': varName,
# 'varValue': rho
# } for rho in rhos
# ],
# 'varying_param_name': 'rho',
# 'x_axis_name': varName,
# },
# {
# 'name': 'Examples',
# 'model': XX(
# n_samples=XX
# rho=XX
# )
# },
}
n_datasets = len(data)
# n_columns = max([len(rhos), len(widths)])