org.android.activityminer.logic.features.selection
Class FeatureSelectionHelper

Package class diagram package FeatureSelectionHelper
java.lang.Object
  extended by de.unikassel.android.sdcframework.util.ObservableEventSourceImpl<ObservableProgressData>
      extended by org.android.activityminer.logic.features.selection.FeatureSelectionHelper
All Implemented Interfaces:
ObservableEventSource<ObservableProgressData>, ObserverRegistration<ObservableProgressData>

public class FeatureSelectionHelper
extends ObservableEventSourceImpl<ObservableProgressData>

A class to delegate feature selection to.


Field Summary
private  Configuration config
          The current configuration.
private  Context context
          The context.
private  DBManager dbManager
          A reference to the database manager.
private  Set<FeatureTypes> featureSet
          The feature set to select features from.
private  String lastError
          The last error
private  android.support.v4.util.LongSparseArray<List<Long>> mapSelectedClassId2SampleIds
          A map to store sample (feature vector) identifiers for the selected lass identifiers
private  int progress
          The current progress.
private  ObservableProgressData progressData
          The observable progress data
private  int sampleCount
          The total sample count.
private  int subSetSize
          The maximum subset size.
private  boolean succeeded
          The success state flag
private  double threshold
          Internal accuracy threshold.
private  List<TrainingActivity> trainingActivites
          The training activities for evaluation.
private  ValidationStrategy validationStrategy
          The validation strategy.
 
Constructor Summary
FeatureSelectionHelper(DBManager dbManager, Set<FeatureTypes> featureSet, Configuration config, int size, Context context)
          Constructor
 
Method Summary
 void doSearchForFeatures()
          Does run the search for the best feature subset.
 double evaluate(Set<FeatureTypes> selectedFeatures, Classifier classifier)
          Evaluation of a feature set.
 String getLastError()
          Getter for the last error
 int getMaxProgress()
          Getter for the maximum progress
 String getStartProgressMessage()
          Getter for the start progress message
 boolean hasSucceeded()
          Getter for the success flag
 void loadSamplesAndCreatePartioning()
          Does load available samples as feature vectors from DB and creates the partitioning for k-fold cross validation.
 boolean saveResultsToFile(String fileName)
          Method to store evaluation result to file.
 void updateProgress(String msg)
          Does publish the current progress with the given message.
 
Methods inherited from class de.unikassel.android.sdcframework.util.ObservableEventSourceImpl
getObservers, hasObservers, notify, onObserverRegistration, onObserverUnregistration, registerEventObserver, removeAllObservers, unregisterEventObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dbManager

private final DBManager dbManager
A reference to the database manager.


config

private Configuration config
The current configuration.


featureSet

private final Set<FeatureTypes> featureSet
The feature set to select features from.


sampleCount

private int sampleCount
The total sample count.


validationStrategy

private final ValidationStrategy validationStrategy
The validation strategy.


trainingActivites

private List<TrainingActivity> trainingActivites
The training activities for evaluation.


progressData

private final ObservableProgressData progressData
The observable progress data


progress

private int progress
The current progress.


succeeded

private boolean succeeded
The success state flag


lastError

private String lastError
The last error


mapSelectedClassId2SampleIds

private final android.support.v4.util.LongSparseArray<List<Long>> mapSelectedClassId2SampleIds
A map to store sample (feature vector) identifiers for the selected lass identifiers


context

private Context context
The context.


threshold

private double threshold
Internal accuracy threshold.


subSetSize

private final int subSetSize
The maximum subset size.

Constructor Detail

FeatureSelectionHelper

public FeatureSelectionHelper(DBManager dbManager,
                              Set<FeatureTypes> featureSet,
                              Configuration config,
                              int size,
                              Context context)
Constructor

Parameters:
dbManager - a reference to the database manager
featureSet - the set with the features
config - the current configuration
size - the subset size
context - the context
Method Detail

hasSucceeded

public final boolean hasSucceeded()
Getter for the success flag

Returns:
the success flag

getLastError

public final String getLastError()
Getter for the last error

Returns:
the last error

doSearchForFeatures

public final void doSearchForFeatures()
Does run the search for the best feature subset.


saveResultsToFile

public final boolean saveResultsToFile(String fileName)
Method to store evaluation result to file.

Parameters:
fileName - the filename
Returns:
true if successful, false otherwise

loadSamplesAndCreatePartioning

public final void loadSamplesAndCreatePartioning()
                                          throws Exception
Does load available samples as feature vectors from DB and creates the partitioning for k-fold cross validation.

Throws:
Exception

evaluate

public final double evaluate(Set<FeatureTypes> selectedFeatures,
                             Classifier classifier)
Evaluation of a feature set.

Parameters:
selectedFeatures - the selected features for evaluation
classifier - the classifier for evaluation
Returns:
the accuracy

updateProgress

public final void updateProgress(String msg)
Does publish the current progress with the given message.

Parameters:
msg - the progress message

getStartProgressMessage

public String getStartProgressMessage()
Getter for the start progress message

Returns:
the start message for progress observation

getMaxProgress

public final int getMaxProgress()
Getter for the maximum progress

Returns:
the maximum progress steps