Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display progress bar for grid search and exponentiated gradient #517

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS.md
Expand Up @@ -23,3 +23,4 @@ All names are sorted alphabetically by last name. Contributors, please add your
- [Hanna Wallach](https://www.microsoft.com/en-us/research/people/wallach/)
- [Vincent Xu](https://github.com/vingu)
- [Beth Zeranski](https://github.com/bethz)
- [Arjun Singh](https://github.com/arjsingh)
1 change: 1 addition & 0 deletions CHANGES.md
Expand Up @@ -41,6 +41,7 @@
* Add new constraints and objectives in `ThresholdOptimizer`
* Add class `InterpolatedThresholder` to represent the fitted `ThresholdOptimizer`
* Add `fairlearn.datasets` module.
* Display progress bar for grid search and exponentiated gradient
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: GridSearch and ExponentiatedGradient


### v0.4.6

Expand Down
Expand Up @@ -9,6 +9,7 @@
from ._constants import _ACCURACY_MUL, _REGRET_CHECK_START_T, _REGRET_CHECK_INCREASE_T, \
_SHRINK_REGRET, _SHRINK_ETA, _MIN_ITER, _PRECISION, _INDENTATION
from ._lagrangian import _Lagrangian
from tqdm import tqdm

from fairlearn.reductions._moments import ClassificationMoment
from fairlearn._input_validation import _validate_and_reformat_input
Expand Down Expand Up @@ -101,7 +102,7 @@ def fit(self, X, y, **kwargs):

last_regret_checked = _REGRET_CHECK_START_T
last_gap = np.PINF
for t in range(0, self.max_iter):
for t in tqdm(range(0, self.max_iter)):
logger.debug("...iter=%03d", t)

# set lambdas for every constraint
Expand Down
3 changes: 2 additions & 1 deletion fairlearn/reductions/_grid_search/grid_search.py
Expand Up @@ -9,6 +9,7 @@
from sklearn.dummy import DummyClassifier
from sklearn.utils.validation import check_is_fitted
from time import time
from tqdm import tqdm

from fairlearn._input_validation import _validate_and_reformat_input, _KW_SENSITIVE_FEATURES
from fairlearn.reductions._moments import Moment, ClassificationMoment
Expand Down Expand Up @@ -151,7 +152,7 @@ def fit(self, X, y, **kwargs):

# Fit the estimates
logger.debug("Setup complete. Starting grid search")
for i in grid.columns:
for i in tqdm(grid.columns):
lambda_vec = grid[i]
logger.debug("Obtaining weights")
weights = self.constraints.signed_weights(lambda_vec)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Expand Up @@ -4,6 +4,7 @@ numpy>=1.17.2
pandas>=0.25.1
scikit-learn>=0.22.1
scipy>=1.4.1
tqdm>=4.47.0

# Required for environment
autopep8
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -23,7 +23,8 @@
"numpy>=1.17.2",
"pandas>=0.25.1",
"scikit-learn>=0.22.1",
"scipy>=1.3.1"
"scipy>=1.3.1",
"tqdm>=4.47.0"
],
extras_require={
"customplots": [
Expand Down