アットウィキロゴ

kuentio

package nn3;
 
public class pro {
 
    double[] y=new double[500];
 double[][] x=new double[500][4];
   int datanumber,number;
  double alpha;
     double[] beta=new double[500];
 
   double[] ys=new double[500];
 
    public static void main(String[] args) {
        pro t=new pro();
    }
    pro(){
 
 
String str="";
str=str+"1,22,28,146,34,";
str=str+"2,36,46,169,57,";
str=str+"3,24,39,160,48,";
str=str+"4,22,25,156,38,";
str=str+"5,27,34,161,47,";
str=str+"6,29,29,168,50,";
str=str+"7,26,38,154,54,";
str=str+"8,23,23,153,40,";
str=str+"9,31,42,160,62,";
str=str+"10,24,27,152,39,";
str=str+"11,23,35,155,46,";
str=str+"12,27,39,154,54,";
str=str+"13,31,38,157,57,";
str=str+"14,25,32,162,53,";
str=str+"15,23,25,142,32";
 
int s;
String[] x5=str.split(",");
int s1=1;
int s2=0;
for(s=0;s<x5.length;s++){
s2=s2+1;
if(s2>5)s1=s1+1;
if(s2>5)s2=1;
int n=num_int(x5[s]);
if(s2==3)x[s1][1]=n;
if(s2==4)x[s1][2]=n;
if(s2==5)x[s1][3]=n;
if(s2==2)ys[s1]=n;
 
}
 
datanumber=s1;
 
System.out.println(datanumber);
 
number=3;
 
 
        for(s=1;s<datanumber+1;s++){
      y[s]=0;
      if(ys[s]>24)y[s]=1;  
        }
 
 
 
 
 
 
 
         faststep sub=new faststep();
         sub.number=number;
         sub.datanumber=datanumber;
         sub.x=x;
         sub.y=y;
         sub.makedata();
         alpha=sub.alpha;
         beta=sub.beta;
 
 
         oprimal sub2=new oprimal();
         sub2.number=number;
         sub2.datanumber=datanumber;
         sub2.x=x;
         sub2.y=y;
         sub2.alpha=alpha;
         sub2.beta=beta;
         sub2.makedata();
         alpha=sub2.alpha;
         beta=sub2.beta;
 
         int sx;
         for(s=1;s<datanumber+1;s++){
         double x1=alpha;
         for(sx=1;sx<number+1;sx++){
         x1=x1+beta[sx]*x[s][sx];    
         }
         double f1=1/(1+Math.exp(-x1));
         System.out.println(y[s]+","+f1);
         }
 
 
 
 
    }
 
 
      int num_int(String str){
 
    int nx;
 
    nx=0;
 
 try{
 
    nx=Integer.parseInt(str);
 
 }catch (Exception e) {}
 
 return nx;
 
 
 
}
 
}
 
最終更新:2016年12月25日 16:04