You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What did you do?
Trying to create Enumerable from IDataView which contains Column with Type Key<UInt32, 0-1059>, into a uint type.
What happened?
Encountered error:
"Can't bind the IDataView column 'ImpressionIdKey' of type 'Key<UInt32, 0-1059>' to field or property 'ImpressionIdKey' of type 'System.UInt32'."
What did you expect?
I want to be able to export key value in its uint format as enumerable
Source code / logs
var a = mlContext.Data.CreateEnumerable<ProcessedData>(
colSelTrainingData, reuseRowObject: false);
...
private class ProcessedData
{
public float[] Feature { get; set; }
public float BackProClick { get; set; }
public uint ImpressionIdKey { get; set; }
}
The text was updated successfully, but these errors were encountered:
Hi, @go2ready . It should be possible for you to create an enumerable from a key column. I don't know why you're getting that exception. Can you please provide a full stacktrace, and also a .zip containing code and data to reproduce your error so I can look closer? Thanks.
For reference, I've just ran this toy example, and it worked as expected, showing you can create enumerables from key columns:
Click to toggle toy example
using System;using Microsoft.ML;using Microsoft.ML.Data;using System.Linq;namespaceTextLoaderSample{classProgram{publicclassModelInput{publicintId{get;set;}publicstringDescription{get;set;}publicfloatNum1{get;set;}publicfloatNum2{get;set;}}publicclassModelOutput{publicuintKeyDescription{get;set;}}staticvoidMain(string[]args){MLContextmlContext=new MLContext(seed:1);varinputList=new[]{new ModelInput(){Id=0,Description="lion",Num1=12.333f,Num2=13.44f},new ModelInput(){Id=1,Description="house",Num1=12.333f,Num2=13.44f},};IDataViewinputDV= mlContext.Data.LoadFromEnumerable(inputList);varpipeline= mlContext.Transforms.Conversion.Hash("KeyDescription","Description");varoutputDV= pipeline.Fit(inputDV).Transform(inputDV);// "KeyDescription" column is type "Key<UInt32, 0-2147483647>"varoutputEnum= mlContext.Data.CreateEnumerable<ModelOutput>(outputDV, reuseRowObject:false);varoutputArray= outputEnum.ToArray();}}}
Thanks @antoniovs1029 for providing the code snippet, I tired this morning it worked, must be something I have been doing wrong on the pipeline :) Really appreciated
System information
Issue
Trying to create Enumerable from IDataView which contains Column with Type Key<UInt32, 0-1059>, into a uint type.
Encountered error:
"Can't bind the IDataView column 'ImpressionIdKey' of type 'Key<UInt32, 0-1059>' to field or property 'ImpressionIdKey' of type 'System.UInt32'."
I want to be able to export key value in its uint format as enumerable
Source code / logs
The text was updated successfully, but these errors were encountered: