Skip to content

Commit 19d97cb

Browse files
author
cezary.maszczyk
committed
Merge branch 'develop'
2 parents 236835a + 90780cd commit 19d97cb

File tree

6 files changed

+54
-55
lines changed

6 files changed

+54
-55
lines changed

rulekit/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# pylint: disable=missing-module-docstring
22
from .main import RuleKit
33

4-
__VERSION__ = '1.7.5'
5-
__RULEKIT_RELEASE_VERSION__ = '1.7.4'
4+
__VERSION__ = '1.7.6'
5+
__RULEKIT_RELEASE_VERSION__ = '1.7.5'

rulekit/classification.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class RuleClassifier(BaseOperator, BaseClassifier):
7373

7474
def __init__(
7575
self,
76-
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
76+
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
7777
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
7878
pruning_measure: Union[Measures,
7979
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
@@ -88,14 +88,14 @@ def __init__(
8888
max_rule_count: int = DEFAULT_PARAMS_VALUE['max_rule_count'],
8989
approximate_induction: bool = DEFAULT_PARAMS_VALUE['approximate_induction'],
9090
approximate_bins_count: int = DEFAULT_PARAMS_VALUE['approximate_bins_count'],
91-
min_rule_covered: Optional[int] = None,
91+
min_rule_covered: Optional[float] = None,
9292
):
9393
"""
9494
Parameters
9595
----------
96-
minsupp_new : int = 5
97-
positive integer representing minimum number of previously uncovered examples to be
98-
covered by a new rule (positive examples for classification problems); default: 5
96+
minsupp_new : float = 5.0
97+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
98+
to be covered by a new rule (positive examples for classification problems); default: 5,
9999
induction_measure : :class:`rulekit.params.Measures` = :class:`rulekit.params.\
100100
Measures.Correlation`
101101
measure used during induction; default measure is correlation
@@ -137,7 +137,7 @@ def __init__(
137137
data sets, results may change in future;
138138
approximate_bins_count: int = 100
139139
maximum number of bins for an attribute evaluated in the approximate induction.
140-
min_rule_covered : int = None
140+
min_rule_covered : float = None
141141
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
142142
version, use `minsupp_new`
143143
@@ -327,7 +327,7 @@ class ExpertRuleClassifier(ExpertKnowledgeOperator, RuleClassifier):
327327

328328
def __init__(
329329
self,
330-
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
330+
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
331331
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
332332
pruning_measure: Union[Measures,
333333
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
@@ -352,14 +352,14 @@ def __init__(
352352
'preferred_conditions_per_rule'],
353353
preferred_attributes_per_rule: int = DEFAULT_PARAMS_VALUE[
354354
'preferred_attributes_per_rule'],
355-
min_rule_covered: Optional[int] = None
355+
min_rule_covered: Optional[float] = None
356356
):
357357
"""
358358
Parameters
359359
----------
360-
minsupp_new : int = 5
361-
positive integer representing minimum number of previously uncovered examples to be
362-
covered by a new rule (positive examples for classification problems); default: 5
360+
minsupp_new : float = 5.0
361+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
362+
to be covered by a new rule (positive examples for classification problems); default: 5,
363363
induction_measure : :class:`rulekit.params.Measures` = \
364364
:class:`rulekit.params.Measures.Correlation`
365365
measure used during induction; default measure is correlation
@@ -421,7 +421,7 @@ def __init__(
421421
maximum number of preferred conditions per rule; default: unlimited,
422422
preferred_attributes_per_rule : int = None
423423
maximum number of preferred attributes per rule; default: unlimited.
424-
min_rule_covered : int = None
424+
min_rule_covered : float = None
425425
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
426426
version, use `minsupp_new`
427427
@@ -555,7 +555,7 @@ def __init__(
555555
penalty_strength: float = DEFAULT_PARAMS_VALUE['penalty_strength'],
556556
penalty_saturation: float = DEFAULT_PARAMS_VALUE['penalty_saturation'],
557557

558-
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
558+
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
559559
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
560560
pruning_measure: Union[Measures,
561561
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
@@ -585,9 +585,9 @@ def __init__(
585585
(s) - penalty strength; Default is 0.5
586586
penalty_saturation: float
587587
the value of p_new / P at which penalty reward saturates; Default is 0.2.
588-
minsupp_new : int = 5
589-
positive integer representing minimum number of previously uncovered examples to be
590-
covered by a new rule (positive examples for classification problems); default: 5
588+
minsupp_new : float = 5.0
589+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
590+
to be covered by a new rule (positive examples for classification problems); default: 5,
591591
induction_measure : :class:`rulekit.params.Measures` = \
592592
:class:`rulekit.params.Measures.Correlation`
593593
measure used during induction; default measure is correlation

rulekit/params.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ class Measures(Enum):
5959

6060

6161
DEFAULT_PARAMS_VALUE = {
62-
'minsupp_new': 5,
63-
'min_rule_covered': 5,
62+
'minsupp_new': 5.0,
63+
'min_rule_covered': 5.0,
6464
'induction_measure': Measures.Correlation,
6565
'pruning_measure': Measures.Correlation,
6666
'voting_measure': Measures.Correlation,
@@ -96,8 +96,8 @@ class Measures(Enum):
9696
class ModelsParams(BaseModel):
9797
"""Model for validating models hyperparameters
9898
"""
99-
min_rule_covered: Optional[int] = None
100-
minsupp_new: Optional[int] = DEFAULT_PARAMS_VALUE['minsupp_new']
99+
min_rule_covered: Optional[float] = None
100+
minsupp_new: Optional[float] = DEFAULT_PARAMS_VALUE['minsupp_new']
101101
induction_measure: Optional[Measures] = DEFAULT_PARAMS_VALUE['induction_measure']
102102
pruning_measure: Optional[Measures] = DEFAULT_PARAMS_VALUE['pruning_measure']
103103
voting_measure: Optional[Measures] = DEFAULT_PARAMS_VALUE['voting_measure']

rulekit/regression.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class RuleRegressor(BaseOperator):
2727

2828
def __init__(
2929
self,
30-
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
30+
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
3131
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
3232
pruning_measure: Union[Measures,
3333
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
@@ -40,14 +40,14 @@ def __init__(
4040
complementary_conditions: bool = DEFAULT_PARAMS_VALUE['complementary_conditions'],
4141
mean_based_regression: bool = DEFAULT_PARAMS_VALUE['mean_based_regression'],
4242
max_rule_count: int = DEFAULT_PARAMS_VALUE['max_rule_count'],
43-
min_rule_covered: Optional[int] = None,
43+
min_rule_covered: Optional[float] = None,
4444
):
4545
"""
4646
Parameters
4747
----------
48-
minsupp_new : int = 5
49-
positive integer representing minimum number of previously uncovered examples to be
50-
covered by a new rule (positive examples for classification problems); default: 5
48+
minsupp_new : float = 5.0
49+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
50+
to be covered by a new rule (positive examples for classification problems); default: 5,
5151
induction_measure : :class:`rulekit.params.Measures` = \
5252
:class:`rulekit.params.Measures.Correlation`
5353
measure used during induction; default measure is correlation
@@ -82,7 +82,7 @@ def __init__(
8282
max_rule_count : int = 0
8383
Maximum number of rules to be generated (for classification data sets it applies
8484
to a single class); 0 indicates no limit.
85-
min_rule_covered : int = None
85+
min_rule_covered : float = None
8686
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
8787
version, use `minsupp_new`
8888
@@ -176,7 +176,7 @@ class ExpertRuleRegressor(ExpertKnowledgeOperator, RuleRegressor):
176176

177177
def __init__(
178178
self,
179-
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
179+
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
180180
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
181181
pruning_measure: Union[Measures,
182182
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
@@ -199,14 +199,14 @@ def __init__(
199199
preferred_attributes_per_rule: int = DEFAULT_PARAMS_VALUE[
200200
'preferred_attributes_per_rule'],
201201

202-
min_rule_covered: Optional[int] = None
202+
min_rule_covered: Optional[float] = None
203203
):
204204
"""
205205
Parameters
206206
----------
207-
minsupp_new : int = 5
208-
positive integer representing minimum number of previously uncovered examples to be
209-
covered by a new rule (positive examples for classification problems); default: 5
207+
minsupp_new : float = 5.0
208+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
209+
to be covered by a new rule (positive examples for classification problems); default: 5,
210210
induction_measure : :class:`rulekit.params.Measures` = \
211211
:class:`rulekit.params.Measures.Correlation`
212212
measure used during induction; default measure is correlation
@@ -364,7 +364,7 @@ def __init__(
364364
penalty_strength: float = DEFAULT_PARAMS_VALUE['penalty_strength'],
365365
penalty_saturation: float = DEFAULT_PARAMS_VALUE['penalty_saturation'],
366366

367-
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
367+
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
368368
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
369369
pruning_measure: Union[Measures,
370370
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
@@ -392,9 +392,9 @@ def __init__(
392392
(s) - penalty strength; Default is 0.5
393393
penalty_saturation: float
394394
the value of p_new / P at which penalty reward saturates; Default is 0.2.
395-
minsupp_new : int = 5
396-
positive integer representing minimum number of previously uncovered examples to be
397-
covered by a new rule (positive examples for classification problems); default: 5
395+
minsupp_new : float = 5.0
396+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
397+
to be covered by a new rule (positive examples for classification problems); default: 5,
398398
induction_measure : :class:`rulekit.params.Measures` = \
399399
:class:`rulekit.params.Measures.Correlation`
400400
measure used during induction; default measure is correlation

rulekit/survival.py

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
from ._helpers import (
1111
PredictionResultMapper,
12-
get_rule_generator,
1312
create_example_set
1413
)
1514
from ._operator import BaseOperator, ExpertKnowledgeOperator, Data
@@ -21,13 +20,13 @@ class SurvivalModelsParams(BaseModel):
2120
"""Model for validating survival models hyperparameters
2221
"""
2322
survival_time_attr: Optional[str]
24-
minsupp_new: Optional[int] = DEFAULT_PARAMS_VALUE['minsupp_new']
23+
minsupp_new: Optional[float] = DEFAULT_PARAMS_VALUE['minsupp_new']
2524
max_growing: Optional[float] = DEFAULT_PARAMS_VALUE['max_growing']
2625
enable_pruning: Optional[bool] = DEFAULT_PARAMS_VALUE['enable_pruning']
2726
ignore_missing: Optional[bool] = DEFAULT_PARAMS_VALUE['ignore_missing']
2827
max_uncovered_fraction: Optional[float] = DEFAULT_PARAMS_VALUE['max_uncovered_fraction']
2928
select_best_candidate: Optional[bool] = DEFAULT_PARAMS_VALUE['select_best_candidate']
30-
min_rule_covered: Optional[int] = None
29+
min_rule_covered: Optional[float] = None
3130
complementary_conditions: Optional[bool] = DEFAULT_PARAMS_VALUE['complementary_conditions']
3231

3332
extend_using_preferred: Optional[bool] = None
@@ -63,9 +62,9 @@ def __init__( # pylint: disable=super-init-not-called
6362
survival_time_attr : str
6463
name of column containing survival time data (use when data passed to model is padnas
6564
dataframe).
66-
minsupp_new : int = 5
67-
positive integer representing minimum number of previously uncovered examples to be
68-
covered by a new rule (positive examples for classification problems); default: 5
65+
minsupp_new : float = 5.0
66+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
67+
to be covered by a new rule (positive examples for classification problems); default: 5,
6968
max_growing : int = 0.0
7069
non-negative integer representing maximum number of conditions which can be added to
7170
the rule in the growing phase (use this parameter for large datasets if execution time
@@ -88,7 +87,7 @@ def __init__( # pylint: disable=super-init-not-called
8887
max_rule_count : int = 0
8988
Maximum number of rules to be generated (for classification data sets it applies
9089
to a single class); 0 indicates no limit.
91-
min_rule_covered : int = None
90+
min_rule_covered : float = None
9291
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
9392
version, use `minsupp_new`
9493
@@ -239,7 +238,7 @@ class ExpertSurvivalRules(ExpertKnowledgeOperator, SurvivalRules):
239238
def __init__( # pylint: disable=super-init-not-called
240239
self,
241240
survival_time_attr: str = None,
242-
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
241+
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
243242
max_growing: int = DEFAULT_PARAMS_VALUE['max_growing'],
244243
enable_pruning: bool = DEFAULT_PARAMS_VALUE['enable_pruning'],
245244
ignore_missing: bool = DEFAULT_PARAMS_VALUE['ignore_missing'],
@@ -256,14 +255,14 @@ def __init__( # pylint: disable=super-init-not-called
256255
preferred_attributes_per_rule: int = DEFAULT_PARAMS_VALUE[
257256
'preferred_attributes_per_rule'],
258257
max_rule_count: int = DEFAULT_PARAMS_VALUE['max_rule_count'],
259-
min_rule_covered: Optional[int] = None
258+
min_rule_covered: Optional[float] = None
260259
):
261260
"""
262261
Parameters
263262
----------
264-
minsupp_new : int = 5
265-
positive integer representing minimum number of previously uncovered examples to be
266-
covered by a new rule (positive examples for classification problems); default: 5
263+
minsupp_new : float = 5.0
264+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
265+
to be covered by a new rule (positive examples for classification problems); default: 5,
267266
survival_time_attr : str
268267
name of column containing survival time data (use when data passed to model is pandas
269268
dataframe).
@@ -309,7 +308,7 @@ def __init__( # pylint: disable=super-init-not-called
309308
maximum number of preferred conditions per rule; default: unlimited,
310309
preferred_attributes_per_rule : int = None
311310
maximum number of preferred attributes per rule; default: unlimited.
312-
min_rule_covered : int = None
311+
min_rule_covered : float = None
313312
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
314313
version, use `minsupp_new`
315314
@@ -420,7 +419,7 @@ def __init__( # pylint: disable=super-init-not-called
420419
penalty_saturation: float = DEFAULT_PARAMS_VALUE['penalty_saturation'],
421420

422421
survival_time_attr: str = None,
423-
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
422+
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
424423
max_growing: int = DEFAULT_PARAMS_VALUE['max_growing'],
425424
enable_pruning: bool = DEFAULT_PARAMS_VALUE['enable_pruning'],
426425
ignore_missing: bool = DEFAULT_PARAMS_VALUE['ignore_missing'],
@@ -446,9 +445,9 @@ def __init__( # pylint: disable=super-init-not-called
446445
survival_time_attr : str
447446
name of column containing survival time data (use when data passed to model is pandas
448447
dataframe).
449-
minsupp_new : int = 5
450-
positive integer representing minimum number of previously uncovered examples to be
451-
covered by a new rule (positive examples for classification problems); default: 5
448+
minsupp_new : float = 5.0
449+
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
450+
to be covered by a new rule (positive examples for classification problems); default: 5,
452451
max_growing : int = 0.0
453452
non-negative integer representing maximum number of conditions which can be added to
454453
the rule in the growing phase (use this parameter for large datasets if execution time

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setuptools.setup(
1111
name="rulekit",
12-
version='1.7.5',
12+
version='1.7.6',
1313
author="Cezary Maszczyk",
1414
author_email="[email protected]",
1515
description="Comprehensive suite for rule-based learning",

0 commit comments

Comments
 (0)