Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
cezary.maszczyk committed Feb 27, 2024
2 parents 236835a + 90780cd commit 19d97cb
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 55 deletions.
4 changes: 2 additions & 2 deletions rulekit/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# pylint: disable=missing-module-docstring
from .main import RuleKit

__VERSION__ = '1.7.5'
__RULEKIT_RELEASE_VERSION__ = '1.7.4'
__VERSION__ = '1.7.6'
__RULEKIT_RELEASE_VERSION__ = '1.7.5'
32 changes: 16 additions & 16 deletions rulekit/classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class RuleClassifier(BaseOperator, BaseClassifier):

def __init__(
self,
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
pruning_measure: Union[Measures,
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
Expand All @@ -88,14 +88,14 @@ def __init__(
max_rule_count: int = DEFAULT_PARAMS_VALUE['max_rule_count'],
approximate_induction: bool = DEFAULT_PARAMS_VALUE['approximate_induction'],
approximate_bins_count: int = DEFAULT_PARAMS_VALUE['approximate_bins_count'],
min_rule_covered: Optional[int] = None,
min_rule_covered: Optional[float] = None,
):
"""
Parameters
----------
minsupp_new : int = 5
positive integer representing minimum number of previously uncovered examples to be
covered by a new rule (positive examples for classification problems); default: 5
minsupp_new : float = 5.0
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
to be covered by a new rule (positive examples for classification problems); default: 5,
induction_measure : :class:`rulekit.params.Measures` = :class:`rulekit.params.\
Measures.Correlation`
measure used during induction; default measure is correlation
Expand Down Expand Up @@ -137,7 +137,7 @@ def __init__(
data sets, results may change in future;
approximate_bins_count: int = 100
maximum number of bins for an attribute evaluated in the approximate induction.
min_rule_covered : int = None
min_rule_covered : float = None
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
version, use `minsupp_new`
Expand Down Expand Up @@ -327,7 +327,7 @@ class ExpertRuleClassifier(ExpertKnowledgeOperator, RuleClassifier):

def __init__(
self,
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
pruning_measure: Union[Measures,
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
Expand All @@ -352,14 +352,14 @@ def __init__(
'preferred_conditions_per_rule'],
preferred_attributes_per_rule: int = DEFAULT_PARAMS_VALUE[
'preferred_attributes_per_rule'],
min_rule_covered: Optional[int] = None
min_rule_covered: Optional[float] = None
):
"""
Parameters
----------
minsupp_new : int = 5
positive integer representing minimum number of previously uncovered examples to be
covered by a new rule (positive examples for classification problems); default: 5
minsupp_new : float = 5.0
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
to be covered by a new rule (positive examples for classification problems); default: 5,
induction_measure : :class:`rulekit.params.Measures` = \
:class:`rulekit.params.Measures.Correlation`
measure used during induction; default measure is correlation
Expand Down Expand Up @@ -421,7 +421,7 @@ def __init__(
maximum number of preferred conditions per rule; default: unlimited,
preferred_attributes_per_rule : int = None
maximum number of preferred attributes per rule; default: unlimited.
min_rule_covered : int = None
min_rule_covered : float = None
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
version, use `minsupp_new`
Expand Down Expand Up @@ -555,7 +555,7 @@ def __init__(
penalty_strength: float = DEFAULT_PARAMS_VALUE['penalty_strength'],
penalty_saturation: float = DEFAULT_PARAMS_VALUE['penalty_saturation'],

minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
pruning_measure: Union[Measures,
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
Expand Down Expand Up @@ -585,9 +585,9 @@ def __init__(
(s) - penalty strength; Default is 0.5
penalty_saturation: float
the value of p_new / P at which penalty reward saturates; Default is 0.2.
minsupp_new : int = 5
positive integer representing minimum number of previously uncovered examples to be
covered by a new rule (positive examples for classification problems); default: 5
minsupp_new : float = 5.0
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
to be covered by a new rule (positive examples for classification problems); default: 5,
induction_measure : :class:`rulekit.params.Measures` = \
:class:`rulekit.params.Measures.Correlation`
measure used during induction; default measure is correlation
Expand Down
8 changes: 4 additions & 4 deletions rulekit/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ class Measures(Enum):


DEFAULT_PARAMS_VALUE = {
'minsupp_new': 5,
'min_rule_covered': 5,
'minsupp_new': 5.0,
'min_rule_covered': 5.0,
'induction_measure': Measures.Correlation,
'pruning_measure': Measures.Correlation,
'voting_measure': Measures.Correlation,
Expand Down Expand Up @@ -96,8 +96,8 @@ class Measures(Enum):
class ModelsParams(BaseModel):
"""Model for validating models hyperparameters
"""
min_rule_covered: Optional[int] = None
minsupp_new: Optional[int] = DEFAULT_PARAMS_VALUE['minsupp_new']
min_rule_covered: Optional[float] = None
minsupp_new: Optional[float] = DEFAULT_PARAMS_VALUE['minsupp_new']
induction_measure: Optional[Measures] = DEFAULT_PARAMS_VALUE['induction_measure']
pruning_measure: Optional[Measures] = DEFAULT_PARAMS_VALUE['pruning_measure']
voting_measure: Optional[Measures] = DEFAULT_PARAMS_VALUE['voting_measure']
Expand Down
30 changes: 15 additions & 15 deletions rulekit/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RuleRegressor(BaseOperator):

def __init__(
self,
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
pruning_measure: Union[Measures,
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
Expand All @@ -40,14 +40,14 @@ def __init__(
complementary_conditions: bool = DEFAULT_PARAMS_VALUE['complementary_conditions'],
mean_based_regression: bool = DEFAULT_PARAMS_VALUE['mean_based_regression'],
max_rule_count: int = DEFAULT_PARAMS_VALUE['max_rule_count'],
min_rule_covered: Optional[int] = None,
min_rule_covered: Optional[float] = None,
):
"""
Parameters
----------
minsupp_new : int = 5
positive integer representing minimum number of previously uncovered examples to be
covered by a new rule (positive examples for classification problems); default: 5
minsupp_new : float = 5.0
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
to be covered by a new rule (positive examples for classification problems); default: 5,
induction_measure : :class:`rulekit.params.Measures` = \
:class:`rulekit.params.Measures.Correlation`
measure used during induction; default measure is correlation
Expand Down Expand Up @@ -82,7 +82,7 @@ def __init__(
max_rule_count : int = 0
Maximum number of rules to be generated (for classification data sets it applies
to a single class); 0 indicates no limit.
min_rule_covered : int = None
min_rule_covered : float = None
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
version, use `minsupp_new`
Expand Down Expand Up @@ -176,7 +176,7 @@ class ExpertRuleRegressor(ExpertKnowledgeOperator, RuleRegressor):

def __init__(
self,
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
pruning_measure: Union[Measures,
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
Expand All @@ -199,14 +199,14 @@ def __init__(
preferred_attributes_per_rule: int = DEFAULT_PARAMS_VALUE[
'preferred_attributes_per_rule'],

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

minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
induction_measure: Measures = DEFAULT_PARAMS_VALUE['induction_measure'],
pruning_measure: Union[Measures,
str] = DEFAULT_PARAMS_VALUE['pruning_measure'],
Expand Down Expand Up @@ -392,9 +392,9 @@ def __init__(
(s) - penalty strength; Default is 0.5
penalty_saturation: float
the value of p_new / P at which penalty reward saturates; Default is 0.2.
minsupp_new : int = 5
positive integer representing minimum number of previously uncovered examples to be
covered by a new rule (positive examples for classification problems); default: 5
minsupp_new : float = 5.0
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
to be covered by a new rule (positive examples for classification problems); default: 5,
induction_measure : :class:`rulekit.params.Measures` = \
:class:`rulekit.params.Measures.Correlation`
measure used during induction; default measure is correlation
Expand Down
33 changes: 16 additions & 17 deletions rulekit/survival.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

from ._helpers import (
PredictionResultMapper,
get_rule_generator,
create_example_set
)
from ._operator import BaseOperator, ExpertKnowledgeOperator, Data
Expand All @@ -21,13 +20,13 @@ class SurvivalModelsParams(BaseModel):
"""Model for validating survival models hyperparameters
"""
survival_time_attr: Optional[str]
minsupp_new: Optional[int] = DEFAULT_PARAMS_VALUE['minsupp_new']
minsupp_new: Optional[float] = DEFAULT_PARAMS_VALUE['minsupp_new']
max_growing: Optional[float] = DEFAULT_PARAMS_VALUE['max_growing']
enable_pruning: Optional[bool] = DEFAULT_PARAMS_VALUE['enable_pruning']
ignore_missing: Optional[bool] = DEFAULT_PARAMS_VALUE['ignore_missing']
max_uncovered_fraction: Optional[float] = DEFAULT_PARAMS_VALUE['max_uncovered_fraction']
select_best_candidate: Optional[bool] = DEFAULT_PARAMS_VALUE['select_best_candidate']
min_rule_covered: Optional[int] = None
min_rule_covered: Optional[float] = None
complementary_conditions: Optional[bool] = DEFAULT_PARAMS_VALUE['complementary_conditions']

extend_using_preferred: Optional[bool] = None
Expand Down Expand Up @@ -63,9 +62,9 @@ def __init__( # pylint: disable=super-init-not-called
survival_time_attr : str
name of column containing survival time data (use when data passed to model is padnas
dataframe).
minsupp_new : int = 5
positive integer representing minimum number of previously uncovered examples to be
covered by a new rule (positive examples for classification problems); default: 5
minsupp_new : float = 5.0
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
to be covered by a new rule (positive examples for classification problems); default: 5,
max_growing : int = 0.0
non-negative integer representing maximum number of conditions which can be added to
the rule in the growing phase (use this parameter for large datasets if execution time
Expand All @@ -88,7 +87,7 @@ def __init__( # pylint: disable=super-init-not-called
max_rule_count : int = 0
Maximum number of rules to be generated (for classification data sets it applies
to a single class); 0 indicates no limit.
min_rule_covered : int = None
min_rule_covered : float = None
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
version, use `minsupp_new`
Expand Down Expand Up @@ -239,7 +238,7 @@ class ExpertSurvivalRules(ExpertKnowledgeOperator, SurvivalRules):
def __init__( # pylint: disable=super-init-not-called
self,
survival_time_attr: str = None,
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
max_growing: int = DEFAULT_PARAMS_VALUE['max_growing'],
enable_pruning: bool = DEFAULT_PARAMS_VALUE['enable_pruning'],
ignore_missing: bool = DEFAULT_PARAMS_VALUE['ignore_missing'],
Expand All @@ -256,14 +255,14 @@ def __init__( # pylint: disable=super-init-not-called
preferred_attributes_per_rule: int = DEFAULT_PARAMS_VALUE[
'preferred_attributes_per_rule'],
max_rule_count: int = DEFAULT_PARAMS_VALUE['max_rule_count'],
min_rule_covered: Optional[int] = None
min_rule_covered: Optional[float] = None
):
"""
Parameters
----------
minsupp_new : int = 5
positive integer representing minimum number of previously uncovered examples to be
covered by a new rule (positive examples for classification problems); default: 5
minsupp_new : float = 5.0
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
to be covered by a new rule (positive examples for classification problems); default: 5,
survival_time_attr : str
name of column containing survival time data (use when data passed to model is pandas
dataframe).
Expand Down Expand Up @@ -309,7 +308,7 @@ def __init__( # pylint: disable=super-init-not-called
maximum number of preferred conditions per rule; default: unlimited,
preferred_attributes_per_rule : int = None
maximum number of preferred attributes per rule; default: unlimited.
min_rule_covered : int = None
min_rule_covered : float = None
alias to `minsupp_new`. Parameter is deprecated and will be removed in the next major
version, use `minsupp_new`
Expand Down Expand Up @@ -420,7 +419,7 @@ def __init__( # pylint: disable=super-init-not-called
penalty_saturation: float = DEFAULT_PARAMS_VALUE['penalty_saturation'],

survival_time_attr: str = None,
minsupp_new: int = DEFAULT_PARAMS_VALUE['minsupp_new'],
minsupp_new: float = DEFAULT_PARAMS_VALUE['minsupp_new'],
max_growing: int = DEFAULT_PARAMS_VALUE['max_growing'],
enable_pruning: bool = DEFAULT_PARAMS_VALUE['enable_pruning'],
ignore_missing: bool = DEFAULT_PARAMS_VALUE['ignore_missing'],
Expand All @@ -446,9 +445,9 @@ def __init__( # pylint: disable=super-init-not-called
survival_time_attr : str
name of column containing survival time data (use when data passed to model is pandas
dataframe).
minsupp_new : int = 5
positive integer representing minimum number of previously uncovered examples to be
covered by a new rule (positive examples for classification problems); default: 5
minsupp_new : float = 5.0
a minimum number (or fraction, if value < 1.0) of previously uncovered examples
to be covered by a new rule (positive examples for classification problems); default: 5,
max_growing : int = 0.0
non-negative integer representing maximum number of conditions which can be added to
the rule in the growing phase (use this parameter for large datasets if execution time
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setuptools.setup(
name="rulekit",
version='1.7.5',
version='1.7.6',
author="Cezary Maszczyk",
author_email="cezary.maszczyk@gmail.com",
description="Comprehensive suite for rule-based learning",
Expand Down

0 comments on commit 19d97cb

Please sign in to comment.