Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4244 for branches


Ignore:
Timestamp:
08/17/10 16:39:11 (14 years ago)
Author:
gkronber
Message:

Use FastRandom instead of Mersenne twister for partial evaluation of training samples. #1082

Location:
branches/DataAnalysis
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Analyzers/FixedValidationBestScaledSymbolicRegressionSolutionAnalyzer.cs

    r4225 r4244  
    256256      int validationStart = ValidiationSamplesStart.Value;
    257257      int validationEnd = ValidationSamplesEnd.Value;
    258       uint seed = (uint)Random.Next();
     258      int seed = Random.Next();
    259259      int count = (int)((validationEnd - validationStart) * RelativeNumberOfEvaluatedSamples.Value);
    260260      if (count == 0) count = 1;
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/MultiObjectiveSymbolicRegressionEvaluator.cs

    r4128 r4244  
    121121
    122122    public override IOperation Apply() {
    123       uint seed = (uint)Random.Next();
     123      int seed = Random.Next();
    124124      IEnumerable<int> rows = SingleObjectiveSymbolicRegressionEvaluator.GenerateRowsToEvaluate(seed, RelativeNumberOfEvaluatedSamples.Value, SamplesStart.Value, SamplesEnd.Value);
    125125      double[] qualities = Evaluate(SymbolicExpressionTreeInterpreter, SymbolicExpressionTree, RegressionProblemData.Dataset,
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis.Regression/3.3/Symbolic/Evaluators/SingleObjectiveSymbolicRegressionEvaluator.cs

    r4195 r4244  
    139139
    140140    public override IOperation Apply() {
    141       uint seed = (uint)Random.Next();
     141      int seed = Random.Next();
    142142      IEnumerable<int> rows = GenerateRowsToEvaluate(seed, RelativeNumberOfEvaluatedSamples.Value, SamplesStart.Value, SamplesEnd.Value);
    143143      double quality = Evaluate(SymbolicExpressionTreeInterpreter, SymbolicExpressionTree, LowerEstimationLimit.Value, UpperEstimationLimit.Value,
     
    149149
    150150
    151     internal static IEnumerable<int> GenerateRowsToEvaluate(uint seed, double relativeAmount, int start, int end) {
     151    internal static IEnumerable<int> GenerateRowsToEvaluate(int seed, double relativeAmount, int start, int end) {
    152152      if (end < start) throw new ArgumentException("Start value is larger than end value.");
    153153      int count = (int)((end - start) * relativeAmount);
  • branches/DataAnalysis/HeuristicLab.Problems.DataAnalysis/3.3/RandomEnumerable.cs

    r4112 r4244  
    2727  public class RandomEnumerable {
    2828    public static IEnumerable<int> SampleRandomNumbers(int maxElement, int count) {
    29       return SampleRandomNumbers(((uint)DateTime.Now.Ticks), 0, maxElement, count);
     29      return SampleRandomNumbers(Environment.TickCount, 0, maxElement, count);
    3030    }
    3131
    3232    public static IEnumerable<int> SampleRandomNumbers(int start, int end, int count) {
    33       return SampleRandomNumbers(((uint)DateTime.Now.Ticks), start, end, count);
    34     }
    35 
    36     public static IEnumerable<int> SampleRandomNumbers(uint seed, int maxElement, int count) {
    37       return SampleRandomNumbers(seed, 0, maxElement, count);
     33      return SampleRandomNumbers(Environment.TickCount, start, end, count);
    3834    }
    3935
     
    4137    //IMPORTANT because IEnumerables with yield are used the seed must best be specified to return always
    4238    //the same sequence of numbers without caching the values.
    43     public static IEnumerable<int> SampleRandomNumbers(uint seed, int start, int end, int count) {
     39    public static IEnumerable<int> SampleRandomNumbers(int seed, int start, int end, int count) {
    4440      int remaining = end - start;
    45       var mt = new MersenneTwister(seed);
     41      var mt = new FastRandom(seed);
    4642      for (int i = start; i < end && count > 0; i++) {
    4743        double probability = mt.NextDouble();
Note: See TracChangeset for help on using the changeset viewer.