Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_computeWithNIPALS(dataset, nCompNIPALS) {
this.U = new Matrix(nCompNIPALS, dataset.columns);
this.S = [];
let x = dataset;
for (let i = 0; i < nCompNIPALS; i++) {
let dc = new NIPALS(x);
this.U.setRow(i, dc.w.transpose());
this.S.push(Math.pow(dc.s.get(0, 0), 2));
x = dc.xResidual;
}
this.U = this.U.transpose(); // to be compatible with API
}
}