/// <summary> /// Constructs a new AnnDialog. /// </summary> public AnnDialog(ref Klu Klu) { InitializeComponent(); _Klu = Klu; #region Initialize ANN stuff _ANN = new ANN(); _ANN.NumLayers = 3; _ANN.SetNumNeurons(0, 38); _ANN.SetNumNeurons(1, 6); _ANN.SetNumNeurons(2, 7); // Bind certain labels to ANN stuff AnnNumLayers.DataContext = _ANN; // Bind DataGrid to ANN-DataSet now _DataSet = new DataSet("HiddenLayer"); _DataSet.Tables.Add("HiddenLayerTable"); uint tmp = 0; _DataSet.Tables[0].Columns.Add("Neurons", tmp.GetType()); tmp = 6; _DataSet.Tables[0].Rows.Add(tmp); HiddenLayerDataGrid.DataContext = _DataSet.Tables[0]; #endregion }
/// <summary> /// Create a neural network using the given parameters and saves it as a reusable /// OpenCV XML file to the desired "filepath". /// </summary> /// <param name="numNeuronsPerLayer"></param> /// <param name="activationFunction"></param> /// <param name="filepath"></param> /// <returns>true if successful; otherwise false</returns> public bool CreateAndSaveAnn(int[] numNeuronsPerLayer, ANN.ActivationFunction activationFunction, double alpha, double beta, string filepath) { int res = klu_createAndSaveAnn(numNeuronsPerLayer, numNeuronsPerLayer.Count(), (int)activationFunction, alpha, beta, filepath); return res == 1; }
public TrainingDialog(ref TrainingDataSet dataSet) { InitializeComponent(); _BackgroundWorker = new BackgroundWorker(); _BackgroundWorker.WorkerReportsProgress = true; _BackgroundWorker.WorkerSupportsCancellation = true; _BackgroundWorker.DoWork += new DoWorkEventHandler(DoWork); _BackgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RunWorkerCompleted); _BackgroundWorker.ProgressChanged += new ProgressChangedEventHandler(ProgressChanged); _DataSet = dataSet; _Chart = new Chart(); windowsFormsHost1.Child = _Chart; _Series = 0; StopButton.IsEnabled = false; _Network = new ActivationNetwork( new SigmoidFunction(), _NumInputNeurons, 9, _NumOutputNeurons ); #region Initialize ANN stuff _ANN = new ANN(); _ANN.NumLayers = 3; _ANN.SetNumNeurons(0, _NumInputNeurons); _ANN.SetNumNeurons(1, 9); _ANN.SetNumNeurons(2, _NumOutputNeurons); // Bind DataGrid to ANN-DataSet now _DataSetANN = new DataSet("HiddenLayer"); _DataSetANN.Tables.Add("HiddenLayerTable"); uint tmp = 9; _DataSetANN.Tables[0].Columns.Add("Neurons", tmp.GetType()); _DataSetANN.Tables[0].Rows.Add(tmp); HiddenLayerDataGrid.DataContext = _DataSetANN.Tables[0]; #endregion }