From a0e2becaf0800efcc2f4f32399d52c0c2e4edd32 Mon Sep 17 00:00:00 2001 From: Netkas Date: Tue, 21 Feb 2023 00:48:56 -0500 Subject: [PATCH] Updated README.md --- README.md | 88 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7f6bfcb..aa5e694 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,92 @@ # AlizeLib -Coming soon... +Calculate the averages, total & best of labelled data, import and export the model for later use. + +## Installation + +The library can be installed using ncc: + +```bash +ncc install -p "nosial/libs.alize=latest@n64" +``` + +or by adding the following to your project.json file under + +the `build.dependencies` section: + +```json +{ + "name": "net.nosial.alizelib", + "version": "latest", + "source_type": "remote", + "source": "nosial/libs.alize=latest@n64" +} +``` + +If you don't have the n64 source configured you can add it + +by running the following command: + +```bash +ncc source add --name n64 --type gitlab --host git.n64.cc +``` + +## Compiling from source + +The library can be compiled from source using ncc: + +```bash +ncc build --config release +``` + +or by running the following command: + +```bash +make release +``` + +## Usage + +```php +// ncc +require 'ncc'; +import('net.nosial.alizelib'); + +// Create a new model +$size = 100; // The size of the model +$model = new \AlizeLib\GeneralizationModel($size); + +// We are intentionally adding more data to the model +// than the model can hold, this is to demonstrate +// how old data is removed from the model. + +// Add random high float values to the model under label "en" x 150 times +for($i = 0; $i < 150; $i++) +{ + $model->add("en", random_float(0.5, 1)); +} + +// Add random low float values to the model under label "zh" x 150 times +for($i = 0; $i < 150; $i++) +{ + $model->add("zh", random_float(0, 0.5)); +} + +// Add random very low float values to the model under label "fr" x 150 times +for($i = 0; $i < 150; $i++) +{ + $model->add("fr", random_float(0, 0.1)); +} + +// Add random very high float values to the model under label "de" x 150 times +for($i = 0; $i < 150; $i++) +{ + $model->add("de", random_float(0.9, 1)); +} + +// Best label should be "de" or second best "en" +var_dump($model->calculateBestLabels()); +``` # License