Skip to content

Commit

Permalink
Display progress bar for grid search and exponentiated gradient
Browse files Browse the repository at this point in the history
Signed-off-by: Arjun Singh <arjsingh@microsoft.com>
  • Loading branch information
arjsingh committed Jul 16, 2020
1 parent b606a22 commit 5f0a6d1
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 3 deletions.
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

### 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

0 comments on commit 5f0a6d1

Please sign in to comment.