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
a13aac38
Commit
a13aac38
authored
Mar 12, 2021
by
lucas_miranda
Browse files
Prototyped KNN_purity callback
parent
25dc77d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
deepof/model_utils.py
View file @
a13aac38
...
@@ -189,11 +189,7 @@ class one_cycle_scheduler(tf.keras.callbacks.Callback):
...
@@ -189,11 +189,7 @@ class one_cycle_scheduler(tf.keras.callbacks.Callback):
def
on_batch_end
(
self
,
epoch
,
logs
=
None
):
def
on_batch_end
(
self
,
epoch
,
logs
=
None
):
"""Add current learning rate as a metric, to check whether scheduling is working properly"""
"""Add current learning rate as a metric, to check whether scheduling is working properly"""
self
.
add_metric
(
return
self
.
last_rate
self
.
last_rate
,
aggregation
=
"mean"
,
name
=
"learning_rate"
,
)
class
knn_cluster_purity
(
tf
.
keras
.
callbacks
.
Callback
):
class
knn_cluster_purity
(
tf
.
keras
.
callbacks
.
Callback
):
...
@@ -256,11 +252,7 @@ class knn_cluster_purity(tf.keras.callbacks.Callback):
...
@@ -256,11 +252,7 @@ class knn_cluster_purity(tf.keras.callbacks.Callback):
*
np
.
max
(
groups
[
sample
])
*
np
.
max
(
groups
[
sample
])
)
)
self
.
add_metric
(
return
purity_vector
.
mean
()
self
.
purity_vector
,
aggregation
=
"mean"
,
name
=
"knn_cluster_purity"
,
)
class
uncorrelated_features_constraint
(
Constraint
):
class
uncorrelated_features_constraint
(
Constraint
):
...
...
Write
Preview
Supports
Markdown
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