|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object marf.Storage.StorageManager marf.Classification.Classification marf.Classification.NeuralNetwork.NeuralNetwork
public class NeuralNetwork
Artificial Neural Network-based Classifier.
$Id: NeuralNetwork.java,v 1.42 2005/06/16 19:58:42 mokhov Exp $
Field Summary | |
---|---|
static int |
DEFAULT_EPOCH_NUMBER
Default number of epoch iterations of 64 if none supplied. |
static double |
DEFAULT_MIN_ERROR
Default minimum training error of 0.1 if none supplied. |
static int |
DEFAULT_OUTPUT_NEURON_BITS
How many binary Neurons in the output layer. |
static double |
DEFAULT_TRAINING_CONSTANT
Default training constant of 1 if none supplied. |
static java.lang.String |
JAXP_SCHEMA_LANGUAGE
JAXP 1.2 Schema. |
static java.lang.String |
JAXP_SCHEMA_SOURCE
JAXP 1.2 Schema URL. |
static java.lang.String |
OUTPUT_ENCODING
All output will use this encoding. |
static java.lang.String |
W3C_XML_SCHEMA
XML 2001 Schema. |
Fields inherited from class marf.Classification.Classification |
---|
oFeatureExtraction, oResultSet, oTrainingSet |
Fields inherited from class marf.Storage.StorageManager |
---|
bDumpOnNotFound, iCurrentDumpMode, oObjectToSerialize, strFilename |
Fields inherited from interface marf.Classification.IClassification |
---|
MARF_INTERFACE_CODE_REVISION |
Fields inherited from interface marf.Storage.IStorageManager |
---|
DUMP_BINARY, DUMP_CSV_TEXT, DUMP_GZIP_BINARY, DUMP_HTML, DUMP_SQL, DUMP_XML, MARF_INTERFACE_CODE_REVISION, STORAGE_FILE_EXTENSIONS |
Constructor Summary | |
---|---|
NeuralNetwork(IFeatureExtraction poFeatureExtraction)
NeuralNetwork Constructor. |
Method Summary | |
---|---|
boolean |
classify()
Neural Network implementation of classification routine. |
void |
commit()
Applies changes made to neurons on every net's layer. |
void |
dump()
Dumps Neural Net to an XML file. |
void |
dumpXML(java.lang.String filename)
Dumps Neural Network as XML file. |
void |
generate(int piNumOfInputs,
int[] paiHiddenLayers,
int piNumOfOutputs)
Generates a virgin net at random. |
static java.lang.String |
getMARFSourceCodeRevision()
Retrieves class' revision. |
double[] |
getRes()
Gets outputs of a neural network run. |
Result |
getResult()
Retrieves the minimum-error classification result. |
static void |
indent(java.io.BufferedWriter bw,
int n)
Indents the output according to the requested tabulation. |
void |
initialize(java.lang.String filename,
boolean dtd)
Parses XML and produces NNet. |
void |
restore()
Restores Neural Net from an XML file. |
boolean |
train()
Implementes training of Neural Net. |
void |
train(double[] in,
int expected,
double trainconst)
Actual training of the net. |
Methods inherited from class marf.Classification.Classification |
---|
getResultSet, getTrainingSetFilename |
Methods inherited from class marf.Storage.StorageManager |
---|
backSynchronizeObject, dumpBinary, dumpCSV, dumpGzipBinary, dumpHTML, dumpSQL, dumpXML, enableDumpOnNotFound, getDefaultExtension, getDefaultExtension, getDumpMode, getFilename, restoreBinary, restoreCSV, restoreGzipBinary, restoreHTML, restoreSQL, restoreXML, setDumpMode, setFilename |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_OUTPUT_NEURON_BITS
public static final double DEFAULT_TRAINING_CONSTANT
1
if none supplied.
public static final int DEFAULT_EPOCH_NUMBER
64
if none supplied.
public static final double DEFAULT_MIN_ERROR
0.1
if none supplied.
public static final java.lang.String OUTPUT_ENCODING
public static final java.lang.String JAXP_SCHEMA_LANGUAGE
public static final java.lang.String W3C_XML_SCHEMA
public static final java.lang.String JAXP_SCHEMA_SOURCE
Constructor Detail |
---|
public NeuralNetwork(IFeatureExtraction poFeatureExtraction)
poFeatureExtraction
- FeatureExtraction module referenceMethod Detail |
---|
public final boolean train() throws ClassificationException
train
in interface IClassification
train
in class Classification
true
ClassificationException
- if there are any errors
java.lang.NullPointerException
- if module parameters are incorrectly setTrainingSet
public final boolean classify() throws ClassificationException
true
ClassificationException
- when input feature vector
length does not match the size of the input neuron layer or
if there was a StorageException during dump/restore.public final void initialize(java.lang.String filename, boolean dtd) throws StorageException
filename
- net's filenamedtd
- if true DTD will be generated
StorageException
public double[] getRes()
public static final void indent(java.io.BufferedWriter bw, int n) throws java.io.IOException
bw
- Writer objectn
- number of tabs
java.io.IOException
public final void dumpXML(java.lang.String filename) throws StorageException
filename
- XML file name to write to
StorageException
public final void generate(int piNumOfInputs, int[] paiHiddenLayers, int piNumOfOutputs) throws ClassificationException
piNumOfInputs
- number of input Neurons in the input layerpaiHiddenLayers
- arrays of numbers of Neurons in the hidden layerspiNumOfOutputs
- number of output Neurons in the output layer
ClassificationException
public final void train(double[] in, int expected, double trainconst) throws ClassificationException
in
- double[]expected
- inttrainconst
- double
ClassificationException
public final void commit()
public void dump() throws StorageException
dump
in interface IStorageManager
dump
in class Classification
StorageException
IStorageManager.DUMP_GZIP_BINARY
,
IStorageManager.DUMP_BINARY
,
StorageManager.dumpGzipBinary()
,
StorageManager.dumpCSV()
,
StorageManager.dumpBinary()
,
StorageManager.dumpXML()
,
StorageManager.dumpHTML()
,
StorageManager.dumpSQL()
,
StorageManager.backSynchronizeObject()
,
StorageManager.iCurrentDumpMode
public void restore() throws StorageException
restore
in interface IStorageManager
restore
in class Classification
StorageException
IStorageManager.DUMP_GZIP_BINARY
,
IStorageManager.DUMP_BINARY
,
StorageManager.dumpGzipBinary()
,
StorageManager.dumpCSV()
,
StorageManager.dumpBinary()
,
StorageManager.dumpXML()
,
StorageManager.dumpHTML()
,
StorageManager.dumpSQL()
,
StorageManager.backSynchronizeObject()
,
StorageManager.iCurrentDumpMode
public Result getResult()
public static java.lang.String getMARFSourceCodeRevision()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |