original_string: protected function fill_dataset(\core_analytics\local\time_splitting\base $timesplitting,
              array &$dataset, ?array $calculatedtarget = null) {
  
          $nranges = count($timesplitting->get_distinct_ranges());
  
          foreach ($dataset as $uniquesampleid => $unmodified) {
  
              list($analysersampleid, $rangeindex) = $timesplitting->infer_sample_info($uniquesampleid);
  
              // No need to add range features if this time splitting method only defines one time range.
              if ($nranges > 1) {
  
                  // 1 column for each range.
                  $timeindicators = array_fill(0, $nranges, 0);
  
                  $timeindicators[$rangeindex] = 1;
  
                  $dataset[$uniquesampleid] = array_merge($timeindicators, $dataset[$uniquesampleid]);
              }
  
              if ($calculatedtarget) {
                  // Add this sampleid's calculated target and the end.
                  $dataset[$uniquesampleid][] = $calculatedtarget[$analysersampleid];
  
              } else {
                  // Add this sampleid, it will be used to identify the prediction that comes back from
                  // the predictions processor.
                  array_unshift($dataset[$uniquesampleid], $uniquesampleid);
              }
          }
      }
code: protected function fill_dataset(\core_analytics\local\time_splitting\base $timesplitting,
              array &$dataset, ?array $calculatedtarget = null) {
  
          $nranges = count($timesplitting->get_distinct_ranges());
  
          foreach ($dataset as $uniquesampleid => $unmodified) {
  
              list($analysersampleid, $rangeindex) = $timesplitting->infer_sample_info($uniquesampleid);
  
              // No need to add range features if this time splitting method only defines one time range.
              if ($nranges > 1) {
  
                  // 1 column for each range.
                  $timeindicators = array_fill(0, $nranges, 0);
  
                  $timeindicators[$rangeindex] = 1;
  
                  $dataset[$uniquesampleid] = array_merge($timeindicators, $dataset[$uniquesampleid]);
              }
  
              if ($calculatedtarget) {
                  // Add this sampleid's calculated target and the end.
                  $dataset[$uniquesampleid][] = $calculatedtarget[$analysersampleid];
  
              } else {
                  // Add this sampleid, it will be used to identify the prediction that comes back from
                  // the predictions processor.
                  array_unshift($dataset[$uniquesampleid], $uniquesampleid);
              }
          }
      }
code_tokens: protected function fill_dataset ( \ core_analytics \ local \ time_splitting \ base $ timesplitting , array & $ dataset , ? array $ calculatedtarget = null ) { $ nranges = count ( $ timesplitting -> get_distinct_ranges ( ) ) ; foreach ( $ dataset as $ uniquesampleid => $ unmodified ) { list ( $ analysersampleid , $ rangeindex ) = $ timesplitting -> infer_sample_info ( $ uniquesampleid ) ; // No need to add range features if this time splitting method only defines one time range. if ( $ nranges > 1 ) { // 1 column for each range. $ timeindicators = array_fill ( 0 , $ nranges , 0 ) ; $ timeindicators [ $ rangeindex ] = 1 ; $ dataset [ $ uniquesampleid ] = array_merge ( $ timeindicators , $ dataset [ $ uniquesampleid ] ) ; } if ( $ calculatedtarget ) { // Add this sampleid's calculated target and the end. $ dataset [ $ uniquesampleid ] [ ] = $ calculatedtarget [ $ analysersampleid ] ; } else { // Add this sampleid, it will be used to identify the prediction that comes back from // the predictions processor. array_unshift ( $ dataset [ $ uniquesampleid ] , $ uniquesampleid ) ; } } }
docstring: Adds time range indicators and the target to each sample.
  
  This will identify the sample as belonging to a specific range.
  
  @param \core_analytics\local\time_splitting\base $timesplitting
  @param array $dataset
  @param array|null $calculatedtarget
  @return null
docstring_tokens: Adds time range indicators and the target to each sample .