63 LogReg(
double l_rate = 001,
int num_iters = 1000,
double lda = 001);
75 void train(
const std::vector<std::vector<double>> &X_train,
76 const std::vector<int> &y_train);
83 std::vector<int>
classify(
const std::vector<std::vector<double>> &X);
90 std::vector<double>
predict(
const std::vector<std::vector<double>> &X_test);
98 double accuracy(
const std::vector<std::vector<double>> &X_test,
99 const std::vector<int> &y_test);
128 double cost_function(
const std::vector<std::vector<double>> &X,
129 const std::vector<int> &y);
Represents a Logistic Regression classifier.
std::vector< double > weights
double sigmoid(double z)
Computes the sigmoid function value for the given input.
std::vector< int > classify(const std::vector< std::vector< double >> &X)
Predicts the class labels for the given test data.
std::vector< double > predict(const std::vector< std::vector< double >> &X_test)
Computes the predicted probabilities for the given test data.
~LogReg()
Destructor for the LogReg class.
double accuracy(const std::vector< std::vector< double >> &X_test, const std::vector< int > &y_test)
Computes the accuracy of the model on the given test data.
LogReg(double l_rate=001, int num_iters=1000, double lda=001)
Constructor for the LogReg class.
void train(const std::vector< std::vector< double >> &X_train, const std::vector< int > &y_train)
Trains the logistic regression model on the given training data.
double cost_function(const std::vector< std::vector< double >> &X, const std::vector< int > &y)
Computes the cost function value for the given input data and labels.
void feature_scaling(std::vector< std::vector< double >> &X)
Performs feature scaling on the input feature matrix.
The source C++ openGPMP namespace.