protected void Button2_Click(object sender, EventArgs e)
{
MLApp.MLAppClass matLab = new MLAppClass();
double[,] TrainIn = new double[7, 10] { { 0, 0.3915, 0.2835, 0.6210, 0.4185, 0.2160, 0.9990, 0.5805, 0.0810, 0.3915 }, { 0, 0.4741, 0.5402, 1.0000, 0.4183, 0.4948, 0.0383, 0.4925, 0.0692, 0.1230 }, { 0.6200, 0.7700, 0.6800, 0.6300, 0.6700, 0.7100, 0.7500, 0.7100, 0.7600, 0.9800 }, { 0, 0.5000, 0, 1.0000, 0.5000, 0, 0.5000, 0, 0, 0.5000 }, {0,0.5000,0.5000,0.5000,0,0,1.0000,0,0,0 }, {0,1.0000,1.0000,1.0000,1.0000,1.0000,1.0000,0 , 0 , 0 }, { 0,0.3158,0.3158,1.0000,0.7368,0.2632,0.9474,0.3684,0.0526,0.8974} };
double[,] TrainOut = new double[1, 10] { { 0, 0.5313, 0.5938, 0.9375, 0.4375, 0.5000, 1.0000, 0.3750, 0.3125, 0.6563 } };
double[,] piIn=new double[7,10] {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0,0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, {0,0,0,0,0,0,0,0,0,0 }, {0,0,0,0,0,0,0,0 , 0 , 0 }, { 0,0,0,0,0,0,0,0,0,0}};
double[,] piOut = new double[1, 10] { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };
double[,] TestIn = new double[7,7] { {0.0270, 0.1755, 0.4320, 0.4995, 0.6885, 0.5400, 0.1620 }, { 0.0742, 0.3667, 0.3790, 0.4347, 0.5842, 0.8038, 0.2565 }, { 0.6200, 0.7700, 0.6800, 0.6300, 0.6700, 0.7100, 0.7500 }, { 0, 0, 0.5000, 0, 0.5000, 0.5000, 0 }, { 0, 0.5000, 0, 0, 35.0000, 0.5000, 0 }, { 0, 1.0000, 1.0000, 1.0000, 1.000, 1.0000, 1.0000 }, { 0.2105, 0.7368, 0.2632, 0.6842, 0.4211, 0.5789, 0.4737 } };
double[,] piTest = new double[7,7] { { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, 0 } };
Array dr = new double[1, 7];
Array pi = new double[1, 7];
double[,] par = new double[1, 4] { { 15, 1, 2000, 0.0001 } };
double[,] pipar = new double[1, 4] { { 0, 0, 0, 0 } };
matLab.PutFullMatrix("a", "base", TrainIn, piIn);
matLab.PutFullMatrix("b", "base", TrainOut, piOut);
matLab.PutFullMatrix("c", "base", TestIn, piTest);
matLab.PutFullMatrix("d","base",par,pipar);
matLab.Execute(@"[Result]=BpNeuralNet(a,b,c,d)");
matLab.GetFullMatrix("Result", "base", ref dr, ref pi);
matLab.MinimizeCommandWindow();
matLab.Quit();
foreach (double i in dr)
{
Label1.Text+=i+",";
}
}
2009-3-27 15:37 上传
点击文件名下载附件
975 Bytes, 下载次数: 3652
BpNeuralNet.m