Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
asv-ml
mlmc
Commits
dc245dd4
Commit
dc245dd4
authored
Dec 13, 2021
by
Janos Borst
Browse files
unsupervised
parent
94c11257
Pipeline
#52996
passed with stage
in 11 minutes and 3 seconds
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
mlmc/metrics/unsupervised.py
View file @
dc245dd4
...
...
@@ -159,9 +159,9 @@ class KeywordCoherence():
kw_acc
=
sum
([(
x
.
item
()
in
y
)
for
x
,
y
in
zip
(
counts
.
sum
(
-
1
).
argmax
(
-
1
),
predictions
)])
/
len
(
predictions
)
kw_sw
=
[
sum
([(
x
.
item
()
in
y
)
for
x
,
y
in
zip
(
counts
[:,:,(
i
-
idx
):
i
].
sum
(
-
1
).
argmax
(
-
1
),
predictions
)])
/
len
(
predictions
)
for
i
in
range
(
min
(
idx
,
ndx
-
1
),
ndx
)]
import
matplotlib.pyplot
as
plt
plt
.
plot
(
kw_sw
)
plt
.
show
()
#
import matplotlib.pyplot as plt
#
plt.plot(kw_sw)
#
plt.show()
return
{
"kw_acc"
:
kw_acc
,
"kwsw_aoc"
:
sum
(
kw_sw
)
/
len
(
kw_sw
),
"kw_sw"
:
kw_sw
,
}
...
...
mlmc/models/abstracts/abstract_textclassification.py
View file @
dc245dd4
...
...
@@ -379,7 +379,7 @@ class TextClassificationAbstract(torch.nn.Module):
if
log_mlflow
:
import
mlflow
mlflow
.
log_metric
(
f
"
{
valid_prefix
}
_loss"
,
valid_loss
,
step
=
e
)
result_metrics
.
log_mlflow
(
step
=
e
,
prefix
=
valid_prefix
)
result_metrics
.
log_mlflow
(
step
=
e
,
prefix
=
valid_prefix
,
model
=
self
)
valid_loss_dict
=
{
f
"
{
valid_prefix
}
_loss"
:
valid_loss
}
valid_loss_dict
.
update
(
result_metrics
.
compute
(
model
=
self
))
...
...
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