Changeset 7664 for branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/Keijzer
- Timestamp:
- 03/27/12 10:05:59 (13 years ago)
- Location:
- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/Keijzer
- Files:
-
- 7 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/Keijzer/KeijzerFunctionEight.cs
r7603 r7664 1 using System; 1 #region License Information 2 /* HeuristicLab 3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 * 5 * This file is part of HeuristicLab. 6 * 7 * HeuristicLab is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * HeuristicLab is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>. 19 */ 20 #endregion 21 22 using System; 2 23 using System.Collections.Generic; 3 24 -
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/Keijzer/KeijzerInstanceProvider.cs
r7610 r7664 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 1Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 24 24 25 25 namespace HeuristicLab.Problems.Instances.Regression { 26 public class KeijzerInstanceProvider : ArtificialRegressionInstanceProvider , IProblemInstanceProvider<RegressionData>{26 public class KeijzerInstanceProvider : ArtificialRegressionInstanceProvider { 27 27 public override string Name { 28 28 get { return "Keijzer Benchmark Problems"; } … … 40 40 public override IEnumerable<IDataDescriptor> GetDataDescriptors() { 41 41 List<IDataDescriptor> descriptorList = new List<IDataDescriptor>(); 42 descriptorList.Add(new KeijzerFunctionFour()); 43 descriptorList.Add(new KeijzerFunctionSix()); 44 descriptorList.Add(new KeijzerFunctionSeven()); 42 45 descriptorList.Add(new KeijzerFunctionEight()); 46 descriptorList.Add(new KeijzerFunctionTwelve()); 47 descriptorList.Add(new KeijzerFunctionThirteen()); 48 descriptorList.Add(new KeijzerFunctionFifteen()); 49 descriptorList.Add(new KeijzerFunctionSixteen()); 43 50 return descriptorList; 44 51 } 45 46 /*#region delete after test47 public RegressionData LoadData(IDataDescriptor descriptor) {48 throw new NotImplementedException();49 }50 51 public RegressionData LoadData(string path) {52 TableFileParser csvFileParser = new TableFileParser();53 csvFileParser.Parse(path);54 55 RegressionData regData = new RegressionData();56 regData.Name = path;57 regData.InputVariables = new List<string>(csvFileParser.VariableNames);58 regData.TargetVariable = csvFileParser.VariableNames.Last();59 //convert to multidimensional array60 double[][] values = csvFileParser.Values.Cast<double[]>().ToArray();61 regData.Values = new double[values.GetLength(0), values.GetLength(1)];62 for (int i = 0; i < values.GetLength(0); i++) {63 for (int j = 0; j < values.GetLength(1); j++) {64 regData.Values[i, j] = values[i][j];65 }66 }67 68 int trainingPartEnd = csvFileParser.Rows * 2 / 3;69 regData.TrainingPartitionStart = 0;70 regData.TrainingPartitionEnd = trainingPartEnd;71 regData.TestPartitionStart = trainingPartEnd;72 regData.TestPartitionEnd = csvFileParser.Rows;73 return regData;74 }75 76 public void SaveData(RegressionData instance, string path) {77 StringBuilder strBuilder = new StringBuilder();78 79 foreach (var variable in instance.InputVariables) {80 strBuilder.Append(variable + ";");81 }82 strBuilder.Remove(strBuilder.Length - 1, 1);83 strBuilder.AppendLine();84 85 double[,] values = instance.Values;86 87 for (int i = 0; i < values.GetLength(0); i++) {88 for (int j = 0; j < values.GetLength(1); j++) {89 strBuilder.Append(values[i, j] + ";");90 }91 strBuilder.Remove(strBuilder.Length - 1, 1);92 strBuilder.AppendLine();93 }94 95 using (StreamWriter writer = new StreamWriter(path)) {96 writer.Write(strBuilder);97 }98 }99 #endregion100 101 #region IProblemInstanceProvider<RegressionData> Members102 103 public IProblemInstanceConsumer<RegressionData> Consumer {104 get {105 return new RegressionProblem();106 }107 set {108 throw new NotImplementedException();109 }110 }111 112 #endregion */113 52 } 114 53 }
Note: See TracChangeset
for help on using the changeset viewer.