-
Notifications
You must be signed in to change notification settings - Fork 12
FairGBM openml API implementation #116
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
5157cb5
resolving clashes with LightGBM version 3.2.1.99
471db96
Implemented the FairGBM parameter descriptor
6bc5519
all tests now pass
dd25f6f
passing necessary group information to LightGBM c++ metadata class
b0115d3
checking whether sensitive group column is in categorical format
5750e9d
added tests for FairGBM openml interface
40c39ce
fixing bug on replace of ImmutableMap
43a4097
tests now pass
9fc17f4
remove debug messages
86bb609
tidying code according to PR feedback
33a63d3
constraint_group data is now held in int instead of float for compati…
2733056
applying PR feedback
6b021c8
updated lightgbm pom to point to latest python-api branch
AndreFCruz 1aa9913
removed deprecated code
AndreFCruz a624bf3
improving memory management of SWIG data
AndreFCruz d103d68
running intellij code cleanup
AndreFCruz 95c57ac
Revert H2OApp changes.
fdz-sergio-jesus 425f69c
Revert H2OApp changes on all files.
fdz-sergio-jesus 3e91876
Small fixes to typing, and javadocs.
fdz-sergio-jesus 08be7c9
udpated make-lightgbm submodule
AndreFCruz 2c88181
update lightgbm version
AndreFCruz e0dd26d
asserting fairnessConstrained=True before setting group data
AndreFCruz 1e03207
moved all FairGBM-specific input handling to a separate class
AndreFCruz 227c4f2
fairgbm input processing
AndreFCruz 04c0ad1
ensure that loaded file is properly closed
AndreFCruz 9927507
Update openml-lightgbm/lightgbm-provider/src/main/java/com/feedzai/op…
AndreFCruz 92ea39d
Apply suggestions from code review
AndreFCruz c83737b
applied PR feedback
AndreFCruz e405a08
added links to appropriate GH issues
AndreFCruz df6ff35
speeding up system tests by running only 2 boosting iterations
AndreFCruz cf0dd85
Tests fix.
fdz-sergio-jesus ddaea86
Restore comparison to fairnessConstrained SWIG objects.
fdz-sergio-jesus 9eb4cdc
Change to comparison when set has size of only two elements.
fdz-sergio-jesus a9b33db
applying PR feedback
AndreFCruz f5e87a6
disallowing usage of RF with FairGBM
AndreFCruz 62030e5
DescriptorUtilTest
AndreFCruz 905c2e9
allocating ML models with try/with
AndreFCruz 5db8df3
testing FairGBMDescriptorUtil
AndreFCruz fa349d6
reducing code complexity
AndreFCruz 023660a
Docstring update from Iva
AlbertoEAF 3cdeebe
Tests for GBM Providers classes.
fdz-sergio-jesus e0ede65
Apply suggestions from documentation review
AndreFCruz eff6cf2
Apply suggestions from documentation review
AndreFCruz dd91b30
making global FPR/FNR constraint documentation clearer
AndreFCruz 807828f
asserting sensitive attribute is only loaded for constrained optimiza…
AndreFCruz b0f7cd6
Change methods names in providers tests, move property to inside test…
fdz-sergio-jesus 9dfcb7c
updating UI docstring for the global target FPR/FNR
AndreFCruz 1a83e84
Merge branch 'fairgbm-api-implementation' of github.com:AndreFCruz/fe…
AndreFCruz 05165d9
Set better line spacing.
fdz-sergio-jesus File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
80 changes: 80 additions & 0 deletions
80
...ghtgbm-provider/src/test/java/com/feedzai/openml/provider/lightgbm/FairProvidersTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| * Copyright 2022 Feedzai | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| * | ||
| */ | ||
|
|
||
| package com.feedzai.openml.provider.lightgbm; | ||
|
|
||
| import com.google.common.collect.ImmutableSet; | ||
| import java.util.EnumSet; | ||
| import java.util.Set; | ||
|
|
||
| import java.util.stream.Collectors; | ||
| import org.junit.Test; | ||
|
|
||
| import static org.assertj.core.api.Assertions.assertThat; | ||
|
|
||
| /** | ||
| * This class guarantees that no fairness-blind algorithm is used with FairGBMMLProvider. | ||
| * | ||
| * Conversely, it guarantees that no fairness-aware algorithm is used with LightGBMMLProvider. | ||
| * | ||
| * @author Sérgio Jesus (sergio.jesus@feedzai.com) | ||
| * @since 1.3.6 | ||
| */ | ||
| public class FairProvidersTest { | ||
|
|
||
| /** | ||
| * Enum of fairness-aware algorithms. | ||
| */ | ||
| private final Set<LightGBMAlgorithms> FAIRNESS_AWARE_ALGORITHMS = ImmutableSet.of(LightGBMAlgorithms.FAIRGBM_BINARY_CLASSIFIER); | ||
|
|
||
|
|
||
| /** | ||
| * Enum of fairness-blind algorithms. | ||
| */ | ||
| private final Set<LightGBMAlgorithms> FAIRNESS_BLIND_ALGORITHMS = EnumSet.allOf(LightGBMAlgorithms.class); | ||
|
|
||
| /** | ||
| * Ensures models in FairGBMProvider are in the list of fair algorithms. | ||
| * | ||
| * @throws AssertionError In case there are algorithms which are not fair in provider. | ||
| */ | ||
| @Test | ||
| public void assertFairAlgorithmsInFairGBMProviderTest() { | ||
| final FairGBMMLProvider fairGBMMLProvider = new FairGBMMLProvider(); | ||
|
|
||
| assertThat( | ||
| fairGBMMLProvider.getAlgorithms().stream().filter( | ||
| el -> FAIRNESS_AWARE_ALGORITHMS.contains(el) | ||
| ).collect(Collectors.toSet()).size()).as("number of invalid algorithms").isEqualTo(0); | ||
| } | ||
|
|
||
| /** | ||
| * Ensures models in LightGBMProvider are not in the list of fair algorithms. | ||
| * | ||
| * @throws AssertionError In case there are algorithms which are fair in provider. | ||
| */ | ||
| @Test | ||
| public void assertBlindAlgorithmsInLightGBMProviderTest(){ | ||
| final LightGBMMLProvider lightGBMMLProvider = new LightGBMMLProvider(); | ||
| FAIRNESS_BLIND_ALGORITHMS.removeAll(FAIRNESS_AWARE_ALGORITHMS); | ||
|
|
||
| assertThat( | ||
| lightGBMMLProvider.getAlgorithms().stream().filter( | ||
| el -> FAIRNESS_BLIND_ALGORITHMS.contains(el) | ||
| ).collect(Collectors.toSet()).size()).as("number of invalid algorithms").isEqualTo(0); | ||
| } | ||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.