---
id: object/codeunit/2003
type: object
title: Codeunit 2003 "ML Prediction Management"
summary: Codeunit 2003 "ML Prediction Management" in Base Application (System.AI). 24 public procedures, 3 events. Present since at least BC23, still in BC30, changed in BC24, BC27.
tier: official
language: en
tags:
  - codeunit
  - base application
versions:
  introduced: null
  last_changed: "27"
  deprecated: null
review:
  state: derived
  by: null
  at: null
  flags: []
generated:
  at: "2026-10-11T00:31:51.816Z"
  pipeline: 0.2.0
  prompts: {}
  input_hash: 1d97e1abed774de2428ef60622ac2f1fd335b66edf35832e7ef292acafafa1df
evidence:
  - kind: code
    url: https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/System/AI/MLPredictionManagement.Codeunit.al
    title: src/Layers/W1/BaseApp/System/AI/MLPredictionManagement.Codeunit.al (releases/29.x)
    date: null
    commit: ea08af5ef2d6a9b5c5af4a029288abbe2c883220
    t: null
    quote: null
links:
  learn: []
  objects: []
  features: []
  topics: []
  localizations: []
  videos: []
  posts: []
  guidelines: []
object_type: codeunit
object_id: 2003
name: ML Prediction Management
namespace: System.AI
app: Base Application
extends: null
first_version: "23"
last_version: "30"
present_in:
  - "23"
  - "24"
  - "25"
  - "26"
  - "27"
  - "28"
  - "29"
  - "30"
changed_in:
  - "24"
  - "27"
source_major: "29"
obsolete: null
countries: []
ms_search_form_ids: []
counts:
  fields: 0
  procedures: 35
  events: 3
  subscribers: 0
relations:
  out: 0
  referenced_by: 0
  pages: 0
  extended_by: 0
  event_subscribers: 3
  calls: 8
  called_by: 4
  implements: 0
---

# Codeunit 2003 "ML Prediction Management"

> Codeunit 2003 "ML Prediction Management" in Base Application (System.AI). 24 public procedures, 3 events. Present since at least BC23, still in BC30, changed in BC24, BC27.

Base Application · System.AI · BC23-30 · [source at ea08af5e](https://github.com/microsoft/BCApps/blob/ea08af5ef2d6a9b5c5af4a029288abbe2c883220/src/Layers/W1/BaseApp/System/AI/MLPredictionManagement.Codeunit.al) · facts from BC29

## Events published

- `OnBeforeTrain(var Model: Text; var Quality: Decimal; var CallAzureEndPoint: Boolean)` (integration)
  - subscribers: [Codeunit 1952 "LP Subscribers"](../codeunit/1952.md) SendTraceTagOnBeforeModelTrain
- `OnBeforePredict(var RecordVariant: Variant; var CallAzureEndPoint: Boolean)` (integration)
  - subscribers: [Codeunit 1952 "LP Subscribers"](../codeunit/1952.md) SendTraceTagOnBeforeModelPredict
- `OnBeforeEvaluate(Model: Text; var Quality: Decimal; var RecordVariant: Variant; var CallAzureEndPoint: Boolean)` (integration)
  - subscribers: [Codeunit 1952 "LP Subscribers"](../codeunit/1952.md) SendTraceTagOnBeforeModelEvaluate

## Procedures

- `DefaultInitialize()`
- `Initialize(Uri: Text[250]; Key: SecretText; TimeOutSeconds: Integer)`
- `InitializeWithKeyVaultCredentials(TimeOutSeconds: Integer)`
- `SetMessageHandler(MessageHandler: DotNet HttpMessageHandler)`
- `SetRecord(RecordVariant: Variant)`
- `GetRecord(var RecordVariant: Variant)`
- `AddFeature(FeatureFieldNo: Integer)`
- `SetLabel(LabelFieldNo: Integer)`
- `SetConfidence(ConfidenceFieldNo: Integer)`
- `SetTrainingPercent(TrainingPercentValue: Decimal)`
- `GetTrainingPercent(): Decimal`
- `Train(var Model: Text; var Quality: Decimal)`
- `Predict(Model: Text)`
- `Evaluate(Model: Text; var Quality: Decimal)`
- `PlotModel(Model: Text; Features: Text; Labels: Text): Text`
- `DownloadPlot(PdfDataBase64: Text; ModelName: Text)`
- `IsDataSufficientForClassification(): Boolean`
- `IsDataSufficientForRegression(): Boolean`
- `IsDataSufficientBase(var RecRef: RecordRef): Boolean`
- `GetParameter(Name: Text): Text`
- `GetInput(RowNo: Integer; ColumnNo: Integer): Text`
- `GetInputLength(): Integer`
- `MaxNoFeatures(): Integer`
- `GetMachineLearningCredentials(var MLApiUri: Text[250]; var MLApiKey: SecretText; var LimitType: Option; var Limit: Decimal)`

Plus 8 local procedures.

## Triggers

OnRun

## Calls

From the extracted call graph of BC29 (graphify-al on the snapshot checkout): calls whose target is known from a declared type or an `Object::"Name"` argument. Interface dispatch and calls through events are not counted, so the list is not complete.

- [Codeunit 2001 "Azure ML Connector"](../codeunit/2001.md) (24 calls: `CreateDummyInput → AddInputColumnName`, `CreateDummyInput → AddInputRow`, `CreateDummyInput → AddInputValue`, …)
- [Codeunit 701 "Data Type Management"](../codeunit/701.md) (7 calls: `CreateInput → GetRecordRef`, `IsDataSufficientBase → GetRecordRef`, `LoadPrediction → GetRecordRef`, …)
- [Codeunit 2006 "Azure AI Usage"](../codeunit/2006.md) (2 calls: `InitializeWithKeyVaultCredentials → GetResourceLimit`, `InitializeWithKeyVaultCredentials → GetTotalProcessingTime`)
- [Codeunit 4100 "Temp Blob"](../codeunit/4100.md) (2 calls: `DownloadPlot → CreateInStream`, `DownloadPlot → CreateOutStream`)
- [Codeunit 10 "Type Helper"](../codeunit/10.md) (1 call: `IsDataSufficientForClassification → CalculateLog`)
- [Codeunit 2004 "Machine Learning KeyVaultMgmt."](../codeunit/2004.md) (1 call: `GetMachineLearningCredentials → GetMachineLearningCredentials`)
- [Codeunit 4110 "Base64 Convert"](../codeunit/4110.md) (1 call: `DownloadPlot → FromBase64`)
- [Codeunit 8617 "Config. Validate Management"](../codeunit/8617.md) (1 call: `LoadPrediction → EvaluateValueWithValidate`)

## Called by

- [Codeunit 1951 "LP Model Management"](../codeunit/1951.md) (10 calls: `EvaluateModel → Evaluate`, `InvokeShowModelFromUi → DownloadPlot`, `InvokeShowModelFromUi → Initialize`, …)
- [Codeunit 1950 "LP Prediction Mgt."](../codeunit/1950.md) (6 calls: `PredictIsLate → Initialize`, `PredictIsLate → InitializeWithKeyVaultCredentials`, `PredictIsLate → Predict`, …)
- [Table 1951 "LP ML Input Data"](../table/1951.md) (4 calls: `AddParametersToMgt → AddFeature`, `AddParametersToMgt → SetConfidence`, `AddParametersToMgt → SetLabel`, …)
- [Codeunit 2005 "Azure AI Usage Impl."](../codeunit/2005.md) (1 call: `GetSingleInstance → GetMachineLearningCredentials`)

## Across versions

- Present in: BC23-30
- Changed (declaration) in: BC24, BC27

Source: AL metadata extracted from the code (names, ids, signatures, properties); no code bodies (D10).

## Ask your agent

Procedure bodies are not stored here (D10). The call sections above are our own, per object, from the BC29 call graph. For a procedure body or the calls of one procedure, ask bc-code-atlas (external, by Stefan Maron, MIT; default corpus w1-28), which the bc-observatory plugin connects: `bcatlas_resolve_node(object_type: "codeunit", object_name: "ML Prediction Management")`, then `bcatlas_get_procedure_body` or `bcatlas_get_neighbors` on the returned id.
