Abstract
Protected
constructorProtected
mayBoolean to know if we may normalize data. If false, then data must not be normalized, otherwise some operations of the model will fail.
Readonly
numThe number of class for labels and model output, 1 or 2 for binary classification.
Protected
xThe second shape of all 3d tensors (or first in case we ignore the batch size), defined in subclasses.
Protected
yThe third shape of 3d tensor (or second in case we ignore the batch size), defined in subclasses.
Protected
addProtected
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.
The current dataset label array, we add an element to it.
The index of the class, 0 for human and 1 for bot.
Abstract
loadThis 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.
The recorder containing loaded records and features.
Optional
userIndex: numberThe index of the class from record, if unspecified or negative, the label array of the return object is empty.
Generated using TypeDoc
An abstract class that extracts some mouse features from Recorder and format them with loadDataSet to create an input of a tf.js model. This input is an array, but you can call tf.tensor3d and tf.reshape to get the tensor. It is always a 3D tensor, each element of the dataset being a matrix xSize x ySize.
You can also specify an integer
userIndex
to work with labels for training. While dataset is a 3D array with the first dimension representing the size of the dataset, labels are represented by a 2D array with the same first dimension and the second one is the label of the corresponding sample.The field numClasses can be 1 or 2. You can ignore it and let the default value to 2. If you want more details: as 1, if a model is constructed with
delbot-training
, it will have a single neuron as output andbinaryCrossentropy
loss function, each label during the training will be a singleton [0] or [1] for respectively human and bot, the model then outputs the probability [p] for the sample to be a bot. If there are two classes, the loss function iscategoricalCrossentropy
for two neurons, the labels are [1,0] or [0,1] for respectively human and bot samples and outputs from the model are [1-p,p] where p is the probability to be a bot.Extend this class and implement the method loadDataSet to create your own logic and data format. Your implementation has to look something like 1. empty data and label arrays, 2. iterate through getRecords and 3. add labels userIndex is positive. You can also check if type is null or includes "Move" to filter only move actions.