Skip to main content

ML

Description:

  A record for machine learning algorithms.

ML.Operator

Type: Enumeration.

Description:

  Enumeration for comparison operators

Signature:

enum Operator
"return"
"<="
">"
"=="
end

BuildDecisionTreeAsync

Type: Function.

Description:

  A function that takes CSV data as input and applies the C4.5 machine learning algorithm to build a decision tree model asynchronously. C4.5 is a decision tree algorithm that uses information gain to select the best attribute to split the data at each node of the tree. The resulting decision tree can be used to make predictions on new data.

Signature:

BuildDecisionTreeAsync: function(
csvData: string,
maxDepth: integer,
handler: function(depth: integer, name: string, op: Operator, value: string)
): --[[accuracy]] number, --[[error]] string

Parameters:

ParameterTypeDescription
csvDatastringThe CSV training data for building the decision tree using delimiter ,.
maxDepthintegerThe maximum depth of the generated decision tree.Set to 0 to prevent limiting the generated tree depth.
handlerfunctionThe callback function to be called for each node of the generated decision tree.

Returns:

Return TypeDescription
number|nilThe accuracy of the decision tree on the training data.
stringAn error message if an error occurred during building of the decision tree.

Definition for handler:

  • Parameters of handler:
ParameterTypeDescription
depthintegerThe depth of the current node in the decision tree.
namestringThe name of the attribute used for splitting the data at the current node.
opOperatorThe comparison operator used for splitting the data at the current node.
valuestringThe value used for splitting the data at the current node.

QLearner

Type: Field.

Description:

  A field for accessing QLearner class.

Signature:

QLearner: QLearnerClass