README
@datafire/azure_cognitiveservices_personalizer
Client library for Personalizer Client
Installation and Usage
npm install --save @datafire/azure_cognitiveservices_personalizer
let azure_cognitiveservices_personalizer = require('@datafire/azure_cognitiveservices_personalizer').create({
apim_key: ""
});
.then(data => {
console.log(data);
});
Description
Personalizer Service is an Azure Cognitive Service that makes it easy to target content and experiences without complex pre-analysis or cleanup of past data. Given a context and featurized content, the Personalizer Service returns which content item to show to users in rewardActionId. As rewards are sent in response to the use of rewardActionId, the reinforcement learning algorithm will improve the model and improve performance of future rank calls.
Actions
Policy_Reset
Resets the Learning settings of the Personalizer service to default.
azure_cognitiveservices_personalizer.Policy_Reset(null, context)
Input
This action has no parameters
Output
- output PolicyContract
Policy_Get
Get the Learning settings currently used by the Personalizer service.
azure_cognitiveservices_personalizer.Policy_Get(null, context)
Input
This action has no parameters
Output
- output PolicyContract
Policy_Update
Update the Learning settings that the Personalizer service will use to train models.
azure_cognitiveservices_personalizer.Policy_Update({
"policy": {
"name": "",
"arguments": ""
}
}, context)
Input
- input
object
- policy required PolicyContract
Output
- output PolicyContract
ServiceConfiguration_Get
Get the Personalizer service configuration.
azure_cognitiveservices_personalizer.ServiceConfiguration_Get(null, context)
Input
This action has no parameters
Output
- output ServiceConfiguration
ServiceConfiguration_Update
Update the Personalizer service configuration.
azure_cognitiveservices_personalizer.ServiceConfiguration_Update({
"config": {
"rewardWaitTime": "",
"defaultReward": 0,
"rewardAggregation": "",
"explorationPercentage": 0,
"modelExportFrequency": "",
"logRetentionDays": 0
}
}, context)
Input
- input
object
- config required ServiceConfiguration
Output
- output ServiceConfiguration
Evaluations_List
List all the submitted evaluations.
azure_cognitiveservices_personalizer.Evaluations_List(null, context)
Input
This action has no parameters
Output
- output
array
- items Evaluation
Evaluations_Create
Submit a new evaluation job.
azure_cognitiveservices_personalizer.Evaluations_Create({
"evaluation": {
"name": "",
"startTime": "",
"endTime": "",
"policies": []
}
}, context)
Input
- input
object
- evaluation required EvaluationContract
Output
- output Evaluation
Evaluations_Delete
Delete the evaluation associated with the Id.
azure_cognitiveservices_personalizer.Evaluations_Delete({
"evaluationId": ""
}, context)
Input
- input
object
- evaluationId required
string
: Id of the evaluation to delete.
- evaluationId required
Output
Output schema unknown
Evaluations_Get
Get the evaluation associated with the Id.
azure_cognitiveservices_personalizer.Evaluations_Get({
"evaluationId": ""
}, context)
Input
- input
object
- evaluationId required
string
: Id of the evaluation.
- evaluationId required
Output
- output Evaluation
Events_Activate
Report that the specified event was actually displayed to the user and a reward should be expected for it
azure_cognitiveservices_personalizer.Events_Activate({
"eventId": ""
}, context)
Input
- input
object
- eventId required
string
: The event ID this activation applies to.
- eventId required
Output
Output schema unknown
Events_Reward
Report reward that resulted from using the action specified in rewardActionId for the specified event.
azure_cognitiveservices_personalizer.Events_Reward({
"eventId": "",
"reward": {
"value": 0
}
}, context)
Input
- input
object
- eventId required
string
: The event id this reward applies to. - reward required RewardRequest
- eventId required
Output
Output schema unknown
Log_Delete
Delete all generated logs.
azure_cognitiveservices_personalizer.Log_Delete(null, context)
Input
This action has no parameters
Output
Output schema unknown
Log_GetProperties
Get properties of generated logs.
azure_cognitiveservices_personalizer.Log_GetProperties(null, context)
Input
This action has no parameters
Output
- output LogsProperties
Model_Reset
Resets the model file generated by Personalizer service.
azure_cognitiveservices_personalizer.Model_Reset(null, context)
Input
This action has no parameters
Output
Output schema unknown
Model_Get
Get the model file generated by Personalizer service.
azure_cognitiveservices_personalizer.Model_Get(null, context)
Input
This action has no parameters
Output
- output
file
Model_GetProperties
Get properties of the model file generated by Personalizer service.
azure_cognitiveservices_personalizer.Model_GetProperties(null, context)
Input
This action has no parameters
Output
- output ModelProperties
Rank
Submit a Personalizer rank request, to get which of the provided actions should be used in the provided context.
azure_cognitiveservices_personalizer.Rank({
"rankRequest": {
"actions": []
}
}, context)
Input
- input
object
- rankRequest required RankRequest
Output
- output RankResponse
Definitions
ContainerStatus
- ContainerStatus
object
- apiStatus
string
- apiStatusMessage
string
- service
string
- apiStatus
DateRange
- DateRange
object
- from
string
- to
string
- from
ErrorResponse
- ErrorResponse
object
: Used to return an error to the client- error required PersonalizerError
Evaluation
- Evaluation
object
- endTime
string
- featureImportance
array
- items
array
- items
string
- items
- items
- id
string
- jobId
string
- name
string
- policyResults
array
- items PolicyResult
- startTime
string
- status
string
(values: completed, pending, failed, notSubmitted)
- endTime
EvaluationContract
- EvaluationContract
object
: A counterfactual evaluation.- enableOfflineExperimentation
boolean
: True if the evaluation should explore for a more optimal Learning settings. - endTime required
string
: The end time of the evaluation. - name required
string
: The name of the evaluation. - policies required
array
: Additional Learning settings to evaluate.- items PolicyContract
- startTime required
string
: The start time of the evaluation.
- enableOfflineExperimentation
InternalError
- InternalError
object
: An object containing more specific information than the parent object about the error.- code
string
: Detailed error code. - innererror InternalError
- code
LogsProperties
- LogsProperties
object
- dateRange
- from
string
- to
string
- from
- dateRange
ModelProperties
- ModelProperties
object
- creationTime
string
- lastModifiedTime
string
- creationTime
PersonalizerError
- PersonalizerError
object
: The error object.- code required
string
(values: BadRequest, ResourceNotFound, InternalServerError, InvalidServiceConfiguration, InvalidPolicyConfiguration, InvalidPolicyContract, InvalidEvaluationContract, InvalidRewardRequest, InvalidEventIdToActivate, InvalidRankRequest, InvalidExportLogsRequest, InvalidContainer, FrontEndNotFound, EvaluationNotFound, LogsPropertiesNotFound, RankNullResponse, UpdateConfigurationFailed, ModelResetFailed): High level error code. - details
array
: An array of details about specific errors that led to this reported error.- items PersonalizerError
- innerError InternalError
- message required
string
: A message explaining the error reported by the service. - target
string
: Error source element.
- code required
PolicyContract
- PolicyContract
object
: Learning settings specifying how to train the model.- arguments required
string
: Arguments of the Learning settings. - name required
string
: Name of the Learning settings.
- arguments required
PolicyResult
- PolicyResult
object
- arguments
string
- name
string
- summary
array
- items PolicyResultSummary
- totalSummary
- aggregateTimeWindow
string
- confidenceInterval
number
- ipsEstimatorDenominator
number
- ipsEstimatorNumerator
number
- nonZeroProbability
number
- snipsEstimatorDenominator
number
- sumOfSquares
number
- timeStamp
string
- aggregateTimeWindow
- arguments
PolicyResultSummary
- PolicyResultSummary
object
- aggregateTimeWindow
string
- confidenceInterval
number
- ipsEstimatorDenominator
number
- ipsEstimatorNumerator
number
- nonZeroProbability
number
- snipsEstimatorDenominator
number
- sumOfSquares
number
- timeStamp
string
- aggregateTimeWindow
RankRequest
- RankRequest
object
: Request a set of actions to be ranked by the Personalizer service.- actions required
array
: The set of actions the Personalizer service can pick from.- items RankableAction
- contextFeatures
array
: Features of the context used for Personalizer as a- items
object
- items
- deferActivation
boolean
: Send false if it is certain the rewardActionId in rank results will be shown to the user, therefore - eventId
string
: Optionally pass an eventId that uniquely identifies this Rank event. - excludedActions
array
: The set of action ids to exclude from ranking.- items
string
- items
- actions required
RankResponse
- RankResponse
object
: Returns which action to use as rewardActionId, and additional information about each action as a result of a Rank request.- eventId
string
: The eventId for the round trip from request to response. - ranking
array
: The calculated ranking for the current request.- items RankedAction
- rewardActionId
string
: The action chosen by the Personalizer service. This is the action your application should display, and for which to report the reward. This might not be the
- eventId
RankableAction
- RankableAction
object
: An action with it's associated features used for ranking.- features required
array
: List of dictionaries containing features.- items
object
- items
- id required
string
: Id of the action.
- features required
RankedAction
- RankedAction
object
: A ranked action with its resulting probability.- id
string
: Id of the action - probability
number
: Probability of the action
- id
RewardRequest
- RewardRequest
object
: Reward given to a rank response.- value required
number
: Reward to be assigned to an action. Value should be between -1 and 1 inclusive.
- value required
ServiceConfiguration
- ServiceConfiguration
object
: The configuration of the service.- defaultReward required
number
: The reward given if a reward is not received within the specified wait time. - explorationPercentage required
number
: The percentage of rank responses that will use exploration. - logMirrorEnabled
boolean
: Flag indicates whether log mirroring is enabled. - logMirrorSasUri
string
: Azure storage account container SAS URI for log mirroring. - logRetentionDays required
integer
: Number of days historical logs are to be maintained. -1 implies the logs will never be deleted. - modelExportFrequency required
string
: Personalizer will start using the most updated trained model for online ranks automatically every specified time period. - rewardAggregation required
string
: The function used to process rewards, if multiple reward scores are received before rewardWaitTime is over. - rewardWaitTime required
string
: The time span waited until a request is marked with the default reward.
- defaultReward required