Is it possible to load external encog networks or build networks programmatically and load external calculated weights?
Load external network does not work:
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:
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 }
Rename
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):
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
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
Currently I am using these statements:
Maybe it's possible to load the network via the "Deep Learning Engine API"? I will play...
CODE:
using WealthLab.Backtest; using System; using WealthLab.Core; using WealthLab.Data; using WealthLab.Indicators; using System.Collections.Generic; using System.Linq; using MathNet.Numerics.Statistics; using System.Windows.Documents; using Newtonsoft.Json; using WLEncog.Persist; using WLEncog.Neural.Networks; using WLEncog.Neural.Networks.Layers; using WLEncog.Engine.Network.Activation; using System.IO; using WealthLab.DeepLearning; using WealthLab.DeepLearning.CoreClasses;
Maybe it's possible to load the network via the "Deep Learning Engine API"? I will play...
Use an AI to help you with the problem. I asked Copilot about your error, and it gave a lengthy answer indicating the compiler is seeing two different definitions of System.Object. So, you may have some assembly references colliding. In any case, here is what I asked Copilot...
Here is a part of the response given by Copilot:
QUOTE:
The following error occurs (albeit translated from German to English): 457: The type 'Object' is defined in an unreferenced assembly. Add a reference to the assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'." here.
Is this possibly an assembly reference collision?
Here is a part of the response given by Copilot:
QUOTE:
The compiler encountered a type (like System.Object) that comes from mscorlib 4.0.0.0.
But your project is not referencing that version of mscorlib.
Or something in your project references a different mscorlib, causing a conflict.
Since System.Object is the root of everything in .NET, this error only appears when something is seriously mismatched.
QUOTE:
I am using these statements:
Yes, but according to the error messages in your original post, the WL editor is not finding these assemblies you're calling out in the using statements.
Did you install the external encog framework in the WL install directory and tell the WL editor where they are using the "Assembly References" menu as shown in the screenshot?
Somewhat off topic, but I don't like your approach. My policy is to never mix foreign data types (like BasicNetwork) in a WL strategy. Instead, I build separate custom libraries (DLLs) that call external frameworks that interface with WL strategies with only WL data types exposed. Then I never have the problem you are having in the first place. That keeps my WL main strategy simpler and cleaner.
Your Response
Post
Edit Post
Login is required