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 IQualityModifierprotected final InductionParametersRule induction parameters.protected ExecutorServiceThread pool to be used by the algorithm.protected intNumber of threads to be used by the induction algorithm. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractFinder(InductionParameters params) Initializes induction parameters and thread pool. -
Method Summary
Modifier and TypeMethodDescriptionvoidvoidvoidclose()intgrow(Rule rule, IExampleSet dataset, Set<Integer> uncovered) Adds elementary conditions to the rule premise until termination conditions are fulfilled.protected abstract ElementaryConditioninduceCondition(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 voidprotected voidprotected voidprotected voidprotected voidvoidpostprocess(Rule rule, IExampleSet dataset) Postprocesses a rule.voidpreprocess(IExampleSet trainSet) Can be implemented by subclasses to perform some initial processing prior growing.voidprune(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:
closein 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
-