A Data class that represents a movement matrix. For each step N of steps we create a 0-matrix xMaxMov-xMinMov x yMaxMov-yMinMov and add a small number at position (dx,dy) for at most N trajectories, where dx = x(n) - x(n-1) is the pixel offset in x coordinate between two recorded movements in the trajectory. We repeat that until there are no sample left, then for the next N.
If a value should be outside the matrix, we put it on the edge. The default size is 50x50 (range -25 to 25) and default steps are [25, 50, 100, 150, 200, 250].

See

Data

Hierarchy

  • Data
    • DataMovementMatrix

Constructors

Properties

mayNormalizeData: boolean

Boolean to know if we may normalize data. If false, then data must not be normalized, otherwise some operations of the model will fail.

neighbourRange: number
numClasses: 2 | 1

The number of class for labels and model output, 1 or 2 for binary classification.

steps: number[]
xMaxMov: number
xMinMov: number
xSize: number

The second shape of all 3d tensors (or first in case we ignore the batch size), defined in subclasses.

yMaxMov: number
yMinMov: number
ySize: number

The third shape of 3d tensor (or second in case we ignore the batch size), defined in subclasses.

Methods

  • Protected

    Gets the current array of labels from a dataset and append a new label according to the number of classes numClasses. If there is one class, [0] means human and [1] bot while with two classes, [1,0] means human and [0,1] bot.

    Parameters

    • datasetLabels: number[][]

      The current dataset label array, we add an element to it.

    • userIndex: number

      The index of the class, 0 for human and 1 for bot.

    Returns void

  • Private

    Force the value to stand in [0, max-min[ for index of matrix, so min is the first index 0 and max the last index. If the value is greater than max or less than min, we consider the bound.

    Returns

    The value in the new integer domain starting from 0.

    Parameters

    • min: number

      An integer, lower bound of initial domain.

    • max: number

      An integer, upper bound of initial domain.

    • value: number

      An integer, the value to constraint.

    Returns number

  • Private

    Get integer neighbours of the given value within a distance of range and return a list of unique elements of this neighbourhood (in case the value is on an edge, there will be less than range squared values).

    Parameters

    • min: number
    • max: number
    • value: number

    Returns number[]

  • This method gets a recorder object and loads it as a Dataset object with the right format. The return value might contain empty arrays if the recorder as too few elements. The userIndex is an integer that says what is the class index for the label, in our case of binary classifier human-bot, 0 means human and 1 means bot.

    Parameters

    • recorder: Recorder

      The recorder containing loaded records and features.

    • userIndex: number = -1

      The index of the class from record, if unspecified or negative, the label array of the return object is empty.

    Returns {
        datasetData: number[][][];
        datasetLabels: number[][];
    }

    • datasetData: number[][][]
    • datasetLabels: number[][]
  • Private

    Create a new empty 0-matrix of size xSize times ySize.

    Returns number[][]

Generated using TypeDoc