Esempio n. 1
0
 public string writeModel(string outModelPath)
 {
     if (lr == null)
     {
         buildModel();
     }
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.LogisticRegression.ToString());
         sw.WriteLine(InTablePath);
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(String.Join(",", Categories));
         sw.WriteLine(NumberOfIndependentVariables.ToString());
         sw.WriteLine(NumberOfCategories.ToString());
         sw.WriteLine(LogLikelihood.ToString());
         sw.WriteLine(Deviance.ToString());
         sw.WriteLine(X2.ToString());
         sw.WriteLine(PValue.ToString());
         sw.WriteLine(String.Join(",", (from double d in minValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in maxValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in sumValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in Coefficients select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in StandardError select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.Statistic.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from Accord.Statistics.Testing.WaldTest d in WaldStatistic select d.PValue.ToString()).ToArray()));
         sw.Close();
     }
     return(outPath);
 }
Esempio n. 2
0
 public string writeModel(string outModelPath)
 {
     if (mlr == null)
     {
         buildModel();
     }
     outPath = outModelPath;
     using (System.IO.StreamWriter sw = new System.IO.StreamWriter(outPath))
     {
         sw.WriteLine(modelTypes.PLR);
         sw.WriteLine(InTablePath);
         sw.WriteLine(String.Join(",", IndependentFieldNames));
         sw.WriteLine(String.Join(",", DependentFieldNames));
         sw.WriteLine(String.Join(",", ClassFieldNames));
         sw.WriteLine(String.Join(",", Categories));
         sw.WriteLine(NumberOfIndependentVariables.ToString());
         sw.WriteLine(NumberOfCategories.ToString());
         sw.WriteLine(Delta.ToString());
         sw.WriteLine(NumberOfIterationsToConverge.ToString());
         sw.WriteLine(LogLikelihood.ToString());
         sw.WriteLine(Deviance.ToString());
         sw.WriteLine(X2.ToString());
         sw.WriteLine(PValue.ToString());
         sw.WriteLine(String.Join(",", (from double d in minValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in maxValues select d.ToString()).ToArray()));
         sw.WriteLine(String.Join(",", (from double d in sumValues select d.ToString()).ToArray()));
         for (int i = 0; i < Coefficients.Length; i++)
         {
             string[] vlArr = (from double d in Coefficients[i] select d.ToString()).ToArray();
             sw.WriteLine(String.Join(" ", vlArr));
         }
         for (int i = 0; i < StandardError.Length; i++)
         {
             string[] vlArr = (from double d in StandardError[i] select d.ToString()).ToArray();
             sw.WriteLine(String.Join(" ", vlArr));
         }
         for (int i = 0; i < WaldStatistic.Length; i++)
         {
             string[] vlArr = (from double d in WaldStatistic[i] select d.ToString()).ToArray();
             sw.WriteLine(String.Join(" ", vlArr));
         }
         for (int i = 0; i < WaldPvalue.Length; i++)
         {
             string[] vlArr = (from double d in WaldPvalue[i] select d.ToString()).ToArray();
             sw.WriteLine(String.Join(" ", vlArr));
         }
         sw.Close();
     }
     return(outPath);
 }