Skip to main content

%ML.Model

Class %ML.Model Extends %Persistent [ ClassType = persistent, System = 4 ]

Definition of a ML model

Properties

Name

Property Name As %String(MAXLEN = 256) [ Required ];

Name of the model

Description

Property Description As %String(MAXLEN = 8192);

Model description

PredictingColumnNames

Property PredictingColumnNames As list Of %String(MAXLEN = 128) [ Required ];

Column Name(s) we're predicting

PredictingColumnTypes

Property PredictingColumnTypes As list Of %String(MAXLEN = 128) [ Required ];

Column Types(s) we're predicting

WithColumnNames

Property WithColumnNames As list Of %String(MAXLEN = 128) [ Required ];

Columns names we're predicting using

WithColumnTypes

Property WithColumnTypes As list Of %String(MAXLEN = 128) [ Required ];

Columns types we're predicting using

WithColumnText

Property WithColumnText As list Of %String(MAXLEN = 512) [ Required ];

Columns text we're predicting using, text from SQL query or with expression

DefaultIDColumnFound

Property DefaultIDColumnFound As %Boolean [ InitialExpression = 0, Required ];

Have we found an ID column that would otherwise be trained on by default if we did not exclude it

TimeSeries

Property TimeSeries As %Boolean [ InitialExpression = 0, Required ];

Is this a timeseries model?

DateTimeColumn

Property DateTimeColumn As %String(MAXLEN = 128);

What is the datetime column for a timeseries model?

Forward

Property Forward As %Integer;

How far forward are we predicting? Important for validation.

TimeStep

Property TimeStep As %String(MAXLEN = 128);

What time step size was returned (DataRobot Exclusive)

ForwardResponse

Property ForwardResponse As %String(MAXLEN = 128);

What is the calculated forward window? (DataRobot Exclusive)

DefaultParameters

Property DefaultParameters As array Of %String(MAXLEN = 1024);

Model parameters

DefaultTrainingQuery

Property DefaultTrainingQuery As %String(MAXLEN = 32000);

Default training query (SQL)

CreatedAt

Property CreatedAt As %TimeStamp [ InitialExpression = {$ZDATETIME($ZTIMESTAMP,3,1,3)}, Required ];

Timestamp for when the model was created (UTC)

DefaultTrainedModel

Property DefaultTrainedModel As %ML.TrainedModel;

Default trained model

Triggers

DeleteTrigger

Trigger DeleteTrigger [ Event = DELETE, Foreach = row/object ]

When deleting a model, also delete any %ML.ValidationRun, %ML.ValidationMetric, %ML.TrainingRun and %ML.TrainedModel objects for this Model

Methods

%Train

Method %Train(data As %SQL.StatementResult, ByRef trainedmodelname As %String, ByRef trainedmodel As %ML.TrainedModel, ByRef trainingrun As %ML.TrainingRun, using As %DynamicObject = {$$$NULLOREF}, notdefault As %Boolean = 0) As %Status

Index on the model name Train an ML model (synchronously)

%Predict

Method %Predict(rowdata As %List, ByRef result As %Double, contextitem As %RawString) As %Status

Predict

%Probability

Method %Probability(rowdata As %List, ByRef result As %Double, ByRef trainedmodel As %ML.TrainedModel = "", expr As %String = 1) As %Status

Probability

%PredictAll

ClassMethod %PredictAll(modelname As %String, trainedmodelname As %String = "", tfn As %Integer, argspos As %List, predpos As %List = "", probpos As %List = "", expr As %String = 1, mtorder As %List, mtunary As %List) As %Status

Bulk Predict arguments: modelname - model name trainedmodelname - name of %ML.TrainedModel, might be different from the DefaultTrainedModel tfn - tempfile index argspos - Positions of the WithColumns in the temp rows, $list(column-positions) predpos - Position of the predicted value, $list(result-column-positions) probpos - Position of the probability value, $list(result-column-positions) expr - expression for probability returns: $$$OK on success, otherwise a $$$ERROR(...)

%Validate

Method %Validate(trainedModel As %ML.TrainedModel = "", ByRef query As %String = "", ByRef validationRunName As %String = "", using As %DynamicObject = {$$$NULLOREF}) [ Internal ]

Note: Do not call this method directly. Please refer to the SQL syntax as documented in %ML.Model

This is the entry point for the

VALIDATE MODEL

command. After setting up a %ML.ValidationRun instance, this method will hand off to helper methods in %ML.TrainedModel specific to the model's type (e.g. classification or regression).

%Purge

Method %Purge(days = 0) As %Status

Purge all trained models