readers

package
v0.0.0-...-bed4406 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DatasetReaders = map[string]Reader{
	"mnist": Mnist{},
}

DatasetReaders contains a map of the reader types which have strings as keys. The API works as following: the string in the json config file creates an instance of a given reader. Any reader can be created by satisfying the Reader trait and appending the key, value to the map.

Functions

This section is empty.

Types

type Instance

type Instance struct {
	Image, Label matrix.Matrix
}

Instance is a struct that contains the input and expected output in form of two vectors.

type Mnist

type Mnist struct{}

Mnist reader with two methods that satisfy the Reader interface.

func (Mnist) DataFrom

func (m Mnist) DataFrom(images, labels string) ([]Instance, error)

func (Mnist) PredictDataFrom

func (m Mnist) PredictDataFrom(filename string) (matrix.Matrix, error)

Credits to: https://github.com/sausheong/gonn

type Reader

type Reader interface {
	// DataFrom fetches the data from the two seperate files which contain
	// both the images and labels. This procedure is equivalent when fetching
	// the training and test data.
	DataFrom(images, labels string) ([]Instance, error)
	// DataFromFile is used to perform a predition. It shouldn't have any information
	// about the expected output so it simply parses a vector from an png image.
	PredictDataFrom(filename string) (matrix.Matrix, error)
}

Reader interface is satisfied with Read method which given two filepaths returns a slice of Instances.

Directories

Path Synopsis
MNIST database reader http://yann.lecun.com/exdb/mnist/ https://gist.githubusercontent.com/higuma/dbcd006546eb844c01e5102b4d0bcc93/raw/e3f3b72a0d3a212bfa0b65feb52d7a73bcf72913/mnist.go
MNIST database reader http://yann.lecun.com/exdb/mnist/ https://gist.githubusercontent.com/higuma/dbcd006546eb844c01e5102b4d0bcc93/raw/e3f3b72a0d3a212bfa0b65feb52d7a73bcf72913/mnist.go

Jump to

Keyboard shortcuts

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