Conversation
…bel for multi-label case
| "Ensure that each label falls within the valid range of 0 to `n_classes - 1`." | ||
| ) | ||
| raise ValueError(message) | ||
| if isinstance(self.label, list): |
There was a problem hiding this comment.
Кое-где встречаются такие проверки. Мб здесь использовать специальные типы, которые ты добавил
There was a problem hiding this comment.
да, наверное стоит потом так и делать
в следующих пр и ревью будем учитывать
| "Please provide at least one valid label." | ||
| ) | ||
| raise ValueError(message) | ||
| if any(lab not in [0, 1] for lab in self.label): |
There was a problem hiding this comment.
Точно это сокращение нужно?
There was a problem hiding this comment.
Точно нужны эти исключения? Не можем просто ValueError кидать
There was a problem hiding this comment.
они в тестах у нас используются
и чтобы одно и то же сообщение каждый раз не переопределять
| msg = "JinoosDecision is compatible with single-label classification only" | ||
| raise WrongClassificationError(msg) | ||
| self.n_classes = len(set(labels).difference([-1])) | ||
| self._n_classes, multilabel, contains_oos = self._validate_inputs(scores, labels) |
There was a problem hiding this comment.
Не хочешь в декоратор эти строчки вынести?
There was a problem hiding this comment.
честно хотел бы но денис и рома говорили что декораторы использовать плохо
мб в будущем как-то исправим это дублирование кода
There was a problem hiding this comment.
Их не плохо использовать, для валидации норм. Просто раньше была какая-то часть логики в них и это было не удобно
| from autointent.custom_types import ListOfLabels | ||
|
|
||
| LABELS_VALUE_TYPE = list[LabelType] | npt.NDArray[Any] | ||
| LABELS_VALUE_TYPE = ListOfLabels |
There was a problem hiding this comment.
ALL_CAPS + UpperCamelCase
There was a problem hiding this comment.
создал issue, потом исправим
| MultiLabel = list[int] | ||
| SimpleLabelWithOOS = SimpleLabel | None | ||
| MultiLabelWithOOS = MultiLabel | None | ||
| ListOfLabels = list[SimpleLabel] | list[MultiLabel] |
There was a problem hiding this comment.
Мне кажется ListOfLabels понятнее
| def _separate_oos(self, dataset: HFDataset) -> tuple[HFDataset, HFDataset]: | ||
| in_domain_ids = [] | ||
| out_of_domain_ids = [] | ||
| for i, sample in enumerate(dataset): |
There was a problem hiding this comment.
Мб попробовать избавиться от этого цикла через map(with_indices=True)
There was a problem hiding this comment.
прикольно, не знал что такое есть) запомню на будущее, а тут пока пусть останется
мне осталось дописать тесты на стратификацию и обновить датасеты на хагинг фейсе
что изменилось в этом огромном пр: