Skip to content

Namespace: predict

Functions

Functions

getReadyToPredictSamples

getReadyToPredictSamples(samplesToPredictWithMissingValues, algorithmConfiguration, referenceDataSetForReplacing?, fnName?): TreeGardenDataSample[]

Missing value replacement before prediction. If you provided getTagOfSampleWithMissingValueWhileClassifying to algorithmConfiguration (configured by default) replacing is delayed to point where value is really needed.

Parameters

Name Type Default value Description
samplesToPredictWithMissingValues TreeGardenDataSample[] undefined -
algorithmConfiguration TreeGardenConfiguration undefined -
referenceDataSetForReplacing? TreeGardenDataSample[] undefined data set from which values for replacing are calculated
fnName string 'getTreePrediction' -

Returns

TreeGardenDataSample[]

Defined in

predict.ts:56


getLeafNodesForSamples

getLeafNodesForSamples(samplesToClassify, decisionTreeRoot, algorithmConfiguration, referenceDataSetForReplacing?): [TreeGardenDataSample, TreeGardenNode][]

Get leaf nodes of tree for multiple unknown samples.

Parameters

Name Type
samplesToClassify TreeGardenDataSample[]
decisionTreeRoot TreeGardenNode
algorithmConfiguration TreeGardenConfiguration
referenceDataSetForReplacing? TreeGardenDataSample[]

Returns

[TreeGardenDataSample, TreeGardenNode][]

Defined in

predict.ts:80


getLeafNodeOfSample

getLeafNodeOfSample<T>(sample, rootNode, algorithmConfiguration, retrieveIds?): NodeOrIdArray<T>

Retrieve leaf node of tree for given sample.

Type parameters

Name Type
T extends boolean

Parameters

Name Type
sample TreeGardenDataSample
rootNode TreeGardenNode
algorithmConfiguration TreeGardenConfiguration
retrieveIds? T

Returns

NodeOrIdArray<T>

Defined in

predict.ts:13


getValueForNode

getValueForNode(leafNode, _sample?): number

Extract value from node and given sample for regression tree

Parameters

Name Type
leafNode TreeGardenNode
_sample? TreeGardenDataSample

Returns

number

Defined in

predict.ts:115


getMostCommonClassForNode

getMostCommonClassForNode(leafNode, _sample?): string

Extract class from node and given sample for classification tree

Parameters

Name Type
leafNode TreeGardenNode
_sample? TreeGardenDataSample

Returns

string

Defined in

predict.ts:94


getResultFromMultipleTrees

getResultFromMultipleTrees(treeRoots, dataSample, config): string | number

Strategy how to obtain results from multiple trees of random forest for given sample.

Parameters

Name Type
treeRoots TreeGardenNode[]
dataSample TreeGardenDataSample
config TreeGardenConfiguration

Returns

string | number

Defined in

predict.ts:168