Skip to content

Commit

Permalink
proportion parameter query
Browse files Browse the repository at this point in the history
  • Loading branch information
gykovacs committed Sep 16, 2022
1 parent 26622ed commit 383eb4d
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
5 changes: 5 additions & 0 deletions docs/release_history.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Release History
***************

Version 0.7.1 (2022.09.16.)
===========================

* Query for oversamplers with `proportion` parameter added.

Version 0.7.0 (2022.09.11.)
===========================

Expand Down
2 changes: 1 addition & 1 deletion smote_variants/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
@author: gykovacs
"""

__version__= '0.7.0'
__version__= '0.7.1'
20 changes: 20 additions & 0 deletions smote_variants/queries/_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
'get_metric_learning_oversamplers',
'get_simplex_sampling_oversamplers',
'get_multiclass_oversamplers',
'get_proportion_oversamplers',
'get_all_noisefilters',
'generate_parameter_combinations']

Expand Down Expand Up @@ -91,6 +92,25 @@ def get_all_oversamplers(n_quickest=-1):

return determine_n_quickest(oversamplers, n_quickest)

def get_proportion_oversamplers(n_quickest=-1):
"""
Returns all oversamplers having a proportion parameter to control the number
of samples to be generated.
Args:
n_quickest (int): the number of quickest oversamplers to return
Returns:
list(OverSampling): the list of oversampling classes having a proportion
parameter
"""

oversamplers = get_all_oversamplers()

oversamplers = [o for o in oversamplers if 'proportion' in o().get_params()]

return determine_n_quickest(oversamplers, n_quickest)

def get_metric_learning_oversamplers(n_quickest=-1):
"""
Returns all oversampling classes supporting the use of metric learning
Expand Down
1 change: 1 addition & 0 deletions tests/test_queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def test_queries():
assert len(sv.get_all_oversamplers()) >= 0
assert len(sv.get_all_oversamplers(n_quickest=2)) == 2
assert len(sv.get_all_noisefilters()) >= 0
assert len(sv.get_proportion_oversamplers()) >= 0
assert len(sv.get_multiclass_oversamplers()) >= 0
assert len(sv.get_multiclass_oversamplers(n_quickest=2)) == 2
assert len(sv.get_metric_learning_oversamplers()) >= 0
Expand Down

0 comments on commit 383eb4d

Please sign in to comment.