Discussion of article "Neural networks made easy (Part 17): Dimensionality reduction" - page 2

 

Hi Dmitriy


This error is occurring when i try to compile the EA code 


cannot convert type 'bool' to type 'matrix' pca.mqh 241 13

this error points here:


bool CPCA::Study(matrix &data)

  {

   matrix X;

   ulong total = data.Rows();

   if(!X.Init(total, data.Cols()))

      return false;

   v_Means = data.Mean(0);

   v_STDs = data.Std(0) + 1e-8;

   for(ulong i = 0; i < total; i++)

     {

      vector temp = data.Row(i) - v_Means;

      temp /= v_STDs;

      X = X.Row(temp, i); <<<<<<<<<<<<<<<<<<<<<<<< Line with error

     }


Thanks for help

Rogerio

 
MrRogerioNeri #:

Hi Dmitriy


This error is occurring when i try to compile the EA code 


cannot convert type 'bool' to type 'matrix' pca.mqh 241 13

this error points here:


bool CPCA::Study(matrix &data)

  {

   matrix X;

   ulong total = data.Rows();

   if(!X.Init(total, data.Cols()))

      return false;

   v_Means = data.Mean(0);

   v_STDs = data.Std(0) + 1e-8;

   for(ulong i = 0; i < total; i++)

     {

      vector temp = data.Row(i) - v_Means;

      temp /= v_STDs;

      X = X.Row(temp, i); <<<<<<<<<<<<<<<<<<<<<<<< Line with error

     }


Thanks for help

Rogerio

Hello Rogerio.

Replace  X = X.Row(temp, i); to

if(!X.Row(temp, i))
   return false;
 

when compiling it generates 2 errors. code fragment

p217 for(ulong r=0; r<total; r++)

218 {

219 vector temp = data.Row(r)- v_Means;

220 temp / = v_STDs;

221 result=result.Row(temp,r);

compilation error at line 221 - cannot convert type 'bool' to type 'matrix'

line 241 X = X.Row(temp,i); same error


How to fix it? Can anyone hint? I think I need to look at the code a bit higher, but I don't have enough knowledge to figure it out.

I'm still an expert!

 
ne86.mo compilation error in line 221 - cannot convert type 'bool' to type 'matrix'

line 241 X = X.Row(temp,i); same error


How to fix it? Can anyone hint? I think you should look at the code above, but I don't have enough knowledge to figure it out.

I'm still an expert!

You don't need to assign. In current builds, the vector is written directly to the matrix, and the logical result of the operation is returned.

for(ulong r = 0; r < total; r++)
     {
      vectorf temp = data.Row(r) - v_Means;
      temp /= v_STDs;
      result.Row(temp, r);
     }
 

DMITRY!!! congratulate you on our national holiday RUSSIA DAY !!!! Health ! Success and good luck in all your endeavours !!! Merry and

happy weekend with family and friends !!!!

Advice ! Should I continue to master the topic : "teaching NS without a teacher" with my hardware.

Processor i7 processor 3.5 ghertz, RAM 8 GB, vidiokarta Nvidio 2060 c 8 GB.

In article 15 everything compiles fine but kmeans advisor does not work.

It writes Create data : 10000 of 10040 and everything stops.

nothing intelligible is written in the log : " execution error 0 ".

in MT5 set 250000 bar in the window

The Expert Advisor was run on real trading "Sberbank" - 6min.

The cycle "training with a teacher" on the same data passed in general asleep, but here I stumbled!