Documentation
¶
Overview ¶
Package web has a web based interface we network training and visualisation.
Index ¶
- Variables
- func SaveNetwork(data *NetworkData, reset bool) error
- type ConfigPage
- func (p *ConfigPage) Base() func(w http.ResponseWriter, r *http.Request)
- func (p *ConfigPage) Load() func(w http.ResponseWriter, r *http.Request)
- func (p *ConfigPage) Reset() func(w http.ResponseWriter, r *http.Request)
- func (p *ConfigPage) Save() func(w http.ResponseWriter, r *http.Request)
- func (p *ConfigPage) Tune() func(w http.ResponseWriter, r *http.Request)
- type Field
- type HistoryData
- type HistoryRow
- type ImagePage
- func (p *ImagePage) Base() func(w http.ResponseWriter, r *http.Request)
- func (p *ImagePage) Grid() func(w http.ResponseWriter, r *http.Request)
- func (p *ImagePage) Image() func(w http.ResponseWriter, r *http.Request)
- func (p *ImagePage) Index(row, col int) int
- func (p *ImagePage) Label(i int) (l LabelInfo)
- func (p *ImagePage) Setopt() func(w http.ResponseWriter, r *http.Request)
- func (p *ImagePage) Url(i int) string
- type LabelInfo
- type Layer
- type LayerData
- type LayerInfo
- type Link
- type Network
- type NetworkData
- type Templates
- func (t *Templates) AddMenuItem(url, name string) *Templates
- func (t *Templates) AddOption(l Link) *Templates
- func (t *Templates) Clone() *Templates
- func (t *Templates) ErrorHandler(status int, errorText error) http.Handler
- func (t *Templates) Exec(w http.ResponseWriter, name string, data interface{}, topLevel bool) error
- func (t *Templates) MenuSelected(name string) bool
- func (t *Templates) OptionSelected(name string) bool
- func (t *Templates) Select(url string) *Templates
- func (t *Templates) SelectOptions(names []string) *Templates
- func (t *Templates) ToggleOption(name string) bool
- type TrainPage
- func (p *TrainPage) Base(url, frame string) func(w http.ResponseWriter, r *http.Request)
- func (p *TrainPage) Command() func(w http.ResponseWriter, r *http.Request)
- func (p *TrainPage) Filter() func(w http.ResponseWriter, r *http.Request)
- func (p *TrainPage) History() []HistoryRow
- func (p *TrainPage) HistoryHeaders() []string
- func (p *TrainPage) LatestStats() []nnet.Stats
- func (p *TrainPage) Setopt() func(w http.ResponseWriter, r *http.Request)
- func (p *TrainPage) Stats(history bool) func(w http.ResponseWriter, r *http.Request)
- func (p *TrainPage) StatsHeaders() []string
- func (p *TrainPage) Websocket() func(w http.ResponseWriter, r *http.Request)
- type TuneParams
- type ViewPage
Constants ¶
This section is empty.
Variables ¶
var AssetDir = os.Getenv("GOPATH") + "/src/github.com/jnb666/deepthought2/assets"
var ErrMissingField = errors.New("value is required")
var ErrNotFound = errors.New("page not found")
Functions ¶
func SaveNetwork ¶
func SaveNetwork(data *NetworkData, reset bool) error
Encode data in gob format and save to file under nnet.DataDir
Types ¶
type ConfigPage ¶
type ConfigPage struct {
*Templates
Fields []Field
Layers []Layer
TuneFields []Field
// contains filtered or unexported fields
}
func NewConfigPage ¶
func NewConfigPage(t *Templates, net *Network) *ConfigPage
Base data for handler functions to view and update the network config
func (*ConfigPage) Base ¶
func (p *ConfigPage) Base() func(w http.ResponseWriter, r *http.Request)
Handler function for the config template
func (*ConfigPage) Load ¶
func (p *ConfigPage) Load() func(w http.ResponseWriter, r *http.Request)
Handler function for the action to load a new model
func (*ConfigPage) Reset ¶
func (p *ConfigPage) Reset() func(w http.ResponseWriter, r *http.Request)
Handler function for the config form save action
func (*ConfigPage) Save ¶
func (p *ConfigPage) Save() func(w http.ResponseWriter, r *http.Request)
Handler function for the config form save action
func (*ConfigPage) Tune ¶
func (p *ConfigPage) Tune() func(w http.ResponseWriter, r *http.Request)
Handler function for the tune form
type HistoryRow ¶
type ImagePage ¶
type ImagePage struct {
*Templates
Dset string
Class int
Page int
Errors bool
Distort string
Rows []int
Cols []int
Width int
Height int
Pages int
Total int
// contains filtered or unexported fields
}
func NewImagePage ¶
Base data for handler functions to view input image dataset
func (*ImagePage) Base ¶
func (p *ImagePage) Base() func(w http.ResponseWriter, r *http.Request)
Handler function for the main image page
func (*ImagePage) Grid ¶
func (p *ImagePage) Grid() func(w http.ResponseWriter, r *http.Request)
Handler function for the frame with grid of images
func (*ImagePage) Image ¶
func (p *ImagePage) Image() func(w http.ResponseWriter, r *http.Request)
Handler function for the image data
type Network ¶
type Network struct {
*NetworkData
*nnet.Network
Data map[string]nnet.Data
Labels map[string][]int32
sync.Mutex
// contains filtered or unexported fields
}
Network and associated training / test data and configuration
func NewNetwork ¶
Create a new network and load config from data given model name
type NetworkData ¶
type NetworkData struct {
Model string
Conf nnet.Config
MaxRun int
Run int
Epoch int
Stats []nnet.Stats
Pred map[string][]int32
Params []LayerData
History []HistoryData
Tuners []TuneParams
}
Embedded structs used to persist state to file
func LoadNetwork ¶
func LoadNetwork(model string, reset bool) (data *NetworkData, err error)
Read back gob encoded data file, if not found or reset is set then load default config.
type Templates ¶
type Templates struct {
*template.Template
Menu []Link
Options []Link
Dropdown []Link
Toplevel bool
WSRoot string
Heading template.HTML
Frame string
Error string
}
Template and main menu definition
func NewTemplates ¶
Load and parse templates and initialise main menu
func (*Templates) AddMenuItem ¶
func (*Templates) ErrorHandler ¶
Return custom error response
func (*Templates) MenuSelected ¶
func (*Templates) OptionSelected ¶
func (*Templates) SelectOptions ¶
func (*Templates) ToggleOption ¶
type TrainPage ¶
type TrainPage struct {
*Templates
Plots []template.HTML
PlotWidth int
PlotHeight int
// contains filtered or unexported fields
}
func NewTrainPage ¶
Base data for handler functions to perform network training and display the stats
func (*TrainPage) Command ¶
func (p *TrainPage) Command() func(w http.ResponseWriter, r *http.Request)
Handler function for the train command options
func (*TrainPage) Filter ¶
func (p *TrainPage) Filter() func(w http.ResponseWriter, r *http.Request)
Handler function for the form to filter the stats values
func (*TrainPage) History ¶
func (p *TrainPage) History() []HistoryRow
func (*TrainPage) HistoryHeaders ¶
func (*TrainPage) LatestStats ¶
func (*TrainPage) Setopt ¶
func (p *TrainPage) Setopt() func(w http.ResponseWriter, r *http.Request)
Handler function to toggle options
func (*TrainPage) StatsHeaders ¶
type TuneParams ¶
type ViewPage ¶
type ViewPage struct {
*Templates
Page string
Input LayerInfo
Output LayerInfo
Layers []LayerInfo
Columns int
// contains filtered or unexported fields
}
func NewViewPage ¶
Base data for handler functions to view network activations and weights
func (*ViewPage) Base ¶
func (p *ViewPage) Base() func(w http.ResponseWriter, r *http.Request)
Handler function for the main view page
func (*ViewPage) Image ¶
func (p *ViewPage) Image() func(w http.ResponseWriter, r *http.Request)
Handler function to generate the image for the output and weight data visualisation