Changeset 15420 for branches/MCTS-SymbReg-2796/Tests/HeuristicLab.Algorithms.DataAnalysis-3.4/MctsSymbolicRegressionTest.cs
- Timestamp:
- 10/17/17 09:56:30 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/MCTS-SymbReg-2796/Tests/HeuristicLab.Algorithms.DataAnalysis-3.4/MctsSymbolicRegressionTest.cs
r15416 r15420 1 1 using System; 2 using System.Collections.Generic; 2 3 using System.Linq; 3 4 using System.Threading; … … 758 759 [TestMethod] 759 760 [TestCategory("Algorithms.DataAnalysis")] 760 [TestProperty("Time", " short")]761 public void MctsSymbReg_NoConstants_Poly10 () {761 [TestProperty("Time", "long")] 762 public void MctsSymbReg_NoConstants_Poly10_250rows() { 762 763 var provider = new HeuristicLab.Problems.Instances.DataAnalysis.VariousInstanceProvider(seed: 1234); 763 764 var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("Poly-10"))); 765 regProblem.TrainingPartition.Start = 0; 766 regProblem.TrainingPartition.End = regProblem.Dataset.Rows; 767 regProblem.TestPartition.Start = 0; 768 regProblem.TestPartition.End = 2; 764 769 TestMctsWithoutConstants(regProblem, nVarRefs: 15, iterations: 200000, allowExp: false, allowLog: false, allowInv: false); 770 } 771 [TestMethod] 772 [TestCategory("Algorithms.DataAnalysis")] 773 [TestProperty("Time", "long")] 774 public void MctsSymbReg_NoConstants_Poly10_10000rows() { 775 // as poly-10 but more rows 776 var rand = new FastRandom(1234); 777 var x1 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 778 var x2 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 779 var x3 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 780 var x4 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 781 var x5 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 782 var x6 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 783 var x7 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 784 var x8 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 785 var x9 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 786 var x10 = Enumerable.Range(0, 10000).Select(_ => rand.NextDouble()).ToList(); 787 var ys = new List<double>(); 788 for (int i = 0; i < x1.Count; i++) { 789 ys.Add(x1[i] * x2[i] + x3[i] * x4[i] + x5[i] * x6[i] + x1[i] * x7[i] * x9[i] + x3[i] * x6[i] * x10[i]); 790 } 791 792 var ds = new Dataset(new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "y" }, 793 new[] { x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, ys }); 794 795 796 var problemData = new RegressionProblemData(ds, new string[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j"}, "y"); 797 798 problemData.TrainingPartition.Start = 0; 799 problemData.TrainingPartition.End = problemData.Dataset.Rows; 800 problemData.TestPartition.Start = 0; 801 problemData.TestPartition.End = 2; // must not be empty 802 803 804 TestMctsWithoutConstants(problemData, nVarRefs: 15, iterations: 100000, allowExp: false, allowLog: false, allowInv: false); 765 805 } 766 806 … … 797 837 var @as = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList(); 798 838 var bs = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList(); 799 var cs = Enumerable.Range(0, 100).Select(_ => rand.NextDouble() * 1.0e-3).ToList();800 var ds = Enumerable.Range(0, 100).Select(_ => rand.NextDouble() 801 var es = Enumerable.Range(0, 100).Select(_ => rand.NextDouble() 839 var cs = Enumerable.Range(0, 100).Select(_ => rand.NextDouble() * 1.0e-3).ToList(); 840 var ds = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList(); 841 var es = Enumerable.Range(0, 100).Select(_ => rand.NextDouble()).ToList(); 802 842 var ys = new double[@as.Count]; 803 for (int i=0;i<ys.Length;i++)804 ys[i] = @as[i] + bs[i] + @as[i] *bs[i]*cs[i];843 for (int i = 0; i < ys.Length; i++) 844 ys[i] = @as[i] + bs[i] + @as[i] * bs[i] * cs[i]; 805 845 806 846 var dataset = new Dataset(new string[] { "a", "b", "c", "d", "e", "y" }, new[] { @as, bs, cs, ds, es, ys.ToList() }); 807 847 808 var problemData = new RegressionProblemData(dataset, new string[] { "a", "b", "c","d","e" }, "y");848 var problemData = new RegressionProblemData(dataset, new string[] { "a", "b", "c", "d", "e" }, "y"); 809 849 810 850 … … 854 894 var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(seed: 1234); 855 895 var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F7 "))); 856 TestMcts(regProblem, maxVariableReferences: 5, allowExp: false, allowLog: true, allowInv: false);896 TestMcts(regProblem, maxVariableReferences: 5, allowExp: false, allowLog: true, allowInv: false); 857 897 } 858 898 [TestMethod] … … 895 935 var provider = new HeuristicLab.Problems.Instances.DataAnalysis.NguyenInstanceProvider(seed: 1234); 896 936 var regProblem = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name.Contains("F11 "))); 897 TestMcts(regProblem, maxVariableReferences: 5, allowExp: true, allowLog: true, allowInv: false); 937 TestMcts(regProblem, maxVariableReferences: 5, allowExp: true, allowLog: true, allowInv: false); 898 938 } 899 939 [TestMethod]
Note: See TracChangeset
for help on using the changeset viewer.