math

package
v0.0.0-...-e3597af Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Example
package main

import (
	"fmt"
	"gopkg.in/sensorbee/sensorbee.v0/data"
)

func main() {
	v := data.Map{
		"labelA": data.Float(2.5),
		"labelB": data.Float(0.7),
		"labelC": data.Float(-1.2),
	}
	s, _ := Softmax(v)
	fmt.Printf("labelA: %0.5f\n", toFloat(s["labelA"]))
	fmt.Printf("labelB: %0.5f\n", toFloat(s["labelB"]))
	fmt.Printf("labelC: %0.5f\n", toFloat(s["labelC"]))

}

func toFloat(d data.Value) float64 {
	ret, _ := data.AsFloat(d)
	return ret
}
Output:

labelA: 0.84032
labelB: 0.13890
labelC: 0.02078

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Softmax

func Softmax(v data.Map) (data.Map, error)

Softmax calculates softmax.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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