All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.actelion.research.calc.regression.median.MedianRegression Maven / Gradle / Ivy

There is a newer version: 2024.11.2
Show newest version
package com.actelion.research.calc.regression.median;

import com.actelion.research.calc.Matrix;
import com.actelion.research.calc.regression.ARegressionMethod;
import com.actelion.research.util.datamodel.ModelXYIndex;

/**
 * MedianRegression
 * 

Modest v. Korff

*

* Created by korffmo1 on 13.02.19. * * The zero model. */ public class MedianRegression extends ARegressionMethod { private Matrix maMedian; public MedianRegression() { setParameterRegressionMethod(new ParameterMedian()); } public Matrix createModel(ModelXYIndex modelXYIndexTrain) { maMedian = modelXYIndexTrain.Y.getMedianCols(); Matrix maYHat = calculateYHat(modelXYIndexTrain.X); return maYHat; } public Matrix calculateYHat(Matrix X){ int rows = X.rows(); int cols = maMedian.cols(); Matrix maYHat = new Matrix(rows, cols); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { maYHat.set(i,j,maMedian.get(0,j)); } } return maYHat; } @Override public double calculateYHat(double[] arrRow) { return maMedian.get(0,0); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy