package app.PREDICTION;

/**
 * Created by Petr Flégl on 1.4.2017.
 */
public abstract class AbstractPredictor implements PredictorInterface {

    Matrix X = new Matrix(new double[][]{{4, 0, 1}, {7, 1, 1}, {6, 1, 0}, {2, 0, 0}, {3, 0, 1}}, Matrix.matrixType.YX);
    Matrix Y = new Matrix(new double[][]{{27}, {29}, {23}, {20}, {21}}, Matrix.matrixType.YX);
    MultiLinearRegression ml = new MultiLinearRegression(X, Y, true);
    Matrix beta;

    public Matrix getBeta(){
        return beta;
    }

    public double[] getBetaArray(){

        if (beta!= null) {
            System.out.println("OCP BETAS MATRIX: "+beta.toString());
            double[] betas = new double[beta.getNrows()];
            for (int row = 0; row < beta.getNrows(); row++) {
                betas[row] = beta.getValueAt(row, 0);
            }

            return betas;

        }else
            return new double[0];
    }


    public abstract double[] getResults(int numOfDays);

    public String toString() {
        return getBeta().toString();
    }
}
