<commit_before>#include "local_kernel_machines_def.h"
#include "utils.h"
#include "my_crossvalidation.h"
#include "fastlib/fastlib.h"
#include "mlpack/svm/svm.h"
//#include "declarations.h"
//#include "example.h"
#include "new_ext_header.h"
int main(int argc, char *argv[]){

  // Initialize FastExec

  fx_init(argc, argv, NULL);

  // Do the usual initialization.

  struct datanode *lkm_module=fx_submodule(fx_root,"lkm");


  // train is the input training data
  const char *train_data_file_name=
    fx_param_str_req(fx_root,"train");

  // test is the input test data
  const char *test_data_file_name=
    fx_param_str_req(fx_root,"test");  

  // train labels
  const char *train_labels_file_name=
    fx_param_str_req(fx_root,"train_labels");  
  
  
  

  Matrix train_data;
  data::Load(train_data_file_name,&train_data);

  // Input parameter is test data
  Matrix test_data;
  data::Load(test_data_file_name,&test_data);

  // The train labels
  
  Matrix train_labels_mat;
  data::Load(train_labels_file_name,&train_labels_mat);

 
  // Convert the above matrix to a vector

  Vector train_labels;
  ConvertMatrixToVector(train_labels_mat,train_labels);
  

  // Get the kernels used

  const char *smoothing_kernel=
    fx_param_str(fx_root,"smoothing_kernel","epan");

  const char *similarity_kernel=
    fx_param_str(fx_root,"svm_kernel","linear");
  
  if (strcmp(similarity_kernel,"linear")){
    
    // The similarity kernel being used is the Linear kernel
    LocalKernelMachines <SVMLinearKernel> lkm;
    lkm.Init(train_data,test_data,train_labels,lkm_module);

    // Train
    lkm.TrainLocalKernelMachines();
  
  }
  else{
    
    //The similarity kernel being used is the SVMRBF kernel
    LocalKernelMachines<SVMRBFKernel> lkm;
    lkm.Init(train_data,test_data,train_labels,lkm_module);

    // Train
    lkm.TrainLocalKernelMachines();
  
  }

  //Run the gateway function

  gateway();
}<commit_msg>Original version. Will make it simple<commit_after>#include "fastlib/fastlib.h"
#include "mlpack/svm/svm.h"
#include "local_kernel_machines_def.h"
#include "local_kernel_machines_impl.h"
#include "utils.h"
#include "my_crossvalidation.h"
int main(int argc, char *argv[]){

  // Initialize FastExec

  fx_init(argc, argv, NULL);

  // Do the usual initialization.

  struct datanode *lkm_module=fx_submodule(fx_root,"lkm");


  // train is the input training data
  const char *train_data_file_name=
    fx_param_str_req(fx_root,"train");

  // test is the input test data
  const char *test_data_file_name=
    fx_param_str_req(fx_root,"test");  

  // train labels
  const char *train_labels_file_name=
    fx_param_str_req(fx_root,"train_labels");  
  
  
  

  Matrix train_data;
  data::Load(train_data_file_name,&train_data);

  // Input parameter is test data
  Matrix test_data;
  data::Load(test_data_file_name,&test_data);

  // The train labels
  
  Matrix train_labels_mat;
  data::Load(train_labels_file_name,&train_labels_mat);

 
  // Convert the above matrix to a vector

  Vector train_labels;
  ConvertOneColumnMatrixToVector(train_labels_mat,train_labels);
  

  // Get the kernels used

  const char *smoothing_kernel=
    fx_param_str(fx_root,"smoothing_kernel","epan");
  
  const char *similarity_kernel=
    fx_param_str(fx_root,"svm_kernel","linear");
  
  
  if (strcmp(similarity_kernel,"linear")){
    
    // The similarity kernel being used is the Linear kernel
    LocalKernelMachines <SVMLinearKernel> lkm;
    lkm.Init(train_data,test_data,train_labels,lkm_module);

    // Train
    lkm.TrainLocalKernelMachines();
  
  }
  else{
    
    //The similarity kernel being used is the SVMRBF kernel
    LocalKernelMachines<SVMRBFKernel> lkm;
    lkm.Init(train_data,test_data,train_labels,lkm_module);

    // Train
    lkm.TrainLocalKernelMachines();
  
  }


}
{'fraction_non_alphanumeric': 0.10509803921568628, 'fraction_numerical': 0.0, 'mean_word_length': 4.135570469798657, 'pattern_counts': {'":': 0, '<': 7, '<?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': '4232585', 'n_tokens_mistral': 1401, 'n_tokens_neox': 1309, 'n_words': 266}