Library of statistical functions and classes in simple C++, compatible for different sequence containers of different numeric data types.
The goal of this header-only library is to mimic some functions of NumPy and SciPy, and some classes of scikit-learn with:
- simple Python-like syntax;
- simple C++ code (compatible from C++11);
- simple dependencies (use only C++ Standard Library, no advanced dependencies like boost, mlpack or Eigen);
- generic templated functions, compatible for different
sequence containers
(
std::list
,std::vector
,std::deque
) of different numeric data types (unsigned int
,int
,float
,double
).
Integer input functions: gcd
, factorial
Checking functions: is_positive
Aggregation functions: prod
Element-wise functions: linear
, absolute
, reciprocal
,
power
, log
, exp
, sigmoid
Others: set
Summary statistics: mean
, hmean
, gmean
, pmean
,
var
, std
, hstd
, gstd
,
skewness
, kurtosis
,
median
, median_abs_deviation
Transformations: center
, zscore
, gzscore
Correlation functions: pearsonr
, spearmanr
Metrics: accuracy_score
Others: rankdata
Class SimpleLinearRegression
,
with fit
, predict
, and score
(coefficient of determination R²).
Class SimpleLogisticRegression
for binary classification,
with fit
, predict
, and score
(accuracy).
#include "CSimpleLinearRegression.hpp"
#include <list>
int main()
{
std::list<double> x = { 5.1, 13, -5, 17.5, 8 }, y = { -2, 3, 7.2, 10, -1 };
SimpleLinearRegression slr = SimpleLinearRegression();
slr.fit(x, y);
x = { 42 };
y = slr.predict(x);
}
Code must be compliant with all features listed in Description.