%DeepSee.PMML.Model.AbstractModel
Class %DeepSee.PMML.Model.AbstractModel Extends %RegisteredObject [ Abstract, System = 4 ]
This class represents a PMML model as defined in the PMML XData block of a %DeepSee.PMML.Definition class.
Parameters
DEFINITIONCLASS
Parameter DEFINITIONCLASS As CLASSNAME [ Internal ];
The name of the %DeepSee.PMML.Definition class defining this PMML model.
DATACLASS
Parameter DATACLASS As CLASSNAME;
The name of the root %DeepSee.PMML.Data class for this model's PMML definition
INPUTCLASS
Parameter INPUTCLASS As CLASSNAME;
The name of the %DeepSee.PMML.ModelInput class for this model
OUTPUTCLASS
Parameter OUTPUTCLASS As CLASSNAME;
The name of the %DeepSee.PMML.ModelOutput class for this model
MODELNAME
Parameter MODELNAME As STRING;
The name of this model as defined in the PMML definition
PREDICTEDFIELD
Parameter PREDICTEDFIELD As STRING;
The field in DATACLASS predicted by this model.
TRACEWEIGHTTYPE
Parameter TRACEWEIGHTTYPE As STRING [ Internal ] = "none";
How the weighting info in this models trace output needs to be interpreted. Either of:
- "none": only rank info available
- "tree": trace info is a sequence of tree nodes leading to the prediction
- "add": additive contributions (total score might be a function of this sum)
- "multiply": multiplicative contributions (total score might be a function of this product)
SUPPORTSSIMPLEMODE
Parameter SUPPORTSSIMPLEMODE As BOOLEAN [ Internal ] = 0;
This parameter defines whether the model type implementation supports "simple mode", with simple array data structures rather than objects used to pass around observation data. This parameter is for internal use only.
Properties
SimpleMode
Property SimpleMode As %Boolean [ InitialExpression = {..#SUPPORTSSIMPLEMODE}, Internal ];
Whether or not to use simple arrays to pass observation data around internally. While faster, data dictionaries with derived fields or requiring specific treatment of certain values, as well as certain model types, cannot use simple mode. In these cases the SUPPORTSSIMPLEMODE is set to 0.
Tracing
Property Tracing As %Boolean [ InitialExpression = 0 ];
Whether or not to generate trace information in the output object.
KeepAllClassProbabilities
Property KeepAllClassProbabilities As %Boolean [ InitialExpression = 0, Internal ];
For classification models only. If set to 1, the probabilities of each class will be available from the output object, regardless of the OutputField settings in the definition.
Methods
%CreateModelClass
ClassMethod %CreateModelClass(pClass As %Dictionary.ClassDefinition, pDefinition As %DeepSee.PMML.Definition.Models.AbstractModel) As %Status [ Internal ]
This method is called as part of compiling a %DeepSee.PMML.Definition Model node and adds the appropriate properties, methods and other constructs to the model class pClass. Subclasses are free to forward (parts of) this activity as they see fit and can even change the superclass of pClass, as long as it remains a subclass of this class.
The following class parameters are already defined in pClass:
- DATACLASS
- INPUTCLASS
- OUTPUTCLASS
- MODELNAME
%GetName
ClassMethod %GetName() As %String [ CodeMode = expression, Final, ForceGenerate ]
Returns the name of this model (similar to MODELNAME)
%GetDataClassName
ClassMethod %GetDataClassName() As %String [ CodeMode = expression, Final, ForceGenerate ]
%GetInputClassName
ClassMethod %GetInputClassName() As %String [ CodeMode = expression, Final, ForceGenerate ]
%GetOutputClassName
ClassMethod %GetOutputClassName() As %String [ CodeMode = expression, Final, ForceGenerate ]
%GetPredictedField
ClassMethod %GetPredictedField() As %String [ CodeMode = expression, Final, ForceGenerate ]
%GetInputObject
ClassMethod %GetInputObject(pData As %DeepSee.PMML.Data) As %DeepSee.PMML.ModelInput [ CodeMode = objectgenerator, Final ]
Builds a %DeepSee.PMML.ModelInput object based on the root %DeepSee.PMML.Data for this PMML definition.
%ExecuteModelInternal
Method %ExecuteModelInternal(ByRef pInput As %DeepSee.PMML.ModelInput, Output pOutput As %DeepSee.PMML.ModelOutput) As %Status [ Abstract, Private ]
To be implemented by subclasses
%ExecuteModelDeepSee
Method %ExecuteModelDeepSee(pFactId As %Integer, Output pOutput As %DeepSee.PMML.ModelOutput, pDataSource As %String = "") As %Status [ Final ]
This method runs the model against a fact from the DeepSee fact table of a cube for which an
%ExecuteModel
Method %ExecuteModel(ByRef pData As %DeepSee.PMML.Data, Output pOutput As %DeepSee.PMML.ModelOutput) As %Status [ Final ]
Executes this model for a given %DeepSee.PMML.Data data object. As an alternative to providing the actual Data Class (or model input class) for this model, it is also possible to supply a simple array containing the data field values indexed by field name.
See also %DeepSee.PMML.Utils for details about running a model against a whole set of records at once, writing the corresponding results to a table.
%GetPredictedFieldFromDef
ClassMethod %GetPredictedFieldFromDef(pDefinition As %DeepSee.PMML.Definition.Models.AbstractModel) As %String [ Internal ]
Returns the name of the field whose value is predicted by this model. To be overridden/refined by subclasses
%GetPredictedFieldsFromDef
ClassMethod %GetPredictedFieldsFromDef(pDefinition As %DeepSee.PMML.Definition.Models.AbstractModel, Output pAllFields) As %Status [ Internal ]
%AppendImplicitOutputFields
ClassMethod %AppendImplicitOutputFields(ByRef pPredictedFields) As %Status [ Internal ]
%GetPredictedFieldInfo
ClassMethod %GetPredictedFieldInfo(Output pFieldName As %String, Output pDataType As %String, Output pOpType As %String) As %Status
Returns basic info about the data field predicted by this model.
%PopulateOutputObject
ClassMethod %PopulateOutputObject(pDefinition As %DeepSee.PMML.Definition.Models.AbstractModel, pMethod As %Stream.Object, pPredictedValueVar As %String = "tPredictedValue") As %Status [ Internal, Private ]
%OnGetOutputFeature
ClassMethod %OnGetOutputFeature(pMethod As %Stream.Object, pDefinition As %DeepSee.PMML.Definition.Models.AbstractModel, pOutputField As %DeepSee.PMML.Definition.OutputField, ByRef pFeatureValueVar As %String, Output pSupported As %Boolean) As %Status [ Internal, Private ]
Write code to compute a nontrivial feature for pOutputField to pMethod, setting the value to a variable named pFeatureValue (can be updated). The features "predictedValue" and x are already taken care of.
%IsOutputFieldSupported
ClassMethod %IsOutputFieldSupported(pDefinition As %DeepSee.PMML.Definition.Models.AbstractModel, pOutputField As %DeepSee.PMML.Definition.OutputField, Output pSC As %Status) As %Boolean [ Internal ]
%GetDefinition
ClassMethod %GetDefinition(Output pModel As %DeepSee.PMML.Definition.Models.AbstractModel) As %Status [ Internal ]
%PopulateTrace
Method %PopulateTrace(ByRef pOutput As %DeepSee.PMML.ModelOutput, ByRef pWeights) As %Status [ Internal, Private ]
%DrawTraceInfo
Method %DrawTraceInfo(pOutput As %DeepSee.PMML.ModelOutput) As %Status [ Internal ]
Prints the trace information for this model type in user-friendly HTML. To be refined by subclasses based on the information available for that model type.
SimpleModeSet
Method SimpleModeSet(pValue As %Boolean) As %Status [ Internal, ServerOnly = 1 ]