Пример #1
0
 /**
  * @param $data
  * @param $base_key
  * @param $base_value
  * @param $split_key
  * @param $split_value
  * @return DecisionTreeData
  */
 private function makeDecisionTreeData($data, $base_key, $base_value, $split_key, $split_value)
 {
     $decisionTreeData = new DecisionTreeData();
     $decisionTreeData->number = count($data);
     $decisionTreeData->split_key = $split_key;
     $decisionTreeData->split_value = $split_value;
     $split_array = ArrayService::split_by_key($data, $base_key);
     $decisionTreeData->match = isset($split_array[$base_value]) ? count($split_array[$base_value]) : 0;
     $decisionTreeData->unmatch = $decisionTreeData->number - $decisionTreeData->match;
     return $decisionTreeData;
 }