-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEmotionRating.h
More file actions
39 lines (31 loc) · 1.07 KB
/
EmotionRating.h
File metadata and controls
39 lines (31 loc) · 1.07 KB
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
#ifndef EMOTION_RATING_H
#define EMOTION_RATING_H
#include <vector>
class EmotionRating {
public:
// Constructor: number of classes R
EmotionRating(int numClasses);
// Compute rating based on P (positivity) and N (negativity)
void compute(double P, double N);
// Get results
int getSelectedClass() const; // k*
int getPolarity() const; // s = sign(Δ)
std::vector<double> getSoftmax() const; // probability distribution
private:
int R; // number of classes
double delta; // Δ
double t; // normalized intensity
std::vector<double> c; // class centers
std::vector<double> u; // scores
std::vector<double> S; // softmax
int k_star; // selected class
int s; // polarity sign
// internal helpers
void computeDelta(double P);
void computeNormalizedIntensity();
void computeClassCenters();
void computeScores();
void computeSoftmax();
void selectClassAndPolarity();
};
#endif