API Reference - Models - BaseModel
The base model for all machine and deep learning models.
Constructors
new()
Creates a new machine learning base model.
BaseModel.new(): BaseModelObject
Functions
setModelParametersInitializationMode()
Sets how the initial model parameters values are generated. The model parameters will be generated when train() function is run.
BaseModel:setModelParametersInitializationMode(initializationMode: string, minimumModelParametersInitializationValue: number, maximumModelParametersInitializationValue: number)
Parameters:
-
initializationMode: The mode for the matrices to be initialized. Available options are:
-
Zero
-
Random
-
RandomNormal
-
RandomUniformPositive
-
RandomUniformNegative
-
RandomUniformNegativeAndPositive
-
HeUniform
-
HeNormal
-
XavierUniform
-
XavierNormal
-
LeCunUniform
-
LeCunNormal
-
None
-
-
minimumModelParametersInitializationValue: The minimum value to be generated by the model. Only applicable to “Random” initialization mode.
-
maximumModelParametersInitializationValue: The maximum value to be generated by the model. Only applicable to “Random” initialization mode.
getModelParameters()
Gets the model parameters from the base model.
BaseModel:getModelParameters(doNotDeepCopy: boolean): ModelParameters
Parameters
- doNotDeepCopy: Set whether or not to deep copy the model parameters.
Returns
- ModelParameters: A matrix/table containing model parameters fetched from the base model.
setModelParameters()
Set the model parameters to the base model.
BaseModel:setModelParameters(ModelParameters: ModelParameters, doNotDeepCopy: boolean)
Parameters
-
ModelParameters: A matrix/table containing model parameters to be given to the base model.
-
doNotDeepCopy: Set whether or not to deep copy the model parameters.
clearModelParameters()
Clears the model parameters contained inside base model.
BaseModel:clearModelParameters()
setNumberOfIterationsPerCostCalculation()
Set the number of iterations needed to calculate the costs. This is to save computational time.
BaseModel:setModelParameters(numberOfIterationsPerCostCalculation: number)
Parameters
- numberOfIterationsPerCostCalculation: The number of iterations for each cost calculation.
setNumberOfIterationsToCheckIfConverged()
Set the number of iterations needed to confirm convergence.
BaseModel:setNumberOfIterationsToCheckIfConverged(numberOfIterations: number)
Parameters
- numberOfIterations: The number of iterations for confirming convergence.
setTargetCost()
Set the upper bound and lower bounds of the target cost.
BaseModel:setTargetCost(upperBound: number, lowerBound: number)
Parameters
-
upperBound: The upper bound of target cost.
-
lowerBound: The lower bound of target cost.
setPrintOutput()
Set if the model prints output.
BaseModel:setPrintOutput(option: boolean)
Parameters:
- option: A boolean value that specifies if the output is printed.
setWaitDurations()
Set wait durations inside the models to avoid exhausting script running time.
BaseModel:setWaitDurations(iterationWaitDuration: number, dataWaitDuration: number, sequenceWaitDuration: number)
Parameters:
-
iterationWaitDuration: The wait duration between the iterations.
-
dataWaitDuration: The wait duration between the data calculations.
-
sequenceWaitDuration: The wait duration between the token sequence.