0

I have a dataset with columns for

  • number of items (an integer value)
  • weight of the items (a fractional value)
  • A product category
  • A start time
  • An end time

and from this dataset I want to train a data model that given a number of items, weight and category can predict a duration (end time - start time).

How can I transform or set my label column to the duration, so that I get an EstimatorChain that I can call Fit on with an IDataView that I've loaded from CSV?

Martijn
  • 11,964
  • 12
  • 50
  • 96

1 Answers1

2

You can use the ML.NET CustomMapping functionality, to calculate the duration, and call that Label. This contains an example of how to use it.

Action<Data, Data> mapping =
            (input, output) => output.Label= input.End - Input.Start;

where Data would be your data model that contains a Label property, in addition to the other properties.

amy8374
  • 1,450
  • 3
  • 17
  • 26