NumericalDiscreteFeature Class Reference

#include <Numerical.h>

Inheritance diagram for NumericalDiscreteFeature:

PersistantFeature Feature AudioPeakFeature BluetoothNumPeersFeature WlanNumPeersFeature List of all members.

Public Member Functions

virtual double getPosition () const
virtual double getDistance (Feature *f) const
virtual void moveTowards (Feature *f, double factor)
virtual string serialize () const
virtual void unserialize (string value)
virtual featureparams write () const
virtual void read (featureparams *param)
virtual Featureclone () const
virtual void aggregate (aggregatelist samples)
virtual FeatureType getType () const
virtual const string getName () const
const long getVal () const
const long getMin () const
const long getMax () const
virtual string toString () const

Protected Member Functions

 NumericalDiscreteFeature (long *minval, long *maxval)
 NumericalDiscreteFeature (long *minval, long *maxval, long val)

Protected Attributes

double val
long * minval
long * maxval

Detailed Description

Abstract discrete numerical feature

A feature of type numerical_discrete. This class imeplements the getType method of the Feature interface and, as a base class for special features, implements the complete handling of numerical discrete values. This includes the implementations of getDistance and moveTowards as well as getPosition, serialize and unserialize. Additionally, minimum and maximum seen values are stored as persistant values of the feature and used for computing the normalized distance and position. Although these values are handled inside this class, the storage for them has to be provided by the subclasses (or generally the factory that creates objects of this class).


Constructor & Destructor Documentation

NumericalDiscreteFeature::NumericalDiscreteFeature long *  minval,
long *  maxval
[protected]
 

Feature constructor

This constructor initializes the feature with a random value and should thus only be used for creating e.g. prototypes of points in a clustering space. For creating a specific sample of a feature, the second constructor should be used.

Parameters:
minval A reference to a static variable (it must be same for all created objects of _one_ feature) for persistantly storing the minimum value.
maxval A reference to a static variable (it must be same for all created objects of _one_ feature) for persistantly storing the maximum value.

NumericalDiscreteFeature::NumericalDiscreteFeature long *  minval,
long *  maxval,
long  val
[protected]
 

Sample constructor

This constructor initializes the feature with a specific value and should thus be used for samples.

Parameters:
minval A reference to a static variable (it must be same for all created objects of _one_ feature) for persistantly storing the minimum value.
maxval A reference to a static variable (it must be same for all created objects of _one_ feature) for persistantly storing the maximum value.
val The sample value.


Member Function Documentation

void NumericalDiscreteFeature::aggregate aggregatelist  samples  )  [virtual]
 

Aggregate a sample values from other sources

Parameters:
samples A list of <timestamp, sample> tuples.

Implements Feature.

Feature * NumericalDiscreteFeature::clone  )  const [virtual]
 

Clone a feature

A feature must be able to clone itself. This is typically implemented with a copy constructor, but should return a new object.

Implements Feature.

double NumericalDiscreteFeature::getDistance Feature f  )  const [virtual]
 

Calculates the distance between two features

Parameters:
f Feature used for distance measurement.
Returns:
Distance between the two samples. The return value has to be in the interval [0; 1] to guarantee comparability among samples of different features.

Implements Feature.

virtual const string NumericalDiscreteFeature::getName  )  const [inline, virtual]
 

Query a features name

Returns:
Name of the Feature in the format "Featureprovider.Feature"

Implements Feature.

Reimplemented in AudioPeakFeature, BluetoothNumPeersFeature, and WlanNumPeersFeature.

double NumericalDiscreteFeature::getPosition  )  const [virtual]
 

Query a features position

Returns:
The distance to the origin. Every implementation must take care that only values in the interval [0; 1] are returned.
Remarks:
This function is only for the purpose of internal search operations and visualisation and should not be used in any other context.

Implements Feature.

virtual FeatureType NumericalDiscreteFeature::getType  )  const [inline, virtual]
 

Query a features type

Returns:
The type of the Feature.

Implements Feature.

const long NumericalDiscreteFeature::getVal  )  const [inline]
 

Returns:
The value of the feature.

void NumericalDiscreteFeature::moveTowards Feature f,
double  factor
[virtual]
 

Move feature

Moves the feature towards a given sample value by the specified factor (factor times the distance). If the factor is 0, the old feature value must not change. If the factor is 1, the new feature value should be equivalent to the sample s.

Parameters:
f Feature used for distance measurement.
factor Distance weight.

Implements Feature.

void NumericalDiscreteFeature::read featureparams param  )  [virtual]
 

Load feature from persistant data

Initializes the persistant feature data from the given representation.

Parameters:
param Persistant feature data.
See also:
write

Implements PersistantFeature.

string NumericalDiscreteFeature::serialize  )  const [virtual]
 

Serialize a samples data to a string

Returns:
String representation of the samples data.

Implements Feature.

string NumericalDiscreteFeature::toString  )  const [virtual]
 

This is only for testing.

Implements Feature.

Reimplemented in AudioPeakFeature, BluetoothNumPeersFeature, and WlanNumPeersFeature.

void NumericalDiscreteFeature::unserialize string  value  )  [virtual]
 

Unserialize a samples data from a string

Parameters:
value String representation of the samples data.

Implements Feature.

featureparams NumericalDiscreteFeature::write  )  const [virtual]
 

Externalize feature

Returns:
Persistant feature data.
See also:
read

Implements PersistantFeature.


Member Data Documentation

long* NumericalDiscreteFeature::maxval [protected]
 

A reference to the static, persistant maximum value seen so far.

long* NumericalDiscreteFeature::minval [protected]
 

A reference to the static, persistant minimum value seen so far.

double NumericalDiscreteFeature::val [protected]
 

The feature value.


The documentation for this class was generated from the following files:
Generated on Mon Jun 5 10:20:49 2006 for Intelligence.kdevelop by  doxygen 1.4.6