Skip to content

Commit 4bc38fb

Browse files
committed
lint
1 parent 2580cde commit 4bc38fb

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

autointent/metrics/scoring.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,28 @@ def scoring_log_likelihood(labels: LABELS_VALUE_TYPE, scores: SCORES_VALUE_TYPE,
3333
r"""
3434
Supports multiclass and multilabel cases.
3535
36-
Multiclass case
36+
Multiclass case:
3737
Mean negative cross-entropy for each utterance classification result:
3838
3939
.. math::
4040
4141
\frac{1}{\ell}\sum_{i=1}^{\ell}\log(s[y[i]])
4242
43-
where ``s[y[i]]`` is a predicted score of ``i``th utterance having ground truth label
43+
where ``s[y[i]]`` is the predicted score of the ``i``-th utterance having the ground truth label.
4444
45-
Multilabel case
45+
Multilabel case:
4646
Mean negative binary cross-entropy:
4747
4848
.. math::
4949
5050
\frac{1}{\ell}\sum_{i=1}^\ell\sum_{c=1}^C\Big[y[i,c]\cdot\log(s[i,c])+(1-y[i,c])\cdot\log(1-s[i,c])\Big]
5151
52-
where ``s[i,c]`` is a predicted score of ``i``'th utterance having ground truth label ``c``
52+
where ``s[i,c]`` is the predicted score of the ``i``-th utterance having the ground truth label ``c``.
5353
54-
:param labels: ground truth labels for each utterance
55-
:param scores: for each utterance, this list contains scores for each of `n_classes` classes
56-
:param eps: small value to avoid division by zero
57-
:return: Score of the scoring metric
54+
:param labels: Ground truth labels for each utterance.
55+
:param scores: For each utterance, a list containing scores for each of `n_classes` classes.
56+
:param eps: A small value to avoid division by zero.
57+
:return: Score of the scoring metric.
5858
"""
5959
labels_array, scores_array = transform(labels, scores)
6060
scores_array[scores_array == 0] = eps

tutorials/pipeline_optimization/demo.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import importlib.resources as ires
88
from pathlib import Path
99
from typing import Literal
10+
from uuid import uuid4
1011

1112
from autointent.configs.optimization_cli import (
1213
DataConfig,
@@ -22,6 +23,13 @@
2223
TaskType = Literal["multiclass", "multilabel", "description"]
2324

2425

26+
def setup_environment() -> tuple[str, str, str]:
27+
logs_dir = ires.files("tests").joinpath("logs") / str(uuid4())
28+
db_dir = logs_dir / "db"
29+
dump_dir = logs_dir / "modules_dump"
30+
return db_dir, dump_dir, logs_dir
31+
32+
2533
def get_search_space_path(task_type: TaskType) -> None:
2634
return ires.files("tests.assets.configs").joinpath(f"{task_type}.yaml")
2735

0 commit comments

Comments
 (0)