Bitrix API

Scoring

Table of Contents

Constants

EVENT_ACTIVITY  = 'activity'
EVENT_ENTITY_UPDATE  = 'update'
EVENT_INITIAL_PREDICTION  = 'initial'
PREDICTION_BATCH  = 'batch'
PREDICTION_IMMEDIATE  = 'immediate'
PREDICTION_REAL_TIME  = 'realtime'
RETRAIN_PERIOD  = 90

Methods

canStartTraining()  : Result
Checks if scoring model is suitable to start training.
deleteMlModel()  : Result
deletePrediction()  : bool
Deletes prediction with the given id.
getAvailableModelNames()  : mixed
getCurrentPrediction()  : array<string|int, mixed>|false
Returns current prediction record or false if prediction is not found.
getLastTraining()  : array<string|int, mixed>|false
Return current training fields for the specified model.
getLicenseInfoText()  : string
getLicenseInfoTitle()  : string
getMinimalClassSize()  : mixed
getMinimalTrainingSetSize()  : mixed
getModelByName()  : Base
getModelClasses()  : array<string|int, mixed>
Returns available classes to work with scoring models.
getPredictionUpdatePullTag()  : string
getScoringAvailableDate()  : int
getScoringModel()  : Base|null
hasAccess()  : bool
isEnabled()  : bool
Returns true if scoring is enabled for this portal by the tariffs.
isMlAvailable()  : bool
Returns true if machine learning is installed for this instance.
isScoringAvailable()  : bool
isTrainingUsed()  : bool
onActivityDelete()  : void
Removes references to this activity
onEntityDelete()  : void
Deletes prediction history records, associated with the entity.
onMlModelStateChange()  : void
queuePredictionUpdate()  : int|false
Return id of the scheduled request.
replaceAssociatedEntity()  : void
Replaces entity type and id in history records.
sendPredictionUpdatePullEvent()  : void
setScoringAvailableDate()  : void
startModelTraining()  : Result
Starts training of the model, if all of the pre-requirements are met, such as: - ml model should not exists, trainer will create it later - last training should be in state finished
tryCreateFirstPrediction()  : bool
Tries to create first prediction for the given entity. Preconditions: - ml module should be installed - model for this entity type should be in ready state - this entity should not have another predictions
updatePrediction()  : Result

Constants

EVENT_ACTIVITY

public mixed EVENT_ACTIVITY = 'activity'

EVENT_ENTITY_UPDATE

public mixed EVENT_ENTITY_UPDATE = 'update'

EVENT_INITIAL_PREDICTION

public mixed EVENT_INITIAL_PREDICTION = 'initial'

PREDICTION_BATCH

public mixed PREDICTION_BATCH = 'batch'

PREDICTION_IMMEDIATE

public mixed PREDICTION_IMMEDIATE = 'immediate'

PREDICTION_REAL_TIME

public mixed PREDICTION_REAL_TIME = 'realtime'

RETRAIN_PERIOD

public mixed RETRAIN_PERIOD = 90

Methods

canStartTraining()

Checks if scoring model is suitable to start training.

public static canStartTraining(Base $model[, bool $useCache = false ]) : Result
Parameters
$model : Base

Scoring model.

$useCache : bool = false
Return values
Result

deleteMlModel()

public static deleteMlModel(Base $model) : Result
Parameters
$model : Base
Return values
Result

deletePrediction()

Deletes prediction with the given id.

public static deletePrediction(int $historyId) : bool
Parameters
$historyId : int
Return values
bool

getAvailableModelNames()

public static getAvailableModelNames() : mixed

getCurrentPrediction()

Returns current prediction record or false if prediction is not found.

public static getCurrentPrediction(int $entityTypeId, int $entityId) : array<string|int, mixed>|false
Parameters
$entityTypeId : int

Entity type id.

$entityId : int

Id of the entity.

Return values
array<string|int, mixed>|false

getLastTraining()

Return current training fields for the specified model.

public static getLastTraining(Base $model) : array<string|int, mixed>|false
Parameters
$model : Base
Return values
array<string|int, mixed>|false

getLicenseInfoText()

public static getLicenseInfoText() : string
Return values
string

getLicenseInfoTitle()

public static getLicenseInfoTitle() : string
Return values
string

getMinimalClassSize()

public static getMinimalClassSize() : mixed

getMinimalTrainingSetSize()

public static getMinimalTrainingSetSize() : mixed

getModelByName()

public static getModelByName(mixed $modelName) : Base
Parameters
$modelName : mixed
Return values
Base

getModelClasses()

Returns available classes to work with scoring models.

public static getModelClasses() : array<string|int, mixed>
Return values
array<string|int, mixed>

getPredictionUpdatePullTag()

public static getPredictionUpdatePullTag(int $entityTypeId, int $entityId) : string
Parameters
$entityTypeId : int
$entityId : int
Return values
string

getScoringAvailableDate()

public static getScoringAvailableDate() : int
Return values
int

getScoringModel()

public static getScoringModel(int $entityTypeId, int $entityId) : Base|null
Parameters
$entityTypeId : int
$entityId : int
Return values
Base|null

hasAccess()

public static hasAccess(string $modelName[, int $userId = 0 ]) : bool
Parameters
$modelName : string
$userId : int = 0
Return values
bool

isEnabled()

Returns true if scoring is enabled for this portal by the tariffs.

public static isEnabled() : bool
Return values
bool

isMlAvailable()

Returns true if machine learning is installed for this instance.

public static isMlAvailable() : bool
Return values
bool

isScoringAvailable()

public static isScoringAvailable() : bool
Return values
bool

isTrainingUsed()

public static isTrainingUsed() : bool
Return values
bool

onActivityDelete()

Removes references to this activity

public static onActivityDelete(int $activityId) : void
Parameters
$activityId : int

onEntityDelete()

Deletes prediction history records, associated with the entity.

public static onEntityDelete(int $entityTypeId, int $entityId) : void
Parameters
$entityTypeId : int

Entity type.

$entityId : int

Entity id.

onMlModelStateChange()

public static onMlModelStateChange(Event $event) : void
Parameters
$event : Event

queuePredictionUpdate()

Return id of the scheduled request.

public static queuePredictionUpdate(int $entityTypeId, int $entityId[, array<string|int, mixed> $additionalParameters = [] ]) : int|false
Parameters
$entityTypeId : int
$entityId : int
$additionalParameters : array<string|int, mixed> = []
  • EVENT_TYPE
  • ASSOCIATED_ACTIVITY_ID
Return values
int|false

replaceAssociatedEntity()

Replaces entity type and id in history records.

public static replaceAssociatedEntity(int $entityTypeId, int $entityId, mixed $newEntityTypeId, mixed $newEntityId) : void
Parameters
$entityTypeId : int

Old entity type.

$entityId : int

Old entity id.

$newEntityTypeId : mixed
$newEntityId : mixed

sendPredictionUpdatePullEvent()

public static sendPredictionUpdatePullEvent(mixed $entityTypeId, mixed $entityId, mixed $predictionRecord) : void
Parameters
$entityTypeId : mixed
$entityId : mixed
$predictionRecord : mixed

setScoringAvailableDate()

public static setScoringAvailableDate(int $value) : void
Parameters
$value : int

startModelTraining()

Starts training of the model, if all of the pre-requirements are met, such as: - ml model should not exists, trainer will create it later - last training should be in state finished

public static startModelTraining(Base $model) : Result
Parameters
$model : Base

Scoring model to train.

Return values
Result

tryCreateFirstPrediction()

Tries to create first prediction for the given entity. Preconditions: - ml module should be installed - model for this entity type should be in ready state - this entity should not have another predictions

public static tryCreateFirstPrediction(int $entityTypeId, int $entityId[, bool $isImmediate = false ]) : bool
Parameters
$entityTypeId : int

Type of the entity.

$entityId : int

Id of the entity.

$isImmediate : bool = false

Should prediction request be executed immediately.

Return values
bool

updatePrediction()

public static updatePrediction(mixed $entityTypeId, mixed $entityId[, array<string|int, mixed> $parameters = [] ]) : Result
Parameters
$entityTypeId : mixed
$entityId : mixed
$parameters : array<string|int, mixed> = []
  • EVENT_TYPE string
  • ASSOCIATED_ACTIVITY_ID int
Return values
Result

        
On this page

Search results