<commit_before>//machineLearning refers to the machine_learning library from "npm install machine_learning;"
function convertData_machineLearning_to_d3(machineLearningDataType, machineLearningData){
  if(machineLearningDataType!='tree'){
    if(arguments.length>=2) //TEMPORARY SHORTCUT (meant to be without curly brackets)
    return {};
  }
  else{//TEMPORARY SHORTCUT
    machineLearningData = arguments[0];
  }

  //machineLearningData has {data:Array, result:Array, tree:Object}
  var machineLearningData_tree = machineLearningData.tree?  machineLearningData.tree: machineLearningData;
  //Future: check if col,value,results,tb,fb exist

  var d3_decisionTree_tree = {};
  transformAttributes("START", machineLearningData_tree, d3_decisionTree_tree);
  return d3_decisionTree_tree;
}

function transformAttributes(nodeName, src_machineLearningTreeData, dst_d3TreeData){
  // console.log(nodeName, src_machineLearningTreeData, dst_d3TreeData);
  dst_d3TreeData.name = dst_d3TreeData.name ||nodeName;
  if(src_machineLearningTreeData['tb'] || src_machineLearningTreeData['fb']){
    dst_d3TreeData.children = dst_d3TreeData.children ||[]; //define .children as an array if there is no .children defined yet --> need to check and avoid overwrites because this function is likely called twice for each level due to recursion<commit_msg>if case<commit_after>//machineLearning refers to the machine_learning library from "npm install machine_learning;"
function convertData_machineLearning_to_d3(machineLearningDataType, machineLearningData){
  if(machineLearningDataType!='tree'){
    if(arguments.length>=2) //TEMPORARY SHORTCUT (meant to be without curly brackets)
      return {};
    //else //TEMPORARY SHORTCUT
    machineLearningData = arguments[0];
  }

  //machineLearningData has {data:Array, result:Array, tree:Object}
  console.log(machineLearningData)
  var machineLearningData_tree = machineLearningData.tree?  machineLearningData.tree: machineLearningData;
  //Future: check if col,value,results,tb,fb exist

  var d3_decisionTree_tree = {};
  transformAttributes("START", machineLearningData_tree, d3_decisionTree_tree);
  return d3_decisionTree_tree;
}

function transformAttributes(nodeName, src_machineLearningTreeData, dst_d3TreeData){
  // console.log(nodeName, src_machineLearningTreeData, dst_d3TreeData);
  dst_d3TreeData.name = dst_d3TreeData.name ||nodeName;
  if(src_machineLearningTreeData['tb'] || src_machineLearningTreeData['fb']){
    dst_d3TreeData.children = dst_d3TreeData.children ||[]; //define .children as an array if there is no .children defined yet --> need to check and avoid overwrites because this function is likely called twice for each level due to recursion
{'fraction_non_alphanumeric': 0.09131238447319778, 'fraction_numerical': 0.0088724584103512, 'mean_word_length': 6.313513513513514, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7442933', 'n_tokens_mistral': 853, 'n_tokens_neox': 772, 'n_words': 192}