- ago
Is it possible to load external encog networks or build networks programmatically and load external calculated weights?

Load external network does not work:

CODE:
public override void BacktestBegin() {          base.BacktestBegin();                    string path = @"C:\Users\richa\Documents\Screener\superbull_modelEncogFirstTry.eg";          BasicNetwork loadadNetwork = (BasicNetwork)EncogDirectoryPersistence.LoadObject(new FileInfo(path));           }


Causes this errors:
Compiled at 04.06.2026 19:46:20
457: Der Typ "Object" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" hinzu.
457: Der Typ "FileInfo" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" hinzu.
457: Der Typ "Stream" ist in einer nicht referenzierten Assembly definiert. Fügen Sie einen Verweis auf die Assembly "mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" hinzu.

I tried a workaround to build the desired network programmatically and add the external calculated weights. But building the network with the following code is also not possible:

CODE:
public override void BacktestBegin() {          base.BacktestBegin();          //create encog network          BasicNetwork network = new BasicNetwork();          // Input layer: 7 Inputs          int t = network.LayerCount;          // Hidden layer: 8 Neuronen ()          network.AddLayer(new BasicLayer(new ActivationSigmoid(), true, 8));          // Output layer: 2 Outputs ()          network.AddLayer(new BasicLayer(new ActivationSigmoid(), false, 2));          network.Structure.FinalizeStructure();                       //load weights }
0
19
1 Replies

Reply

Bookmark

Sort
- ago
#1
You have a missing "using" statement. Show us all your "using" statements in your code. It should look something like this along with the WL assemblies (not shown):

CODE:
using System; using ConsoleExamples.Examples; using Encog.Engine.Network.Activation; using Encog.ML.Data; using Encog.ML.Data.Basic; using Encog.ML.Train; using Encog.Neural.Networks; using Encog.Neural.Networks.Layers; using Encog.Neural.Networks.Training.Propagation.Back; using Encog.Neural.Networks.Training.Propagation.Resilient;

This is more of an encog question than a WealthLab question. Their forum may be able to help you better. I'm not sure anyone on the WL forum is using encog. https://github.com/jeffheaton/encog-dotnet-core
0

Reply

Bookmark

Sort