Changeset 7610 for branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression
- Timestamp:
- 03/13/12 15:33:19 (12 years ago)
- Location:
- branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4
-
Property
svn:ignore
set to
Plugin.cs
bin
obj
-
Property
svn:ignore
set to
-
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/HeuristicLab.Problems.Instances.Regression-3.4.csproj
r7603 r7610 40 40 <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 41 41 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 42 <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 42 43 <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> 43 44 <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" /> … … 52 53 <ItemGroup> 53 54 <Compile Include="Keijzer\KeijzerFunctionEight.cs" /> 55 <Compile Include="Plugin.cs" /> 54 56 <Compile Include="ResourceRegressionInstanceProvider.cs" /> 55 57 <Compile Include="ArtificialRegressionInstanceProvider.cs" /> -
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/Keijzer/KeijzerInstanceProvider.cs
r7603 r7610 20 20 #endregion 21 21 22 23 22 using System; 24 23 using System.Collections.Generic; 24 25 25 namespace HeuristicLab.Problems.Instances.Regression { 26 public class KeijzerInstanceProvider : ArtificialRegressionInstanceProvider {26 public class KeijzerInstanceProvider : ArtificialRegressionInstanceProvider, IProblemInstanceProvider<RegressionData> { 27 27 public override string Name { 28 28 get { return "Keijzer Benchmark Problems"; } … … 43 43 return descriptorList; 44 44 } 45 46 /*#region delete after test 47 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 array 60 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 #endregion 100 101 #region IProblemInstanceProvider<RegressionData> Members 102 103 public IProblemInstanceConsumer<RegressionData> Consumer { 104 get { 105 return new RegressionProblem(); 106 } 107 set { 108 throw new NotImplementedException(); 109 } 110 } 111 112 #endregion */ 45 113 } 46 114 } -
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/Properties/AssemblyInfo.cs
r7603 r7610 1 using System.Reflection; 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.Reflection; 2 23 using System.Runtime.CompilerServices; 3 24 using System.Runtime.InteropServices; … … 6 27 // set of attributes. Change these attribute values to modify the information 7 28 // associated with an assembly. 8 [assembly: AssemblyTitle("HeuristicLab.Problems.Instances.Regression -3.4")]29 [assembly: AssemblyTitle("HeuristicLab.Problems.Instances.Regression")] 9 30 [assembly: AssemblyDescription("")] 10 31 [assembly: AssemblyConfiguration("")] 11 [assembly: AssemblyCompany(" ")]12 [assembly: AssemblyProduct("HeuristicLab .Problems.Instances.Regression-3.4")]13 [assembly: AssemblyCopyright(" Copyright © 2012")]32 [assembly: AssemblyCompany("HEAL")] 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-2012 HEAL")] 14 35 [assembly: AssemblyTrademark("")] 15 36 [assembly: AssemblyCulture("")] … … 33 54 // by using the '*' as shown below: 34 55 // [assembly: AssemblyVersion("1.0.*")] 35 [assembly: AssemblyVersion(" 1.0.0.0")]36 [assembly: AssemblyFileVersion(" 1.0.0.0")]56 [assembly: AssemblyVersion("3.4.0.0")] 57 [assembly: AssemblyFileVersion("3.4.0.7603")] -
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/RegressionInstanceProvider.cs
r7603 r7610 21 21 22 22 using System; 23 using System.Collections; 23 24 using System.Collections.Generic; 24 25 using System.IO; … … 33 34 34 35 RegressionData regData = new RegressionData(); 35 regData.Name = path; 36 int pos = path.LastIndexOf('\\'); 37 if (pos < 0) 38 regData.Name = path; 39 else { 40 pos++; 41 regData.Name = path.Substring(pos, path.Length - pos); 42 } 36 43 regData.InputVariables = new List<string>(csvFileParser.VariableNames); 37 44 regData.TargetVariable = csvFileParser.VariableNames.Last(); 45 regData.AllowedInputVariables = regData.InputVariables.Where(x => !x.Equals(regData.TargetVariable)); 38 46 //convert to multidimensional array 39 double[][] values = csvFileParser.Values.Cast<double[]>().ToArray();40 regData.Values = new double[values. GetLength(0), values.GetLength(1)];41 for (int i = 0; i < values. GetLength(0); i++) {42 for (int j = 0; j < values. GetLength(1); j++) {43 regData.Values[ i, j] =values[i][j];47 List<IList> values = csvFileParser.Values; 48 regData.Values = new double[values.First().Count, values.Count]; 49 for (int i = 0; i < values.Count; i++) { 50 for (int j = 0; j < values.First().Count; j++) { 51 regData.Values[j, i] = (double)values[i][j]; 44 52 } 45 53 } -
branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Problems.Instances.Regression/3.4/ValueGenerator.cs
r7603 r7610 30 30 31 31 public static double[,] Transformation(List<List<double>> data) { 32 double[,] values = new double[data. Count, data.First().Count];32 double[,] values = new double[data.First().Count, data.Count]; 33 33 for (int i = 0; i < values.GetLength(0); i++) { 34 34 for (int j = 0; j < values.GetLength(1); j++) { 35 values[i, j] = data[ i][j];35 values[i, j] = data[j][i]; 36 36 } 37 37 }
Note: See TracChangeset
for help on using the changeset viewer.