public class ClassifierSystem
extends java.lang.Object
implements java.lang.Cloneable
Library classifierLibrary, Class ClassifierSystem
Copyright by Klaus Hufschlag 2004,2005,2006
This file is part of the Generic Classifier Library. The Generic Classifier Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. The Generic Classifier Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with the Generic Classifier Library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
Constructor and Description |
---|
ClassifierSystem()
Constructor
|
ClassifierSystem(java.lang.String name,
Classifier sample,
int size,
boolean randomized)
Enhanced Constructor, initializing the CS following given parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Classifier cl)
Adds a Classifier to the instances' internal ruleset.
|
void |
add(ClassifierSystem cs)
Adds all Classifiers of another instance to the instances' internal
ruleset.
|
ClassifierSystem |
allWithCondition(Situation condition)
Returns a subset of the CS with all rules having the same condition as given.
|
java.lang.Object |
clone()
Clone-method creates a duplicate of the cs.
|
ClassifierSystem |
crossover()
Creates a clone of the instance and fills clone with pairwise crossover
(at random positions) of all classfiers.
|
ClassifierSystem |
csSelection(double thresh,
boolean minimize,
java.lang.String which)
Creates a new LCS with a selection of classifiers, having a
criterion-value above (or below, if minimize is true) a given threshold.
|
void |
debug_out()
Method for debugging purposes.
|
ClassifierSystem |
filterbyaction(Situation action)
Returns a subset of the CS with all rules that match a given action with
their action part.
|
ClassifierSystem |
filterbyaction(Situation action,
boolean subsumptive)
Returns a subset of the CS with all rules that match a given action with
their action part.
|
ClassifierSystem |
filterByCondition(Situation condition)
Returns a subset of the CS with all rules that match a given condition
with their condition part.
|
ClassifierSystem |
filterByCondition(Situation condition,
boolean subsumtive)
Returns a subset of the CS with all rules that match a given condition
with their action part.
|
double |
getAverage(java.lang.String which)
Calculates the average of a given functional method called for all
classifiers in the CS.
|
Classifier |
getClassifier(int index)
Returns a classifier at a given position
|
int |
getConditionCount()
Counts the number of distinct conditions in CS.
|
double[] |
getExtremeValues(java.lang.String which)
Returns an array with minimum and maximum numerical value a given
functional method (of the classifiers) reaches in the CS
|
java.lang.String |
getName()
Returning the name of the instance.
|
Classifier |
getSample()
Returns the sample classifier defined for the instance.
|
double |
getTotal(java.lang.String which)
Calculates the total of a given functional method called for all
classifiers in the CS.
|
void |
init(Classifier sample,
long size,
boolean randomized)
CS is initialized with a given number of classifiers following a sample
(by cloning the sample).
|
java.util.Iterator |
iterator()
(Delegate)-Function returns an iterator to the set of classifiers.
|
ClassifierSystem |
mutation(double probability)
Creates a clone of the instance and fills it with mutations of all
classfiers, handing over a given probability for mutation.
|
ClassifierSystem |
randomSubset(long size)
Returns a subset of the CS of a given size.
|
void |
remove()
Removes all classifiers.
|
void |
remove(Classifier cl)
Function removes a given Classifier from CS.
|
void |
remove(ClassifierSystem cs)
Removes (subtracts) all classifiers contained in a given CS from this
instance.
|
Classifier |
RoulettewheelChoice(java.lang.String which,
boolean invert)
Returns roulettewheel-choice, using a given method of the classifiers for
determining probability/weight.
|
void |
setName(java.lang.String name)
Used for setting the name of the instance.
|
int |
size()
Returns the number of Classifiers contained.
|
public ClassifierSystem()
public ClassifierSystem(java.lang.String name, Classifier sample, int size, boolean randomized)
name
- Name of the CSsample
- Sample-classifier, CS will be filled with clones of the
sample.size
- Number of classifiersrandomized
- Classifiers are randomized if parameter is set to true.init()
public void init(Classifier sample, long size, boolean randomized)
sample
- Sample-classifier, CS will be filled with clones of the
sample.size
- Number of classifiersrandomized
- Classifiers are randomized if parameter is set to true.public java.lang.Object clone()
clone
in class java.lang.Object
Object.clone()
public void setName(java.lang.String name)
name
- Name to be setpublic java.lang.String getName()
public Classifier getSample()
public int size()
public void add(Classifier cl) throws SimLibraryError
cl
- Classifier to be addedSimLibraryError
public java.util.Iterator iterator()
ArrayList.iterator()
public void add(ClassifierSystem cs)
cs
- CS whose classifiers are to be added to the CSpublic Classifier getClassifier(int index)
index
- Positionpublic void remove(Classifier cl)
cl
- Classifier der entfernt werden soll.public void remove()
public void remove(ClassifierSystem cs)
cs
- CS, whose classifiers are to be removed from the CS.public void debug_out()
public ClassifierSystem mutation(double probability)
probability
- Probability for mutationpublic ClassifierSystem crossover()
public ClassifierSystem csSelection(double thresh, boolean minimize, java.lang.String which)
thresh
- Threshold valueminimize
- If true, values must be below or equal thresh, otherwise
above or equal.which
- Name of a functional method of the classifiers returning a
numeric value as criterion for selection.public double[] getExtremeValues(java.lang.String which)
which
- Name of a classifier's method returning a numerical valuepublic double getTotal(java.lang.String which)
which
- Name of a functional method that returns a numerical valuepublic double getAverage(java.lang.String which)
which
- Name of a functional method that returns a numerical valuepublic Classifier RoulettewheelChoice(java.lang.String which, boolean invert)
which
- NName of a functional method that returns a numerical valueinvert
- If true, the wheigts for probablity are inverted.public ClassifierSystem randomSubset(long size)
size
- Size of subsetpublic ClassifierSystem filterbyaction(Situation action, boolean subsumptive)
action
- Action used as criterion for selectionsubsumptive
- If set to true, wildcards are usedpublic ClassifierSystem filterbyaction(Situation action)
action
- Action used as criterion for selectionpublic ClassifierSystem filterByCondition(Situation condition, boolean subsumtive)
condition
- Condition to be used as criterion for selectionsubsumtive
- If set to true, wildcards are usedpublic ClassifierSystem filterByCondition(Situation condition)
condition
- Condition to be used as criterion for selectionpublic ClassifierSystem allWithCondition(Situation condition)
condition
- Condition to be used as criterion for selectionpublic int getConditionCount()