Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Lucas Miranda
deepOF
Commits
e863c9bb
Commit
e863c9bb
authored
Mar 15, 2021
by
lucas_miranda
Browse files
Set default radius for latent entropy computation using an empirically derived linear equation
parent
f4152036
Changes
3
Hide whitespace changes
Inline
Side-by-side
deepof/model_utils.py
View file @
e863c9bb
...
...
@@ -211,12 +211,12 @@ class neighbor_cluster_purity(tf.keras.callbacks.Callback):
"""
def
__init__
(
self
,
variational
=
True
,
validation_data
=
None
,
r
=
0.75
,
samples
=
10000
,
log_dir
=
"."
self
,
r
,
variational
=
True
,
validation_data
=
None
,
samples
=
10000
,
log_dir
=
"."
):
super
().
__init__
()
self
.
r
=
r
self
.
variational
=
variational
self
.
validation_data
=
validation_data
self
.
r
=
r
# Make radius default depend on encoding dimensions
self
.
samples
=
samples
self
.
log_dir
=
log_dir
...
...
deepof/train_model.py
View file @
e863c9bb
...
...
@@ -403,7 +403,7 @@ else:
phenotype_class
=
pheno_class
,
predictor
=
predictor
,
loss
=
loss
,
logparam
=
None
,
logparam
=
logparam
,
outpath
=
output_path
,
)
...
...
deepof/train_utils.py
View file @
e863c9bb
...
...
@@ -75,8 +75,8 @@ def get_callbacks(
cp
:
bool
=
False
,
reg_cat_clusters
:
bool
=
False
,
reg_cluster_variance
:
bool
=
False
,
entropy_samples
:
int
=
1
0
000
,
entropy_radius
:
float
=
0.75
,
entropy_samples
:
int
=
1
5
000
,
entropy_radius
:
float
=
None
,
logparam
:
dict
=
None
,
outpath
:
str
=
"."
,
)
->
List
[
Union
[
Any
]]:
...
...
@@ -113,7 +113,13 @@ def get_callbacks(
)
entropy
=
deepof
.
model_utils
.
neighbor_cluster_purity
(
r
=
entropy_radius
,
r
=
(
entropy_radius
if
entropy_radius
is
not
None
else
0.15
*
logparam
[
"encoding"
]
-
0.18
# equation derived empirically to keep neighbor number constant.
# See examples/set_default_entropy_radius.ipynb for details
),
samples
=
entropy_samples
,
validation_data
=
X_val
,
log_dir
=
os
.
path
.
join
(
outpath
,
"metrics"
,
run_ID
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment