Skip to content

Commit

Permalink
Add missing include
Browse files Browse the repository at this point in the history
  • Loading branch information
svgsponer committed May 11, 2019
1 parent fc6af63 commit 17edea4
Showing 1 changed file with 29 additions and 25 deletions.
54 changes: 29 additions & 25 deletions SqLoss/LinearModel.h
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
/** Linear model class
Author: Severin Gsponer ([email protected])
The model consist of is represented as vector of tupels from the step_size and the corresponding ngram
The model consist of is represented as vector of tupels from the step_size
and the corresponding ngram
**/

#ifndef LINEARMODEL_H
#define LINEARMODEL_H

#include <vector>
#include <tuple>
#include <iostream>
#include <fstream>
#include <string>
#include <map>
#include "unistd.h"
#include <cstring>
#include "common.h"
#include "darts.h"
#include <memory>
#include "mmap.h"
#include "unistd.h"
#include <cmath>
#include <cstring>
#include <fstream>
#include <iostream>
#include <map>
#include <memory>
#include <string>
#include <tuple>
#include <vector>

namespace LinearModel{
class LinearModel{
public:
LinearModel():da(new Darts::DoubleArray){};
LinearModel(std::vector<std::tuple<double, std::string>> fullList):fullList(fullList){};
LinearModel(std::string filename, double threshold):da(new Darts::DoubleArray){
namespace LinearModel {
class LinearModel {
public:
LinearModel() : da(new Darts::DoubleArray){};
LinearModel(std::vector<std::tuple<double, std::string>> fullList) :
fullList(fullList){};
LinearModel(std::string filename, double threshold) :
da(new Darts::DoubleArray) {
open(filename, threshold);
};

Expand All @@ -33,25 +37,25 @@ class LinearModel{
void print_model(std::string outfile_name);
void save_as_binary(std::string outfile_name);
void build_tree(double multiplyValue = 1);
friend bool operator== (const LinearModel &c1, const LinearModel &c2);
friend bool operator==(const LinearModel &c1, const LinearModel &c2);
std::shared_ptr<Darts::DoubleArray> da;

bool open (std::string file, double threshold);
bool open(std::string file, double threshold);
double get_bias() const;
void set_bias(double bias);
std::vector <double> weights;
std::vector<double> weights;
void normalize_weights();
long double intercept = 0.0;
private:
double bias = 0.0;

private:
double bias = 0.0;
double l1_norm = 0.0;
double l2_norm = 0.0;
std::vector <std::pair<const char *, double> > rules;
std::vector<std::pair<const char *, double>> rules;
std::vector<std::tuple<double, std::string>> fullList;

};

std::vector<std::tuple<double, std::string>> parse_model(std::string file);
};
std::vector<std::tuple<double, std::string>> parse_model(std::string file);
}; // namespace LinearModel

#endif

0 comments on commit 17edea4

Please sign in to comment.