models

package
v0.0.0-...-3298520 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: MIT Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const (
	Numeric         = "numeric"
	Category        = "category"
	Text            = "text"
	MissingPrefix   = "_missing_"
	MissingNumeric  = "0"
	MissingCategory = "_unknown_"
)

Variables

View Source
var ActionError = errors.New("action not found")
View Source
var ErrInvalidIncludedActions = fmt.Errorf("slot included action id that was not in the action set")
View Source
var InvalidBitSize = fmt.Errorf("invalid learning rate, learning rate must be above 10")
View Source
var InvalidCbType = fmt.Errorf("invalid CbType")
View Source
var InvalidLearningRate = fmt.Errorf("invalid learning rate, learning rate must be above 0")
View Source
var InvalidSeed = fmt.Errorf("invalid seed, seed must be a 32 bit integer")
View Source
var ValidCBTypes = map[string]struct{}{
	"mtr": {},
	"dr":  {},
	"dm":  {},
	"ips": {},
}

Functions

This section is empty.

Types

type Action

type Action struct {
	Id       string    `json:"id"`
	Features []Feature `json:"features,omitempty"`
}

type ActionReward

type ActionReward struct {
	Slot    Slot    `json:"slot"`
	Action  Action  `json:"action"`
	CbLabel CbLabel `json:"cb_label"`
}

type BatchAdviceFile

type BatchAdviceFile struct {
	Id                  int       `json:"id"`
	CampaignId          int       `json:"campaign_id" binding:"required"`
	Name                string    `json:"name" binding:"required"`
	Status              string    `json:"status"`
	Reason              string    `json:"reason"`
	AdviceRequestCount  int       `json:"advice_request_count"`
	RewardReceivedCount int       `json:"reward_received_count"`
	Created             time.Time `json:"created"`
	Updated             time.Time `json:"updated"`
}

type Campaign

type Campaign struct {
	Id               int       `json:"id,omitempty"`
	Name             string    `json:"name" binding:"required"`
	Description      string    `json:"description"`
	Status           string    `json:"status"`
	AdviceTimeout    string    `json:"advice_timeout" binding:"required"`
	TrainingInterval string    `json:"training_interval"`
	CacheAdvice      bool      `json:"cache_advice"`
	RuntimeActions   bool      `json:"runtime_actions"`
	HoldoutPercent   float64   `json:"holdout_percent"`
	PredictionType   string    `json:"prediction_type"`
	Created          time.Time `json:"created"`
	Updated          time.Time `json:"updated"`
}

type CbAction

type CbAction struct {
	Id          string
	Probability float64
}

type CbContextExample

type CbContextExample struct {
	CampaignFeatures []Feature
	Actions          []Action
}

func (CbContextExample) Format

func (cex CbContextExample) Format() ([]string, error)

type CbLabel

type CbLabel struct {
	Reward      float64 `json:"reward"`
	Probability float64 `json:"probability"`
}

type CbPrediction

type CbPrediction struct {
	ActionIndex int
	Probability float64
}

type CbRewardExample

type CbRewardExample struct {
	CampaignFeatures []Feature    `json:"campaign_features"`
	Actions          []Action     `json:"actions"`
	ActionReward     ActionReward `json:"action_reward"`
}

type CbSample

type CbSample struct {
	Index       int
	Probability float64
}

type CcbContextExample

type CcbContextExample struct {
	CampaignFeatures []Feature
	Actions          []Action
	Slots            []Slot
}

type CcbRewardExample

type CcbRewardExample struct {
	CampaignFeatures []Feature      `json:"campaign_features"`
	Actions          []Action       `json:"actions"`
	ActionRewards    []ActionReward `json:"action_rewards"`
}

func (CcbRewardExample) Format

func (rex CcbRewardExample) Format() ([]string, error)

type Feature

type Feature struct {
	Id    int    `json:"id"`
	Name  string `json:"name"`
	DType string `json:"dtype"`
	Value string `json:"value"`
}

type LearningParameters

type LearningParameters struct {
	LearningRate float64 `json:"learning_rate"`
	CbType       string  `json:"cb_type"`
	Interactions string  `json:"interactions"`
	BitSize      int     `json:"bit_size"`
	Seed         int32   `json:"seed"`
}

func (*LearningParameters) HandleDefaults

func (lp *LearningParameters) HandleDefaults(banditType string)

func (*LearningParameters) Validate

func (lp *LearningParameters) Validate() error

type ModelPaths

type ModelPaths struct {
	InputModelPath  string `json:"input_model_path"`
	OutputModelPath string `json:"output_model_path"`
}

type Policy

type Policy struct {
	Type               string             `json:"type"  binding:"required"`
	Strategy           string             `json:"strategy" binding:"required"`
	Parameters         map[string]float64 `json:"parameters" binding:"required"`
	LearningParameters LearningParameters `json:"learning_parameters"`
}

type Slot

type Slot struct {
	Id       int       `json:"id"`
	Features []Feature `json:"features,omitempty"`

	//Optional: If included then the slot only has access to the specific included actions, otherwise all
	//actions are considered
	IncludedActions []string `json:"included_actions,omitempty"`
}

Jump to

Keyboard shortcuts

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