server

package
v2.1.2-0...-e76204f Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDashboardData

func GetDashboardData(w http.ResponseWriter, r *http.Request)

GetDashboardData encodes the json for the dashboard data

func Reply

func Reply(request RequestMessage) []byte

Reply takes the entry message and returns an array of bytes for the answer

func Serve

func Serve(_neuralNetworks map[string]network.Network, port string)

Serve serves the server in the given port

func SocketHandle

func SocketHandle(w http.ResponseWriter, r *http.Request)

SocketHandle manages the entry connections and reply with the neural network

func Train

func Train(w http.ResponseWriter, r *http.Request)

Train is the route to re-train the neural network

Types

type Dashboard

type Dashboard struct {
	Layers   Layers   `json:"layers"`
	Training Training `json:"training"`
}

Dashboard contains the data sent for the dashboard

type Layers

type Layers struct {
	InputNodes   int `json:"input"`
	HiddenLayers int `json:"hidden"`
	OutputNodes  int `json:"output"`
}

Layers contains the data of the network's layers

func GetLayers

func GetLayers(locale string) Layers

GetLayers returns the number of input, hidden and output layers of the network

type RequestMessage

type RequestMessage struct {
	Type        int              `json:"type"` // 0 for handshakes and 1 for messages
	Content     string           `json:"content"`
	Token       string           `json:"user_token"`
	Locale      string           `json:"locale"`
	Information user.Information `json:"information"`
}

RequestMessage is the structure that uses entry connections to chat with the websocket

type ResponseMessage

type ResponseMessage struct {
	Content     string           `json:"content"`
	Tag         string           `json:"tag"`
	Information user.Information `json:"information"`
}

ResponseMessage is the structure used to reply to the user through the websocket

type Training

type Training struct {
	Rate   float64   `json:"rate"`
	Errors []float64 `json:"errors"`
	Time   float64   `json:"time"`
}

Training contains the data related to the training of the network

func GetTraining

func GetTraining(locale string) Training

GetTraining returns the learning rate, training date and error loss for the network

Jump to

Keyboard shortcuts

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