Libraries: ALGLIB - Numerical Analysis Library - page 2

 
When I wrote my article, I used ALGLIB. I even managed to ask the author of the library on the forum something that I did not understand at that time. The author was very kind and answered me in detail. For what to him a special respect and respect. I am glad that Bochkanov S.A.'s work was noticed by MQ Co....
 
Very excited about the arrival of this library. Thank you!
 
MQ beauties! Serious work!

An example of using the library is teaching the MLP neural network the multiplication table.

#include <Math\Alglib\dataanalysis.mqh>
//+------------------------------------------------------------------+
#define _rand(min,max) ((rand()/(double)SHORT_MAX)*((max)-(min))+min)
//+------------------------------------------------------------------+
void OnStart()
{
   CMultilayerPerceptron net;
   CMLPReport rep;
   CMatrixDouble patterns;
   double vector[2], out[1];
   int info;
   // data preparation
   patterns.Resize(100,3);
   int m=0;     // first pattern
   for(int i=1; i<=10; i++)
      for(int j=1; j<=10; j++)
      {
         patterns[m].Set(0,i/10.0);       // input 1
         patterns[m].Set(1,j/10.0);       // input 2
         patterns[m].Set(2,(i*j)/100.0);  // target
         m++; //next pattern
      }
   // creating a network with one hidden layer(5 neurons)
   CMLPBase::MLPCreate1(2,5,1,net);
   // network training
   CMLPTrain::MLPTrainLM(net,patterns,100,1 e-3,5,info,rep);     //Levenberg-Marquardt
   //CMLPTrain::MLPTrainLBFGS(net,paterns,100,1e-3,10,0.001,1000,info,rep);//L-BFGS
   Print("Info=",info,"  Error=",CMLPBase::MLPError(net,patterns,100)); 
   // check the network on integer data
   string s="Test 1 >> ";
   for(int i=1; i<=10; i++)
   {
      int d1=(int)_rand(1,10), d2=(int)_rand(1,10);
      vector[0]=d1/10.0;
      vector[1]=d2/10.0;
      CMLPBase::MLPProcess(net,vector,out);
      s+=(string)d1+"*"+(string)d2+"="+DoubleToString(out[0]*100,0)+" // ";
   }
   Print(s);
   // check the network on fractional data
   s="Test 2 >> ";
   for(int i=1; i<=5; i++)
   {
      double d1=NormalizeDouble(_rand(1,10),1), d2=NormalizeDouble(_rand(1,10),1);
      vector[0]=d1/10.0;
      vector[1]=d2/10.0;
      CMLPBase::MLPProcess(net,vector,out);
      s+=DoubleToString(d1,1)+"*"+DoubleToString(d2,1)+"="+DoubleToString(out[0]*100,2)+
         "("+DoubleToString(d1*d2,2)+") // ";
   }
   Print(s);
}
2012.10.13 12:44:31     Test_MLP(Alglib) (EURUSD,M30)   Info=2  Error=0.0005349624857861839
2012.10.13 12:44:31     Test_MLP(Alglib) (EURUSD,M30)   Тест 1 >> 3*6=18 // 1*1=0 // 7*8=56 // 1*5=5 // 4*6=24 // 7*6=42 // 8*2=16 // 1*5=5 // 3*2=6 // 6*7=42 // 
2012.10.13 12:44:31     Test_MLP(Alglib) (EURUSD,M30)   Тест 2 >> 6.3*8.2=51.83(51.66) // 7.0*8.1=57.04(56.70) // 9.0*8.1=73.36(72.90) // 4.1*9.6=39.05(39.36) // 6.3*8.8=55.63(55.44) // 

:( I'm afraid to think what will happen to the cloud when users start actively using the library in their experts.
This simple script weighs under a megabyte.
Files:
 
Yurich: An example of using the library is teaching the MLP neural network the multiplication table.

where did you get this example? ))))))))))))))

thanks, I was just going to study the same example for myself, but can you find out whose code for teaching the multiplication table is faster, yours https://www.mql5.com/en/code/596 or the ported ALGLIB ?

 
Thanks for the novelty.
The breakthrough will be the implementation using OpenCL.

Except that Metaquotes will die young when implementing this project.

Is full support for this library planned?

If yes, can it be supplied in binary form?

If you deliver it in binary form, it's time to add a tick in Terminal settings "Allow MetaQuotes DLL call" :0)

 
Only 11 mqh files are uploaded via MetaEditor
 

Hello,

I need to find eigenvalues of below matrix:


2   3    2

10  3   4

3    6   1


how can I apply this library on this matrix? (non-symmetric matrix)

 

Thank you very, very much for this great article and the attached code! This will surely be the main tool for my planned MQL5 codes, and prevents me from going the C++-to-DLL-to-MQL5 way.

 

Regarding the previous question: there is a function named "NonSymmetricEVD" in the linalg.mqh file, which is not referenced in the text. Simply use this routine.

 

Best, David 

 

I have a further question: the newest version of the alglib seems to be 3.8.2., whereas according to the text the ported version is 3.5.0.

 

Are there plans for updating the ported code?

 

Thanks in advance,

David 

 
The source could be updated to the latest version 3.8.2.