public void GenerateOptimalModel(OptimalModelAlgorithm alg) { if (!_initialized) { return; } ForOptMdl.Clear(); var n = Data.Count; int fullM = 0; foreach (bool b in TrueFunc) { if (b) { fullM++; } } double fullR2 = calcR2(_Y, n); TettaRSS fullXTettaRss = TettaRSS.Compute(generateX(Data.Count, fullM, TrueFunc.ToArray()), _Y); var sigma2 = fullXTettaRss.Rss / (n - fullM); if (alg == OptimalModelAlgorithm.Exception) { exceptionAlgorithm(n, fullM, fullR2, sigma2); } else { insertionAlgorithm(n, fullM, fullR2, sigma2); } selectBestF(ForOptMdl.Mellous, ref ForOptMdl.BestFMell); selectBestF(ForOptMdl.MSEP, ref ForOptMdl.BestFMSEP); selectBestF(ForOptMdl.AEV, ref ForOptMdl.BestFAEV); selectBestF(ForOptMdl.E, ref ForOptMdl.BestFE); selectBestFR(ForOptMdl.ManyKrit, ref ForOptMdl.BestFR); }
public void GenerateOptimalModel(OptimalModelAlgorithm alg) { if (!_initialized) return; ForOptMdl.Clear(); var n = Data.Count; int fullM = 0; foreach (bool b in TrueFunc) if (b) fullM++; double fullR2 = calcR2(_Y, n); TettaRSS fullXTettaRss = TettaRSS.Compute(generateX(Data.Count, fullM, TrueFunc.ToArray()), _Y); var sigma2 = fullXTettaRss.Rss / (n - fullM); if (alg == OptimalModelAlgorithm.Exception) exceptionAlgorithm(n, fullM, fullR2, sigma2); else insertionAlgorithm(n, fullM, fullR2, sigma2); selectBestF(ForOptMdl.Mellous, ref ForOptMdl.BestFMell); selectBestF(ForOptMdl.MSEP, ref ForOptMdl.BestFMSEP); selectBestF(ForOptMdl.AEV, ref ForOptMdl.BestFAEV); selectBestF(ForOptMdl.E, ref ForOptMdl.BestFE); selectBestFR(ForOptMdl.ManyKrit, ref ForOptMdl.BestFR); }