Documentation ¶
Overview ¶
Copyright 2020 gorse Project Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- 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) GetString(name ParamName, _default string) string
- func (parameters Params) Overwrite(params Params) Params
- func (parameters Params) ToString() string
- type ParamsGrid
- type Runner
- type Tracker
Constants ¶
const ( SimilarityCosine = "Cosine" SimilarityDot = "Dot" )
Variables ¶
var ( GorseDir string DataSetDir string TempDir string )
The Data directories
Functions ¶
func LocateBuiltInDataset ¶ added in v0.2.0
func LocateBuiltInDataset(name string, format DatasetFormat) (string, string, error)
Types ¶
type BaseModel ¶ added in v0.2.0
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 ¶ added in v0.2.0
func (model *BaseModel) GetRandomGenerator() base.RandomGenerator
type DatasetFormat ¶ added in v0.2.0
type DatasetFormat int
const ( FormatUnknown DatasetFormat = iota FormatNCF FormatLibFM )
type Model ¶ added in v0.2.0
type Model interface { SetParams(params Params) GetParams() Params GetParamsGrid() ParamsGrid Clear() Invalid() bool }
Model is the interface for all models. Any model in this package should implement it.
type ParamName ¶ added in v0.2.0
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" )
Predefined hyper-parameter names
type Params ¶ added in v0.2.0
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 ¶ added in v0.2.2
GetBool gets a boolean parameter by name. Returns _default if not exists or type doesn't match.
func (Params) GetFloat32 ¶ added in v0.2.0
func (Params) GetInt ¶ added in v0.2.0
GetInt gets a integer parameter by name. Returns _default if not exists or type doesn't match.
func (Params) GetInt64 ¶ added in v0.2.0
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.
type ParamsGrid ¶ added in v0.2.0
type ParamsGrid map[ParamName][]interface{}
ParamsGrid contains candidate for grid search.
func (ParamsGrid) Fill ¶ added in v0.2.0
func (grid ParamsGrid) Fill(_default ParamsGrid)
func (ParamsGrid) Len ¶ added in v0.2.0
func (grid ParamsGrid) Len() int
func (ParamsGrid) NumCombinations ¶ added in v0.2.0
func (grid ParamsGrid) NumCombinations() int