Skip to content
Snippets Groups Projects
Commit 6eea26eb authored by Dean Samuel Schmitz's avatar Dean Samuel Schmitz
Browse files

Update README.md

parent 509fdc61
Branches
No related tags found
No related merge requests found
# Prolog mlpack Library # Prolog mlpack Library
## Getting started ## Getting started
To use the main file with the connected BayesianLinearRegression functions in sicstus use: The Library contains 30 of the Machine Learning Methods from MLpack.
``` For example **Linear_SVM**, **KMeans**, **Perceptron**, **Random_Forest**, **Kernel_PCA** ... and more
compile(main).
```
while running sicstus in the repository or:
``` You can find a full list of the Methods [here](https://gitlab.cs.uni-duesseldorf.de/stups/abschlussarbeiten/prolog-mlpack-libary/-/wikis/Home#prolog-methods).
['/full_path_to_main/main'].
```
when running sicstus in a different directory.
## Compile the main files with Makefile
To compile the main files just use __make__ ### Useful Links
if your full path to splfr is not __/usr/local/sicstus4.7.1/bin/splfr__ * [mlpack c++ documentation](https://www.mlpack.org/doc/mlpack-3.4.2/doxygen/)
* [mlpack python documentation](https://www.mlpack.org/doc/mlpack-3.4.2/python_documentation.html)
* [SICStus C Interface documentation](https://sicstus.sics.se/sicstus/docs/latest4/html/sicstus.html/Mixing-C-and-Prolog.html)
* [prolog-mlpack-library documentation](https://gitlab.cs.uni-duesseldorf.de/stups/abschlussarbeiten/prolog-mlpack-libary/-/wikis/Home)
then you will have to exchange this Makefile line with your splfr path. ### **_Quickstart_**
```
splfr=/usr/local/sicstus4.7.1/bin/splfr
```
#### How to get the project running:
## Compile the main files manually 1. Clone the project onto your system
2. Have MLpacks system Version installed (at best 3.4.2)
3. Have SICStus prolog installed (at least 4.7.1)
4. Have Ensmallen C++ Libary installed
To compile the main files manually with splfr you need to use the following command in the repository folder. (Required by the Methods Linear_SVM, LMNN, Logistic_regression and NCA)
5. Change the SPLFR_PATH Variable in the root folder Makefile to your absolute path to the SICStus splfr tool
6. Run the root folder Makefile using the command: make
The flags After that you can use each Method by loading their module with SICStus e.g.
-lmlpack (for mlpack intern libarys like armadillo) ```prolog
:- use_module('path/to/.../src/methods/dbscan/dbscan.pl').
-lstdc++ (for stdI/O and vector etc.) %% usage example
TrainData = [5.1,3.5,1.4, 4.9,3.0,1.4, 4.7,3.2,1.3, 4.6,3.1,1.5],
dbscan(1.0, 1, 0, ordered, kd, TrainData, 3, AssignList, CentroidsList, _).
```
--struct (for the sicstus struct library) #### How to edit the project:
``` To edit the Project the steps are almost the same as above except you should also install the Eclipse IDE SICStus integration Spider.
splfr -lmlpack -lstdc++ -cxx --struct main.pl main.cpp mlpack-3.4.2/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression.cpp
```
or if you dont have a command shortcut for splfr use
```
/path_to_splfr/splfr -lmlpack -lstdc++ -cxx --struct main.pl main.cpp mlpack-3.4.2/src/mlpack/methods/bayesian_linear_regression/bayesian_linear_regression.cpp
```
## Available functions Since it makes writing and running the prolog Code easier.
For a list of the functions the BayesianLinearRegression method has go to To test all methods there is a test_all.pl file in the root directory that you can compile with SICStus and then call :
[Mlpack BayesianLinearRegression documentation](https://www.mlpack.org/doc/stable/doxygen/classmlpack_1_1regression_1_1BayesianLinearRegression.html) ```prolog
run_tests.
```
For Arrays i have added predicates for converting Prolog lists [] to the needed float_array type and when receiving an array also Predicates for converting it to a normal list. Just make sure the SICStus Toplevel is the prolog-mlpack-libary root directory. (If not it will cause the predicate open/3, for opening files, to not find the iris2.csv)
A Matrix is just a long list with the added information how many row it has. ### Status
In both cases when using the array in a function the size must also be send, since after sending or receiving it you cant get the length of the array from itself. The Projekt was developt and tested on Ubuntu 22.04 LTS, with mlpack Version 3.4.2 and SICStus 4.7.1
for example: older Ubuntu Version could run into the Problem, that their mlpack system version is missing a few of the methods
```
train :-
convert_list_to_float_array([5.1,3.5,1.4,4.9,3.0,1.4,4.7,3.2,1.3,4.6,3.1,1.5],3, array(Xsize, Xrownum, X)),
convert_list_to_float_array([0.2,0.2,0.2,0.2], array(Ysize, Y)),
train(X,Xsize, Xrownum,Y, Ysize).
```
here the longer list representing a Matrix gets convertet into an array X with the row amount, and the smaller list into an array Y.
And they get used in the foreign function from BayesianLinearRegression that takes an Matrix of points and a vector of targets to train the model.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment