Class AbstractFinder
java.lang.Object
adaa.analytics.rules.logic.induction.AbstractFinder
- All Implemented Interfaces:
AutoCloseable
- Direct Known Subclasses:
ClassificationFinder
,RegressionFinder
Abstract base class for growing and pruning procedures for all types of rules (classification, regression, survival).
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Map<IAttribute,
List<Integer>> protected IQualityModifier
protected final InductionParameters
Rule induction parameters.protected ExecutorService
Thread pool to be used by the algorithm.protected int
Number of threads to be used by the induction algorithm. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFinder
(InductionParameters params) Initializes induction parameters and thread pool. -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
void
close()
int
grow
(Rule rule, IExampleSet dataset, Set<Integer> uncovered) Adds elementary conditions to the rule premise until termination conditions are fulfilled.protected abstract ElementaryCondition
induceCondition
(Rule rule, IExampleSet trainSet, Set<Integer> uncoveredByRuleset, Set<Integer> coveredByRule, Set<IAttribute> allowedAttributes, Pair<String, Object>... extraParams) Abstract method representing all procedures which induce an elementary condition.protected Set<IAttribute>
names2attributes
(Set<String> names, IExampleSet dataset) Maps a set of attribute names to a set of attributes.protected void
protected void
protected void
protected void
protected void
void
postprocess
(Rule rule, IExampleSet dataset) Postprocesses a rule.void
preprocess
(IExampleSet trainSet) Can be implemented by subclasses to perform some initial processing prior growing.void
prune
(Rule rule, IExampleSet trainSet, Set<Integer> uncovered) Removes irrelevant conditions from rule using hill-climbing strategy.
-
Field Details
-
params
Rule induction parameters. -
threadCount
protected int threadCountNumber of threads to be used by the induction algorithm. -
pool
Thread pool to be used by the algorithm. -
modifier
-
attributeValuesOrder
-
-
Constructor Details
-
AbstractFinder
Initializes induction parameters and thread pool.- Parameters:
params
- Induction parameters.
-
-
Method Details
-
addObserver
-
clearObservers
public void clearObservers() -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
preprocess
Can be implemented by subclasses to perform some initial processing prior growing.- Parameters:
trainSet
- Training set.
-
grow
Adds elementary conditions to the rule premise until termination conditions are fulfilled.- Parameters:
rule
- Rule to be grown.dataset
- Training set.uncovered
- Collection of examples yet uncovered by the model (positive examples in the classification problems).- Returns:
- Number of conditions added.
-
prune
Removes irrelevant conditions from rule using hill-climbing strategy.- Parameters:
rule
- Rule to be pruned.trainSet
- Training set.uncovered
- Collection of examples yet uncovered by the model (positive examples in the classification problems).
-
postprocess
Postprocesses a rule.- Parameters:
rule
- Rule to be postprocessed.dataset
- Training set.
-
induceCondition
protected abstract ElementaryCondition induceCondition(Rule rule, IExampleSet trainSet, Set<Integer> uncoveredByRuleset, Set<Integer> coveredByRule, Set<IAttribute> allowedAttributes, Pair<String, Object>... extraParams) Abstract method representing all procedures which induce an elementary condition.- Parameters:
rule
- Current rule.trainSet
- Training set.uncoveredByRuleset
- Set of examples uncovered by the model.coveredByRule
- Set of examples covered by the rule being grown.allowedAttributes
- Set of attributes that may be used during induction.extraParams
- Additional parameters.- Returns:
- Induced elementary condition.
-
names2attributes
Maps a set of attribute names to a set of attributes.- Parameters:
names
- Set of attribute names.dataset
- Training set.- Returns:
- Set of attributes.
-
notifyGrowingStarted
-
notifyGrowingFinished
-
notifyConditionAdded
-
notifyConditionRemoved
-
notifyRuleReady
-