|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.AbleObject | +--com.ibm.able.beans.knn.AbleKnn
Field Summary | |
---|---|
static java.lang.String |
defaultName
Value assigned to name by default. |
double[] |
inNum
The numeric input buffer |
static java.lang.String[] |
MODE_NAMES
Labels for the train, test and run modes for GUI use. |
double[] |
outNum
The numeric output buffer |
static java.lang.String |
PropertyK
|
static int |
PropertyKId
|
static int |
RUN
Application or Run mode output is produced |
static int |
TEST
Test mode performance is tested (errors are computed) |
static int |
TRAIN
Training mode training data is stored |
Fields inherited from class com.ibm.able.AbleObject |
---|
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace |
Constructor Summary | |
---|---|
AbleKnn()
Default constructor |
|
AbleKnn(java.lang.String aName)
Construct a knn bean with specified name |
|
AbleKnn(java.lang.String aName,
int args)
Construct a network with specified name and architecture. |
Method Summary | |
---|---|
static java.lang.String |
Copyright()
Determine the copyright of this class. |
void |
generateTranslateTemplates(AbleFilter inFilt,
AbleFilter outFilt,
java.util.Vector fields)
The next three methods change the default behaviour of the ABLE filters, making them appropriate for k-NN algorithm. |
double |
getAccuracy()
Get the accuracy |
double |
getCurrentActualClass()
Get the current actual classes corresponding to the current test example |
double |
getCurrentLearnedClass()
Get the current learned classes corresponding to the current test/run example |
double[] |
getCurrentTestExample()
Get the current test example |
double[] |
getCurrentTrainExample()
Get the current training example |
double |
getError()
Get the error |
double[] |
getInNum()
|
int |
getK()
Get k parameter |
int |
getKnnMode()
Get the current operating mode of the network. |
double |
getMajorityClass(java.util.Hashtable kClosestClasses)
Given a Hashtable having all the class values as keys and the number of the nearest neighbors falling in each class as values, get the majority class (the class containing most of those k nearest neighbors). |
int |
getNumAttributes()
Get numAttr parameter |
int |
getNumClasses()
Get numClasses parameter |
long |
getNumCorrectTestExamples()
Get the number of correctly classified test examples |
long |
getNumRecords()
Get numRecords parameter |
long |
getNumTestExamples()
Get the number of test examples seen so far |
double[] |
getOutNum()
|
void |
init()
Get ready to process - init all the bean members |
void |
process()
Performs the main, synchronous, standard processing function performed by this bean. |
void |
reset()
reset the knn bean |
protected void |
setDefaults()
Set up the event queue behavior No timer processing and no asynch event processing |
void |
setK(int newK)
Set the k parameter for k-NN bean |
void |
setKnnMode(int mode)
Set the operating mode of the network. |
void |
setModelParameters(long newRec,
int newAttr,
int newCl)
Set numRecords, numAttributes, numClasses parameters |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String defaultName
public static final int PropertyKId
public static final java.lang.String PropertyK
public double[] inNum
public double[] outNum
public static final int TRAIN
public static final int TEST
public static final int RUN
public static final java.lang.String[] MODE_NAMES
Constructor Detail |
public AbleKnn() throws AbleException
public AbleKnn(java.lang.String aName) throws AbleException
Name
- The object name
public AbleKnn(java.lang.String aName, int args) throws AbleException
Name
- The object name
k
- The k-NN parameter
Method Detail |
protected void setDefaults() throws AbleException
public double[] getInNum()
public double[] getOutNum()
public int getKnnMode()
public void setKnnMode(int mode)
Mode
- The current operating mode, train/test/run
public void setModelParameters(long newRec, int newAttr, int newCl)
public void setK(int newK) throws AbleException
parameter
- k int that defines the k-NN parameter
Also fire a propertyChange event to notify any propertyChange listenerspublic int getK()
public long getNumRecords()
public int getNumAttributes()
public int getNumClasses()
public long getNumTestExamples()
public long getNumCorrectTestExamples()
public double getAccuracy()
public double getError()
public double[] getCurrentTrainExample()
public double[] getCurrentTestExample()
public double getCurrentLearnedClass()
public double getCurrentActualClass()
public void init() throws AbleException
init
in class AbleObject
com.ibm.able.AbleObject
AbleException
- If an error occurs.AbleObject.startEnabledEventProcessing()
public void reset() throws AbleException
reset
in class AbleObject
com.ibm.able.AbleObject
AbleException
- If an error occurs.AbleBean.reset()
public double getMajorityClass(java.util.Hashtable kClosestClasses)
public void process() throws AbleException
AbleObject
This base method implementation provides tracing only.
process
in class AbleObject
com.ibm.able.AbleObject
AbleObject.inputBuffer
,
AbleObject.outputBuffer
,
AbleBean.process()
public void generateTranslateTemplates(AbleFilter inFilt, AbleFilter outFilt, java.util.Vector fields) throws AbleException
generateTranslateTemplates
in interface AbleTranslateTemplateProvider
com.ibm.able.beans.filter.AbleTranslateTemplateProvider
inFilter
- The AbleFilter used to convert incoming data.outFilter
- The AbleFilter used to convert outgoing data.fields
- A vector of AbleFields from which to derive the translation template.public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |