Ejemplo n.º 1
0
        public RegressionPipelineEstimator <TR, TE> Fit(Matrix <double> x, Vector <double> y)
        {
            var(transformer, transformedX) = _transformation.FitTransform(x, y);
            var regressionEstimator = _regression.Fit(transformedX, y);

            return(new RegressionPipelineEstimator <TR, TE>(this, transformer, regressionEstimator));
        }
        private IModelledFunction GetOptimalFunction(IExcelSheet sheet,
                                                     ExcelColumnIndex yColumnIndex)
        {
            var xValues = new List <double>(_iterationsNumber);
            var yValues = new List <double>(_iterationsNumber);

            for (int rowIndex = 1.SkipHeader(); rowIndex <= _lastSegmentValueRowIndex; ++rowIndex)
            {
                IExcelCellHolder sampleSizeCell = sheet[_sampleSizeColumnIndex, rowIndex];
                xValues.Add(sampleSizeCell.NumericValue);

                IExcelCellValueHolder yValueCell = sheet.EvaluateCell(yColumnIndex, rowIndex);
                yValues.Add(yValueCell.NumericValue);
            }

            return(_regression.Fit(xValues, yValues));
        }