//reset the ANN public void resetNetwork() { if (_bat.OpMode == NeuralNetworkDataAdapter.OperationMode.Learn) { _netI = new BatchNetworkTrainer(_bat.Conditioner, (TrainingExample[])_bat.Instances); _netI.finishedProcessingEvent += finishedProcessing; } }
//new a network interface, classify or train public void initNetworkAdapter(string fileName) { //set current working directory to the directory where the descriptor file is Directory.SetCurrentDirectory(fileName.Substring(0, fileName.LastIndexOf("\\"))); //these options will become further differentiated once more data source //adaptors have bben implemented BatchNetworkAdapter bna = new TabNetworkAdapter(fileName); if (bna.OpMode == NeuralNetworkDataAdapter.OperationMode.Validate) { _batchValidator = bna; if(_bat != null) _netI = new BatchNetworkTrainer(_bat.Conditioner, (TrainingExample[])_bat.Instances , (TrainingExample[])_batchValidator.Instances); } else { _bat = bna; if (_bat.OpMode == NeuralNetworkDataAdapter.OperationMode.Learn) _netI = new BatchNetworkTrainer(_bat.Conditioner, (TrainingExample[])_bat.Instances); else { _netI = new BatchClassifier(_bat.Conditioner, _bat.Instances); } } //subscribe to the finished processing event in the network interface if (_netI != null && _netI.finishedProcessingEvent == null) _netI.finishedProcessingEvent += finishedProcessing; }