mirror of
https://github.com/Karaka-Management/jsOMS.git
synced 2026-01-28 01:18:40 +00:00
Remove outdated js files. Maybe reimplement later when php side is done
This commit is contained in:
parent
320936bedf
commit
d9673b5ba4
|
|
@ -1,31 +0,0 @@
|
|||
/**
|
||||
* Average class.
|
||||
*
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
(function (jsOMS)
|
||||
{
|
||||
"use strict";
|
||||
|
||||
/** @namespace jsOMS.Math.Stochastic.Average */
|
||||
jsOMS.Autoloader.defineNamespace('jsOMS.Math.Stochastic.Average');
|
||||
|
||||
jsOMS.Math.Stochastic.Average.arithmeticMean = function (values, offset = 0)
|
||||
{
|
||||
Array.sort(values);
|
||||
let length = values.length;
|
||||
|
||||
if (offset > 0) {
|
||||
values = Array.splice(offset, length - offset);
|
||||
}
|
||||
|
||||
if (length === 0) {
|
||||
throw 'Division zero';
|
||||
}
|
||||
|
||||
return values.reduce((a, b) => a + b, 0) / length;
|
||||
};
|
||||
}(window.jsOMS = window.jsOMS || {}));
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/**
|
||||
* Linear regression class.
|
||||
*
|
||||
* @copyright Dennis Eichhorn
|
||||
* @license OMS License 1.0
|
||||
* @version 1.0.0
|
||||
* @since 1.0.0
|
||||
*/
|
||||
(function (jsOMS)
|
||||
{
|
||||
"use strict";
|
||||
/** @namespace jsOMS.Math.Stochastic.Forecast.LinearRegression */
|
||||
jsOMS.Autoloader.defineNamespace('jsOMS.Math.Stochastic.Forecast.LinearRegression');
|
||||
|
||||
jsOMS.Math.Stochastic.Forecast.LinearRegression.getLinearRegresseion = function (x, y)
|
||||
{
|
||||
let count = x.length,
|
||||
meanX = jsOMS.Math.Stochastic.Average.arithmeticMean(x),
|
||||
meanY = jsOMS.Math.Stochastic.Average.arithmeticMean(y),
|
||||
sum1 = 0,
|
||||
sum2 = 0,
|
||||
b0, b1;
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
sum1 += (y[i] - meanY) * (x[i] - meanX);
|
||||
sum2 += Math.pow(x[i] - meanX, 2);
|
||||
}
|
||||
|
||||
b1 = sum1 / sum2;
|
||||
b0 = meanY - b1 * meanX;
|
||||
|
||||
return {b0: b0, b1: b1};
|
||||
};
|
||||
}(window.jsOMS = window.jsOMS || {}));
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
describe('AverageTest', function ()
|
||||
{
|
||||
"use strict";
|
||||
|
||||
beforeEach(function ()
|
||||
{
|
||||
});
|
||||
|
||||
afterEach(function ()
|
||||
{
|
||||
});
|
||||
});
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
describe('LinearRegressionTest', function ()
|
||||
{
|
||||
"use strict";
|
||||
|
||||
beforeEach(function ()
|
||||
{
|
||||
});
|
||||
|
||||
afterEach(function ()
|
||||
{
|
||||
});
|
||||
});
|
||||
Loading…
Reference in New Issue
Block a user