提交

提交图

1824 次代码提交

作者 SHA1 备注 提交日期
Anish Athalye a903c4c022 Add CI check for trailing newlines in notebooks
The rendered docs don't look good when code cells have trailing
newlines.
2022-04-05 08:32:24 -04:00
Anish Athalye 6cac342613 Add CI check that .ipynb outputs are empty
Preserving the output cells in Jupyter notebooks that are checked in to
this repo bloat the repo size, and keeping the output is not necessary
because the notebooks are run as part of the CI for producing docs.

For example, in https://github.com/cleanlab/cleanlab/pull/165, the
`audio.ipynb` is 112K (and now part of the repo history forever), while
clearing the output cells reduces that size down to 24K. I suspect that
Git's delta compression will also work better without the output cells
there as we make changes to the notebook. Also, the diffs will be more
readable.
2022-04-05 08:15:54 -04:00
Wei Jing 080c7a841c Add overview for computing out-of-sample predicted probabilities with cross-validation to doc site (#166)
* add pred probs cross val tutorial

Co-authored-by: Jonas Mueller <1390638+jwmueller@users.noreply.github.com>
2022-04-05 03:34:30 -07:00
Wei Jing 5b6d297b6c Add audio tutorial to doc site (#165)
* add audio tutorial
2022-04-05 03:16:07 -07:00
Wei Jing 1f60745b2c add text tutorial, update notebook titles and naming conventions (#154) 2022-04-04 20:56:34 -07:00
Anish Athalye c73336cb3a Merge branch 'development-guide' 2022-04-03 19:53:50 -04:00
Anish Athalye 9101b85e68 Add development guide
This patch also adds a pre-commit hook that runs Black.
2022-04-03 19:31:05 -04:00
Jonas Mueller 89c172a359 Merge pull request #160 from anishathalye/py310
Add Python 3.10 to CI
2022-04-03 13:37:12 -07:00
Anish Athalye 78c30b04f7 Add Python 3.10 to CI 2022-04-03 14:22:49 -04:00
Jonas Mueller 3f17be685e Minor tutorial edits (#155)
* remove whats next in tutorial

* capitalize tutorial title
2022-04-01 08:45:58 -07:00
Jonas Mueller 2f60c0f263 Merge pull request #151 from weijinglok/add-tab-tut
Add tutorial for tabular data classification
2022-03-31 20:36:17 -07:00
Johnson Kuan 6d8102c7f6 Add fix and test for sklearn GridSearchCV with LearningWithNoisyLabels (#153)
* Move _process_label_issues_kwargs to fit method

* Add test for sklearn GridSearchCV with kwargs

* Add comment to test for sklearn GridSearchCV with kwargs

* Change cv=3 for GridSearchCV in test
2022-03-31 19:21:35 -07:00
Wei Jing Lok d5dc5564e5 add tabular tutorial 2022-04-01 09:59:01 +08:00
Johnson Kuan 0f86e7b884 Enable use of find_label_issues_kwargs for hyper-parameter search (#152)
* Move find_label_issues_kwargs dict arg to init() method

* Update tests after moving find_label_issues_kwargs dict arg to init() method.

* Remove blank line

* Cleanup docstring

* add self.find_label_issues_kwargs
2022-03-31 15:11:03 -07:00
Jonas Mueller 1247f165f2 Improve user-control (#149)
* improved language in docs Quickstart

* LearningWithNoisyLabels refactor to improve API flexibility and UX

* fix LearningWithNoisy rare label handling

* additional arg-checking unit tests
2022-03-30 08:18:38 -07:00
Jonas Mueller 00e3681955 Merge pull request #148 from anishathalye/allow-nd
Allow n-dim data in LearningWithNoisyLabels
2022-03-28 21:24:36 -07:00
Anish Athalye aec6734902 Allow n-dim data in LearningWithNoisyLabels
LearningWithNoisyLabels used `sklearn.utils.check_X_y` to enforce that
`X` was 2D, to be in line with what sklearn's standard estimators
expect. However, LearningWithNoisyLabels is dataset-agnostic: it doesn't
look at the data points themselves. If the underlying classifier
supports data in a different shape, there's no reason
LearningWithNoisyLabels should prohibit it. Users have requested that we
relax this unnecessary restriction [1] so LearningWithNoisyLabels will
more naturally support e.g. image datasets and CNN models.

Thanks to @kothari1997narayan for suggesting this change.

[1]: https://github.com/cleanlab/cleanlab/issues/86
2022-03-29 00:16:40 -04:00
Johnson Kuan 39f6948e2e Update default label quality scoring method to self_confidence (#147)
* Update default label quality scoring method to self_confidence
2022-03-28 20:10:09 -07:00
Jonas Mueller b4b48f88bc Merge pull request #144 from anishathalye/safe-clone
Fix sklearn estimator cloning
2022-03-28 15:47:57 -07:00
Wei Jing 4c9fb124b1 update quickstart to reflect v2.0 API (#143) 2022-03-28 15:44:41 -07:00
Anish Athalye e7f828976f Add explanation that estimators must be clonable (#146)
Inspired by [1] and similar examples. See also: the pull request that
switches from `copy.deepcopy` to `sklearn.base.clone` [2]. Even the
latter calls `sklearn.base.clone(..., safe=False)` on the values
returned by `get_params()`, so the user has to be sure that their model
is correctly clonable, otherwise they may get silently incorrect
behavior.

[1]: https://github.com/cleanlab/cleanlab/issues/87
[2]: https://github.com/cleanlab/cleanlab/pull/144
2022-03-28 15:43:44 -07:00
Anish Athalye 51a4c921b1 Remove unnecessary print statement (#145)
This was accidentally included in
0a6b55b323.
2022-03-28 15:40:11 -07:00
Anish Athalye 1848db0223 Fix sklearn estimator cloning
Arbitrary scikit-learn estimators are not safe to clone via
`copy.deepcopy()`, for example when they contain state that cannot be
pickled, such as a Keras model that contains a `_thread.RLock` [1]. The
correct way to clone an estimator is to use `sklearn.base.clone()` [2],
which constructs a new unfitted estimator with the same parameters as
the original by calling `get_params()` followed by creating a new object
of the class, passing the parameters to `__init__()`. This patch
switches from `copy.deepcopy` to `sklearn.base.clone`.

This patch also updates the MNIST PyTorch CNN example model to be
compatible with `sklearn.base.clone`. Writing a custom `get_params`
implementation usually wouldn't be necessary with a more standard
estimator that inherits from `BaseEstimator`, but it was necessary to
override the method in this case because of the nonstandard
implementation that supports multiple datasets and does data loading
within the estimator itself based on the `dataset` argument.

[1]: https://github.com/cleanlab/cleanlab/issues/87
[2]: https://scikit-learn.org/stable/modules/generated/sklearn.base.clone.html
2022-03-28 15:54:19 -04:00
Jonas Mueller 1ed74986a8 Merge branch 'anishathalye-numpy-deprecation-warning' 2022-03-28 13:17:23 -04:00
Jonas Mueller dac3d12717 merge np.long->int32 update 2022-03-28 13:17:10 -04:00
Jonas Mueller 7b2340b638 Utilites -> internal submodule refactor (#141)
* utilities -> internals

* docbuilding instructions improvement

* fixup formatting of contributing.md

* change contributor guidelines language to be optional

* line formatting
2022-03-28 09:53:10 -07:00
Anish Athalye 0a6b55b323 Fix NumPy deprecation warning
`np.long` was deprecated in NumPy 1.20, and this was making the test
output noisy with deprecation warnings. This patch replaces the type
with `np.int32` (the labels are 0--9).
2022-03-28 09:45:06 -04:00
Jonas Mueller 9a3eb36881 Merge pull request #138 from weijinglok/fix-img-tut
Change cleanlab version in Image Tutorial
2022-03-27 09:32:39 -07:00
Wei Jing Lok 034eb80061 Change .ipynb files to use master ver of cleanlab 2022-03-27 17:45:05 +08:00
Johnson Kuan c50836cfbf Add label quality scoring functions and user API to choose the method (#131)
* Add label quality scoring function for users to choose the scoring method.

Add confidence_weighted_entropy as another label quality score that is available for scoring and ranking.

Add option in scoring function to adjust predicted probabilities by subtracting the class thresholds.

Refactor order_label_issues to use the new label quality scoring function and accept keyword args.

* Cleanup docstring in label quality scoring functions

* Change rank_by_kwargs default to empty dict. Dict is used as keyword args for label quality scoring function.

* Cleanup docstrings. Add **rank_by_kwargs to signature of order_label_issues function.

* Add exception handler for invalid rank_by methods

* Add **rank_by_kwargs to allow keyword args in find_label_issues()

* Add test for confidence_weighted_entropy rank scoring function

* Add test for scoring function that accepts scoring method

* Cleanup comments

* Update test for scoring functions

* Update test for scoring functions

* Modify order_label_issues() function to run score_label_quality with (labels, pred_probs) and then filter with label_issues_mask. This is more robust to allow us to adjust the pred_probs (e.g. subtract confident class thresholds)

* Update test for label quality scoring

* Update test for label quality scoring

* Update exception handler for label scoring function

* Add test for subtracting confident class thresholds

* Update test for subtracting confident class thresholds

* Update test for subtracting confident class thresholds

* Add ensemble label quality scoring function

* Update test for ensemble label quality scoring function

* Update test for ensemble label quality scoring function

* Update docstrings for functions that accept adj_pred_probs with description of the adjustment to pred_probs

* Update find_label_issues to pass rank_by_kwargs as a dict

* Cleanup comments

* Refactor tests for scoring functions to avoid redundancies

* Refactor tests for scoring functions to avoid redundancies. Use parameterize instead of for-loop

* Parameterize scoring method to test ensemble scoring function

* Print scoring method when scoring function test fails

* Cleanup docstrings to avoid redundancies

* Move class confident threshold functions to new label quality utils module. Add weight_ensemble_members_by parameter to label quality ensemble scoring function allows users to choose weighting scheme (uniform, accuracy). Enhance tests for CI.

* Add test for CI. Test bad arg for weight_ensemble_members_by parameter.

* Add explicit error checking of pred_probs_list arg.

* Cleanup docstring and print statements

* Cleanup docstrings. Move get_entropy to utils. Refactor score_label_quality_ensemble to print accuracy weights

* Change default label quality scoring method to normalized_margin. Add to docstring explaining when to use normalized_margin vs self_confidence.

* Cleanup docstring

* Cleanup docstrings. Rename get_entropy() to get_normalized_entropy()

* Rename score_label_quality() to get_label_quality_scores(). Rename score_label_quality_ensemble() to get_label_quality_ensemble_scores().

* Remove extra indent in docstring

* Rename adj_pred_probs to adjust_pred_probs. Move get_confident_thresholds() to count.py module.

* Add comment to explain why we add a dimension for numpy broadcasting.

* Change renormalization logic when adjusting pred_probs. Raise ValueError when adjust_pred_probs is used with unsupported scoring method. Add test for ValueError.

* Update tests to account for unsupported method when running adjust_pred_probs.

* Enhance docstring tests
2022-03-26 18:50:34 -07:00
Jonas Mueller 9d1fb54842 Merge pull request #136 from weijinglok/fix-toc
Fix docs TOC for v2.0
2022-03-23 14:23:38 -07:00
Wei Jing Lok da686a4006 update doc toc for 2.0 2022-03-24 03:28:14 +08:00
Jonas Mueller cf09fbe86c Merge pull request #135 from weijinglok/fix-rel-path
Remove extra slashes in docs relative path
2022-03-23 10:07:41 -07:00
Wei Jing Lok 2b9a7123ed remove extra slash in rel path 2022-03-24 01:03:45 +08:00
Jonas Mueller 9d1e5319bc Merge pull request #134 from cleanlab/patch-docsrebuild
remove redundant text
2022-03-23 09:38:24 -07:00
Jonas Mueller 9aae5c330b remove redundant text
also retrigger docs build
2022-03-23 09:37:05 -07:00
Wei Jing aca683ec80 Add image classification tutorial and streamline docs CI/CD (#127) 2022-03-22 19:34:27 -04:00
Jonas Mueller 3a53705287 Merge pull request #132 from weijinglok/rtd-redirect
Redirect RTD site to docs.cleanlab.ai: Part 2
2022-03-22 15:55:32 -07:00
Wei Jing Lok e8be62eee2 delete readthedocs files 2022-03-21 14:55:22 +08:00
Jonas Mueller 520349361c Merge pull request #130 from weijinglok/rtd-redirect
Redirect RTD site to docs.cleanlab.ai
2022-03-20 23:07:13 -07:00
Wei Jing Lok 1ffda28bfc add RTD redirecting file 2022-03-18 18:47:53 +08:00
Anish Athalye 11dff1faf4 Standardize code style to Black (#107)
* Set up Black as the code style

* Migrate code style to Black
2022-03-16 21:27:36 -04:00
Curtis G. Northcutt 8f9f3f5380 Major API change. Introducing Cleanlab 2.0 (#128)
* Refactor modules pruning to filter and latent_estimation to count

* Remove polyplex (research) algorithms from cleanlab

* Create new module rank and move scoring functions to rank.

* Rename test to match new module names

* Fixed error in normalized margin. added ranking for arbitrary psx and labels.

* Remove unused tests and methods. add multi-label support for baseline.

* Move baseline methods to filter and delete baseline module.

* change filter.get_noise_indices to filter.find_label_issues

* Rename baseline methods. fill out docstrings.

* Only require 1 example to be left in each class after removing errors. (instead of 5)

* Remove K as a parameter to count.compute_confident_joint

* Add C_argmax and C_ij methods from CL paper to find_label_issues

* Add warnings for new prune methods and frac_noise. Fix tests.

* Add baseline tests to test_rank_filter and delete baseline test

* Remove inverse_noise_matrix parameter in classification call to find_label_issues

* add todo to update docstring with new ranking functions

* 100% tests pass. add multi-label support for prune_method

* Major NOT-backwards-compatible name changes to most components

* More Major NOT-backwards-compatible name changes

* fixed s -> label mistakes

* Several nomenclature updates from PR feedback. models renamed to example models.

* Remove python2 support across all modules.

* major api changes. psx -> pred_probs. prob_given_label -> self_confidence. testing added.

* enable python version 3.9 for pytorch model.

* ran spellcheck

* ran grammar check

* Update count.py

* Update filter.py

* Update setup.py and ci.yml to no longer support Python 2 and py3.4/5

* Increase test coverage and documentation of rank module methods.

* create utils submodule and move util and latent_algebra

* Rename y everywhere to true_labels, and p(true_label=..)

* Enforce positional arguments in methods. Fully remove py2 support.
2022-03-16 06:52:03 -04:00
Jonas Mueller d745b8f16c Merge pull request #129 from anishathalye/editorconfig
Add EditorConfig
2022-03-14 20:24:10 -07:00
Anish Athalye 5b3691eff0 Add EditorConfig
This will help maintain consistent coding styles across various editors
and IDEs. See <https://editorconfig.org/>.
2022-03-12 09:23:40 -05:00
Curtis G. Northcutt b1ea583acc Update readme for new conda installation 2022-03-04 13:25:33 -05:00
Curtis G. Northcutt 07e5ed8221 add conda update instructions 2022-03-04 13:21:07 -05:00
Curtis G. Northcutt 0ce822da79 Merge pull request #126 from cgnorthcutt/master
convert readme to markdown for pypi release.
2022-03-03 01:11:06 -08:00
Curtis G. Northcutt be7c3d825e convert readme to markdown for pypi release. 2022-03-03 01:00:21 -08:00
Curtis G. Northcutt 29e4a97124 Merge pull request #125 from cgnorthcutt/release101
CI / Test: Python 2.7 on ubuntu-latest (push) Has been cancelled
CI / Test: Python 2.7 on macos-latest (push) Has been cancelled
CI / Test: Python 3.6 on macos-latest (push) Has been cancelled
CI / Test: Python 3.7 on macos-latest (push) Has been cancelled
CI / Test: Python 3.8 on macos-latest (push) Has been cancelled
CI / Test: Python 3.9 on macos-latest (push) Has been cancelled
CI / Test: Python 3.6 on ubuntu-latest (push) Has been cancelled
CI / Test: Python 3.7 on ubuntu-latest (push) Has been cancelled
CI / Test: Python 3.8 on ubuntu-latest (push) Has been cancelled
CI / Test: Python 3.9 on ubuntu-latest (push) Has been cancelled
CI / Test: Python 2.7 on windows-latest (push) Has been cancelled
CI / Test: Python 3.6 on windows-latest (push) Has been cancelled
CI / Test: Python 3.7 on windows-latest (push) Has been cancelled
CI / Test: Python 3.8 on windows-latest (push) Has been cancelled
CI / Test: Python 3.9 on windows-latest (push) Has been cancelled
Update version to 1.0.1
v1.0.1
2022-03-02 16:58:43 -08:00