personalizer

package
v34.4.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package personalizer implements the Azure ARM Personalizer service API version v1.0.

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 your content in a ranked list. As rewards are sent in response to the ranked list, the reinforcement learning algorithm will improve the model and improve performance of future rank calls.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UserAgent

func UserAgent() string

UserAgent returns the UserAgent string to use when sending http.Requests.

func Version

func Version() string

Version returns the semantic version (see http://semver.org) of the client.

Types

type BaseClient

type BaseClient struct {
	autorest.Client
	Endpoint string
}

BaseClient is the base client for Personalizer.

func New

func New(endpoint string) BaseClient

New creates an instance of the BaseClient client.

func NewWithoutDefaults

func NewWithoutDefaults(endpoint string) BaseClient

NewWithoutDefaults creates an instance of the BaseClient client.

func (BaseClient) Rank

func (client BaseClient) Rank(ctx context.Context, rankRequest RankRequest) (result RankResponse, err error)

Rank sends the rank request. Parameters: rankRequest - a Personalizer request.

func (BaseClient) RankPreparer

func (client BaseClient) RankPreparer(ctx context.Context, rankRequest RankRequest) (*http.Request, error)

RankPreparer prepares the Rank request.

func (BaseClient) RankResponder

func (client BaseClient) RankResponder(resp *http.Response) (result RankResponse, err error)

RankResponder handles the response to the Rank request. The method always closes the http.Response Body.

func (BaseClient) RankSender

func (client BaseClient) RankSender(req *http.Request) (*http.Response, error)

RankSender sends the Rank request. The method will close the http.Response Body if it receives an error.

type Error

type Error struct {
	// Code - High level error code. Possible values include: 'BadRequest', 'ResourceNotFound', 'InternalServerError'
	Code ErrorCode `json:"code,omitempty"`
	// Message - A message explaining the error reported by the service.
	Message *string `json:"message,omitempty"`
	// Target - Error source element.
	Target *string `json:"target,omitempty"`
	// Details - An array of details about specific errors that led to this reported error.
	Details *[]Error `json:"details,omitempty"`
	// InnerError - Finer error details.
	InnerError *InternalError `json:"innerError,omitempty"`
}

Error the error object.

type ErrorCode

type ErrorCode string

ErrorCode enumerates the values for error code.

const (
	// BadRequest Request could not be understood by the server.
	BadRequest ErrorCode = "BadRequest"
	// InternalServerError A generic error has occurred on the server.
	InternalServerError ErrorCode = "InternalServerError"
	// ResourceNotFound Requested resource does not exist on the server.
	ResourceNotFound ErrorCode = "ResourceNotFound"
)

func PossibleErrorCodeValues

func PossibleErrorCodeValues() []ErrorCode

PossibleErrorCodeValues returns an array of possible values for the ErrorCode const type.

type ErrorResponse

type ErrorResponse struct {
	// Error - The error object.
	Error *Error `json:"error,omitempty"`
}

ErrorResponse used to return an error to the client

type EventsClient

type EventsClient struct {
	BaseClient
}

EventsClient is the 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 your content in a ranked list. As rewards are sent in response to the ranked list, the reinforcement learning algorithm will improve the model and improve performance of future rank calls.

func NewEventsClient

func NewEventsClient(endpoint string) EventsClient

NewEventsClient creates an instance of the EventsClient client.

func (EventsClient) Activate

func (client EventsClient) Activate(ctx context.Context, eventID string) (result autorest.Response, err error)

Activate sends the activate request. Parameters: eventID - the event ID this activation applies to.

func (EventsClient) ActivatePreparer

func (client EventsClient) ActivatePreparer(ctx context.Context, eventID string) (*http.Request, error)

ActivatePreparer prepares the Activate request.

func (EventsClient) ActivateResponder

func (client EventsClient) ActivateResponder(resp *http.Response) (result autorest.Response, err error)

ActivateResponder handles the response to the Activate request. The method always closes the http.Response Body.

func (EventsClient) ActivateSender

func (client EventsClient) ActivateSender(req *http.Request) (*http.Response, error)

ActivateSender sends the Activate request. The method will close the http.Response Body if it receives an error.

func (EventsClient) Reward

func (client EventsClient) Reward(ctx context.Context, eventID string, reward RewardRequest) (result autorest.Response, err error)

Reward sends the reward request. Parameters: eventID - the event id this reward applies to. reward - the reward should be a floating point number.

func (EventsClient) RewardPreparer

func (client EventsClient) RewardPreparer(ctx context.Context, eventID string, reward RewardRequest) (*http.Request, error)

RewardPreparer prepares the Reward request.

func (EventsClient) RewardResponder

func (client EventsClient) RewardResponder(resp *http.Response) (result autorest.Response, err error)

RewardResponder handles the response to the Reward request. The method always closes the http.Response Body.

func (EventsClient) RewardSender

func (client EventsClient) RewardSender(req *http.Request) (*http.Response, error)

RewardSender sends the Reward request. The method will close the http.Response Body if it receives an error.

type InternalError

type InternalError struct {
	// Code - Detailed error code.
	Code *string `json:"code,omitempty"`
	// Innererror - The error object.
	Innererror *InternalError `json:"innererror,omitempty"`
}

InternalError an object containing more specific information than the parent object about the error.

type RankRequest

type RankRequest struct {
	// ContextFeatures - Features of the context used for Personalizer as a
	// dictionary of dictionaries. This depends on the application, and
	// typically includes features about the current user, their
	// device, profile information, data about time and date, etc.
	ContextFeatures *[]interface{} `json:"contextFeatures,omitempty"`
	// Actions - The set of actions the Personalizer service can pick from.
	// The set should not contain more than 50 actions.
	// The order of the actions does not affect the rank result but the order
	// should match the sequence your application would have used to display them.
	Actions *[]RankableAction `json:"actions,omitempty"`
	// ExcludedActions - The set of action ids to exclude from ranking.
	ExcludedActions *[]string `json:"excludedActions,omitempty"`
	// EventID - Optionally pass an eventId that uniquely identifies this Rank event.
	// If null, the service generates a unique eventId. The eventId will be used for
	// associating this request with its reward, as well as seeding the pseudo-random
	// generator when making a Personalizer call.
	EventID *string `json:"eventId,omitempty"`
	// DeferActivation - Send false if the user will see the rank results, therefore
	// Personalizer will expect a Reward call, otherwise it will assign the default
	// Reward to the event. Send true if it is possible the user will not see the
	// rank results, because the page is rendering later, or the Rank results may be
	// overridden by code further downstream.
	DeferActivation *bool `json:"deferActivation,omitempty"`
}

RankRequest request a set of actions to be ranked by the Personalizer service.

type RankResponse

type RankResponse struct {
	autorest.Response `json:"-"`
	// Ranking - READ-ONLY; The calculated ranking for the current request.
	Ranking *[]RankedAction `json:"ranking,omitempty"`
	// EventID - READ-ONLY; The eventId for the round trip from request to response.
	EventID *string `json:"eventId,omitempty"`
	// RewardActionID - READ-ONLY; The action chosen by the Personalizer service. This is the action for which to report the reward. This might not be the
	// first found in 'ranking' if an action in the request in first position was part of the excluded ids.
	RewardActionID *string `json:"rewardActionId,omitempty"`
}

RankResponse a resulting ordered list of actions that result from a rank request.

type RankableAction

type RankableAction struct {
	// ID - Id of the action.
	ID *string `json:"id,omitempty"`
	// Features - List of dictionaries containing features.
	Features *[]interface{} `json:"features,omitempty"`
}

RankableAction an action with it's associated features used for ranking.

type RankedAction

type RankedAction struct {
	// ID - READ-ONLY; Id of the action
	ID *string `json:"id,omitempty"`
	// Probability - READ-ONLY; Probability of the action
	Probability *float64 `json:"probability,omitempty"`
}

RankedAction a ranked action with its resulting probability.

type RewardRequest

type RewardRequest struct {
	// Value - Reward to be assigned to an action. Value should be between -1 and 1 inclusive.
	Value *float64 `json:"value,omitempty"`
}

RewardRequest reward given to a rank response.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL