Extractors and Estimators


Table of Contents

What is an Extractor/Estimator?

Estimators are objects that can use built in sensors to estimate certain parameters or vital signs. For example, described an algorithm that can estimate activity levels from accelerometer data. We implemented the algorithm in the estimator EEEstimator.

Extractors are objects that can extract data from sensors without further estimation. For example, BatteryUsageExtractor extracts the phone’s battery usage as indicated by the phone.

How to initialize an estimator or an extractor?

In order to initialize an extractor or an estimator, you first need to get a place to store the data resulting from their operation. All extractors and estimators work with BackableEncapsulator data holders. The standard process of creating an estimator or an extractor of type EstimatorType that outputs data of type ExtractorDataContainer is described in the following snippet:

BackableEncapsulatorIdentifier myDataIdentifier = new BackableEncapsulatorIdentifier("My data identifier");
BackableEncapsulator<ExtractorDataContainer> myData = new BackableEncapsulator<ExtractorDataContainer>(myDataIdentifier);
EstimatorType myEstimator = new EstimatorType(myData);

Note that, in addition to the data structure holding the output of the estimator or extractor, additional objects may be required for the operation of the estimator or extractor. Check the tutorial of each estimator or extractor for more details.

Each estimator/extractor has its own prerequisites to be functional, usually depending on the hardware available on the client. For instance, the energy expenditure estimator, described above, requires the client to have a tri-axial accelerometer sensor for it to operate properly. In order to facilitate easy ways for you to validate that these requirements are met, each estimator/extractor provides the method reqSatisfied() that throws an ExtractorHardwarePrerequisiteUnsatisfiedException if it does not meet the prerequisites. Once the client application has made sure that these requirements are met, it can invoke the start() method to start the estimation/extraction process (the estimator/extractor is now said to be active). Lastly, the terminate() method can be used to terminate the estimation/extraction process. The following snipped demonstrates these concepts.

try {
    myEstimator.reqSatisfied();
    myEstimator.start();
} catch (ExtractorHardwarePrerequisiteUnsatisfiedException e) {
    // The prerequisites of the extractor were not satisfied
}

// Keep collecting until... 
myEstimator.stop();

Whenever an active estimator/extractor obtains a new data point, it will add it to the BackableEncapsulator that was provided to it at the initialization stage (myData in our example). Consequently, you can utilize the backable encapsulator listeners to get a trigger whenever that event happens. For more information about this, refer to the backable encapsulators tutorial. The snippet below demonstrates this.

AbstractEncapsulatorBlockingListener myDataListener = new AbstractEncapsulatorBlockingListener() {
	
	@Override
	public void onEvent(EncapsulatorEvent e) {
		if (e.getType() == EncapsulatorEvent.EventType.ADDED) {
			// A data point was added to the encapsulator e.getSource()
		}
	}

	@Override
	public void onListen(Object source) {
	}

	@Override
	public void onUnListen(Object source) {
		
	}
};

myData.addListener(myDataListener);

 

What estimators are currently implemented?

Energy expenditure (activity levels) estimator

The energy expenditure (EE) estimator utilizes tri-axial accelerometer data to estimate the subject’s activity levels.

Heart-beat rate extractors

The framework includes two heart-beat rate estimators based on video data.

 

Heart-beat rate from face video estimator

This estimator uses a video of the subject’s face to estimate her or his heart-beat rate.

Heart-beat rate from finger video estimator

This estimator uses a video of the subject’s finger (commonly, the index finger) to estimate her or his heart-beat rate.

GPS extractors

The GPS extractors allows you to monitor the location of the client. There are two GPS extractors available in the framework. The first extractor works periodically with a configurable period, and the second extractor works whenever the GPS sensor of the client gets an updated reading.

Battery usage extractor

The battery usage extractor allows you to monitor the battery level of the client. Currently, the battery usage extractor works periodically with a configurable period.

Screen light extractor

The screen light extractor allows you to monitor whether the screen of the client is lit or dim. Currently, the screen light extractor works periodically with a configurable period.

Running speed estimator

The running speed estimator allows you to monitor the speed at which the device is traveling.

Cadence estimator

The cadence estimator allows you to monitor the cadence of the user carrying the client device using accelerometer data collected from the device.

References

Chen, Kong Y., and Ming Sun. 1997. “Improving Energy Expenditure Estimation by Using a Triaxial Accelerometer.” Journal of Applied Physiology 83 (6): 2112–22. http://jap.physiology.org/content/83/6/2112.