Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ienco Dino
cMTS-Clustering
Commits
8444a01c
Commit
8444a01c
authored
Mar 10, 2021
by
Ienco Dino
Browse files
some modification
parent
4f80c5d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
main.py
View file @
8444a01c
...
...
@@ -136,6 +136,7 @@ def trainRNNAE(model, nClasses, data, f_data, s_data, y_val, loss_huber, optimiz
#th = 40
n_epochs_warmUp
=
40
centers
=
None
print
(
"PRETRAINING STAGE : AE + CONTRASTIVE LOSS"
)
for
e
in
range
(
n_epochs_warmUp
):
f_data
,
s_data
,
y_val
,
=
shuffle
(
f_data
,
s_data
,
y_val
)
data
=
shuffle
(
data
)
...
...
@@ -143,6 +144,8 @@ def trainRNNAE(model, nClasses, data, f_data, s_data, y_val, loss_huber, optimiz
trainLoss
+=
trainStepL
(
model
,
f_data
,
s_data
,
y_val
,
loss_huber
,
optimizer2
,
BATCH_SIZE
,
e
)
print
(
"epoch %d with loss %f"
%
(
e
,
trainLoss
))
print
(
"COMPUTE INTERMEDIATE CLUSTERING ASSIGNMENT"
)
emb
,
_
,
_
,
_
=
model
(
data
)
km
=
KMeans
(
n_clusters
=
nClasses
)
km
.
fit
(
emb
)
...
...
@@ -151,6 +154,8 @@ def trainRNNAE(model, nClasses, data, f_data, s_data, y_val, loss_huber, optimiz
centers
.
append
(
km
.
cluster_centers_
[
val
])
centers
=
np
.
array
(
centers
)
print
(
"REFINEMENT STEP alternating AE + MANIFOLD STRETCH TOWARDS CENTROIDS and AE + CONTRASTIVE LOSS"
)
for
e
in
range
(
n_epochs
-
n_epochs_warmUp
):
#labelledData, labelsSmall = shuffle(labelledData, labelsSmall)
data
,
centers
=
shuffle
(
data
,
centers
)
...
...
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