Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
## declare variable private double[][] input; private double[][] ideal; private BasicNeuralDataSet dataset; private BasicNetwork network; ## load variable public void LoadNeuralNetwork() { this.network = new BasicNetwork(); this.network = LoadNET(networkTextBox.Text) as BasicNetwork; this.network.Name = "something"; this.network.Description = "something else"; } ## load function public static object LoadNET(string filename) { Stream s = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read); BinaryFormatter b = new BinaryFormatter(); object obj = b.Deserialize(s); s.Close(); return obj; } ## function where I try to use 'this.network' private void TrainNetworkHybrid() { if (network != null) { } this.dataset.Description = "not null"; this.dataset.Name = "something entirely differnt"; ITrain train = new ResilientPropagation(this.network, this.dataset); //this.network and this.dataset all have no null properties now double lastError = Double.MaxValue; int epoch = 1; do { train.Iteration(); //NullReferenceException happens here double error = train.Error; backgroundWorker1.ReportProgress(0, "Iteration(ResProp) #" + epoch + " Error:" + error); if (error > 0.05) { if (trainAnneal == true) { TrainNetworkAnneal(); trainAnneal = false; } } lastError = error; epoch++; } while (train.Error > MAX_ERROR && backgroundWorker1.CancellationPending == false && epoch < MAX_ITERATIONS); }
This paste will be private.
From the Design Piracy series on my blog: