Package adaptlil
Class GazeWindow
java.lang.Object
adaptlil.GazeWindow
- All Implemented Interfaces:
Component
Intended use of this file is to implement a 'window' in which gaze can be analyzed and conclusions/predictions can be drawn.
In terms of the real-time visualization prototype, it is used to make invokes adaptovis.adaptations to the charts and analyze if they are working
based of the user's gaze data.
-
Field Summary
Modifier and TypeFieldDescriptionprivate int
private RecXml[]
private GazeMetrics
private AdaptationMediator
private int
private int
private float
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionint
Adds a RecXmlObject to the buffer.void
Calculates additional metrics useful for classification and ml training.void
flush()
Clears the gazeBuffer and resets the internal position.ArrayList<weka.core.Attribute>
getAttributeList
(boolean reduceAttributeNames, boolean useAdditionalGazeMetrics) Gets Attributes used for machine learning classificationRecXml[]
weka.core.DenseInstance
getInstancesFromAttributeList
(ArrayList<weka.core.Attribute> attributeList, boolean useAdditionalGazeMetrics) Creates a DenseInstanceList of all gaze data points (RecXmlObjects) in the window.int
Internal index pointer for the array holding the gaze dataint
Returns the number of individual data points the window can holdfloat
void
Linear adaptlil.interpolation to fill in any values that may be flagged as invalid by the eyetracker.boolean
isFull()
void
setGazeBuffer
(RecXml[] gazeBuffer) void
setMediator
(Mediator mediator) void
setWindowSize
(int windowSize) void
setWindowSizeInMilliseconds
(float windowSizeInMilliseconds) Sets the # of packets that should belong in the GazeData (non-enforcing)weka.core.Instance
toDenseInstance
(boolean reduceAttributeNames, boolean useAdditionalGazeMetrics) https://weka.sourceforge.io/doc.dev/weka/core/DenseInstance.html Converts the window into an instance than can be used for Weka ML Works by going over each declared field/attribute in each RecXmlObject of each gazeDataorg.nd4j.linalg.api.ndarray.INDArray
toINDArray
(boolean useAdditionalGazeMetrics) Converts each gaze data point (RecXmlObject) into an element for the INDArray.
-
Field Details
-
windowSizeInMilliseconds
private float windowSizeInMilliseconds -
windowSize
private int windowSize -
pollingRateInHz
private int pollingRateInHz -
bufferIndex
private int bufferIndex -
gazeBuffer
-
mediator
-
gazeMetrics
-
-
Constructor Details
-
GazeWindow
public GazeWindow(float windowSizeInMilliseconds, int pollingRateInHz) - Parameters:
windowSizeInMilliseconds
-
-
-
Method Details
-
interpolateMissingValues
public void interpolateMissingValues()Linear adaptlil.interpolation to fill in any values that may be flagged as invalid by the eyetracker. This applies to all attributes in the RecXmlObject -
toDenseInstance
public weka.core.Instance toDenseInstance(boolean reduceAttributeNames, boolean useAdditionalGazeMetrics) https://weka.sourceforge.io/doc.dev/weka/core/DenseInstance.html Converts the window into an instance than can be used for Weka ML Works by going over each declared field/attribute in each RecXmlObject of each gazeData- Returns:
-
toINDArray
public org.nd4j.linalg.api.ndarray.INDArray toINDArray(boolean useAdditionalGazeMetrics) Converts each gaze data point (RecXmlObject) into an element for the INDArray. The # of elements in the array is a factor of number of non-null protected/public attributes in the class. E.g. RecXmlOBjects have 3 non-null public attributes and there is a gaze window of size 10. The shape of the INDArray will be 30- Parameters:
useAdditionalGazeMetrics
-- Returns:
-
getAttributeList
public ArrayList<weka.core.Attribute> getAttributeList(boolean reduceAttributeNames, boolean useAdditionalGazeMetrics) Gets Attributes used for machine learning classification- Parameters:
reduceAttributeNames
-useAdditionalGazeMetrics
-- Returns:
-
getInstancesFromAttributeList
public weka.core.DenseInstance getInstancesFromAttributeList(ArrayList<weka.core.Attribute> attributeList, boolean useAdditionalGazeMetrics) Creates a DenseInstanceList of all gaze data points (RecXmlObjects) in the window. The DenseInstance list can be used for WEKA- Parameters:
attributeList
-useAdditionalGazeMetrics
-- Returns:
-
calculateAdditionalGazeMetrics
public void calculateAdditionalGazeMetrics()Calculates additional metrics useful for classification and ml training. -
add
Adds a RecXmlObject to the buffer.- Parameters:
recXml
-- Returns:
- The index it was inserted into is returned. -1 is returned if the buffer is full.
-
getInternalIndex
public int getInternalIndex()Internal index pointer for the array holding the gaze data- Returns:
-
flush
public void flush()Clears the gazeBuffer and resets the internal position. -
setGazeBuffer
-
setWindowSizeInMilliseconds
public void setWindowSizeInMilliseconds(float windowSizeInMilliseconds) Sets the # of packets that should belong in the GazeData (non-enforcing)- Parameters:
windowSizeInMilliseconds
-
-
setWindowSize
public void setWindowSize(int windowSize) -
getGazeBuffer
-
getWindowSize
public int getWindowSize()Returns the number of individual data points the window can hold- Returns:
-
getWindowSizeInMilliseconds
public float getWindowSizeInMilliseconds()- Returns:
- Returns size of the window in terms of milliseconds
-
isFull
public boolean isFull()- Returns:
- returns true if the buffer is full (internal index is equal to the window size)
-
setMediator
- Specified by:
setMediator
in interfaceComponent
-