-
Notifications
You must be signed in to change notification settings - Fork 0
/
lassospp.h
44 lines (37 loc) · 1.26 KB
/
lassospp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#ifndef LASSOSPP_H
#define LASSOSPP_H
#include "prefixspan.h"
#include "database.h"
#include "learnerspp.h"
#include <vector>
using namespace std;
//Lasso
class LASSOSPP: public LearnerSPP{
private:
uint mN;
double mBias;
vector<double> mR;
uint mT;
uint mMaxIter;
uint mFreq;
double mEps;
double mRatio;
double clac_sup(const vector<Event> &aSequence, const vector<Event> &aPattern, const uint aSupMode);
public:
LASSOSPP(uint aMaxIter, uint aFreq, double aEps, double aRatio){
mMaxIter = aMaxIter;
mFreq = aFreq;
mEps = aEps;
mRatio = aRatio;
}
;
//Learning with aLambdas[i - 1] is done by inserting a number from 1 to aLambdas.size() in aOption[0].
virtual void learn(PrefixSpan &aPrefix, const vector<double> &aLambdas, const vector<uint> &aOptions);
//Calculate and return the value of λmax
virtual double get_lambda_max(PrefixSpan &aPrefix);
//Perform prediction using the model currently being learned
virtual vector<double> predict(const PrefixSpan &aPrefix, const vector<vector<Event> > &aTransaction) const;
//Returns the predicted value for all solution paths.
virtual vector<vector<double> > get_all_predict(PrefixSpan &aPrefix, const vector<double> &aLambdas, const vector<vector<Event> > &aTransaction, const vector<uint> &aOptions);
};
#endif