marf
Class MARF

java.lang.Object
  extended by marf.MARF

public class MARF
extends java.lang.Object

Provides basic recognition pipeline and its configuration.

Implements a so-called MARF server.

$Id: MARF.java,v 1.82 2005/07/29 23:09:53 mokhov Exp $

Since:
0.0.1
Version:
$Revision: 1.82 $
Author:
Serguei Mokhov, Stephen Sinclair, The MARF Research and Development Group

Nested Class Summary
static interface MARF.INgramModels
          Enumeration of N-gram Models.
static interface MARF.IStatisticalEstimators
          Enumeration of Statistical Estimators.
static class MARF.NLP
          Class NLP is more related to the Natural Language Processing part of MARF.
 
Field Summary
static int AIFF
          AIFF sample format.
static int AIFFC
          AIFF-C sample format.
static int AU
          AU sample format.
static int BANDPASS_FFT_FILTER
          Indicates to use band-pass filter.
static int CEPSTRAL
          Indicates to use cepstral analysis.
static int CHEBYSHEV_DISTANCE
          Indicates to use Chebyshev distance for classification.
static int CITYBLOCK_DISTANCE
          A synonym to Chebyshev distance.
static int CLASSIFICATION_PLUGIN
          Indicates to employ user-defined classification plugin.
static int DIFF_DISTANCE
          Indicates to use diff-distance classification.
static int DUMMY
          Indicates to use Dummy preprocessing module (just normalization).
static int ENDPOINT
          Indicates to use endpointing.
static int EUCLIDEAN_DISTANCE
          Indicates to use Euclidean distance for classification.
static int F0
          Indicates to use F0.
static int FEATURE_EXTRACTION_PLUGIN
          Indicates to employ user-defined feature extraction plugin.
static int FFT
          Indicates to use FFT.
static int HIGH_FREQUENCY_BOOST_FFT_FILTER
          Indicates to use filter boosting high frequencies.
static int HIGH_PASS_BOOST_FILTER
          Indicates to use high-pass high-frequency boost FFT filter.
static int HIGH_PASS_FFT_FILTER
          Indicates to use high-pass FFT filter.
static int LOW_PASS_FFT_FILTER
          Indicates to use low-pass FFT filter.
static int LPC
          Indicates to use LPC.
static int MAHALANOBIS_DISTANCE
          Indicates to use Mahalanobis distance for classification.
static int MAJOR_VERSION
          Indicates major MARF version, like 1.x.x.
static int MANHATTAN_DISTANCE
          A synonym to Chebyshev distance.
static int MARKOV
          Indicates to use Hidden Markov Models for classification.
static int MAX_CLASSIFICATION_METHOD
          Upper boundary for classificantion methods enumeration.
static int MAX_FEATUREEXTRACTION_METHOD
          Upper boundary for classificantion methods enumeration.
static int MAX_PREPROCESSING_METHOD
          Upper boundary for classificantion methods enumeration.
static int MIDI
          MIDI sample format.
static int MIN_CLASSIFICATION_METHOD
          Lower boundary for classificantion methods enumeration.
static int MIN_FEATUREEXTRACTION_METHOD
          Lower boundary for classificantion methods enumeration.
static int MIN_MAX_AMPLITUDES
          Indicates to use min/max amplitude extraction.
static int MIN_PREPROCESSING_METHOD
          Lower boundary for classificantion methods enumeration.
static int MINKOWSKI_DISTANCE
          Indicates to use Minkowski distance for classification.
static int MINOR_REVISION
          Indicates MARF minor development revision, like 1.1.1.1.
static int MINOR_VERSION
          Indicates minor MARF version, like 1.1.x.
static int MP3
          Indicates MP3 incoming sample file format.
static int NEURAL_NETWORK
          Indicates to use Neural Network for classification.
static int PREPROCESSING_PLUGIN
          Indicates to employ user-defined preprocessing plugin.
static int RANDOM_CLASSIFICATION
          Indicates to use random classification.
static int RANDOM_FEATURE_EXTRACTION
          Indicates to use random feature extraction.
static int RAW
          Indicates to use raw preprocessing, which means no preprocessing.
static int REVISION
          Indicates MARF revision, like 1.1.1.
static int SEGMENTATION
          Indicates to use segmentation.
static int SINE
          Sine sample format.
static int SND
          SND sample format.
static int STOCHASTIC
          Indicates to use stochastic models for classification.
static int ULAW
          Indicates ULAW incoming sample file format.
static int UNSET
          Value indecating that some configuration param is not set.
static int WAV
          Indicates WAVE incoming sample file format.
 
Method Summary
static IClassification getClassification()
          Retrieves current Classification reference.
static int getClassificationMethod()
          Gets classification method to be used.
static java.lang.String getConfig()
          Returns a string representation of the current MARF configuration.
static int getCurrentSubject()
          Gets ID of a subject currently being trained on.
static double getDoubleVersion()
          Retrieves double version of MARF.
static boolean getDumpSpectrogram()
          Whether spectrogram wanted or not.
static boolean getDumpWaveGraph()
          Whether wave graph wanted or not.
static IFeatureExtraction getFeatureExtraction()
          Retrieves current FeatureExtraction reference.
static int getFeatureExtractionMethod()
          Gets currently selected feature extraction method.
static int getIntVersion()
          Returns an integer representation of the MARF version.
static java.lang.String getMARFSourceCodeRevision()
          Retrieves class' revision.
static ModuleParams getModuleParams()
          Gets module-specific parameters an application programmer passed on to the module.
static IPreprocessing getPreprocessing()
          Retrieves current Preprocessing reference.
static int getPreprocessingMethod()
          Gets currently selected preprocessing method.
static Result getResult()
          Gets the entire Result object of the likely outcome.
static ResultSet getResultSet()
          Gets the entire collection of results.
static Sample getSample()
          Retrieves current Sample reference.
static java.lang.String getSampleFile()
          Obtains filename of a sample currently being processed.
static int getSampleFormat()
          Gets input sample file format.
static SampleLoader getSampleLoader()
          Retrieves current SampleLoader reference.
static java.lang.String getVersion()
          Returns a string representation of the MARF version.
static int queryResultID()
          Queries for the final classification result.
static void recognize()
          Recognition/Identification mode.
static void setClassificationMethod(int piClassificationMethod)
          Sets classification method to be used.
static void setCurrentSubject(int piSubjectID)
          Sets ID of a subject currently being trained on.
static void setDumpSpectrogram(boolean pbDump)
          Indicates whether spectrogram is wanted as an output of a FeatureExtraction module.
static void setDumpWaveGraph(boolean pbDump)
          Indicates whether wave graph is wanted as an output.
static void setFeatureExtractionMethod(int piFeatureExtractionMethod)
          Sets feature extraction method to be used.
static void setModuleParams(ModuleParams poModuleParams)
          Sets module-specific parameters an application programmer wishes to pass on to the module.
static void setPreprocessingMethod(int piPreprocessingMethod)
          Sets preprocessing method to be used.
static void setSampleFile(java.lang.String pstrFileName)
          Sets input sample file name.
static void setSampleFormat(int piSampleFormat)
          Sets input sample file format.
static void setSamplesDir(java.lang.String pstrSamplesDir)
          Sets directory with sample files to be read from.
static void streamedRecognition()
          Meant to provide implementation of the buffered sample processing for large samples.
static void train()
          Training mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNSET

public static final int UNSET
Value indecating that some configuration param is not set.

See Also:
Constant Field Values

DUMMY

public static final int DUMMY
Indicates to use Dummy preprocessing module (just normalization).

See Also:
Constant Field Values

HIGH_FREQUENCY_BOOST_FFT_FILTER

public static final int HIGH_FREQUENCY_BOOST_FFT_FILTER
Indicates to use filter boosting high frequencies.

See Also:
Constant Field Values

BANDPASS_FFT_FILTER

public static final int BANDPASS_FFT_FILTER
Indicates to use band-pass filter.

See Also:
Constant Field Values

ENDPOINT

public static final int ENDPOINT
Indicates to use endpointing.

See Also:
Constant Field Values

LOW_PASS_FFT_FILTER

public static final int LOW_PASS_FFT_FILTER
Indicates to use low-pass FFT filter.

See Also:
Constant Field Values

HIGH_PASS_FFT_FILTER

public static final int HIGH_PASS_FFT_FILTER
Indicates to use high-pass FFT filter.

See Also:
Constant Field Values

HIGH_PASS_BOOST_FILTER

public static final int HIGH_PASS_BOOST_FILTER
Indicates to use high-pass high-frequency boost FFT filter.

Since:
0.3.0
See Also:
Constant Field Values

RAW

public static final int RAW
Indicates to use raw preprocessing, which means no preprocessing.

Since:
0.3.0
See Also:
Constant Field Values

PREPROCESSING_PLUGIN

public static final int PREPROCESSING_PLUGIN
Indicates to employ user-defined preprocessing plugin.

Since:
0.3.0
See Also:
Constant Field Values

MAX_PREPROCESSING_METHOD

public static final int MAX_PREPROCESSING_METHOD
Upper boundary for classificantion methods enumeration. Used in error checks. *Update it when add more methods.*

Since:
0.3.0
See Also:
Constant Field Values

MIN_PREPROCESSING_METHOD

public static final int MIN_PREPROCESSING_METHOD
Lower boundary for classificantion methods enumeration. Used in error checks.

Since:
0.3.0
See Also:
Constant Field Values

LPC

public static final int LPC
Indicates to use LPC.

See Also:
Constant Field Values

FFT

public static final int FFT
Indicates to use FFT.

See Also:
Constant Field Values

F0

public static final int F0
Indicates to use F0.

See Also:
Constant Field Values

SEGMENTATION

public static final int SEGMENTATION
Indicates to use segmentation.

See Also:
Constant Field Values

CEPSTRAL

public static final int CEPSTRAL
Indicates to use cepstral analysis.

See Also:
Constant Field Values

RANDOM_FEATURE_EXTRACTION

public static final int RANDOM_FEATURE_EXTRACTION
Indicates to use random feature extraction.

Since:
0.2.0
See Also:
Constant Field Values

MIN_MAX_AMPLITUDES

public static final int MIN_MAX_AMPLITUDES
Indicates to use min/max amplitude extraction.

Since:
0.3.0
See Also:
Constant Field Values

FEATURE_EXTRACTION_PLUGIN

public static final int FEATURE_EXTRACTION_PLUGIN
Indicates to employ user-defined feature extraction plugin.

Since:
0.3.0
See Also:
Constant Field Values

MAX_FEATUREEXTRACTION_METHOD

public static final int MAX_FEATUREEXTRACTION_METHOD
Upper boundary for classificantion methods enumeration. Used in error checks. *Update it when add more methods.*

Since:
0.3.0
See Also:
Constant Field Values

MIN_FEATUREEXTRACTION_METHOD

public static final int MIN_FEATUREEXTRACTION_METHOD
Lower boundary for classificantion methods enumeration. Used in error checks.

Since:
0.3.0
See Also:
Constant Field Values

NEURAL_NETWORK

public static final int NEURAL_NETWORK
Indicates to use Neural Network for classification.

See Also:
Constant Field Values

STOCHASTIC

public static final int STOCHASTIC
Indicates to use stochastic models for classification.

See Also:
Constant Field Values

MARKOV

public static final int MARKOV
Indicates to use Hidden Markov Models for classification.

See Also:
Constant Field Values

EUCLIDEAN_DISTANCE

public static final int EUCLIDEAN_DISTANCE
Indicates to use Euclidean distance for classification.

See Also:
Constant Field Values

CHEBYSHEV_DISTANCE

public static final int CHEBYSHEV_DISTANCE
Indicates to use Chebyshev distance for classification.

See Also:
Constant Field Values

MANHATTAN_DISTANCE

public static final int MANHATTAN_DISTANCE
A synonym to Chebyshev distance.

Since:
0.2.0
See Also:
Constant Field Values

CITYBLOCK_DISTANCE

public static final int CITYBLOCK_DISTANCE
A synonym to Chebyshev distance.

Since:
0.3.0
See Also:
Constant Field Values

MINKOWSKI_DISTANCE

public static final int MINKOWSKI_DISTANCE
Indicates to use Minkowski distance for classification.

Since:
0.2.0
See Also:
Constant Field Values

MAHALANOBIS_DISTANCE

public static final int MAHALANOBIS_DISTANCE
Indicates to use Mahalanobis distance for classification.

Since:
0.2.0
See Also:
Constant Field Values

RANDOM_CLASSIFICATION

public static final int RANDOM_CLASSIFICATION
Indicates to use random classification.

Since:
0.2.0
See Also:
Constant Field Values

DIFF_DISTANCE

public static final int DIFF_DISTANCE
Indicates to use diff-distance classification.

Since:
0.3.0
See Also:
Constant Field Values

CLASSIFICATION_PLUGIN

public static final int CLASSIFICATION_PLUGIN
Indicates to employ user-defined classification plugin.

Since:
0.3.0
See Also:
Constant Field Values

MAX_CLASSIFICATION_METHOD

public static final int MAX_CLASSIFICATION_METHOD
Upper boundary for classificantion methods enumeration. Used in error checks. *Update it when add more methods.*

Since:
0.3.0
See Also:
Constant Field Values

MIN_CLASSIFICATION_METHOD

public static final int MIN_CLASSIFICATION_METHOD
Lower boundary for classificantion methods enumeration. Used in error checks.

Since:
0.3.0
See Also:
Constant Field Values

WAV

public static final int WAV
Indicates WAVE incoming sample file format.

See Also:
Constant Field Values

ULAW

public static final int ULAW
Indicates ULAW incoming sample file format.

See Also:
Constant Field Values

MP3

public static final int MP3
Indicates MP3 incoming sample file format.

See Also:
Constant Field Values

SINE

public static final int SINE
Sine sample format.

Since:
0.3.0
See Also:
Constant Field Values

AIFF

public static final int AIFF
AIFF sample format.

Since:
0.3.0
See Also:
Constant Field Values

AIFFC

public static final int AIFFC
AIFF-C sample format.

Since:
0.3.0
See Also:
Constant Field Values

AU

public static final int AU
AU sample format.

Since:
0.3.0
See Also:
Constant Field Values

SND

public static final int SND
SND sample format.

Since:
0.3.0
See Also:
Constant Field Values

MIDI

public static final int MIDI
MIDI sample format.

Since:
0.3.0
See Also:
Constant Field Values

MAJOR_VERSION

public static final int MAJOR_VERSION
Indicates major MARF version, like 1.x.x. As of 0.3.0.3 made public.

See Also:
Constant Field Values

MINOR_VERSION

public static final int MINOR_VERSION
Indicates minor MARF version, like 1.1.x. As of 0.3.0.3 made public.

See Also:
Constant Field Values

REVISION

public static final int REVISION
Indicates MARF revision, like 1.1.1. As of 0.3.0.3 made public.

See Also:
Constant Field Values

MINOR_REVISION

public static final int MINOR_REVISION
Indicates MARF minor development revision, like 1.1.1.1. This is primarily for development releases. On the final release the counting stops and is reset to 0 every minor version. As of 0.3.0.3 made public.

Since:
0.3.0
See Also:
MINOR_VERSION, Constant Field Values
Method Detail

setPreprocessingMethod

public static final void setPreprocessingMethod(int piPreprocessingMethod)
                                         throws MARFException
Sets preprocessing method to be used.

Parameters:
piPreprocessingMethod - one of the allowed preprocessing methods
Throws:
MARFException - if the parameter outside of the valid range

getPreprocessingMethod

public static final int getPreprocessingMethod()
Gets currently selected preprocessing method.

Returns:
one of the preprocessing methods

setFeatureExtractionMethod

public static final void setFeatureExtractionMethod(int piFeatureExtractionMethod)
                                             throws MARFException
Sets feature extraction method to be used.

Parameters:
piFeatureExtractionMethod - one of the allowed feature extraction methods
Throws:
MARFException - if the parameter outside of the valid range

getFeatureExtractionMethod

public static final int getFeatureExtractionMethod()
Gets currently selected feature extraction method.

Returns:
current feature extraction method

setClassificationMethod

public static final void setClassificationMethod(int piClassificationMethod)
                                          throws MARFException
Sets classification method to be used.

Parameters:
piClassificationMethod - one of the allowed classification methods
Throws:
MARFException - if the parameter outside of the valid range

getClassificationMethod

public static final int getClassificationMethod()
Gets classification method to be used.

Returns:
current classification method

setSampleFormat

public static final void setSampleFormat(int piSampleFormat)
Sets input sample file format.

Parameters:
piSampleFormat - one of the allowed sample formats

getSampleFormat

public static final int getSampleFormat()
Gets input sample file format.

Returns:
current sample format

setSampleFile

public static final void setSampleFile(java.lang.String pstrFileName)
Sets input sample file name.

Parameters:
pstrFileName - string representing sample file to be read

getSampleFile

public static final java.lang.String getSampleFile()
Obtains filename of a sample currently being processed.

Returns:
file name of a string representing sample file

setSamplesDir

public static final void setSamplesDir(java.lang.String pstrSamplesDir)
Sets directory with sample files to be read from.

Parameters:
pstrSamplesDir - string representing directory name

setModuleParams

public static final void setModuleParams(ModuleParams poModuleParams)
Sets module-specific parameters an application programmer wishes to pass on to the module.

Parameters:
poModuleParams - parameters' instance

getModuleParams

public static final ModuleParams getModuleParams()
Gets module-specific parameters an application programmer passed on to the module.

Returns:
ModuleParams object reference

setDumpSpectrogram

public static final void setDumpSpectrogram(boolean pbDump)
Indicates whether spectrogram is wanted as an output of a FeatureExtraction module.

Parameters:
pbDump - true if wanted, false if not

getDumpSpectrogram

public static final boolean getDumpSpectrogram()
Whether spectrogram wanted or not.

Returns:
true if spectrogram being dumped, false otherwise

setDumpWaveGraph

public static final void setDumpWaveGraph(boolean pbDump)
Indicates whether wave graph is wanted as an output.

Parameters:
pbDump - true if wanted, false if not

getDumpWaveGraph

public static final boolean getDumpWaveGraph()
Whether wave graph wanted or not.

Returns:
true if graph wanted being dumped, false otherwise

setCurrentSubject

public static final void setCurrentSubject(int piSubjectID)
Sets ID of a subject currently being trained on.

Parameters:
piSubjectID - integer ID of the subject

getCurrentSubject

public static final int getCurrentSubject()
Gets ID of a subject currently being trained on.

Returns:
integer ID of the subject
Since:
0.2.0

getVersion

public static final java.lang.String getVersion()
Returns a string representation of the MARF version. As of 0.3.0.3 MINOR_REVISION is also returned.

Returns:
version String
See Also:
MINOR_REVISION

getIntVersion

public static final int getIntVersion()
Returns an integer representation of the MARF version. As of 0.3.0.3, MINOR_REVISION is included into calculations and the formula changed to begin with 1000 as a MAJOR_VERSION coefficient.

Returns:
integer version as MAJOR_VERSION * 1000 + MINOR_VERSION * 100 + REVISION * 10 + MINOR_REVISION
See Also:
MAJOR_VERSION, MINOR_VERSION, REVISION, MINOR_REVISION

getDoubleVersion

public static final double getDoubleVersion()
Retrieves double version of MARF. Unlike the integer version, the double one begins with 100 and the minor revision is returned after the point, e.g. 123.4 for 1.2.3.4.

Returns:
double version as MAJOR_VERSION * 100 + MINOR_VERSION * 10 + REVISION + MINOR_REVISION / 10
Since:
0.3.0.3
See Also:
MAJOR_VERSION, MINOR_VERSION, REVISION, MINOR_REVISION

getConfig

public static final java.lang.String getConfig()
Returns a string representation of the current MARF configuration.

Returns:
configuration string

getSample

public static final Sample getSample()
Retrieves current Sample reference.

Returns:
Sample object
Since:
0.2.0

getSampleLoader

public static final SampleLoader getSampleLoader()
Retrieves current SampleLoader reference.

Returns:
SampleLoader object
Since:
0.2.0

getPreprocessing

public static final IPreprocessing getPreprocessing()
Retrieves current Preprocessing reference.

Returns:
Preprocessing object
Since:
0.2.0

getFeatureExtraction

public static final IFeatureExtraction getFeatureExtraction()
Retrieves current FeatureExtraction reference.

Returns:
FeatureExtraction object
Since:
0.2.0

getClassification

public static final IClassification getClassification()
Retrieves current Classification reference.

Returns:
Classification object
Since:
0.2.0

queryResultID

public static final int queryResultID()
Queries for the final classification result.

Returns:
integer ID of the indentified subject

getResult

public static final Result getResult()
Gets the entire Result object of the likely outcome.

Returns:
Result ID and all the stats of the classification

getResultSet

public static final ResultSet getResultSet()
Gets the entire collection of results.

Returns:
ResultSet object with one or more results.
Since:
0.3.0

recognize

public static final void recognize()
                            throws MARFException
Recognition/Identification mode.

Throws:
MARFException - if there was an error in the pipeline or classification
Since:
0.2.0

train

public static final void train()
                        throws MARFException
Training mode.

Throws:
MARFException - if the subject is unset or there was an error in training in the underlying classification module
Since:
0.2.0

streamedRecognition

public static final void streamedRecognition()
Meant to provide implementation of the buffered sample processing for large samples. Not implemented.

Throws:
NotImplementedException

getMARFSourceCodeRevision

public static java.lang.String getMARFSourceCodeRevision()
Retrieves class' revision.

Returns:
revision string
Since:
0.3.0.2