Machine learning in trading: theory, models, practice and algo-trading - page 2312

 
elibrarius:
Seen it. That's not it. It just rewrote the 3x3 matrix into variables. But the new component vectors are not calculated.
The result is to get 6 rows for each component (according to this example).

I really lost and do not remember... there was a version of the bot on pca, if I find it, I'll post it later

 
Maxim Dmitrievsky:

Really lost and do not remember... there was a version of the bot on pca, if I find it later I will send it to you

Search for the word PCABuildBasis on the whole disk may help) If the file is not deleted.
 
elibrarius:
Searching for the word PCABuildBasis throughout the disk may help) If the file is not deleted.

everything in the cloud in the archives is old

here is a piece of code with pca or lda (the second one is commented out)

//+------------------------------------------------------------------+
//|Use LDA for inputs transforming                                   |
//+------------------------------------------------------------------+
CRLAgent::PCApermutation(void) {                                         
 int inf;    
 double s2s[];            
 //CLDA::FisherLDAN(RDFPM,RDFPM.Size(),features,2,inf,LDAmatrix); 
 CPCAnalysis::PCABuildBasis(RDFPM,RDFPM.Size(),features,inf,s2s,LDAmatrix);  
 RDFPMPCA.Resize(RDFPM.Size(),this.features+2);  
 ArrayResize(PCAarr,features*features);
   
 int ldaind=0;
 for(int f=0;f<this.features;f++)
  for(int i=0;i<this.features;i++) {
   PCAarr[ldaind] = LDAmatrix[i][f];
   ldaind++; }
   
 for(int s=0; s<this.features; s++) {
  for(int i=0;i<RDFPMPCA.Size();i++) {
   double feach = 0;
   for(int f=0;f<this.features;f++)
    feach+=RDFPM[i][f]*LDAmatrix[f][s];   
    RDFPMPCA[i].Set(s,feach);
    RDFPMPCA[i].Set(this.features,RDFPM[i][this.features]);
    RDFPMPCA[i].Set(this.features+1,RDFPM[i][this.features+1]); } }                      
  CDForest::DFBuildRandomDecisionForest(RDFPMPCA,RDFPMPCA.Size(),this.features,2,trees,r,RDFinfo,RDF,RDF_report);
  RDF_report.m_oobrelclserror = CDForest::DFRelClsError(RDF,RDFPMPCA,RDFPMPCA.Size());
 
 ArrayResize(permutated,this.features);
 double buypass[]; ArrayResize(buypass,RDFPMPCA.Size());
 for(int s=0; s<this.features; s++) {
  for(int i=0;i<RDFPMPCA.Size();i++) {  
   buypass[i] = RDFPMPCA[i][s];
   RDFPMPCA[i].Set(s,rand()/32767.0); } 
  permutated[s][1] = s; double err = CDForest::DFRelClsError(RDF,RDFPMPCA,RDFPMPCA.Size()); if(err == 0.0) err = 0.001;
  permutated[s][0] = RDF_report.m_oobrelclserror / err; 
  for(int i=0;i<RDFPMPCA.Size();i++) RDFPMPCA[i].Set(s,buypass[i]); }
   
 ArraySort(permutated); ArrayResize(permutated,this.bf_n); 
 RDFPM.Resize(RDFPMPCA.Size(),this.bf_n+2);
  
 for(int s=0; s<this.bf_n; s++) {
  for(int i=0;i<RDFPMPCA.Size();i++) {   
   RDFPM[i].Set(s,RDFPMPCA[i][(int)permutated[s][1]]);
   RDFPM[i].Set(bf_n,RDFPMPCA[i][this.features]);
   RDFPM[i].Set(bf_n+1,RDFPMPCA[i][this.features+1]); } } 
 CDForest::DFBuildRandomDecisionForest(RDFPM,RDFPM.Size(),this.bf_n,2,trees,r,RDFinfo,RDF,RDF_report); }
 

Here's more

//+------------------------------------------------------------------+
//|Use LDA for inputs transforming                                   |
//+------------------------------------------------------------------+
CRLAgent::LDA(void) {                                        
   CDecisionForest   mRDF;                                                  
   CDFReport         mRep;   
   int inf;    
   double s2s[];            
   //CLDA::FisherLDAN(RDFpolicyMatrix,RDFpolicyMatrix.Size(),features,2,inf,LDAmatrix); 
   CPCAnalysis::PCABuildBasis(RDFpolicyMatrix,RDFpolicyMatrix.Size(),features,inf,s2s,LDAmatrix);
   
   
   RDFpolicyMatrix2.Resize(RDFpolicyMatrix.Size(),bestfeatures_num+2);
   
   ArrayResize(LDAarr,features*features);
   
   int ldaind=0;
   for(int f=0;f<this.features;f++)
     for(int i=0;i<this.features;i++){
       LDAarr[ldaind] = LDAmatrix[i][f];
       ldaind++;
      }
   
   for(int s=0; s<this.bestfeatures_num; s++) {
     for(int i=0;i<RDFpolicyMatrix.Size();i++) {
       double feach = 0;
       for(int f=0;f<this.features;f++)
         {
          feach+=RDFpolicyMatrix[i][f]*LDAmatrix[f][s];
         }
        RDFpolicyMatrix2[i].Set(s,feach);
        RDFpolicyMatrix2[i].Set(bestfeatures_num,RDFpolicyMatrix[i][this.features]);
        RDFpolicyMatrix2[i].Set(bestfeatures_num+1,RDFpolicyMatrix[i][this.features+1]);
       }
    }
                        
  CDForest::DFBuildRandomDecisionForest(RDFpolicyMatrix2,RDFpolicyMatrix2.Size(),bestfeatures_num,2,trees,r,RDFinfo,RDF,RDF_report);
 }
 

Thanks, I'll look into it.

 
elibrarius:

Thanks, I'll look into it.

it's kind of like. The signs are multiplied by the coefficients of the vectors

then the forest is trained on the components

for(int s=0; s<this.bestfeatures_num; s++) {
     for(int i=0;i<RDFpolicyMatrix.Size();i++) {
       double feach = 0;
       for(int f=0;f<this.features;f++)
         {
          feach+=RDFpolicyMatrix[i][f]*LDAmatrix[f][s];
         }
        RDFpolicyMatrix2[i].Set(s,feach);
        RDFpolicyMatrix2[i].Set(bestfeatures_num,RDFpolicyMatrix[i][this.features]);
        RDFpolicyMatrix2[i].Set(bestfeatures_num+1,RDFpolicyMatrix[i][this.features+1]);
       }
    }
 
Ludwig has deep learning models without having to write code, no programming skills required to teach the model:https://ludwig-ai.github.io/ludwig-docs/
Ludwig - code-free deep learning toolbox
Ludwig - code-free deep learning toolbox
  • ludwig-ai.github.io
Ludwig is a toolbox for training and testing deep learning models without writing code
 
Maxim Dmitrievsky:

like this. Traits are multiplied by vector coefficients

for(int s=0; s<this.bestfeatures_num; s++) {
     for(int i=0;i<RDFpolicyMatrix.Size();i++) {
       double feach = 0;
       for(int f=0;f<this.features;f++)
         {
          feach+=RDFpolicyMatrix[i][f]*LDAmatrix[f][s];
         }
        RDFpolicyMatrix2[i].Set(s,feach);
        RDFpolicyMatrix2[i].Set(bestfeatures_num,RDFpolicyMatrix[i][this.features]);
        RDFpolicyMatrix2[i].Set(bestfeatures_num+1,RDFpolicyMatrix[i][this.features+1]);
       }
    }

then the forest is trained on the components

1) I don't quite understand the point. Instead of 100 columns of raw data, we should have fed 100 columns of principal components that have lost some information.
Instead of 100 columns of input data, you should feed 10-20 principal components. Then the loss of information will be compensated by the speed of training.


2) I still haven't found out how to make 10 columns per 1000 rows of GC from 100 columns per 1000 rows.
We need to generate 1000 rows from the first 10 components. The matrix with components will be 100x100.

Индикаторы: Portfolio Optimizer
Индикаторы: Portfolio Optimizer
  • 2018.12.01
  • www.mql5.com
Portfolio Optimizer: Автор: transcendreamer...
 
elibrarius:

1) The meaning is not quite clear. Instead of 100 columns of raw data, we fed 100 columns of principal components, in which some information is lost .
You should have fed 10-20 principal components instead of 100 original data, then the loss of information is compensated by the speed of training.

))))

If you feed 100 components out of 100 traits, then the percentage of information loss is 0.0%.

You might want to study theory.)

 
mytarmailS:

))))

If a hundred signs make a hundred components, the percentage of information loss is 0.0%.

you should study the theory))

In theory, I guess so.
But still, what is the point of the action? If there is no gain in speed, but rather a slowdown, for an extra operation.
We need to get 10 out of 100. Is there a solution?
Reason: