// SoftMax returns the input values in the range of 0 to 1
// with sum of all the probabilities being equal to one. It
// is commonly used in machine learning neural networks.
437343
func SoftMax(input Float64Data) ([]float64, error) {
	if input.Len() == 0 {
		return Float64Data{}, EmptyInput
	}

	s := 0.0
	c, _ := Max(input)
	for _, e := range input {
		s += math.Exp(e - c)
	}

	sm := make([]float64, len(input))
	for i, v := range input {
		sm[i] = math.Exp(v-c) / s
	}

	return sm, nil
}
588712
func Max(x, y float32) float32 {
	return float32(math.Max(float64(x), float64(y)))
}
716833
func (s *Limit) SetMax(v int64) *Limit {
	s.Max = &v
	return s
}
724950
func binOpMax(rate int8, x, y Input, numOutputs int) Input {
	CheckRate(rate)
	return NewInput(BinOpUgenName, rate, BinOpMax, numOutputs, x, y)
}
413278
func (l *TeamLoader) seqnosMax(seqnos []keybase1.Seqno) (ret keybase1.Seqno) {
	for _, x := range seqnos {
		if x > ret {
			ret = x
		}
	}
	return ret
}
565840
def softmax(w)
	    e = Numo::NMath.exp(w - (w.max))
	    dist = e / (e.sum)
	    return dist
	end
905590
func (s *Softmax) String() string {
	if len(s.Parameters) == 0 {
		fmt.Fprintf(s.Output, "ERROR: Attempting to print model with the 0 vector as it's parameter vector! Train first!\n")
	}
	var buffer bytes.Buffer

	buffer.WriteString(fmt.Sprintf("h(θ,x)[i] = exp(θ[i]x) / Σ exp(θ[j]x)\n\tθ ∊ ℝ^(%v x %v)\n", len(s.Parameters), len(s.Parameters[0])))

	return buffer.String()
}
1353676
func (s *UniformSample) Max() int64 {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	return SampleMax(s.values)
}
1226991
func MinMax(real []float64, timePeriod int32) ([]float64, []float64) {
	var outBegIdx C.int
	var outNBElement C.int
	outMin := make([]float64, len(real))
	outMax := make([]float64, len(real))
	C.TA_MINMAX(0, C.int(len(real)-1), (*C.double)(unsafe.Pointer(&real[0])), C.int(timePeriod), &outBegIdx, &outNBElement, (*C.double)(unsafe.Pointer(&outMin[0])), (*C.double)(unsafe.Pointer(&outMax[0])))
	return outMin[:outNBElement], outMax[:outNBElement]
}
907483
func (i *Info) genTimeMax() time.Time {
	return i.GenTime.Add(i.Accuracy.Duration())
}
443525
func Min(v T) interface{} {
	x, _ := minmax(v, -1, true)
	return x.Interface()
}
890459
func Max(a, b *T) T {
	max := *a
	if b[0] > max[0] {
		max[0] = b[0]
	}
	if b[1] > max[1] {
		max[1] = b[1]
	}
	if b[2] > max[2] {
		max[2] = b[2]
	}
	return max
}
480892
func MinMax(min, max time.Time) (time.Time, time.Time) {
	if IsGreaterThan(min, max, false) {
		return max, min
	}
	return min, max
}
750846
func maxUint64(inputs ...uint64) uint64 {
	l := len(inputs)
	if l == 0 {
		return 0
	} else if l == 1 {
		return inputs[0]
	}

	max := inputs[0]
	for i := 1; i < l; i++ {
		cur := inputs[i]
		if cur > max {
			max = cur
		}
	}
	return max
}
478212
func (s *Datapoint) SetMaximum(v float64) *Datapoint {
	s.Maximum = &v
	return s
}
993574
func (as ArraySpec) SoftClip() Input {
	return as.proc(func(i Input) Input {
		return i.SoftClip()
	})
}
485203
func Max(v1, v2 Value) (Value, error) {
	return minmax(v1, v2, false)
}