This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nn | |
import gonum.org/v1/gonum/mat | |
type NN interface { | |
Train(x,y mat.Matrix) | |
Evaluate(x, y mat.Matrix) float64 | |
Predict(x mat.Matrix) mat.Matrix | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nn | |
import ( | |
"gonum.org/v1/gonum/mat" | |
) | |
func (n *MLP) Evaluate(x, y mat.Matrix) float64 { | |
p := n.Predict(x) | |
N, _ := p.Dims() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nn | |
import "gonum.org/v1/gonum/mat" | |
func (n *MLP) Predict(x mat.Matrix) mat.Matrix { | |
as, _ := n.forward(x) | |
return as[len(as)-1] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nn | |
import ( | |
"fmt" | |
"gonum.org/v1/gonum/mat" | |
) | |
func (n *MLP) Train(x, y *mat.Dense) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nn | |
import "gonum.org/v1/gonum/mat" | |
// forward takes input data and returns the 'activation' and 'z' | |
// from each layer - z = w.x +b and a = sigmoid(z) | |
func (n *MLP) forward(x mat.Matrix) (as, zs []mat.Matrix) { | |
as = append(as, x) // first activation is input | |
_x := x |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package nn | |
import "gonum.org/v1/gonum/mat" | |
func (n *MLP) backward(x, y mat.Matrix) { | |
// get activations | |
as, zs := n.forward(x) | |
// final z |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/csv" | |
"fmt" | |
"io" | |
"log" | |
"os" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "fmt" | |
type A struct { | |
OnlyForA string | |
} | |
func (a *A) Eyo() { | |
fmt.Println("eyo") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- User --> | |
<comment> | |
Hi can anyone recommend a good film? | |
</comment> | |
<!-- Attacker--> | |
<comment> | |
<script src="xss.js"></script> | |
I like star wars! | |
<a id="its-a-trap" href="#">Check it out.</a> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"time" | |
"github.com/pborman/uuid" | |
) | |
func main() { |
NewerOlder