Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/17 15:16:43 (8 years ago)
Author:
bburlacu
Message:

#2760: Implement shuffling of crossvalidation samples.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis/3.4/Dataset.cs

    r14857 r14864  
    126126      return new ModifiableDataset(variableNames, values);
    127127    }
     128    /// <summary>
     129    /// Shuffle a dataset's rows
     130    /// </summary>
     131    /// <param name="random">Random number generator used for shuffling.</param>
     132    /// <returns>A shuffled copy of the current dataset.</returns>
     133    public Dataset Shuffle(IRandom random) {
     134      var values = variableNames.Select(x => variableValues[x]).ToList();
     135      return new Dataset(variableNames, values.ShuffleLists(random));
     136    }
    128137
    129138    protected Dataset(Dataset dataset) : this(dataset.variableNames, dataset.variableValues.Values) { }
Note: See TracChangeset for help on using the changeset viewer.