mirror of
https://github.com/Relintai/MLPP.git
synced 2025-03-12 18:08:59 +01:00
To do: Add LeakyRelu, Elu to ANN
This commit is contained in:
parent
c135e53bfc
commit
17884c6c15
@ -389,6 +389,24 @@ namespace MLPP{
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::vector<double>> Activation::leakyReLU(std::vector<std::vector<double>> z, double c, bool deriv){
|
||||||
|
if(deriv){
|
||||||
|
std::vector<std::vector<double>> deriv;
|
||||||
|
deriv.resize(z.size());
|
||||||
|
for(int i = 0; i < z.size(); i++){
|
||||||
|
deriv[i] = leakyReLU(z[i], c, 1);
|
||||||
|
}
|
||||||
|
return deriv;
|
||||||
|
}
|
||||||
|
std::vector<std::vector<double>> a;
|
||||||
|
a.resize(z.size());
|
||||||
|
|
||||||
|
for(int i = 0; i < a.size(); i++){
|
||||||
|
a[i] = leakyReLU(z[i], c);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
double Activation::ELU(double z, double c, bool deriv){
|
double Activation::ELU(double z, double c, bool deriv){
|
||||||
if (deriv){
|
if (deriv){
|
||||||
if(z <= 0){
|
if(z <= 0){
|
||||||
@ -424,6 +442,24 @@ namespace MLPP{
|
|||||||
return a;
|
return a;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::vector<double>> Activation::ELU(std::vector<std::vector<double>> z, double c, bool deriv){
|
||||||
|
if(deriv){
|
||||||
|
std::vector<std::vector<double>> deriv;
|
||||||
|
deriv.resize(z.size());
|
||||||
|
for(int i = 0; i < z.size(); i++){
|
||||||
|
deriv[i] = ELU(z[i], c, 1);
|
||||||
|
}
|
||||||
|
return deriv;
|
||||||
|
}
|
||||||
|
std::vector<std::vector<double>> a;
|
||||||
|
a.resize(z.size());
|
||||||
|
|
||||||
|
for(int i = 0; i < a.size(); i++){
|
||||||
|
a[i] = ELU(z[i], c);
|
||||||
|
}
|
||||||
|
return a;
|
||||||
|
}
|
||||||
|
|
||||||
double Activation::SELU(double z, double lambda, double c, bool deriv){
|
double Activation::SELU(double z, double lambda, double c, bool deriv){
|
||||||
if (deriv){
|
if (deriv){
|
||||||
return ELU(z, c, 1);
|
return ELU(z, c, 1);
|
||||||
|
@ -55,9 +55,11 @@ namespace MLPP{
|
|||||||
|
|
||||||
double leakyReLU(double z, double c, bool deriv = 0);
|
double leakyReLU(double z, double c, bool deriv = 0);
|
||||||
std::vector<double> leakyReLU(std::vector<double> z, double c, bool deriv = 0);
|
std::vector<double> leakyReLU(std::vector<double> z, double c, bool deriv = 0);
|
||||||
|
std::vector<std::vector<double>> leakyReLU(std::vector<std::vector<double>> z, double c, bool deriv = 0);
|
||||||
|
|
||||||
double ELU(double z, double c, bool deriv = 0);
|
double ELU(double z, double c, bool deriv = 0);
|
||||||
std::vector<double> ELU(std::vector<double> z, double c, bool deriv = 0);
|
std::vector<double> ELU(std::vector<double> z, double c, bool deriv = 0);
|
||||||
|
std::vector<std::vector<double>> ELU(std::vector<std::vector<double>> z, double c, bool deriv = 0);
|
||||||
|
|
||||||
double SELU(double z, double lambda, double c, bool deriv = 0);
|
double SELU(double z, double lambda, double c, bool deriv = 0);
|
||||||
std::vector<double> SELU(std::vector<double> z, double lambda, double c, bool deriv = 0);
|
std::vector<double> SELU(std::vector<double> z, double lambda, double c, bool deriv = 0);
|
||||||
|
2
main.cpp
2
main.cpp
@ -9,7 +9,7 @@
|
|||||||
// POLYMORPHIC IMPLEMENTATION OF REGRESSION CLASSES
|
// POLYMORPHIC IMPLEMENTATION OF REGRESSION CLASSES
|
||||||
// EXTEND SGD/MBGD SUPPORT FOR DYN. SIZED ANN
|
// EXTEND SGD/MBGD SUPPORT FOR DYN. SIZED ANN
|
||||||
// STANDARDIZE ACTIVATIONS/OPTIMIZATIONS
|
// STANDARDIZE ACTIVATIONS/OPTIMIZATIONS
|
||||||
// FINISH ADDING ALL ACTIVATIONS TO ANN
|
// ADD LEAKYRELU, ELU TO ANN
|
||||||
|
|
||||||
// HYPOTHESIS TESTING CLASS
|
// HYPOTHESIS TESTING CLASS
|
||||||
// GAUSS MARKOV CHECKER CLASS
|
// GAUSS MARKOV CHECKER CLASS
|
||||||
|
Loading…
Reference in New Issue
Block a user