Issue changing model from TaxiFareExample. 'Features' must be a known-size vector of R4, but has type: Vec<I4, 2>.
System information
Issue changing model from TaxiFareExample. 'Features' must be a known-size vector of R4, but has type: Vec<I4, 2>.
- OS version/distro: Windows
- .NET Version (eg., dotnet --info): 4.6.1
Issue
- What did you do? I started with the TaxiFare Example and that works. But then I changed the model and added my own values and my data. I got the error about the "Features" above. I played with it for a while and tried limiting my data. Even tried predicting the Fare Amount again.
- What happened?
- What did you expect?
Source code / logs
Please paste or attach the code or logs or traces that would be helpful to diagnose the issue you are reporting.
@bsexton thanks for your question!
This is a good example of an error message that actually makes perfect sense :) The trainer expects float features, but it's given integer features instead.
The correct way to address it is either to convert the features column to float using ColumnTypeConverter, or to make your original features floats instead of ints.
The names I4 and R4 means int and float for the purposes of our data view type system.
Please see the extensive type system doc for full insight into the type system. It is a long read, but it'll answer many further questions.
@Zruty0 Thanks!
I originally had all ints (which is what I really want). But there I get this error. Is it saying that it can't predict ints, only floats? "ArgumentOutOfRangeException: Training label column 'Label' type isn't suitable for regression: I4. Type must be R4 or R8. Parameter name: data"
This is right, regression models only predict floats or doubles.
@Zruty0 Thanks again. Unfortunately I switch the column type to a float and add float values to the CSV and still get an error.
ArgumentOutOfRangeException: Training feature column 'Features' must be a known-size vector of R4, but has type: Vec<I4, 2>.
This doesn't seem right to me. Would you mind sharing a relevant piece of the code?
I'm interested in the class definition (the one that has fields with [Column] attribute), and the pipeline construction.
I am going to try breaking down the Pipeline constructor. Right now I am using the example and it isn't clear where it breaks.
I will get some code here after that.
I am also getting the similar issue -
ArgumentOutOfRangeException: Training feature column 'Features' must be a known-size vector of R4, but has type: Vec<R8, 17>
I am using all 16 properties as double and one string. I was trying this demo solution with this dataset. The exception comes in step 5 -> pipeline.Train()
Finally, I got the solution. Posted here.
DRI RESPONSE: I considering this issue as answered and intent to close it within next few day, unless someone objects.