public string ReadSource(string period, int month, int chunk, DecisionTreeAlgorithm algorithm) { switch (algorithm) { case DecisionTreeAlgorithm.C45: return ReadC45Source(period, month, chunk); case DecisionTreeAlgorithm.C50: return ReadC50Source(period, month, chunk); default: throw new DalException("Incorrect algorithm provided."); } }
public string ReadSource(string period, int month, int chunk, DecisionTreeAlgorithm algorithm) { switch (algorithm) { case DecisionTreeAlgorithm.C45: return(ReadC45Source(period, month, chunk)); case DecisionTreeAlgorithm.C50: return(ReadC50Source(period, month, chunk)); default: throw new DalException("Incorrect algorithm provided."); } }
public void PrepareForAlgorithm(DecisionTreeAlgorithm algorithm) { Algorithm = algorithm; _forexTradingAgentService.Algorithm = algorithm; switch (algorithm) { case DecisionTreeAlgorithm.C45: foreach (var sequence in StatisticsSequences.Select(sequenceElement => sequenceElement.Value)) { sequence.Sort(delegate(StatisticsSequenceDto sequenceDtoOne, StatisticsSequenceDto sequenceDtoTwo) { var errorsOne = (double)sequenceDtoOne.C45Errors / sequenceDtoOne.Cases; var errorsTwo = (double)sequenceDtoTwo.C45Errors / sequenceDtoTwo.Cases; return(errorsOne.CompareTo(errorsTwo)); }); } break; case DecisionTreeAlgorithm.C50: foreach (var sequence in StatisticsSequences.Select(sequenceElement => sequenceElement.Value)) { sequence.Sort(delegate(StatisticsSequenceDto sequenceDtoOne, StatisticsSequenceDto sequenceDtoTwo) { var errorsOne = (double)sequenceDtoOne.C50Errors / sequenceDtoOne.Cases; var errorsTwo = (double)sequenceDtoTwo.C50Errors / sequenceDtoTwo.Cases; return(errorsOne.CompareTo(errorsTwo)); }); } break; default: throw new ArgumentOutOfRangeException("algorithm", algorithm, null); } _prepared = true; }
private void AddToHistogram(Dictionary <double, HistogramDto> histogramDictionary, double intervalFrom, DecisionTreeAlgorithm algorithm) { if (!histogramDictionary.ContainsKey(intervalFrom)) { histogramDictionary.Add(intervalFrom, new HistogramDto { IntervalFrom = MathHelpers.PreservePrecision(intervalFrom), IntervalTo = MathHelpers.PreservePrecision(intervalFrom + IntervalLength) }); } var histogramDto = histogramDictionary[intervalFrom]; switch (algorithm) { case DecisionTreeAlgorithm.C45: histogramDto.C45Cases++; break; case DecisionTreeAlgorithm.C50: histogramDto.C50Cases++; break; } }
public void PrepareForAlgorithm(DecisionTreeAlgorithm algorithm) { Algorithm = algorithm; _forexTradingAgentService.Algorithm = algorithm; switch (algorithm) { case DecisionTreeAlgorithm.C45: foreach (var sequence in StatisticsSequences.Select(sequenceElement => sequenceElement.Value)) { sequence.Sort(delegate(StatisticsSequenceDto sequenceDtoOne, StatisticsSequenceDto sequenceDtoTwo) { var errorsOne = (double)sequenceDtoOne.C45Errors / sequenceDtoOne.Cases; var errorsTwo = (double)sequenceDtoTwo.C45Errors / sequenceDtoTwo.Cases; return errorsOne.CompareTo(errorsTwo); }); } break; case DecisionTreeAlgorithm.C50: foreach (var sequence in StatisticsSequences.Select(sequenceElement => sequenceElement.Value)) { sequence.Sort(delegate(StatisticsSequenceDto sequenceDtoOne, StatisticsSequenceDto sequenceDtoTwo) { var errorsOne = (double)sequenceDtoOne.C50Errors / sequenceDtoOne.Cases; var errorsTwo = (double)sequenceDtoTwo.C50Errors / sequenceDtoTwo.Cases; return errorsOne.CompareTo(errorsTwo); }); } break; default: throw new ArgumentOutOfRangeException("algorithm", algorithm, null); } _prepared = true; }
private void AddToHistogram(Dictionary<double, HistogramDto> histogramDictionary, double intervalFrom, DecisionTreeAlgorithm algorithm) { if (!histogramDictionary.ContainsKey(intervalFrom)) { histogramDictionary.Add(intervalFrom, new HistogramDto { IntervalFrom = MathHelpers.PreservePrecision(intervalFrom), IntervalTo = MathHelpers.PreservePrecision(intervalFrom + IntervalLength) }); } var histogramDto = histogramDictionary[intervalFrom]; switch (algorithm) { case DecisionTreeAlgorithm.C45: histogramDto.C45Cases++; break; case DecisionTreeAlgorithm.C50: histogramDto.C50Cases++; break; } }