Greetings! I am a newcomer to Angular 2 and facing difficulties in importing the Regression npm module for utilizing the Linear Regression function within my Angular 2 application. My project setup includes Angular 2, Webpack, and TypeScript.
I have executed the command npm install regression
and added the script tag in my index.html file as follows:
<script src="node_modules/regression/src/regression.js"></script>
In addition, I have imported Regression in my App.Module like this:
import * as Regression from 'regression';
Despite these steps, when attempting to utilize the regression function, it is indicating that the function cannot be found:
let actualXY = [];
for (var j = 0; j <= 11; j++) {
let entry = [];
entry[0] = j+1;
entry[1] = m.actuals[j];
actualXY[j] = entry;
}
var result = regression('linear', actualXY);
Am I missing any crucial steps in importing the Regression package or is it simply not feasible?