<commit_before>#ifndef OLL_HPP__
#define OLL_HPP__

// oll -- online learning library
// <NAME> 2008
// 
// References
// ----------------------
// - Perceptron
// [1] <NAME>, "The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain", Cornell Aeronautical Laboratory, Psychological Review, v65, No. 6, pp. 386-408, 1958. 
// [2] <NAME>, and <NAME>, "Large margin classification using the perceptron algorithm". COLT 1998 
//
// - Averaged Perceptron
// [3] <NAME>, "Discriminative Training Methods for Hidden Markov Models: Theory and Experiments with Perceptron Algorithms", EMNLP 2002. 
// 
// - Passive Agressive
// [4] <NAME>, <NAME>. <NAME>, <NAME>, <NAME>, "Online Passive-Aggressive Algorithms.", Journal of Machine Learning Research, 2006.
// 
// - Confidence Weighted
// [5] <NAME>, <NAME>, <NAME>. "Confidence-Weighted Linear Classification", ICML 2008
//

#include <vector>
#include <iostream>
#include <sstream>
#include <fstream>

namespace oll_tool{  
  typedef std::vector<std::pair<int, float> > fv_t; // feature vector
  typedef std::vector<float> fvec;

  enum trainMethod{
    P  = 0,  // Perceptron
    AP  = 1, // Averaged Perceptron
    PA  = 2, // Passive Agressive
    PA1 = 3, // Passive Agressive L1
    PA2 = 4, // Passive Agressive L2
    PAK = 5, // Kernelized Passive Agressive
    CW  = 6, // Confidence Weighted     
    AL  = 7  // ALMA HD
  };
  
  int trainFile(const char* trainfile, const char* modelfile, 
		const trainMethod tm, const float C, const float bias, const int iter, bool verb, bool shuffle);

  int testFile (const char* testfile, const char* modelfile, std::vector<int>& confMat, int verb);

  // For specializing oll::exampleTrain
  struct P_s {};   // Perceptron<commit_msg>explicitly "#include <algorithm>"<commit_after>#ifndef OLL_HPP__
#define OLL_HPP__

// oll -- online learning library
// <NAME> 2008
// 
// References
// ----------------------
// - Perceptron
// [1] <NAME>, "The Perceptron: A Probabilistic Model for Information Storage and Organization in the Brain", Cornell Aeronautical Laboratory, Psychological Review, v65, No. 6, pp. 386-408, 1958. 
// [2] <NAME>, and <NAME>, "Large margin classification using the perceptron algorithm". COLT 1998 
//
// - Averaged Perceptron
// [3] <NAME>, "Discriminative Training Methods for Hidden Markov Models: Theory and Experiments with Perceptron Algorithms", EMNLP 2002. 
// 
// - Passive Agressive
// [4] <NAME>, <NAME>. <NAME>, <NAME>, <NAME>, "Online Passive-Aggressive Algorithms.", Journal of Machine Learning Research, 2006.
// 
// - Confidence Weighted
// [5] <NAME>, <NAME>, <NAME>. "Confidence-Weighted Linear Classification", ICML 2008
//

#include <vector>
#include <iostream>
#include <sstream>
#include <fstream>
#include <algorithm>

namespace oll_tool{  
  typedef std::vector<std::pair<int, float> > fv_t; // feature vector
  typedef std::vector<float> fvec;

  enum trainMethod{
    P  = 0,  // Perceptron
    AP  = 1, // Averaged Perceptron
    PA  = 2, // Passive Agressive
    PA1 = 3, // Passive Agressive L1
    PA2 = 4, // Passive Agressive L2
    PAK = 5, // Kernelized Passive Agressive
    CW  = 6, // Confidence Weighted     
    AL  = 7  // ALMA HD
  };
  
  int trainFile(const char* trainfile, const char* modelfile, 
		const trainMethod tm, const float C, const float bias, const int iter, bool verb, bool shuffle);

  int testFile (const char* testfile, const char* modelfile, std::vector<int>& confMat, int verb);

  // For specializing oll::exampleTrain
  struct P_s {};   // Perceptron
{'fraction_non_alphanumeric': 0.14065564583917065, 'fraction_numerical': 0.028019052956010086, 'mean_word_length': 3.2348754448398576, 'pattern_counts': {'":': 0, '<': 47, '<?xml version=': 0, '>': 47, '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': '4755017', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1123, 'n_words': 391}