-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinterface.go
More file actions
35 lines (27 loc) · 805 Bytes
/
interface.go
File metadata and controls
35 lines (27 loc) · 805 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package neuraln
import "neuraln/neural"
type NeuralNetwork struct {
neural *neural.Neural
}
func New(inputNodes, hiddenNodes, outputNodes int) *NeuralNetwork {
neural := neural.Neural{}
return &NeuralNetwork{
neural.Create(inputNodes, hiddenNodes, outputNodes),
}
}
func ImportJSON(data []byte) (*neural.Neural, error) {
return neural.ImportJSON(data)
}
func (n *NeuralNetwork) ExportJSON() ([]byte, error) {
return n.neural.ExportJSON()
}
func (n *NeuralNetwork) Train(inputArray, targetArray [][]float64, epochs int) error {
return n.neural.Train(inputArray, targetArray, epochs)
}
func (n *NeuralNetwork) Predict(inputArray []float64) ([]float64, error) {
predictions, err := n.neural.FeedForword(inputArray)
if err != nil {
return nil, err
}
return predictions.Flatten(), nil
}