This is documentation for Caché & Ensemble. See the InterSystems IRIS version of this content.

For information on migrating to InterSystems IRIS, see How to Migrate to InterSystems IRIS, available on the WRC Distributions page (login required).


class %iKnow.Classification.IKnowBuilder extends %iKnow.Classification.Builder

Parent class for any iKnow-based %iKnow.Classification.Builder implementations, providing common infrastructure abstracting a few iKnow API calls. IKnowBuilder implementations assume category specs are %iKnow.Filters.Filter instances in their string representation.

Property Inventory (Including Private)

Method Inventory (Including Private)


property DomainId as %Integer;
The iKnow domain this categorization model is built from
Property methods: DomainIdDisplayToLogical(), DomainIdGet(), DomainIdIsValid(), DomainIdLogicalToDisplay(), DomainIdNormalize(), DomainIdSet()
property MetadataField as %String;
If set, this metadata field contains the actual category value for each source
Property methods: MetadataFieldDisplayToLogical(), MetadataFieldGet(), MetadataFieldIsValid(), MetadataFieldLogicalToDisplay(), MetadataFieldLogicalToOdbc(), MetadataFieldNormalize(), MetadataFieldSet()
property TestSet as %iKnow.Filters.Filter;
Property methods: TestSetGet(), TestSetGetSwizzled(), TestSetIsValid(), TestSetNewObject(), TestSetSet()
property TrainingSet as %iKnow.Filters.Filter;
The sample set of the domain to be used for training this model
Property methods: TrainingSetGet(), TrainingSetGetSwizzled(), TrainingSetIsValid(), TrainingSetNewObject(), TrainingSetSet()


method %GetCategoryInfo(Output pCategories) as %Status
Returns all categories added so far: pCategories(n) = $lb([name], [record count])
method %GetRecordCount(Output pSC As %Status) as %Integer
method %LoadMetadataCategories(pFieldName As %String) as %Status

Creates (appends) categories for each of the available values of a given metadata field pFieldName in the full domain (thus ignoring TrainingSet).

Note: as category names are case sensitive, it is highly recommended to use a case-sensitive metadata field.

private method %OnCreateExportTable(pClassDef As %Dictionary.ClassDefinition, pVerbose As %Boolean) as %Status
Inherited description: Callback invoked by %ExportDataTable() when creating the export table definition.
private method %OnExportTable(pClassName As %String, pVerbose As %Boolean, pTracking As %Boolean) as %Status
Inherited description: Callback invoked by %ExportDataTable() to load the data into export table pClassName.
private method %OnGenerateClassifier(ByRef pDefinition As %iKnow.Classification.Definition.Classifier, pVerbose As %Boolean = 1, pIncludeBuilderInfo As %Boolean = 0) as %Status
Inherited description: Appends the ClassificationMethod element for this type of classifier.
private method %OnReset() as %Status
method %PopulateTerms(pCount As %Integer = 100, pType As %String = "entity", pMetric As %String = "BM25", pPerCategory As %Boolean = 0) as %Status

This %PopulateTerms implementation accepts "BM25" and "TFIDF" as acceptable values for pMetric. See also the class reference for this method in %iKnow.Classification.Builder.

method %TestClassifier(pTestSet As %CacheString = "", Output pResult, Output pAccuracy As %Double, pCategorySpec As %String = "", pVerbose As %Boolean = 0) as %Status

Utility method to batch-test the classifier against a test set pTestSet, which can be supplied as an %iKnow.Filters.Filter object or its serialized form. Per-record results are returned through pResult:
pResult(n) = $lb([record ID], [actual category], [predicted category])

pAccuracy will contain the raw accuracy (# of records predicted correctly) of the current model. Use %iKnow.Classificaton.Utils for more advanced model testing.

If the current model's category options were added through %AddCategory() without providing an appropriate category filter specification, rather than through a call to %LoadMetadataCategories (which sets MetadataField), supply a metadata field through pCategorySpec where the actual category values to test against can be found.

Inherited Members

Inherited Properties (Including Private)

Inherited Methods (Including Private)