Compute the softmax of the given value set, v_i = exp(v_i) / s,
    where s = sum(exp(v_0), exp(v_1), ..).
191023
def softmax(values):
    
    e_values = list(map(exp, values))
    s = sum(e_values)
    inv_s = 1.0 / s
    return [ev * inv_s for ev in e_values]
217190
private static int getRolledValue(int value, int amount, int min, int max) {
        assert value >= min && value <= max;
        int range = max - min + 1;
        amount %= range;
        int n = value + amount;
        if (n > max) {
            n -= range;
        } else if (n < min) {
            n += range;
        }
        assert n >= min && n <= max;
        return n;
    }
152948
def predict_proba(self, X):
        """"""
        return F.softmax(self.forward(X), dim=1).data.cpu().numpy()
745665
def _penalized_acquisition(self, x,  model, X_batch, r_x0, s_x0):
        '''
        
        '''
        fval = -self.acq.acquisition_function(x)[:,0]

        if self.transform=='softplus':
            fval_org = fval.copy()
            fval[fval_org>=40.] = np.log(fval_org[fval_org>=40.])
            fval[fval_org<40.] = np.log(np.log1p(np.exp(fval_org[fval_org<40.])))
        elif self.transform=='none':
            fval = np.log(fval+1e-50)

        fval = -fval
        if X_batch is not None:
            h_vals = self._hammer_function(x, X_batch, r_x0, s_x0)
            fval += -h_vals.sum(axis=-1)
        return fval
1370678
def softmax(attrs, inputs, proto_obj):
    """"""
    if 'axis' not in attrs:
        attrs = translation_utils._add_extra_attributes(attrs, {'axis': 1})
    return 'softmax', attrs, inputs
875859
def max(self, default=None):
        
        return numpy.asscalar(numpy.max(self.values)) if self.values else default
758784
def p_max_assignment(self, t):
    ''''''
    self.accu.add(Term('ismax', [self.name,"gen(\""+t[1]+"\")"]))
133690
def _compute_softmax(scores):
    """"""
    if not scores:
        return []

    max_score = None
    for score in scores:
        if max_score is None or score > max_score:
            max_score = score

    exp_scores = []
    total_sum = 0.0
    for score in scores:
        x = math.exp(score - max_score)
        exp_scores.append(x)
        total_sum += x

    probs = []
    for score in exp_scores:
        probs.append(score / total_sum)
    return probs
248139
def ExtValueMax(mu, sigma, tag=None):
    
    assert sigma > 0, 'ExtremeValueMax "sigma" must be greater than zero'
    p = U(0, 1)._mcpts[:]
    return UncertainFunction(mu - sigma * np.log(-np.log(p)), tag=tag)
565840
def softmax(w)
	    e = Numo::NMath.exp(w - (w.max))
	    dist = e / (e.sum)
	    return dist
	end
679417
def _get_min_max_value(min, max, value=None, step=None):
    """"""
    # Either min and max need to be given, or value needs to be given
    if value is None:
        if min is None or max is None:
            raise ValueError('unable to infer range, value from: ({0}, {1}, {2})'.format(min, max, value))
        diff = max - min
        value = min + (diff / 2)
        # Ensure that value has the same type as diff
        if not isinstance(value, type(diff)):
            value = min + (diff // 2)
    else:  # value is not None
        if not isinstance(value, Real):
            raise TypeError('expected a real number, got: %r' % value)
        # Infer min/max from value
        if value == 0:
            # This gives (0, 1) of the correct type
            vrange = (value, value + 1)
        elif value > 0:
            vrange = (-value, 3*value)
        else:
            vrange = (3*value, -value)
        if min is None:
            min = vrange[0]
        if max is None:
            max = vrange[1]
    if step is not None:
        # ensure value is on a step
        tick = int((value - min) / step)
        value = min + tick * step
    if not min <= value <= max:
        raise ValueError('value must be between min and max (min={0}, value={1}, max={2})'.format(min, value, max))
    return min, max, value
265507
private int getMaximum() {
		int max = 0;
		for (int x = 0; x <= T.length - 1; x++) {
			if (T[x] > max) max = T[x];
			if (A[x] > max) max = A[x];
			if (C[x] > max) max = C[x];
			if (G[x] > max) max = G[x];
		}
		return max;
	}
758350
public static float max(float[] x) {
        float m = Float.NEGATIVE_INFINITY;

        for (float n : x) {
            if (n > m) {
                m = n;
            }
        }

        return m;
    }
434507
def map(value, v_min, v_max, d_min, d_max)
      v_value = value.to_f # so it returns float

      v_range = v_max - v_min
      d_range = d_max - d_min
      (v_value - v_min) * d_range / v_range + d_min
    end
845291
def optimize(self, x0, target):
        """"""
        x = x0
        for _ in range(self.maxiter):
            delta = np.linalg.solve(self.h(x, target), -self.g(x, target))
            x = x + delta
            if np.linalg.norm(delta) < self.tol:
                break
        return x
282277
def _compute(self):
        """"""
        if self.xvals:
            if self.xrange:
                x_adapter = reduce(compose, self._x_adapters) if getattr(
                    self, '_x_adapters', None
                ) else ident

                xmin = x_adapter(self.xrange[0])
                xmax = x_adapter(self.xrange[1])

            else:
                xmin = min(self.xvals)
                xmax = max(self.xvals)
            xrng = (xmax - xmin)
        else:
            xrng = None

        if self.yvals:
            ymin = self._min
            ymax = self._max

            if self.include_x_axis:
                ymin = min(ymin or 0, 0)
                ymax = max(ymax or 0, 0)

            yrng = (ymax - ymin)
        else:
            yrng = None

        for serie in self.all_series:
            serie.points = serie.values
            if self.interpolate:
                vals = list(
                    zip(
                        *sorted(
                            filter(lambda t: None not in t, serie.points),
                            key=lambda x: x[0]
                        )
                    )
                )
                serie.interpolated = self._interpolate(vals[0], vals[1])

        if self.interpolate:
            self.xvals = [
                val[0] for serie in self.all_series
                for val in serie.interpolated
            ]
            self.yvals = [
                val[1] for serie in self.series for val in serie.interpolated
            ]
            if self.xvals:
                xmin = min(self.xvals)
                xmax = max(self.xvals)
                xrng = (xmax - xmin)
            else:
                xrng = None

        # these values can also be 0 (zero), so testing explicitly for None
        if xrng is not None:
            self._box.xmin, self._box.xmax = xmin, xmax

        if yrng is not None:
            self._box.ymin, self._box.ymax = ymin, ymax
29973
@Pure
	public static float max(float... values) {
		if (values == null || values.length == 0) {
			return Float.NaN;
		}
		float max = values[0];
		for (final float v : values) {
			if (v > max) {
				max = v;
			}
		}
		return max;
	}