Skip to content
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
May 18, 2022
471db96
Implemented the FairGBM parameter descriptor
May 23, 2022
6bc5519
all tests now pass
May 27, 2022
dd25f6f
passing necessary group information to LightGBM c++ metadata class
May 31, 2022
b0115d3
checking whether sensitive group column is in categorical format
Jun 1, 2022
5750e9d
added tests for FairGBM openml interface
Jun 1, 2022
40c39ce
fixing bug on replace of ImmutableMap
Jun 2, 2022
43a4097
tests now pass
Jun 2, 2022
9fc17f4
remove debug messages
Jun 2, 2022
86bb609
tidying code according to PR feedback
Jun 3, 2022
33a63d3
constraint_group data is now held in int instead of float for compati…
Jun 7, 2022
2733056
applying PR feedback
Jun 14, 2022
6b021c8
updated lightgbm pom to point to latest python-api branch
AndreFCruz Jun 27, 2022
1aa9913
removed deprecated code
AndreFCruz Jun 29, 2022
a624bf3
improving memory management of SWIG data
AndreFCruz Jun 29, 2022
d103d68
running intellij code cleanup
AndreFCruz Jun 30, 2022
95c57ac
Revert H2OApp changes.
fdz-sergio-jesus Jul 1, 2022
425f69c
Revert H2OApp changes on all files.
fdz-sergio-jesus Jul 1, 2022
3e91876
Small fixes to typing, and javadocs.
fdz-sergio-jesus Jul 1, 2022
08be7c9
udpated make-lightgbm submodule
AndreFCruz Jul 6, 2022
2c88181
update lightgbm version
AndreFCruz Jul 6, 2022
e0dd26d
asserting fairnessConstrained=True before setting group data
AndreFCruz Jul 7, 2022
1e03207
moved all FairGBM-specific input handling to a separate class
AndreFCruz Jul 7, 2022
227c4f2
fairgbm input processing
AndreFCruz Jul 7, 2022
04c0ad1
ensure that loaded file is properly closed
AndreFCruz Jul 7, 2022
9927507
Update openml-lightgbm/lightgbm-provider/src/main/java/com/feedzai/op…
AndreFCruz Jul 8, 2022
92ea39d
Apply suggestions from code review
AndreFCruz Jul 8, 2022
c83737b
applied PR feedback
AndreFCruz Jul 8, 2022
e405a08
added links to appropriate GH issues
AndreFCruz Jul 8, 2022
df6ff35
speeding up system tests by running only 2 boosting iterations
AndreFCruz Jul 8, 2022
cf0dd85
Tests fix.
fdz-sergio-jesus Jul 8, 2022
ddaea86
Restore comparison to fairnessConstrained SWIG objects.
fdz-sergio-jesus Jul 8, 2022
9eb4cdc
Change to comparison when set has size of only two elements.
fdz-sergio-jesus Jul 11, 2022
a9b33db
applying PR feedback
AndreFCruz Jul 11, 2022
f5e87a6
disallowing usage of RF with FairGBM
AndreFCruz Jul 11, 2022
62030e5
DescriptorUtilTest
AndreFCruz Jul 11, 2022
905c2e9
allocating ML models with try/with
AndreFCruz Jul 11, 2022
5db8df3
testing FairGBMDescriptorUtil
AndreFCruz Jul 11, 2022
fa349d6
reducing code complexity
AndreFCruz Jul 11, 2022
023660a
Docstring update from Iva
AlbertoEAF Jul 11, 2022
3cdeebe
Tests for GBM Providers classes.
fdz-sergio-jesus Jul 12, 2022
e0ede65
Apply suggestions from documentation review
AndreFCruz Jul 12, 2022
eff6cf2
Apply suggestions from documentation review
AndreFCruz Jul 12, 2022
dd91b30
making global FPR/FNR constraint documentation clearer
AndreFCruz Jul 12, 2022
807828f
asserting sensitive attribute is only loaded for constrained optimiza…
AndreFCruz Jul 12, 2022
b0f7cd6
Change methods names in providers tests, move property to inside test…
fdz-sergio-jesus Jul 12, 2022
9dfcb7c
updating UI docstring for the global target FPR/FNR
AndreFCruz Jul 12, 2022
1a83e84
Merge branch 'fairgbm-api-implementation' of github.com:AndreFCruz/fe…
AndreFCruz Jul 12, 2022
05165d9
Set better line spacing.
fdz-sergio-jesus Jul 12, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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() {
Comment thread
AndreFCruz marked this conversation as resolved.
Outdated
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);
}
}