Documentation
¶
Index ¶
- Variables
- func LocateBuiltInDataset(name string, format DatasetFormat) (string, string, error)
- type BaseModel
- type DatasetFormat
- type Model
- type ParamName
- type Params
- func (parameters Params) Copy() Params
- func (parameters Params) GetBool(name ParamName, _default bool) bool
- func (parameters Params) GetFloat32(name ParamName, _default float32) float32
- func (parameters Params) GetInt(name ParamName, _default int) int
- func (parameters Params) GetInt64(name ParamName, _default int64) int64
- func (parameters Params) GetIntSlice(name ParamName, _default []int) []int
- func (parameters Params) GetString(name ParamName, _default string) string
- func (parameters Params) Overwrite(params Params) Params
- type ParamsGrid
Constants ¶
This section is empty.
Variables ¶
var ( GorseDir string DataSetDir string TempDir string )
The Data directories
Functions ¶
func LocateBuiltInDataset ¶
func LocateBuiltInDataset(name string, format DatasetFormat) (string, string, error)
Types ¶
type BaseModel ¶
type BaseModel struct {
Params Params // Hyper-parameters
// contains filtered or unexported fields
}
BaseModel model must be included by every recommendation model. Hyper-parameters, ID sets, random generator and fitting options are managed the BaseModel model.
func (*BaseModel) GetRandomGenerator ¶
func (model *BaseModel) GetRandomGenerator() util.RandomGenerator
type Model ¶
type Model interface {
SetParams(params Params)
GetParams() Params
SuggestParams(trial goptuna.Trial) Params
Clear()
Invalid() bool
}
Model is the interface for all models. Any model in this package should implement it.
type ParamName ¶
type ParamName string
ParamName is the type of hyper-parameter names.
const ( Lr ParamName = "Lr" // learning rate Reg ParamName = "Reg" // regularization strength NEpochs ParamName = "NEpochs" // number of epochs NFactors ParamName = "NFactors" // number of factors RandomState ParamName = "RandomState" // random state (seed) InitMean ParamName = "InitMean" // mean of gaussian initial parameter InitStdDev ParamName = "InitStdDev" // standard deviation of gaussian initial parameter Alpha ParamName = "Alpha" // weight for negative samples in ALS Similarity ParamName = "Similarity" UseFeature ParamName = "UseFeature" BatchSize ParamName = "BatchSize" HiddenLayers ParamName = "HiddenLayers" Optimizer ParamName = "Optimizer" SGD = "sgd" Adam = "adam" )
Predefined hyper-parameter names
type Params ¶
type Params map[ParamName]interface{}
Params stores hyper-parameters for an model. It is a map between strings (names) and interface{}s (values). For example, hyper-parameters for SVD is given by:
base.Params{
base.Lr: 0.007,
base.NEpochs: 100,
base.NFactors: 80,
base.Reg: 0.1,
}
func (Params) GetBool ¶
GetBool gets a boolean parameter by name. Returns _default if not exists or type doesn't match.
func (Params) GetFloat32 ¶
func (Params) GetInt ¶
GetInt gets a integer parameter by name. Returns _default if not exists or type doesn't match.
func (Params) GetInt64 ¶
GetInt64 gets a int64 parameter by name. Returns _default if not exists or type doesn't match. The type will be converted if given int.
func (Params) GetIntSlice ¶
type ParamsGrid ¶
type ParamsGrid map[ParamName][]interface{}
ParamsGrid contains candidate for grid search.
func (ParamsGrid) Fill ¶
func (grid ParamsGrid) Fill(_default ParamsGrid)
func (ParamsGrid) Len ¶
func (grid ParamsGrid) Len() int
func (ParamsGrid) NumCombinations ¶
func (grid ParamsGrid) NumCombinations() int