forked from NeuroSyn-AI-Club/simple-deep-learning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObjectives.h
More file actions
31 lines (25 loc) · 996 Bytes
/
Copy pathObjectives.h
File metadata and controls
31 lines (25 loc) · 996 Bytes
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
#ifndef OBJECTIVES_H
#define OBJECTIVES_H
#include <vector>
#include <cmath>
#include <numeric>
#include <algorithm>
#include "VectorOps.h"
namespace objectives {
class MeanSquaredError{
private:
public:
double cost(const std::vector<std::vector<double>>& AL, const std::vector<std::vector<double>>& Y);
std::vector<std::vector<double>> cost_prime(const std::vector<std::vector<double>>& AL, const std::vector<std::vector<double>>& Y);
};
class CrossEntropyLoss{
private:
bool use_softmax;
public:
CrossEntropyLoss(bool use_softmax);
std::vector<std::vector<double>> softmax(const std::vector<std::vector<double>>& A);
double cost(const std::vector<std::vector<double>>& AL, const std::vector<std::vector<double>>& Y);
std::vector<std::vector<double>> cost_prime(const std::vector<std::vector<double>>& AL, const std::vector<std::vector<double>>& Y);
};
} // namespace objectives
#endif // OBJECTIVES_H