2021-05-27 22:14:20 +02:00
# ML++
2021-12-03 07:55:31 +01:00
Machine learning is a vast and exiciting discipline, garnering attention from specialists of many fields. Unfortunately, for C++ programmers and enthusiasts, there appears to be a lack of support in the field of machine learning. To fill that void and give C++ a true foothold in the ML sphere, this library was written. The intent with this library is for it to act as a crossroad between low-level developers and machine learning engineers.
2021-05-28 03:52:51 +02:00
< p align = "center" >
2021-05-28 04:31:00 +02:00
< img src = "https://user-images.githubusercontent.com/78002988/119920911-f3338d00-bf21-11eb-89b3-c84bf7c9f4ac.gif"
2021-05-28 04:43:40 +02:00
width = 600 height = 400>
2021-05-28 04:25:14 +02:00
< / p >
2021-05-28 04:43:40 +02:00
2021-05-28 20:52:29 +02:00
## Installation
2022-01-22 06:47:44 +01:00
Begin by downloading the header files for the ML++ library. You can do this by cloning the repository and extracting the MLPP directory within it:
2021-05-28 20:52:29 +02:00
```
git clone https://github.com/novak-99/MLPP
```
2022-01-29 02:27:35 +01:00
Next, execute the "buildSO.sh" shell script:
2022-01-22 06:47:44 +01:00
```
2022-01-22 18:05:40 +01:00
sudo ./buildSO.sh
2022-01-22 06:47:44 +01:00
```
2021-05-28 21:32:55 +02:00
After doing so, maintain the ML++ source files in a local directory and include them in this fashion:
2021-05-28 20:52:29 +02:00
```cpp
#include "MLPP/Stat/Stat.hpp" // Including the ML++ statistics module.
int main(){
...
}
```
2022-01-22 06:47:44 +01:00
Finally, after you have concluded creating a project, compile it using g++:
2021-05-28 20:52:29 +02:00
```
2022-01-22 06:47:44 +01:00
g++ main.cpp /usr/local/lib/MLPP.so --std=c++17
2021-05-28 20:52:29 +02:00
```
2021-05-28 07:47:08 +02:00
## Usage
2022-02-13 22:36:33 +01:00
Please note that ML++ uses the ```std::vector< double > ``` data type for emulating vectors, and the ```std::vector< std::vector < double > >``` data type for emulating matrices.
2021-05-28 07:57:13 +02:00
2021-05-28 07:56:53 +02:00
Begin by including the respective header file of your choice.
2021-05-28 07:47:08 +02:00
```cpp
#include "MLPP/LinReg/LinReg.hpp"
```
2021-05-28 07:59:13 +02:00
Next, instantiate an object of the class. Don't forget to pass the input set and output set as parameters.
2021-05-28 07:55:41 +02:00
```cpp
LinReg model(inputSet, outputSet);
```
2022-02-13 22:36:33 +01:00
Afterwards, call the optimizer that you would like to use. For iterative optimizers such as gradient descent, include the learning rate, epoch number, and whether or not to utilize the UI panel.
2021-05-28 07:55:41 +02:00
```cpp
model.gradientDescent(0.001, 1000, 0);
```
Great, you are now ready to test! To test a singular testing instance, utilize the following function:
```cpp
model.modelTest(testSetInstance);
```
This will return the model's singular prediction for that example.
2021-05-28 20:52:29 +02:00
2021-05-29 07:55:59 +02:00
To test an entire test set, use the following function:
2021-05-28 07:55:41 +02:00
```cpp
model.modelSetTest(testSet);
```
The result will be the model's predictions for the entire dataset.
2021-05-28 07:47:08 +02:00
2021-05-28 04:43:40 +02:00
## Contents of the Library
2021-05-28 04:45:39 +02:00
1. ** *Regression***
2021-05-28 04:43:40 +02:00
1. Linear Regression
2. Logistic Regression
3. Softmax Regression
4. Exponential Regression
5. Probit Regression
6. CLogLog Regression
2021-05-28 05:35:24 +02:00
7. Tanh Regression
2021-05-28 04:54:43 +02:00
2. ** *Deep, Dynamically Sized Neural Networks***
2021-05-28 04:53:57 +02:00
1. Possible Activation Functions
- Linear
- Sigmoid
2021-06-06 07:33:44 +02:00
- Softmax
2021-05-28 04:53:57 +02:00
- Swish
2021-09-11 07:03:20 +02:00
- Mish
- SinC
2021-05-28 04:53:57 +02:00
- Softplus
2021-06-01 07:59:14 +02:00
- Softsign
2021-05-28 04:53:57 +02:00
- CLogLog
2021-09-25 06:11:07 +02:00
- Logit
2021-05-28 04:53:57 +02:00
- Gaussian CDF
2021-05-29 02:39:46 +02:00
- RELU
2021-05-28 04:53:57 +02:00
- GELU
2021-09-25 01:45:10 +02:00
- Sign
2021-05-28 04:53:57 +02:00
- Unit Step
- Sinh
- Cosh
- Tanh
- Csch
- Sech
- Coth
- Arsinh
- Arcosh
- Artanh
- Arcsch
- Arsech
- Arcoth
2022-01-19 07:26:57 +01:00
2. Possible Optimization Algorithms
- Batch Gradient Descent
- Mini-Batch Gradient Descent
- Stochastic Gradient Descent
- Gradient Descent with Momentum
- Nesterov Accelerated Gradient
- Adagrad Optimizer
- Adadelta Optimizer
- Adam Optimizer
- Adamax Optimizer
- Nadam Optimizer
- AMSGrad Optimizer
- 2nd Order Newton-Raphson Optimizer*
- Normal Equation*
2022-01-19 07:28:55 +01:00
< p > < / p >
*Only available for linear regression
2022-01-19 07:26:57 +01:00
3. Possible Loss Functions
2021-05-28 04:49:07 +02:00
- MSE
- RMSE
- MAE
- MBE
- Log Loss
- Cross Entropy
- Hinge Loss
2022-02-25 07:52:40 +01:00
- Wasserstein Loss
2022-01-19 07:26:57 +01:00
4. Possible Regularization Methods
2021-05-28 04:53:57 +02:00
- Lasso
- Ridge
- ElasticNet
2022-02-25 07:52:40 +01:00
- Weight Clipping
2022-01-19 07:26:57 +01:00
5. Possible Weight Initialization Methods
2021-05-28 04:53:57 +02:00
- Uniform
- Xavier Normal
- Xavier Uniform
- He Normal
- He Uniform
2021-11-24 08:46:32 +01:00
- LeCun Normal
- LeCun Uniform
2022-01-30 10:04:23 +01:00
6. Possible Learning Rate Schedulers
- Time Based
- Epoch Based
2022-02-05 06:52:00 +01:00
- Step Based
- Exponential
2021-05-28 05:04:26 +02:00
3. ** *Prebuilt Neural Networks***
1. Multilayer Peceptron
2. Autoencoder
3. Softmax Network
2022-01-29 02:32:28 +01:00
4. ** *Generative Modeling***
1. Tabular Generative Adversarial Networks
2022-02-25 07:52:40 +01:00
2. Tabular Wasserstein Generative Adversarial Networks
2022-01-29 02:32:28 +01:00
5. ** *Natural Language Processing***
2021-12-03 07:55:31 +01:00
1. Word2Vec (Continous Bag of Words, Skip-Gram)
2021-05-28 05:04:26 +02:00
2. Stemming
3. Bag of Words
4. TFIDF
5. Tokenization
6. Auxiliary Text Processing Functions
2022-01-29 02:32:28 +01:00
6. ** *Computer Vision***
2021-05-28 05:04:26 +02:00
1. The Convolution Operation
2. Max, Min, Average Pooling
3. Global Max, Min, Average Pooling
4. Prebuilt Feature Detectors
- Horizontal/Vertical Prewitt Filter
- Horizontal/Vertical Sobel Filter
- Horizontal/Vertical Scharr Filter
- Horizontal/Vertical Roberts Filter
2022-01-22 19:27:36 +01:00
- Gaussian Filter
- Harris Corner Detector
2022-01-29 02:32:28 +01:00
7. ** *Principal Component Analysis***
8. ** *Naive Bayes Classifiers***
2021-05-28 05:25:37 +02:00
1. Multinomial Naive Bayes
2. Bernoulli Naive Bayes
3. Gaussian Naive Bayes
2022-01-29 02:32:28 +01:00
9. ** *Support Vector Classification***
2022-01-01 03:29:56 +01:00
1. Primal Formulation (Hinge Loss Objective)
2. Dual Formulation (Via Lagrangian Multipliers)
10. ** *K-Means***
11. ** *k-Nearest Neighbors***
12. ** *Outlier Finder (Using z-scores)***
13. ** *Matrix Decompositions***
2021-11-12 06:52:10 +01:00
1. SVD Decomposition
2. Cholesky Decomposition
2021-11-21 04:55:47 +01:00
- Positive Definiteness Checker
2021-11-12 06:52:10 +01:00
3. QR Decomposition
2022-01-01 03:29:56 +01:00
14. ** *Numerical Analysis***
2022-01-16 09:43:51 +01:00
1. Numerical Diffrentiation
- Univariate Functions
- Multivariate Functions
2. Jacobian Vector Calculator
3. Hessian Matrix Calculator
4. Function approximator
- Constant Approximation
- Linear Approximation
- Quadratic Approximation
- Cubic Approximation
5. Diffrential Equations Solvers
- Euler's Method
- Growth Method
2022-02-12 10:32:46 +01:00
15. ** *Mathematical Transforms***
1. Discrete Cosine Transform
16. ** *Linear Algebra Module***
17. ** *Statistics Module***
18. ** *Data Processing Module***
2021-05-28 05:25:37 +02:00
1. Setting and Printing Datasets
2022-02-24 23:05:25 +01:00
2. Available Datasets
1. Wisconsin Breast Cancer Dataset
- Binary
- SVM
2. MNIST Dataset
- Train
- Test
3. Iris Flower Dataset
4. Wine Dataset
5. California Housing Dataset
6. Fires and Crime Dataset (Chicago)
3. Feature Scaling
4. Mean Normalization
5. One Hot Representation
6. Reverse One Hot Representation
7. Supported Color Space Conversions
2022-02-12 04:25:37 +01:00
- RGB to Grayscale
- RGB to HSV
- RGB to YCbCr
2022-02-12 08:25:07 +01:00
- RGB to XYZ
- XYZ to RGB
2022-02-12 10:32:46 +01:00
19. ** *Utilities***
2021-05-28 20:58:09 +02:00
1. TP, FP, TN, FN function
2. Precision
3. Recall
4. Accuracy
5. F1 score
2021-09-25 02:00:59 +02:00
## What's in the Works?
2021-11-24 08:46:32 +01:00
ML++, like most frameworks, is dynamic, and constantly changing. This is especially important in the world of ML, as new algorithms and techniques are being developed day by day. Here are a couple of things currently being developed for ML++:
2021-09-25 02:05:33 +02:00
< p >
2021-09-25 02:03:01 +02:00
- Convolutional Neural Networks
2021-09-25 02:05:33 +02:00
< / p >
2021-09-25 02:03:59 +02:00
< p >
2021-09-25 02:02:38 +02:00
- Kernels for SVMs
2021-09-25 02:03:59 +02:00
< / p >
< p >
2021-09-25 02:03:01 +02:00
- Support Vector Regression
2021-09-25 02:02:38 +02:00
< / p >
2021-09-25 02:00:59 +02:00
## Citations
2022-01-30 22:32:55 +01:00
Various different materials helped me along the way of creating ML++, and I would like to give credit to several of them here. [This ](https://www.tutorialspoint.com/cplusplus-program-to-compute-determinant-of-a-matrix ) article by TutorialsPoint was a big help when trying to implement the determinant of a matrix, and [this ](https://www.geeksforgeeks.org/adjoint-inverse-matrix/ ) article by GeeksForGeeks was very helpful when trying to take the adjoint and inverse of a matrix.