Skip to content

Commit

Permalink
Merge pull request #27 from akkoyun/01.04.15
Browse files Browse the repository at this point in the history
01.04.15 - Regresion model updated, R2 function added.
  • Loading branch information
akkoyun authored Mar 10, 2022
2 parents 6d8f97b + dd19ff0 commit 8cb5470
Show file tree
Hide file tree
Showing 11 changed files with 245 additions and 142 deletions.
Binary file modified .DS_Store
Binary file not shown.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
![GitHub release (latest by date)](https://img.shields.io/github/v/release/akkoyun/Statistical) ![arduino-library-badge](https://www.ardu-badge.com/badge/Statistical.svg?) ![Visits Badge](https://badges.pufler.dev/visits/akkoyun/Statistical) ![GitHub stars](https://img.shields.io/github/stars/akkoyun/Statistical?style=flat&logo=github) ![Updated Badge](https://badges.pufler.dev/updated/akkoyun/Statistical) ![PlatformIO Registry](https://badges.registry.platformio.org/packages/akkoyun/library/Statistical.svg)
[![Check Arduino](https://github.com/akkoyun/Statistical/actions/workflows/check-arduino.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/check-arduino.yml) [![Compile Examples](https://github.com/akkoyun/Statistical/actions/workflows/compile-examples.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/compile-examples.yml) [![Spell Check](https://github.com/akkoyun/Statistical/actions/workflows/spell-check.yml/badge.svg)](https://github.com/akkoyun/Statistical/actions/workflows/spell-check.yml)

Build - 01.04.14
Build - 01.04.15

---

Expand Down Expand Up @@ -60,6 +60,7 @@ Library calculate listed statistical parameters for fixed size arrays.

* Slope
* Offset
* R2

</details>

Expand All @@ -72,7 +73,8 @@ Library calculate listed statistical parameters for data stream. User set the re
* Precision
* Slope
* Offset

* R2

</details>

<details>
Expand Down
Binary file modified examples/.DS_Store
Binary file not shown.
53 changes: 53 additions & 0 deletions examples/Linear_Regression/Linear_Regression.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#include <Statistical.h>

Statistical DataSet;

void setup() {

// Start Serial
Serial.begin(115200);

}

void loop() {

// Set Data
Serial.println("Learning Data...");

// Set Precision
uint8_t Linear_Regression_Precision = 5;

// Set Array
float Data[Linear_Regression_Precision][2];

// Learn Data
DataSet.Array_FILO(Data, Linear_Regression_Precision, 1, 220.14);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 2, 221.36);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 3, 218.21);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 4, 217.06);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 5, 220.14);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 6, 222.14);
DataSet.Array_FILO(Data, Linear_Regression_Precision, 7, 225.14);

// Print FILO Array
Serial.print("Regression Data Array : ");
for (uint8_t i = 0; i < Linear_Regression_Precision; i++) {
Serial.print("[");
Serial.print(Data[i][0]);
Serial.print(",");
Serial.print(Data[i][1]);
Serial.print("] ");
}
Serial.println("");

// Print Calculated Data
Serial.print("Regression Data Count : "); Serial.println(Linear_Regression_Precision);
Serial.print("Regression Slope : "); Serial.println(DataSet.Linear_Regression_Slope(Data, Linear_Regression_Precision), 4);
Serial.print("Regression Offset : "); Serial.println(DataSet.Linear_Regression_Offset(Data, Linear_Regression_Precision), 4);
Serial.print("Regression R2 : "); Serial.println(DataSet.Linear_Regression_R2(Data, Linear_Regression_Precision), 4);
Serial.println("------------------------");

delay(10000);

}

48 changes: 0 additions & 48 deletions examples/Regression/Regression.ino

This file was deleted.

4 changes: 2 additions & 2 deletions examples/Stream/Stream.ino
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ void loop() {
DataSet.Stream_Statistic(132.2);

// Print Calculations
Serial.print("Stream Data Count : "); Serial.println(DataSet.Stream_Data_Count_Avg);
Serial.print("Stream Data Count : "); Serial.println(DataSet.Stream_Data_Count);
Serial.print("Stream Avg Value : "); Serial.println(DataSet.Stream_Average);
Serial.print("Stream Min Value : "); Serial.println(DataSet.Stream_Minimum);
Serial.print("Stream Max Value : "); Serial.println(DataSet.Stream_Maximum);
Serial.println("----------------");

// Reset
DataSet.Stream_Clear();
DataSet.Stream_Data_Clear();

delay(1000);

Expand Down
2 changes: 1 addition & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ LinearRegression KEYWORD2
# Constants (LITERAL1)
#######################################

Data_Count LITERAL1
Stream_Data_Count LITERAL1
Stream_Average LITERAL1
Stream_Minimum LITERAL1
Stream_Maximum LITERAL1
Expand Down
8 changes: 4 additions & 4 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Statistical",
"version": "1.4.14",
"version": "1.4.15",
"keywords": "Statistical, Max, Min, Average, Regression, Data, Sensor, Slope, Offset",
"description": "Function calculates statistical parameters of data stream and array",
"authors":
Expand Down Expand Up @@ -31,10 +31,10 @@
]
},
{
"name": "Regression",
"base": "examples/Regression/",
"name": "Linear Regression",
"base": "examples/Linear_Regression/",
"files": [
"Regression.ino"
"Linear_Regression.ino"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Statistical
version=1.4.14
version=1.4.15
author=Gunce Akkoyun <[email protected]>
maintainer=Gunce Akkoyun <[email protected]>
sentence=Statistic, Sum, Max, Min, Sq_Sum, Arithmetic Average, Geometric Average, RMS Average, Ext RMS Average, Bubble Sort, Median, Standard Deviation, Standard Deviation Error, Coefficient Factor, Average, Stream, Regression, Slope, Data, Analyse
Expand Down
Loading

0 comments on commit 8cb5470

Please sign in to comment.