Changeset 9607


Ignore:
Timestamp:
06/11/13 16:37:01 (8 years ago)
Author:
sforsten
Message:

#1730: added cell formatting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Symbolic.Views/3.4/MenuItems/ExportSymbolicSolutionToExcelMenuItem.cs

    r9600 r9607  
    124124      modelWorksheet.Cells[row, 2].Value = solution.Model.LowerEstimationLimit;
    125125      modelWorksheet.Names.Add("EstimationLimitLower", modelWorksheet.Cells[row, 2]);
     126      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    126127      row++;
    127128
     
    129130      modelWorksheet.Cells[row, 2].Value = solution.Model.UpperEstimationLimit;
    130131      modelWorksheet.Names.Add("EstimationLimitUpper", modelWorksheet.Cells[row, 2]);
     132      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    131133      row += 2;
    132134
     
    167169      modelWorksheet.Cells[row, 1].Value = "Pearson's R² (training)";
    168170      modelWorksheet.Cells[row, 2].Formula = string.Format("POWER(PEARSON({0},{1}),2)", excelTrainingTarget, excelTrainingEstimated);
     171      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    169172      row++;
    170173
    171174      modelWorksheet.Cells[row, 1].Value = "Pearson's R² (test)";
    172175      modelWorksheet.Cells[row, 2].Formula = string.Format("POWER(PEARSON({0},{1}),2)", excelTestTarget, excelTestEstimated);
     176      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    173177      row++;
    174178
     
    176180      modelWorksheet.Cells[row, 2].Formula = string.Format("AVERAGE({0})", excelTrainingMSE);
    177181      modelWorksheet.Names.Add("TrainingMSE", modelWorksheet.Cells[row, 2]);
     182      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    178183      row++;
    179184
     
    181186      modelWorksheet.Cells[row, 2].Formula = string.Format("AVERAGE({0})", excelTestMSE);
    182187      modelWorksheet.Names.Add("TestMSE", modelWorksheet.Cells[row, 2]);
     188      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    183189      row++;
    184190
    185191      modelWorksheet.Cells[row, 1].Value = "Mean absolute error (training)";
    186192      modelWorksheet.Cells[row, 2].Formula = string.Format("AVERAGE({0})", excelTrainingAbsoluteError);
     193      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    187194      row++;
    188195
    189196      modelWorksheet.Cells[row, 1].Value = "Mean absolute error (test)";
    190197      modelWorksheet.Cells[row, 2].Formula = string.Format("AVERAGE({0})", excelTestAbsoluteError);
     198      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    191199      row++;
    192200
    193201      modelWorksheet.Cells[row, 1].Value = "Mean error (training)";
    194202      modelWorksheet.Cells[row, 2].Formula = string.Format("AVERAGE({0})", excelTrainingMeanError);
     203      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    195204      row++;
    196205
    197206      modelWorksheet.Cells[row, 1].Value = "Mean error (test)";
    198207      modelWorksheet.Cells[row, 2].Formula = string.Format("AVERAGE({0})", excelTestMeanError);
     208      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    199209      row++;
    200210
     
    211221      modelWorksheet.Cells[row, 1].Value = "Normalized Mean Squared error (training)";
    212222      modelWorksheet.Cells[row, 2].Formula = string.Format("TrainingMSE / VAR({0})", excelTrainingTarget);
     223      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    213224      row++;
    214225
    215226      modelWorksheet.Cells[row, 1].Value = "Normalized Mean Squared error  (test)";
    216227      modelWorksheet.Cells[row, 2].Formula = string.Format("TestMSE / VAR({0})", excelTestTarget);
     228      modelWorksheet.Cells[row, 2].Style.Numberformat.Format = "0.000";
    217229
    218230      modelWorksheet.Cells["A1:B" + row].AutoFitColumns();
     
    300312        estimatedWorksheet.Cells[i + 2, 9].Formula = string.Format(preparedFormula, i + 2);
    301313      }
     314      estimatedWorksheet.Cells["B2:B" + (rows + 1)].Style.Numberformat.Format = "0.000";
    302315
    303316      estimatedWorksheet.Cells["C2:C" + (rows + 1)].Formula = "J2";
    304 
     317      estimatedWorksheet.Cells["C2:C" + (rows + 1)].Style.Numberformat.Format = "0.000";
    305318      estimatedWorksheet.Cells["D2:D" + (rows + 1)].Formula = "ABS(B2 - C2)";
     319      estimatedWorksheet.Cells["D2:D" + (rows + 1)].Style.Numberformat.Format = "0.000";
    306320      estimatedWorksheet.Cells["E2:E" + (rows + 1)].Formula = "ABS(D2 / B2)";
     321      estimatedWorksheet.Cells["E2:E" + (rows + 1)].Style.Numberformat.Format = "0.000";
    307322      estimatedWorksheet.Cells["F2:F" + (rows + 1)].Formula = "C2 - B2";
     323      estimatedWorksheet.Cells["F2:F" + (rows + 1)].Style.Numberformat.Format = "0.000";
    308324      estimatedWorksheet.Cells["G2:G" + (rows + 1)].Formula = "POWER(F2, 2)";
    309 
     325      estimatedWorksheet.Cells["G2:G" + (rows + 1)].Style.Numberformat.Format = "0.000";
     326
     327      estimatedWorksheet.Cells["I2:I" + (rows + 1)].Style.Numberformat.Format = "0.000";
    310328      estimatedWorksheet.Cells["J2:J" + (rows + 1)].Formula = "IFERROR(IF(I2 > Model!EstimationLimitUpper, Model!EstimationLimitUpper, IF(I2 < Model!EstimationLimitLower, Model!EstimationLimitLower, I2)), AVERAGE(Model!EstimationLimitLower, Model!EstimationLimitUpper))";
     329      estimatedWorksheet.Cells["J2:J" + (rows + 1)].Style.Numberformat.Format = "0.000";
    311330    }
    312331
Note: See TracChangeset for help on using the changeset viewer.