Changeset 16092 for branches/2839_HiveProjectManagement
- Timestamp:
- 08/29/18 09:44:07 (6 years ago)
- Location:
- branches/2839_HiveProjectManagement
- Files:
-
- 21 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/2839_HiveProjectManagement
- Property svn:mergeinfo changed
/trunk merged: 16059,16063,16071,16084-16086
- Property svn:mergeinfo changed
-
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Algorithms.DataAnalysis merged: 16071,16086
- Property svn:mergeinfo changed
-
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis/3.4
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Algorithms.DataAnalysis/3.4 merged: 16071,16086
- Property svn:mergeinfo changed
-
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis/3.4/GBM/GradientBoostingRegressionAlgorithm.cs
r16057 r16092 210 210 protected override void Run(CancellationToken cancellationToken) { 211 211 // Set up the algorithm 212 if (SetSeedRandomly) Seed = new System.Random().Next();212 if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed(); 213 213 var rand = new MersenneTwister((uint)Seed); 214 214 -
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis/3.4/GradientBoostedTrees/GradientBoostedTreesAlgorithm.cs
r16057 r16092 186 186 protected override void Run(CancellationToken cancellationToken) { 187 187 // Set up the algorithm 188 if (SetSeedRandomly) Seed = new System.Random().Next();188 if (SetSeedRandomly) Seed = Random.RandomSeedGenerator.GetSeed(); 189 189 190 190 // Set up the results display -
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis/3.4/NearestNeighbour/NearestNeighbourModel.cs
r16057 r16092 130 130 // automatic determination of weights (all features should have variance = 1) 131 131 this.weights = this.allowedInputVariables 132 .Select(name => 1.0 / dataset.GetDoubleValues(name, rows).StandardDeviationPop()) 132 .Select(name => { 133 var pop = dataset.GetDoubleValues(name, rows).StandardDeviationPop(); 134 return pop.IsAlmost(0) ? 1.0 : 1.0/pop; 135 }) 133 136 .Concat(new double[] { 1.0 }) // no scaling for target variable 134 137 .ToArray(); -
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis/3.4/NonlinearRegression/NonlinearRegression.cs
r16057 r16092 186 186 qualityTable.Rows.Add(testRMSERow); 187 187 Results.Add(new Result(qualityTable.Name, qualityTable.Name + " for all restarts", qualityTable)); 188 if (SetSeedRandomly) Seed = (new System.Random()).Next();188 if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed(); 189 189 var rand = new MersenneTwister((uint)Seed); 190 190 bestSolution = CreateRegressionSolution(Problem.ProblemData, ModelStructure, Iterations, ApplyLinearScaling, rand); -
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestClassification.cs
r16057 r16092 135 135 protected override void Run(CancellationToken cancellationToken) { 136 136 double rmsError, relClassificationError, outOfBagRmsError, outOfBagRelClassificationError; 137 if (SetSeedRandomly) Seed = new System.Random().Next();137 if (SetSeedRandomly) Seed = Random.RandomSeedGenerator.GetSeed(); 138 138 139 139 var model = CreateRandomForestClassificationModel(Problem.ProblemData, NumberOfTrees, R, M, Seed, out rmsError, out relClassificationError, out outOfBagRmsError, out outOfBagRelClassificationError); -
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis/3.4/RandomForest/RandomForestRegression.cs
r16057 r16092 134 134 protected override void Run(CancellationToken cancellationToken) { 135 135 double rmsError, avgRelError, outOfBagRmsError, outOfBagAvgRelError; 136 if (SetSeedRandomly) Seed = new System.Random().Next();136 if (SetSeedRandomly) Seed = Random.RandomSeedGenerator.GetSeed(); 137 137 var model = CreateRandomForestRegressionModel(Problem.ProblemData, NumberOfTrees, R, M, Seed, 138 138 out rmsError, out avgRelError, out outOfBagRmsError, out outOfBagAvgRelError); -
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.DataAnalysis/3.4/TSNE/TSNEAlgorithm.cs
r16057 r16092 275 275 if (wdist != null) wdist.Initialize(problemData); 276 276 if (state == null) { 277 if (SetSeedRandomly) Seed = new System.Random().Next();277 if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed(); 278 278 var random = new MersenneTwister((uint)Seed); 279 279 var dataset = problemData.Dataset; -
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.MOCMAEvolutionStrategy
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Algorithms.MOCMAEvolutionStrategy (added) merged: 16071
- Property svn:mergeinfo changed
-
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.MOCMAEvolutionStrategy/3.3/MOCMAEvolutionStrategy.cs
r16057 r16092 285 285 #region Initialization 286 286 protected override void Initialize(CancellationToken cancellationToken) { 287 if (SetSeedRandomly) Seed = new System.Random().Next();287 if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed(); 288 288 random.Reset(Seed); 289 289 gauss = new NormalDistributedRandom(random, 0, 1); -
branches/2839_HiveProjectManagement/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/ParameterlessPopulationPyramid.cs
r16057 r16092 231 231 protected override void Initialize(CancellationToken cancellationToken) { 232 232 // Set up the algorithm 233 if (SetSeedRandomly) Seed = new System.Random().Next();233 if (SetSeedRandomly) Seed = RandomSeedGenerator.GetSeed(); 234 234 pyramid = new List<Population>(); 235 235 seen.Clear(); -
branches/2839_HiveProjectManagement/HeuristicLab.Problems.DataAnalysis
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis merged: 16059,16063,16084
- Property svn:mergeinfo changed
-
branches/2839_HiveProjectManagement/HeuristicLab.Problems.DataAnalysis.Symbolic
- Property svn:mergeinfo changed
/trunk/HeuristicLab.Problems.DataAnalysis.Symbolic merged: 16085
- Property svn:mergeinfo changed
-
branches/2839_HiveProjectManagement/HeuristicLab.Problems.DataAnalysis.Symbolic/3.4/Converters/LinearModelToTreeConverter.cs
r16057 r16092 37 37 string[] variableNames, double[] coefficients, 38 38 double @const = 0) { 39 39 40 if (factorCoefficients.Length == 0 && coefficients.Length == 0) throw new ArgumentException(); 40 ISymbolicExpressionTree p1 = null; 41 42 // Create tree for double variables 43 ISymbolicExpressionTree tree = null; 41 44 if (coefficients.Length > 0) { 42 p1 = CreateTree(variableNames, new int[variableNames.Length], coefficients, @const); 43 if (factorCoefficients.Length == 0) 44 return p1; 45 tree = CreateTree(variableNames, new int[variableNames.Length], coefficients, @const); 46 if (factorCoefficients.Length == 0) return tree; 45 47 } 48 49 // Create tree for string variables 50 ISymbolicExpressionTree factorTree = null; 46 51 if (factorCoefficients.Length > 0) { 47 var p2 = CreateTree(factors, factorCoefficients); 48 if (p1 == null) return p2; 52 factorTree = CreateTree(factors, factorCoefficients, @const); 53 if (tree == null) return factorTree; 54 } 49 55 50 // combine51 ISymbolicExpressionTreeNode add = p1.Root.GetSubtree(0).GetSubtree(0);52 foreach (var binFactorNode in p2.IterateNodesPrefix().OfType<BinaryFactorVariableTreeNode>())53 add.AddSubtree(binFactorNode);54 return p1;55 } 56 // Combine both trees 57 ISymbolicExpressionTreeNode add = tree.Root.GetSubtree(0).GetSubtree(0); 58 foreach (var binFactorNode in factorTree.IterateNodesPrefix().OfType<BinaryFactorVariableTreeNode>()) 59 add.InsertSubtree(add.SubtreeCount - 1, binFactorNode); 60 return tree; 61 56 62 throw new ArgumentException(); 57 63 } -
branches/2839_HiveProjectManagement/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs
r16057 r16092 116 116 117 117 public ModifiableDataset ToModifiable() { 118 var values = new List<IList>(); 119 foreach (var v in variableNames) { 120 if (VariableHasType<double>(v)) { 121 values.Add(new List<double>((IList<double>)variableValues[v])); 122 } else if (VariableHasType<string>(v)) { 123 values.Add(new List<string>((IList<string>)variableValues[v])); 124 } else if (VariableHasType<DateTime>(v)) { 125 values.Add(new List<DateTime>((IList<DateTime>)variableValues[v])); 126 } else { 127 throw new ArgumentException("Unknown variable type."); 128 } 129 } 130 return new ModifiableDataset(variableNames, values); 118 return new ModifiableDataset(variableNames, variableNames.Select(v => variableValues[v]), true); 131 119 } 132 120 … … 141 129 } 142 130 143 protected Dataset(Dataset dataset) : this(dataset.variableNames, dataset.variableValues.Values) { } 131 144 132 145 133 #region Backwards compatible code, remove with 3.5 … … 318 306 #region IStringConvertibleMatrix Members 319 307 [Storable] 320 pr otectedint rows;308 private int rows; 321 309 public int Rows { 322 310 get { return rows; } 311 protected set { rows = value; } 323 312 } 324 313 int IStringConvertibleMatrix.Rows { -
branches/2839_HiveProjectManagement/HeuristicLab.Problems.DataAnalysis/3.4/Implementation/DataAnalysisProblemData.cs
r16057 r16092 163 163 164 164 var variables = dataset.VariableNames.Where(variable => dataset.VariableHasType<double>(variable) || dataset.VariableHasType<string>(variable)); 165 var inputVariables = new CheckedItemList<StringValue>(variables.Select(x => new StringValue(x) ));165 var inputVariables = new CheckedItemList<StringValue>(variables.Select(x => new StringValue(x).AsReadOnly())); 166 166 foreach (StringValue x in inputVariables) 167 167 inputVariables.SetItemCheckedState(x, allowedInputVariables.Contains(x.Value)); -
branches/2839_HiveProjectManagement/HeuristicLab.Problems.DataAnalysis/3.4/ModifiableDataset.cs
r16057 r16092 47 47 public ModifiableDataset() { } 48 48 49 public ModifiableDataset(IEnumerable<string> variableNames, IEnumerable<IList> variableValues) : 50 base(variableNames, variableValues, cloneValues: false) { } 51 49 public ModifiableDataset(IEnumerable<string> variableNames, IEnumerable<IList> variableValues, bool cloneValues = false) : 50 base(variableNames, variableValues, cloneValues) { } 51 52 public Dataset ToDataset() { 53 return new Dataset(variableNames, variableNames.Select(v => variableValues[v])); 54 } 52 55 public void ReplaceRow(int row, IEnumerable<object> values) { 53 56 var list = values.ToList(); … … 91 94 variableValues[variableNames[i]].Add(list[i]); 92 95 } 93 rows++;96 Rows++; 94 97 OnRowsChanged(); 95 98 OnReset(); … … 98 101 // adds a new variable to the dataset 99 102 public void AddVariable(string variableName, IList values) { 103 InsertVariable(variableName, Columns, values); 104 } 105 106 107 public void InsertVariable(string variableName, int position, IList values) { 100 108 if (variableValues.ContainsKey(variableName)) 101 109 throw new ArgumentException(string.Format("Variable {0} is already present in the dataset.", variableName)); 102 110 103 if (values == null || values.Count == 0) 104 throw new ArgumentException("Cannot add variable with no values."); 111 if (position < 0 || position > Columns) 112 throw new ArgumentException(string.Format("Incorrect position {0} specified. The position must be between 0 and {1}.", position, Columns)); 113 114 if (values == null) 115 throw new ArgumentNullException("values", "Values must not be null. At least an empty list of values has to be provided."); 116 117 if (values.Count != Rows) 118 throw new ArgumentException(string.Format("{0} values are provided, but {1} rows are present in the dataset.", values.Count, Rows)); 105 119 106 120 if (!IsAllowedType(values)) 107 121 throw new ArgumentException(string.Format("Unsupported type {0} for variable {1}.", GetElementType(values), variableName)); 108 122 123 variableNames.Insert(position, variableName); 109 124 variableValues[variableName] = values; 110 variableNames.Add(variableName);111 125 112 126 OnColumnsChanged(); … … 129 143 foreach (var list in variableValues.Values) 130 144 list.RemoveAt(row); 131 rows--;145 Rows--; 132 146 OnRowsChanged(); 133 147 OnReset(); -
branches/2839_HiveProjectManagement/HeuristicLab.Random/3.3/HeuristicLab.Random-3.3.csproj
r14407 r16092 120 120 <Compile Include="GammaDistributedRandom.cs" /> 121 121 <Compile Include="ListExtensions.cs" /> 122 <Compile Include="RandomSeedGenerator.cs" /> 122 123 <Compile Include="UniformDistributedRandom.cs" /> 123 124 <Compile Include="FastRandom.cs" /> -
branches/2839_HiveProjectManagement/HeuristicLab.Random/3.3/RandomCreator.cs
r16057 r16092 94 94 IntValue seed = SeedParameter.ActualValue; 95 95 96 if (setSeedRandomly) seed.Value = new System.Random().Next();96 if (setSeedRandomly) seed.Value = RandomSeedGenerator.GetSeed(); 97 97 IRandom random = (IRandom)RandomType.Clone(); 98 98 random.Reset(seed.Value);
Note: See TracChangeset
for help on using the changeset viewer.