pmlpp/mlpp/activation/activation.h

146 lines
6.7 KiB
C
Raw Normal View History

2023-01-24 18:57:18 +01:00
#ifndef MLPP_ACTIVATION_H
#define MLPP_ACTIVATION_H
//
// Activation.hpp
//
// Created by Marc Melikyan on 1/16/21.
//
#include <vector>
2023-01-24 19:23:30 +01:00
class MLPPActivation {
2023-01-24 19:00:54 +01:00
public:
double linear(double z, bool deriv = 0);
std::vector<double> linear(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> linear(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double sigmoid(double z, bool deriv = 0);
std::vector<double> sigmoid(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> sigmoid(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
std::vector<double> softmax(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> softmax(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
std::vector<double> adjSoftmax(std::vector<double> z);
std::vector<std::vector<double>> adjSoftmax(std::vector<std::vector<double>> z);
2023-01-24 19:00:54 +01:00
std::vector<std::vector<double>> softmaxDeriv(std::vector<double> z);
std::vector<std::vector<std::vector<double>>> softmaxDeriv(std::vector<std::vector<double>> z);
2023-01-24 19:00:54 +01:00
double softplus(double z, bool deriv = 0);
std::vector<double> softplus(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> softplus(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double softsign(double z, bool deriv = 0);
std::vector<double> softsign(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> softsign(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double gaussianCDF(double z, bool deriv = 0);
std::vector<double> gaussianCDF(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> gaussianCDF(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double cloglog(double z, bool deriv = 0);
std::vector<double> cloglog(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> cloglog(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double logit(double z, bool deriv = 0);
std::vector<double> logit(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> logit(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double unitStep(double z, bool deriv = 0);
std::vector<double> unitStep(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> unitStep(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double swish(double z, bool deriv = 0);
std::vector<double> swish(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> swish(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double mish(double z, bool deriv = 0);
std::vector<double> mish(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> mish(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double sinc(double z, bool deriv = 0);
std::vector<double> sinc(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> sinc(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double RELU(double z, bool deriv = 0);
std::vector<double> RELU(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> RELU(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double leakyReLU(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);
2023-01-24 19:00:54 +01:00
double ELU(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);
2023-01-24 19:00:54 +01:00
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<std::vector<double>> SELU(std::vector<std::vector<double>>, double lambda, double c, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double GELU(double z, bool deriv = 0);
std::vector<double> GELU(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> GELU(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double sign(double z, bool deriv = 0);
std::vector<double> sign(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> sign(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double sinh(double z, bool deriv = 0);
std::vector<double> sinh(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> sinh(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double cosh(double z, bool deriv = 0);
std::vector<double> cosh(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> cosh(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double tanh(double z, bool deriv = 0);
std::vector<double> tanh(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> tanh(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double csch(double z, bool deriv = 0);
std::vector<double> csch(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> csch(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double sech(double z, bool deriv = 0);
std::vector<double> sech(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> sech(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double coth(double z, bool deriv = 0);
std::vector<double> coth(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> coth(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double arsinh(double z, bool deriv = 0);
std::vector<double> arsinh(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> arsinh(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double arcosh(double z, bool deriv = 0);
std::vector<double> arcosh(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> arcosh(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double artanh(double z, bool deriv = 0);
std::vector<double> artanh(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> artanh(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double arcsch(double z, bool deriv = 0);
std::vector<double> arcsch(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> arcsch(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double arsech(double z, bool deriv = 0);
std::vector<double> arsech(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> arsech(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
double arcoth(double z, bool deriv = 0);
std::vector<double> arcoth(std::vector<double> z, bool deriv = 0);
std::vector<std::vector<double>> arcoth(std::vector<std::vector<double>> z, bool deriv = 0);
2023-01-24 19:00:54 +01:00
std::vector<double> activation(std::vector<double> z, bool deriv, double (*function)(double, bool));
2023-01-24 19:00:54 +01:00
private:
};
#endif /* Activation_hpp */