Skip to content

Commit

Permalink
Add a simple noop test for sklearn API conformance
Browse files Browse the repository at this point in the history
The "default constructible" (i.e. no required __init__ parameters)
property is the most basic property of a scikit-learn estimator. It is a
prerequisite for all other estimator checks. None of our estimators
adhere to it yet, so this test serves as a todo list for now.
  • Loading branch information
timokau committed Jul 1, 2020
1 parent 194dac8 commit e7e5b0c
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions csrank/tests/test_estimators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
"""Check that our estimators adhere to the scikit-learn interface.
https://scikit-learn.org/stable/developers/develop.html#rolling-your-own-estimator
"""

import pytest
from sklearn.utils.estimator_checks import check_parameters_default_constructible

from csrank.choicefunction import FETALinearChoiceFunction
from csrank.discretechoice import FETALinearDiscreteChoiceFunction
from csrank.objectranking import FETALinearObjectRanker


@pytest.mark.parametrize(
"Estimator",
[
# CmpNet,
# CmpNetChoiceFunction,
# CmpNetDiscreteChoiceFunction,
# ExpectedRankRegression,
# FATEChoiceFunction,
# FATEDiscreteChoiceFunction,
# FATELinearChoiceFunction,
# FATELinearDiscreteChoiceFunction,
# FATELinearObjectRanker,
# FATEObjectRanker,
# FETAChoiceFunction,
# FETADiscreteChoiceFunction,
FETALinearChoiceFunction,
FETALinearDiscreteChoiceFunction,
FETALinearObjectRanker,
# FETAObjectRanker,
# GeneralizedLinearModel,
# GeneralizedNestedLogitModel,
# ListNet,
# MixedLogitModel,
# MultinomialLogitModel,
# NestedLogitModel,
# PairedCombinatorialLogit,
# PairwiseSVMChoiceFunction,
# PairwiseSVMDiscreteChoiceFunction,
# RankNet,
# RankNetChoiceFunction,
# RankNetDiscreteChoiceFunction,
# RankSVM,
],
)
def test_all_estimators(Estimator):
check_parameters_default_constructible("default_constructible", Estimator)

0 comments on commit e7e5b0c

Please sign in to comment.