File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -5,16 +5,18 @@ const splitTestData = (
55  labels : CsvTable , 
66  splitTest : true  |  number 
77)  =>  { 
8-   const  length  = 
8+   const  dataLength  =  features . length ; 
9+   const  testLength  = 
910    typeof  splitTest  ===  'number' 
10-       ? Math . max ( 0 ,  Math . min ( splitTest ,  features . length   -   1 ) ) 
11+       ? Math . max ( 0 ,  Math . min ( splitTest ,  dataLength ) ) 
1112      : Math . floor ( features . length  /  2 ) ; 
13+   const  testStartIndex  =  dataLength  -  testLength ; 
1214
1315  return  { 
14-     testFeatures : features . slice ( length ) , 
15-     testLabels : labels . slice ( length ) , 
16-     features : features . slice ( 0 ,   length ) , 
17-     labels : labels . slice ( 0 ,   length ) , 
16+     features : features . slice ( 0 ,   testStartIndex ) , 
17+     labels : labels . slice ( 0 ,   testStartIndex ) , 
18+     testFeatures : features . slice ( testStartIndex ) , 
19+     testLabels : labels . slice ( testStartIndex ) , 
1820  } ; 
1921} ; 
2022
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments