//package com.nowjava;
/** 时代Java - N o w J a v a . c o m 提 供 **/
public class Main {
public static void main(String[] argv) throws Exception {
int index = 2;
double[] x = new double[] { 34.45, 35.45, 36.67, 37.78, 37.0000,
37.1234, 67.2344, 68.34534, 69.87700 };
System.out.println(softmax(index, x));
}
/**
* produces a double between 0 and 1 based on the given array x
* and the index that must be between (0 and x.length)
* For further information see also:
* http://www-ccs.ucsd.edu/matlab/toolbox/nnet/softmax.html
*/
public static double softmax(int index, double[] x) {
double sum = 0;
for (int i = 0; i < x.length; i++) {
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。