Iris data set appears to have no header (column names) in the source csv. However, you write in your example:

var reader = mlContext.Data.CreateTextReader<IrisData>(separatorChar: ',', hasHeader: true);

Here it obviously says that hasHeader is used to control whether the data set has "header with feature names", but example data set does not have feature names (or am I missing something?).

If I am not mistaken, the code above might not fail, but the loaded data will likely have names taken from the first row (so, feature "5.1", feature "3.5" and so on), and the total number of observations will be reduced by 1.

I've had so many weird errors reading tables in R because of the missing header = TRUE/FALSE parameters that I now try to be super-cautious about it.

Only those users with full accounts are able to leave comments. Log in, please.