文件历史

14 次代码提交

作者 SHA1 备注 提交日期
Elías Snorrason bad83457f3 Drop Python 3.7 support and add Python 3.11 support (#980) 2024-02-07 14:46:58 -07:00
Tata Ganesh d37a7d8d85 Expose low memory option for token and multi-label classification (#822) 2023-08-23 01:14:29 -04:00
Jonas Mueller d5e81f0c6d allow for kwargs in token find_label_issues (#686) 2023-04-28 10:28:39 -07:00
Elías Snorrason 8ff371c16c separate word coloring from token-replacement (#514)
Fixes #513
2022-10-31 14:21:05 +00:00
Jonas Mueller 7256cd3546 More improvements to token classification code and documentation (#452)
* improved token docs/code

* format paragraphs in docstrings

* fix typo

Co-authored-by: Elías Snorrason <eliassno@gmail.com>
2022-09-16 14:04:45 +00:00
Elías Snorrason 95b0742342 Make softmin_sentence_score a private function (#449)
This scoring function is only used internally. Might as well be private.
2022-09-15 23:19:15 +00:00
Elías Snorrason 9a109182b1 Update argument given_labels -> labels in token classification module (#423)
* given_labels -> labels

only applies to the argument to `display_issues`

Fixes #418

* update kwargs in test for display_issues

* apply black formatter
2022-09-11 12:38:38 -07:00
Elías Snorrason 8371edffc9 🐛 escape special regex characters (#404)
Fixes #403
2022-09-06 09:28:59 -07:00
Elías Snorrason 9f030a65ac Cleanup-summary (#396)
* 🎨 remove wildcard imports

* 🏷️ review type annotations in display_issues

Restrict nested lists with `List`. Keep unrestricted lists as `list`. Remove hard-coded tags from docstrings, should be auto-tagged in later PR.

* ♻️ use `isinstance` for type-check at runtime

* 🏷️ review type annotations in common_label_issues and filter_by_token

Remove hard-coded tags in docstrings. Should be auto-tagged in later PR.

*  improve test coverage of display issues

No part of the function is easily testable except ensuring it completes exection. Some parts handle edge cases that were never reached during testing.

*  parametrize tests for coverage on common_label_issues and filter_by_token
2022-09-05 17:21:26 -07:00
Elías Snorrason 71521e90d3 Match token/s in color_sentence (#397)
*  search tokenized sentence for coloring

Searches through the list of tokens before trying to match substrings. Thanks for this code suggestion Eric!

* 🚧 fix signature in all calls to color_sentence

*  update color_sentence test after changing its api

(sentence, word) -> (word, tokens)

*  use regex for coloring tokens in sentence

Find word boundaries with regex, use builtin replace() as fallback w/o boundaries.

Closes #288

* 🚑 invert fallback condition

Use replace if NO substitutions were made with regex.
2022-09-05 16:30:29 -07:00
Elías Snorrason afa217cb4a Fix typing for find_label_issues (#391) 2022-09-03 12:30:07 -07:00
Elías Snorrason c884dc5171 Cleanup token_classification.rank module (#393)
*  add test fixture for get_label_quality_scores

*  test softmin_sentence_score

include test cases for temperature limits

* ♻️ cleanup softmin_sentence_score

Remove unused keyword-only args, Fix tag in docstring, Change format of nested functions.

*  specialize edge-case temperature=inf in softmin_sentence_score

* ♻️ simplify temperature lookup

* ♻️ cleanup get_label_quality_scores

Remove unused args/variables. Update parameter list in docstring. Rename parameter of inner function. Function always returns a tuple.

* 🏷️ tag token_scores as optional

*  test raised error

* 🩹 skip untestable elif statement

the elif statement only gets partial coverage because it can't evaluate to False due to the `assert sentence_score_method` at the start of the function
2022-09-02 18:26:07 -07:00
Elías Snorrason 6ec5b173dd Cleanup token classification utils (#390)
* 🏷️ restrict parameters for list types

* 🐛 only process characters in input token

Example: process_token("Cleanlab", [("C", "a"), ("a", "C")]) should return "aleCnlCb", not "CleCnlCb".

*  use all sentences in test_get_sentence

*  add test cases to test_filter_sentence

*  extent test cases in test_mapping

* 📝 clean up docstrings

Restrict arg types based on docstrings. Fix punctuation and typos. Add examples to docstring.

*  split tests for filter_sentence

*  extend test_merge_probs

*  test merge_probs with ignored/normalized columns in probs

*  extend test cases for get_sentences

* ⚰️ remove unused pandas import

* 🏷️ pass strict mypy check

We ignore np.max as it is untyped.

No issues found in token_classification_utils.py by running
```
mypy --install-types --non-interactive --strict cleanlab/internal/token_classification_utils.py
```

* 👷 add strict type-checking in CI

* 💚 use strict type-check for single file

*  remove strict type check in CI

* refactor: 🏷️ use np.ndarray type instead of npt.NDArray

*  go back to generic np.ndarray type

* ♻️ always return tuple in filter_sentence

Remove unused argument+docstring. Simplify relevant unit tests.

* 🔥 resolve comments on typing

Remove ignore-comments. Remove duplicate tag in docstring. Remove unused imports.

* 🔥 remove duplicate tag in docstring
2022-09-01 17:07:39 -07:00
Eric Wang 1bad2f82a2 Adding functionality for cleanlab to find label errors in token classification datasets (#347)
* add token_classification functionality

* add typing

* fix typing

* add typing

* fixed typing and black

* fix typing
2022-08-30 09:17:07 -07:00