#ifndef MLPP_UTILITIES_H #define MLPP_UTILITIES_H // // Utilities.hpp // // Created by Marc Melikyan on 1/16/21. // #include #include #include class Utilities { public: // Weight Init static std::vector weightInitialization(int n, std::string type = "Default"); static double biasInitialization(); static std::vector> weightInitialization(int n, int m, std::string type = "Default"); static std::vector biasInitialization(int n); // Cost/Performance related Functions double performance(std::vector y_hat, std::vector y); double performance(std::vector> y_hat, std::vector> y); // Parameter Saving Functions void saveParameters(std::string fileName, std::vector weights, double bias, bool app = 0, int layer = -1); void saveParameters(std::string fileName, std::vector weights, std::vector initial, double bias, bool app = 0, int layer = -1); void saveParameters(std::string fileName, std::vector> weights, std::vector bias, bool app = 0, int layer = -1); // Gradient Descent related static void UI(std::vector weights, double bias); static void UI(std::vector weights, std::vector initial, double bias); static void UI(std::vector>, std::vector bias); static void CostInfo(int epoch, double cost_prev, double Cost); static std::vector>> createMiniBatches(std::vector> inputSet, int n_mini_batch); static std::tuple>>, std::vector>> createMiniBatches(std::vector> inputSet, std::vector outputSet, int n_mini_batch); static std::tuple>>, std::vector>>> createMiniBatches(std::vector> inputSet, std::vector> outputSet, int n_mini_batch); // F1 score, Precision/Recall, TP, FP, TN, FN, etc. std::tuple TF_PN(std::vector y_hat, std::vector y); //TF_PN = "True", "False", "Positive", "Negative" double recall(std::vector y_hat, std::vector y); double precision(std::vector y_hat, std::vector y); double accuracy(std::vector y_hat, std::vector y); double f1_score(std::vector y_hat, std::vector y); private: }; #endif /* Utilities_hpp */