Opened 3 months ago

Last modified 2 months ago

#3002 readytorelease feature request

Build dataset with row-wise data

Reported by: abeham Owned by: abeham
Priority: medium Milestone: HeuristicLab 3.3.16
Component: Problems.DataAnalysis Version:
Keywords: Cc:

Description

Currently the dataset only accepts data in column format in its constructor. The dataset would be easier to use if it would accept row-wise data in the constructor.

Maybe we can create static methods instead of constructor methods like Dataset.FromRowData(double[,] data) and Dataset.FromRowData(IEnumerable<IList> data).

Change History (5)

comment:1 Changed 3 months ago by abeham

Maybe using some kind of helper function:

    private IEnumerable<IList> Transpose(IEnumerable<IList> data) {
      var transposed = new List<IList>();
      var iter = data.GetEnumerator();
      if (!iter.MoveNext()) return transposed;
      for (var d = 0; d < iter.Current.Count; d++)
        transposed.Add(new ArrayList());
      do {
        for (var d = 0; d < iter.Current.Count; d++)
          transposed[d].Add(iter.Current[d]);
      } while (iter.MoveNext());
      return transposed;
    }

comment:2 Changed 2 months ago by abeham

  • Owner set to abeham
  • Status changed from new to accepted

comment:3 Changed 2 months ago by abeham

  • Owner changed from abeham to mkommend
  • Status changed from accepted to reviewing

r16820: Implement static methods to build dataset from row-wise data and added unit test

comment:4 Changed 2 months ago by jkarder

r16821: fixed namespace and type name of DatasetTest

comment:5 Changed 2 months ago by gkronber

  • Owner changed from mkommend to abeham
  • Status changed from reviewing to readytorelease

Reviewed r16820 and r16821 together with jkarder.

Note: See TracTickets for help on using tickets.