/** * sigmoid函数 * * @param value * @return */ public static float sigMoid(float value) { return (float) (1d / (1d + Math.exp(-value))); }
private static double toProb(Node n, double Z) { return Math.exp(n.alpha + n.beta - n.cost - Z); }
public double prob() { return Math.exp(-cost_ - Z_); }
public static double[] softmax(double[] scales) { double[] newScales = new double[scales.length]; double sum = 0; for (int i = 0; i < scales.length; i++) { newScales[i] = Math.exp(scales[i]); sum += newScales[i]; } for (int i = 0; i < scales.length; i++) { newScales[i] /= sum; } return newScales; }
@Override protected ExprEval eval(double param) { return ExprEval.of(Math.exp(param)); } }
@Override public void unLog() { super.unLog(); for (float[][] m : transition_probability2) { for (float[] v : m) { for (int i = 0; i < v.length; i++) { v[i] = (float) Math.exp(v[i]); } } } }
/** * Returns the probability for the given labels (indexed using classIndex), * where the last label corresponds to the label at the specified position. * For instance if you called prob(5, {1,2,3}) it will return the marginal * prob that the label at position 3 is 1, the label at position 4 is 2 and * the label at position 5 is 3. */ public double prob(int position, int[] labels) { return Math.exp(logProb(position, labels)); }
/** * returns the probability for the given labels, where the last label * corresponds to the label at the specified position. For instance if you * called logProb(5, {"O", "PER", "ORG"}) it will return the marginal prob * that the label at position 3 is "O", the label at position 4 is "PER" and * the label at position 5 is "ORG". */ public double prob(int position, E[] labels) { return Math.exp(logProb(position, labels)); }
public static double poisson(int x, double lambda) { if (x<0 || lambda<=0.0) throw new RuntimeException("Bad arguments: " + x + " and " + lambda); double p = (Math.exp(-lambda) * Math.pow(lambda, x)) / factorial(x); if (Double.isInfinite(p) || p<=0.0) throw new RuntimeException(Math.exp(-lambda) +" "+ Math.pow(lambda, x) + ' ' + factorial(x)); return p; }
static double randomPositiveDouble() { return Math.exp(randomDouble(6)); } }
private static Point tileXYToLatitudeLongitude(int tileX, int tileY, int zoomLevel) { long mapSize = mapSize(zoomLevel); double x = (clip(tileX * TILE_PIXELS, 0, mapSize) / mapSize) - 0.5; double y = 0.5 - (clip(tileY * TILE_PIXELS, 0, mapSize) / mapSize); double latitude = 90 - 360 * Math.atan(Math.exp(-y * 2 * Math.PI)) / Math.PI; double longitude = 360 * x; return new Point(longitude, latitude); }
public static DoubleValue exp( AnyValue in ) { if ( in instanceof NumberValue ) { return doubleValue( Math.exp( ((NumberValue) in).doubleValue() ) ); } else { throw needsNumbers( "exp()" ); } }
@Description("Euler's number raised to the given power") @ScalarFunction @SqlType(StandardTypes.DOUBLE) public static double exp(@SqlType(StandardTypes.DOUBLE) double num) { return Math.exp(num); }
@OutputFunction(StandardTypes.REAL) public static void output(@AggregationState LongAndDoubleState state, BlockBuilder out) { long count = state.getLong(); if (count == 0) { out.appendNull(); } else { REAL.writeLong(out, floatToRawIntBits((float) Math.exp(state.getDouble() / count))); } } }
public static <T> Counter<T> exp(Counter<T> c) { Counter<T> d = c.getFactory().create(); for (T t : c.keySet()) { d.setCount(t, Math.exp(c.getCount(t))); } return d; }
@OutputFunction(StandardTypes.DOUBLE) public static void output(@AggregationState LongAndDoubleState state, BlockBuilder out) { long count = state.getLong(); if (count == 0) { out.appendNull(); } else { DOUBLE.writeDouble(out, Math.exp(state.getDouble() / count)); } } }
double gprime(double lambdaP, int index) { double s = 0.0; for (int i = 0; i < p.functions.get(index).len(); i++) { int y = ((p.functions.get(index))).getY(i); int x = p.functions.get(index).getX(i); s = s + p.data.ptildeX(x) * pcond(y, x) * p.functions.get(index).getVal(i) * Math.exp(lambdaP * fnum(x, y)) * fnum(x, y); } return s; }