util

package
v0.0.0-...-fa1df65 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2017 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_FAKE_DATA_NUM_POINTS             = 200
	DEFAULT_FAKE_DATA_NUM_CLASSES            = 2
	DEFAULT_FAKE_DATA_NUM_FEATURES           = 2
	DEFAULT_FAKE_DATA_MAX_DISTANCE_TO_CENTER = 30.0
	DEFAULT_FAKE_DATA_RANGE_MIN              = -100.0
	DEFAULT_FAKE_DATA_RANGE_MAX              = 100.0
)
View Source
const (
	RANDOM_NAME_LENGTH = 64
	RANDOM_CHARS       = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
)
View Source
const EPSILON = 0.00000001

Variables

This section is empty.

Functions

func FakeData

func FakeData(numPoints int, numClasses int, numFeatures int, maxDistanceToCenter float64,
	rangeMin []float64, rangeMax []float64, seed int64) ([][]float64, []int)

Pass zero/negative or nil to any param to default (except seed).

func FakeDataDefault

func FakeDataDefault() ([][]float64, []int)

func FloatEquals

func FloatEquals(a float64, b float64) bool

func FloatToBool

func FloatToBool(val float64) bool

func InterfaceSlice

func InterfaceSlice(slice interface{}) []interface{}

http://stackoverflow.com/a/12754757

func IsNumeric

func IsNumeric(obj interface{}) bool

func LogSumExp

func LogSumExp(values []float64) float64

The logSumExp trick to prevent over/under-flow.. The elements of the array need to be exp'd, summed, and then log of the sum needs to be taken.

func Max

func Max(values []float64) (int, float64)

func MaxInt

func MaxInt(a int, b int) int

Does not handle NaN, Inf, -Inf.

func MinInt

func MinInt(a int, b int) int

Does not handle NaN, Inf, -Inf.

func NumericValue

func NumericValue(value interface{}) float64

func RandomString

func RandomString(length int) string

func RangeSlice

func RangeSlice(size int) []int

Make a slice with the indecies [0, size).

func SelectIndexesFloat

func SelectIndexesFloat(data []float64, indexes []int) []float64

Pull out indexes that match the given indexes.

func SelectIndexesFloat2D

func SelectIndexesFloat2D(data [][]float64, indexes []int) [][]float64

func SelectIndexesInt

func SelectIndexesInt(data []int, indexes []int) []int

func ShuffleIntSlice

func ShuffleIntSlice(slice []int)

func ShuffleSlice

func ShuffleSlice(slice []interface{})

Fisher–Yates (Sattolo variant).

func Sigmoid

func Sigmoid(val float64) float64

func Sign

func Sign(val float64) int

func TempFilePath

func TempFilePath(extension string, prefix string, suffix string) string

You should probably pass an extension, but the other two can be empty strings.

Types

This section is empty.

Jump to

Keyboard shortcuts

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