|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.android.activityminer.logic.features.FeatureExtractionHelper<T>
T
- the enumeration type for the dimensionspublic class FeatureExtractionHelper<T extends Enum<T> & Dimensions>
Nested Class Summary | |
---|---|
private class |
FeatureExtractionHelper.Entry
Helper class for time stamp lookups |
class |
FeatureExtractionHelper.ProgressEvent
The observable progress event (to notify progress on a single sequence processing) |
Field Summary | |
---|---|
private T |
accGXId
Dimension id for gravitation vector x value. |
private T |
accGYId
Dimension id for gravitation vector y value. |
private T |
accGZId
Dimension id for gravitation vector z value. |
private T |
accXId
Dimension id for x acceleration. |
private T |
accYId
Dimension id for y acceleration. |
private T |
accZId
Dimension id for z acceleration. |
private Context |
context
The context. |
private AtomicInteger |
currentFeatureVectorCount
The current feature vector count |
private DBManager |
dbManager
A reference to the database manager. |
private AbstractFeatureExtractorForDBRecordings<T> |
featureExtractor
The feature extractor to use |
private LowPassFilter |
filter
The low pass filter for the accelerometer data. |
private GravitationFilter |
gFilter
The gravitation filter |
private boolean |
hasToAdaptToConfiguration
The flag for configuration based adaption. |
private boolean |
isUseOwnGravitationFilter
The gravitation filter usage flag |
private Exception |
lastException
last exception reference if one occurs during asynchronous saves |
private ObservableEventSource<FeatureExtractionHelper.ProgressEvent> |
progressEventSource
The observable delegator for progress events |
private ConcurrentLinkedQueue<FeatureExtractionHelper.Entry> |
queueTs2IDMapping
The queue to store mappings for time stamps and recording identifiers in |
private long |
sampleRate
The configured sample rate |
private int |
sampleRateAdaptionFactor
The adaption factor for the sample rate is the relation of the configured sample rate to the one used for recordings. |
Constructor Summary | |
---|---|
private |
FeatureExtractionHelper(DBManager dbManager,
Configuration config,
AbstractFeatureExtractorForDBRecordings<T> featureExtractor,
AbstractFeatureFactory<T> factory,
Context context,
boolean hasToAdaptToConfiguration)
Constructor |
Method Summary | ||
---|---|---|
private SensorObservationCutout<T,Double> |
adaptToConfiguration(SensorObservationCutout<T,Double> cutOut,
Long lastTs)
Method to apply the configured sample rate and the optional filter to the cut-out window of a recording. |
|
static
|
createFeatureExtractionHelper(Context context,
DBManager dbManager,
Configuration config,
AbstractFeatureExtractorForDBRecordings<T> featureExtractor,
AbstractFeatureFactory<T> factory,
boolean hasToAdaptToConfiguration)
Method to create a feature extraction helper instance. |
|
protected DBManager |
getDbManager()
Getter for the dbManager |
|
String |
getErrorNotificationMsg(List<Long> failedIds)
Getter for the error notification message |
|
protected Exception |
getLastException()
Getter for the last exception |
|
double |
getLastExtractionTime()
Getter for the last extraction time from the feature extractor |
|
String |
getResultNotificationMsg(int extractedSampleCount,
double avgTimeForFeatureExtraction,
double processingTime)
Getter for the result notification message |
|
void |
onDestroy()
Destruction. |
|
void |
onEvent(ObservableEventSource<? extends FeatureVector> eventSource,
FeatureVector featureVector)
|
|
int |
process(long sequenceId,
EventObserver<FeatureExtractionHelper.ProgressEvent> progressObserver)
Does process a sequence of continuous recordings. |
|
protected void |
setLastException(Exception lastException)
Setter for the last exception |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private final LowPassFilter filter
private final AbstractFeatureExtractorForDBRecordings<T extends Enum<T> & Dimensions> featureExtractor
private final ObservableEventSource<FeatureExtractionHelper.ProgressEvent> progressEventSource
private final DBManager dbManager
private final ConcurrentLinkedQueue<FeatureExtractionHelper.Entry> queueTs2IDMapping
private final AtomicInteger currentFeatureVectorCount
private Exception lastException
private final int sampleRateAdaptionFactor
private Context context
private T extends Enum<T> & Dimensions accXId
private T extends Enum<T> & Dimensions accYId
private T extends Enum<T> & Dimensions accZId
private T extends Enum<T> & Dimensions accGXId
private T extends Enum<T> & Dimensions accGYId
private T extends Enum<T> & Dimensions accGZId
private final GravitationFilter gFilter
private final boolean isUseOwnGravitationFilter
private final long sampleRate
private final boolean hasToAdaptToConfiguration
Constructor Detail |
---|
private FeatureExtractionHelper(DBManager dbManager, Configuration config, AbstractFeatureExtractorForDBRecordings<T> featureExtractor, AbstractFeatureFactory<T> factory, Context context, boolean hasToAdaptToConfiguration)
dbManager
- a reference to the database managerconfig
- the configurationfeatureExtractor
- the feature extractorfactory
- the feature factorycontext
- the contexthasToAdaptToConfiguration
- flag if adaption is required (can only happen in batch export
mode)Method Detail |
---|
protected DBManager getDbManager()
protected final Exception getLastException()
protected final void setLastException(Exception lastException)
lastException
- the last exception to setpublic final String getErrorNotificationMsg(List<Long> failedIds)
failedIds
- a list with failed record id's
public String getResultNotificationMsg(int extractedSampleCount, double avgTimeForFeatureExtraction, double processingTime)
extractedSampleCount
- the count of extracted training samplesavgTimeForFeatureExtraction
- the average time for feature extraction in millisecondsprocessingTime
- the whole processing time in seconds
public final double getLastExtractionTime()
public final int process(long sequenceId, EventObserver<FeatureExtractionHelper.ProgressEvent> progressObserver) throws Exception
sequenceId
- the identifier of the continuous recordings sequence to extract
features fromprogressObserver
- the optional progress observer
Exception
private SensorObservationCutout<T,Double> adaptToConfiguration(SensorObservationCutout<T,Double> cutOut, Long lastTs)
cutOut
- the cut-out windowlastTs
- time stamp from last
public final void onDestroy()
public void onEvent(ObservableEventSource<? extends FeatureVector> eventSource, FeatureVector featureVector)
onEvent
in interface EventObserver<FeatureVector>
public static final <T extends Enum<T> & Dimensions> FeatureExtractionHelper<T> createFeatureExtractionHelper(Context context, DBManager dbManager, Configuration config, AbstractFeatureExtractorForDBRecordings<T> featureExtractor, AbstractFeatureFactory<T> factory, boolean hasToAdaptToConfiguration)
context
- the application contextdbManager
- the database managerconfig
- the configurationfeatureExtractor
- the feature extractorfactory
- the factoryhasToAdaptToConfiguration
- flag if adaption is required (can only happen in batch export
mode)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |