Utility class to load raw data from your computer, parse them with a Data object and get final tensors for a model. You first need a JSON file that represents a Session object, with a list of files containing human or bot trajectories. Each file must be something like:

resolution:1536,864
9131.1,Pressed,717,361
9134.8,Move,717,361
9151.8,Move,717,361
[...]
10402.3,Move,722,360
10419.1,Move,718,358
10425.8,Released,717,360

Were, as first line, the resolution to normalize X and Y and the following lines are timestamp,actionType,x,y.
A part of the dataset if used as training data and the other part for testing.
To use this class, just call load, then you can call nextTrainBatch and nextTestBatch.

Hierarchy

  • DataTraining

Constructors

  • Constructor of the DataTraining object, it takes parameters :

    • data : The data object to parse raw data with delbot.data.Data.loadDataSet.
    • filePath : The path to a JSON file containing an object Session, default to "../../python/sessions.json"
    • trainingRatio : A number between 0 and 1, the %/100 of the training set compared to the whole dataset, default to 0.8 for 80%.

    Parameters

    Returns DataTraining

Properties

data: Data

The data object to parse raw data with delbot.data.Data.loadDataSet.

filePath: string

The path to a JSON file containing an object Session. Default to "../../python/sessions.json".

nbrTestElements: number = -1
nbrTrainElements: number = -1
shuffledTestIndex: number = 0
shuffledTrainIndex: number = 0
testData: number[][][] = []
testLabel: number[][] = []
trainData: number[][][] = []
trainLabel: number[][] = []
trainingRatio: number

A number between 0 and 1, the %/100 of the training set compared to the whole dataset, default to 0.8 for 80%.

Methods

  • Loads the JSON file Session containing every mouse trajectories and their labels according to the data object and separate the dataset into training data set and testing dataset, with a shuffle.

    Parameters

    • consoleInfo: boolean = false

    Returns Promise<void>

  • Parameters

    • batchSize: number
    • images: number[][][]
    • labels: number[][]
    • shuffledIndex: number

    Returns {
        xs: number[][][];
        ys: number[][];
    }

    • xs: number[][][]
    • ys: number[][]
  • Get a batch of tensor data and labels from the testing set.

    Parameters

    • batchSize: number

      The batch size.

    Returns {
        xs: Tensor<Rank>;
        ys: Tensor<Rank>;
    }

    • xs: Tensor<Rank>
    • ys: Tensor<Rank>
  • Get a batch of data and labels as number array from the testing set.

    Parameters

    • batchSize: number

      The batch size.

    Returns {
        xs: number[][][];
        ys: number[][];
    }

    • xs: number[][][]
    • ys: number[][]
  • Get a batch of tensor data and labels from the training set.

    Parameters

    • batchSize: number

      The batch size.

    Returns {
        xs: Tensor<Rank>;
        ys: Tensor<Rank>;
    }

    • xs: Tensor<Rank>
    • ys: Tensor<Rank>
  • Get a batch of data and labels as number array from the training set.

    Parameters

    • batchSize: number

    Returns {
        xs: number[][][];
        ys: number[][];
    }

    • xs: number[][][]
    • ys: number[][]

Generated using TypeDoc