mirror of
https://github.com/Relintai/pmlpp.git
synced 2024-12-22 15:06:47 +01:00
Fixed warnings in ProbitReg.
This commit is contained in:
parent
d341f6f8d0
commit
0289fcb70e
@ -14,7 +14,6 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
|
|
||||||
MLPPProbitReg::MLPPProbitReg(std::vector<std::vector<real_t>> inputSet, std::vector<real_t> outputSet, std::string reg, real_t lambda, real_t alpha) :
|
MLPPProbitReg::MLPPProbitReg(std::vector<std::vector<real_t>> inputSet, std::vector<real_t> outputSet, std::string reg, real_t lambda, real_t alpha) :
|
||||||
inputSet(inputSet), outputSet(outputSet), n(inputSet.size()), k(inputSet[0].size()), reg(reg), lambda(lambda), alpha(alpha) {
|
inputSet(inputSet), outputSet(outputSet), n(inputSet.size()), k(inputSet[0].size()), reg(reg), lambda(lambda), alpha(alpha) {
|
||||||
y_hat.resize(n);
|
y_hat.resize(n);
|
||||||
@ -147,7 +146,9 @@ void MLPPProbitReg::MBGD(real_t learning_rate, int max_epoch, int mini_batch_siz
|
|||||||
|
|
||||||
// Creating the mini-batches
|
// Creating the mini-batches
|
||||||
int n_mini_batch = n / mini_batch_size;
|
int n_mini_batch = n / mini_batch_size;
|
||||||
auto [inputMiniBatches, outputMiniBatches] = MLPPUtilities::createMiniBatches(inputSet, outputSet, n_mini_batch);
|
auto createMiniBatchesResult = MLPPUtilities::createMiniBatches(inputSet, outputSet, n_mini_batch);
|
||||||
|
auto inputMiniBatches = std::get<0>(createMiniBatchesResult);
|
||||||
|
auto outputMiniBatches = std::get<1>(createMiniBatchesResult);
|
||||||
|
|
||||||
// Creating the mini-batches
|
// Creating the mini-batches
|
||||||
for (int i = 0; i < n_mini_batch; i++) {
|
for (int i = 0; i < n_mini_batch; i++) {
|
||||||
@ -198,12 +199,12 @@ void MLPPProbitReg::MBGD(real_t learning_rate, int max_epoch, int mini_batch_siz
|
|||||||
}
|
}
|
||||||
|
|
||||||
real_t MLPPProbitReg::score() {
|
real_t MLPPProbitReg::score() {
|
||||||
MLPPUtilities util;
|
MLPPUtilities util;
|
||||||
return util.performance(y_hat, outputSet);
|
return util.performance(y_hat, outputSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MLPPProbitReg::save(std::string fileName) {
|
void MLPPProbitReg::save(std::string fileName) {
|
||||||
MLPPUtilities util;
|
MLPPUtilities util;
|
||||||
util.saveParameters(fileName, weights, bias);
|
util.saveParameters(fileName, weights, bias);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,7 +238,6 @@ real_t MLPPProbitReg::propagate(std::vector<real_t> x) {
|
|||||||
|
|
||||||
// gaussianCDF ( wTx + b )
|
// gaussianCDF ( wTx + b )
|
||||||
void MLPPProbitReg::forwardPass() {
|
void MLPPProbitReg::forwardPass() {
|
||||||
MLPPLinAlg alg;
|
|
||||||
MLPPActivation avn;
|
MLPPActivation avn;
|
||||||
|
|
||||||
z = propagate(inputSet);
|
z = propagate(inputSet);
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MLPPProbitReg {
|
class MLPPProbitReg {
|
||||||
public:
|
public:
|
||||||
MLPPProbitReg(std::vector<std::vector<real_t>> inputSet, std::vector<real_t> outputSet, std::string reg = "None", real_t lambda = 0.5, real_t alpha = 0.5);
|
MLPPProbitReg(std::vector<std::vector<real_t>> inputSet, std::vector<real_t> outputSet, std::string reg = "None", real_t lambda = 0.5, real_t alpha = 0.5);
|
||||||
@ -52,5 +50,4 @@ private:
|
|||||||
real_t alpha; /* This is the controlling param for Elastic Net*/
|
real_t alpha; /* This is the controlling param for Elastic Net*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* ProbitReg_hpp */
|
#endif /* ProbitReg_hpp */
|
||||||
|
Loading…
Reference in New Issue
Block a user