コード例 #1
0
        public LogRegressionResults GetRegressionResult(GadgetParameters gadgetOptions, List <string> columnNames, List <DictionaryDTO> inputDtoList, IEnumerable <EwavDataFilterCondition> ewavDataFilters, List <EwavRule_Base> rules, string filterString = "", string customFilter = "")
        {
            if (gadgetOptions.UseAdvancedDataFilter)
            {
                dh = new DashboardHelper(gadgetOptions, filterString, rules);
                gadgetOptions.UseAdvancedDataFilter  = true;
                gadgetOptions.AdvancedDataFilterText = filterString;
            }
            else
            {
                dh = new DashboardHelper(gadgetOptions, ewavDataFilters, rules);
            }
            DataTable dt;
            Dictionary <string, string> inputVariableList = RegressionManager.ConvertDtoToDic(inputDtoList);

            //LogRegressionResults results = new LogRegressionResults();
            StatisticsRepository.LogisticRegression logisticRegression = new StatisticsRepository.LogisticRegression();
            try
            {
                dt = dh.GenerateTable(columnNames, gadgetOptions, customFilter);
            }
            catch (System.Exception e)
            {
                throw new Exception("Error retrieving data from Dashboard Helper");
                //results.ErrorMessage = e.Message;
                //return results;
            }



            StatisticsRepository.LogisticRegression.LogisticRegressionResults regressionResults = logisticRegression.LogisticRegression(inputVariableList, dt);

            LogRegressionResults results = RegressionManager.ConvertToLogRegResults(regressionResults);

            //results.CasesIncluded = results.RegressionResults1.CasesIncluded;
            //results.Convergence = results.RegressionResults1.Convergence;
            //results.FinalLikelihood = results.RegressionResults1.FinalLikelihood;
            //results.Iterations = results.RegressionResults1.Iterations;
            //results.LRDF = results.RegressionResults1.LRDF;
            //results.LRP = results.RegressionResults1.LRP;
            //results.LRStatistic = results.RegressionResults1.LRStatistic;
            //results.ScoreDF = results.RegressionResults1.ScoreDF;
            //results.ScoreP = results.RegressionResults1.ScoreP;
            //results.ScoreStatistic = results.RegressionResults1.ScoreStatistic;
            //if (results.RegressionResults1.ErrorMessage != null)
            //{
            //    results.ErrorMessage = results.RegressionResults1.ErrorMessage.Replace("<tlt>", string.Empty).Replace("</tlt>", string.Empty);
            //}

            //results.Variables = results.RegressionResults1.Variables;


            return(results);
        }
コード例 #2
0
        /// <summary>
        /// GetFactory that converts LogisticRegressionResults values to LogRessionResults(custom) class.
        /// </summary>
        /// <param name="logisticRegressionResults"></param>
        /// <returns></returns>
        internal static LogRegressionResults ConvertToLogRegResults(StatisticsRepository.LogisticRegression.LogisticRegressionResults logisticRegressionResults)
        {
            LogRegressionResults logRegResults = new LogRegressionResults();

            logRegResults.CasesIncluded   = logisticRegressionResults.casesIncluded;
            logRegResults.Convergence     = logisticRegressionResults.convergence;
            logRegResults.FinalLikelihood = logisticRegressionResults.finalLikelihood;
            logRegResults.Iterations      = logisticRegressionResults.iterations;
            logRegResults.LRDF            = logisticRegressionResults.LRDF;
            logRegResults.LRP             = logisticRegressionResults.LRP;
            logRegResults.LRStatistic     = logisticRegressionResults.LRStatistic;
            logRegResults.ScoreDF         = logisticRegressionResults.scoreDF;
            logRegResults.ScoreP          = logisticRegressionResults.scoreP;
            logRegResults.ScoreStatistic  = logisticRegressionResults.scoreStatistic;
            logRegResults.Variables       = ConvertToVariableClass(logisticRegressionResults.variables);
            logRegResults.ErrorMessage    = logisticRegressionResults.errorMessage;
            return(logRegResults);
        }