private void button1_Click(object sender, EventArgs e) { this.textBox1.AppendText("正在训练中,请稍等......\n"); Application.DoEvents();//C#界面假死导致label不更新解决 DllInvoke dll = new DllInvoke(@"../../../../x64/Release/CreateDLL.dll"); svm_train train_svm_model = (svm_train)dll.Invoke("train_svm", typeof(svm_train)); if (train_svm_model() == 0) { this.textBox1.Text = ""; this.textBox1.AppendText("模型训练完成!\n"); this.textBox1.AppendText("\n"); this.textBox1.AppendText("测试结果如下:\n"); FileStream fs = new FileStream("svm_result.txt", FileMode.Open, FileAccess.ReadWrite); byte[] buff = new byte[1024]; int len = fs.Read(buff, 0, 1024); while (len > 0) { string s = Encoding.UTF8.GetString(buff, 0, len); this.textBox1.AppendText(s); len = fs.Read(buff, 0, 1024); } } }
private double _Z; //Z = ln(1/epsilon) #endregion Fields #region Constructors public svm_modelSelection() { Trainer = new svm_train(); StartX = 2E-5; StartY = 2E-15; StartZ = 2E-5; Interval = 10; Increment = 2; }
private double _Z; //Z = log2(epsilon) #endregion Fields #region Constructors public svm_modelSelection() { Trainer = new svm_train(); Log = true; StartX = Math.Pow(2, -6); StartY = Math.Pow(2, -7); StartZ = Math.Pow(2, -10); ArrX = new ArrayList(); ArrY = new ArrayList(); ArrZ = new ArrayList(); Interval = 7; Increment = Math.Pow(2, 2); }
public static void Main(System.String[] argv) { svm_train t = new svm_train(); t.run(argv); }