Documentation
¶
Index ¶
- Constants
- func ChannelSoftmax(a *mx.Symbol) *mx.Symbol
- func Combine(nn Block) *mx.Symbol
- func DefaultModelMap(network *Network, features []string, predicts string) model.MemorizeMap
- func HardSigmoid(a *mx.Symbol) *mx.Symbol
- func LoadSymbol(input iokit.Input) (symbolic *mx.Symbol, inputdim mx.Dimension, err error)
- func LuckyObjectify(source iokit.Input, collection ...string) model.GpuPredictionModel
- func NextSymbolId() int
- func Objectify(source iokit.Input, collection ...string) (fm model.GpuPredictionModel, err error)
- func ObjectifyModel(c map[string]iokit.Input) (pm model.PredictionModel, err error)
- func ReLU(a *mx.Symbol) *mx.Symbol
- func SaveSymbol(inputdim mx.Dimension, sym *mx.Symbol, output iokit.Output) (err error)
- func Sigmoid(a *mx.Symbol) *mx.Symbol
- func Sin(a *mx.Symbol) *mx.Symbol
- func SoftReLU(a *mx.Symbol) *mx.Symbol
- func SoftSign(a *mx.Symbol) *mx.Symbol
- func Softmax(a *mx.Symbol) *mx.Symbol
- func Swish(a *mx.Symbol) *mx.Symbol
- func Tanh(a *mx.Symbol) *mx.Symbol
- func Tanh25(a *mx.Symbol) *mx.Symbol
- func Train(e Model, dataset model.Dataset, w model.Workout, mmf ModelMapFunction) (report *model.Report, err error)
- type Activation
- type Adam
- type AvgPool
- type BatchNorm
- type Block
- type BlockConcat
- type BlockConnect
- type BlockStack
- type Const
- type Convolution
- type CrossEntropyLoss
- type Dropout
- type FeaturesMapper
- type Flatten
- type FullyConnected
- type L0Loss
- type L1Loss
- type L2Loss
- type Lambda
- type LcosLoss
- type LossFunc
- type MaxPool
- type Model
- type ModelMapFunction
- type Network
- func (network *Network) Forward(data interface{}, out []float32)
- func (network *Network) LoadParams(input iokit.Input, forced ...bool) (err error)
- func (network *Network) Predict(data interface{}) [][]float32
- func (network *Network) Release()
- func (network *Network) SaveParams(output iokit.Output, only ...string) (err error)
- func (network *Network) SaveSymbol(output iokit.Output) (err error)
- func (network *Network) Train(data interface{}, label interface{}, opt Optimizer)
- func (network *Network) Update(opt Optimizer)
- type Optimizer
- type OptimizerConf
- type Output
- type ParamsReader
- type PredictionModel
- type ResidualBlock
- type SGD
- type Slice
- type SoftmaxCrossEntropyLoss
- type Uniform
- type Xavier
- type XavierFactor
Constants ¶
View Source
const DefaultBatchSize = 32
default batch size for general nn training
View Source
const ModelPartInfo = "network.yaml"
View Source
const ModelPartParams = "params.bin.xz"
View Source
const ModelPartSummary = "summary.txt"
View Source
const ModelPartSymbol = "symbol.bin.xz"
Variables ¶
This section is empty.
Functions ¶
func DefaultModelMap ¶
func DefaultModelMap(network *Network, features []string, predicts string) model.MemorizeMap
func LoadSymbol ¶
func LuckyObjectify ¶
func LuckyObjectify(source iokit.Input, collection ...string) model.GpuPredictionModel
func Objectify ¶
func ObjectifyModel ¶
func SaveSymbol ¶
Types ¶
type Activation ¶
type Adam ¶
type AvgPool ¶
type BatchNorm ¶
type Block ¶
type BlockConcat ¶
type BlockConcat struct {
// contains filtered or unexported fields
}
type BlockConnect ¶
type BlockConnect struct {
// contains filtered or unexported fields
}
type BlockStack ¶
type BlockStack struct {
// contains filtered or unexported fields
}
type Convolution ¶
type Convolution struct { Channels int Kernel mx.Dimension Stride mx.Dimension Padding mx.Dimension Activation func(*mx.Symbol) *mx.Symbol WeightInit mx.Inite // none by default BiasInit mx.Inite // &nn.Const{0} by default NoBias bool Groups bool BatchNorm bool Layout string Name string Round int TurnOff bool Output bool Dropout float32 }
type FeaturesMapper ¶
type FeaturesMapper struct {
// contains filtered or unexported fields
}
FeaturesMapper maps features to prediction
func (*FeaturesMapper) Close ¶
func (fm *FeaturesMapper) Close() error
Close releases all bounded resources
type Flatten ¶
type Flatten struct{}
type FullyConnected ¶
type L0Loss ¶
type L0Loss struct{}
type Lambda ¶
type LossFunc ¶
type MaxPool ¶
type Model ¶
type Model struct { Network Block Optimizer OptimizerConf Loss mx.Loss Input mx.Dimension Seed int BatchSize int Predicted string Context mx.Context // CPU by default }
Model is a ANN/Gym definition to train network
type ModelMapFunction ¶
type ModelMapFunction func(network *Network, features []string, predicts string) model.MemorizeMap
type Network ¶
func Inherit ¶
func Load ¶
func New ¶
func (*Network) LoadParams ¶
func (*Network) SaveParams ¶
func (*Network) Train ¶
type Optimizer ¶
type Output ¶
type ParamsReader ¶
func NewParamsReader ¶
func NewParamsReader(input iokit.Input) (prd *ParamsReader, err error)
func (*ParamsReader) HasMore ¶
func (prd *ParamsReader) HasMore() bool
func (*ParamsReader) Next ¶
func (prd *ParamsReader) Next() (n string, out []float32, err error)
type PredictionModel ¶
type PredictionModel struct {
// contains filtered or unexported fields
}
PredictionModel is the FeaturesMapper factory
func (PredictionModel) Features ¶
func (pm PredictionModel) Features() []string
Features model uses when maps features the same as Features in the training dataset
func (PredictionModel) FeaturesMapper ¶
func (pm PredictionModel) FeaturesMapper(batchSize int) (fm tables.FeaturesMapper, err error)
Returns new table with all original columns except features adding one new column with prediction
func (PredictionModel) Gpu ¶
func (pm PredictionModel) Gpu(no ...int) model.PredictionModel
Gpu changes context of prediction network to gpu enabled
func (PredictionModel) Predicted ¶
func (pm PredictionModel) Predicted() string
Column name model adds to result table when maps features. By default it's 'Predicted'
type ResidualBlock ¶
type ResidualBlock struct {
// contains filtered or unexported fields
}
type SGD ¶
type Slice ¶
type SoftmaxCrossEntropyLoss ¶
type SoftmaxCrossEntropyLoss struct{}
type Xavier ¶
type Xavier struct { Gaussian bool Magnitude float32 Factor XavierFactor }
type XavierFactor ¶
type XavierFactor int
const ( XavierIn XavierFactor = 1 XavierOut XavierFactor = 2 XavierAvg XavierFactor = 3 )
Source Files
¶
Click to show internal directories.
Click to hide internal directories.