The predict function of the PLS Class optionally scales the X values but always reverse scaling on the Y-Values. Shouldn't the Y scaling be embedded within an if(this.scale) block?
Code as-is:
predict(dataset) {
let X = Matrix.checkMatrix(dataset);
if (this.scale) {
X = X.subRowVector(this.meanX).divRowVector(this.stdDevX);
}
let Y = X.mmul(this.PBQ);
Y = Y.mulRowVector(this.stdDevY).addRowVector(this.meanY);
return Y;
}
Proposed fix:
predict(dataset) {
let X = Matrix.checkMatrix(dataset);
if (this.scale) {
X = X.subRowVector(this.meanX).divRowVector(this.stdDevX);
}
let Y = X.mmul(this.PBQ);
if (this.scale) {
Y = Y.mulRowVector(this.stdDevY).addRowVector(this.meanY);
}
return Y;
}
The predict function of the PLS Class optionally scales the X values but always reverse scaling on the Y-Values. Shouldn't the Y scaling be embedded within an
if(this.scale)block?Code as-is:
Proposed fix: