machinelearning-samples icon indicating copy to clipboard operation
machinelearning-samples copied to clipboard

Invalid call to GetValue

Open agerewines opened this issue 5 years ago • 17 comments

I'm trying to implement this GetBestThreePredictions() in my code, but I keep getting this error and don't know how to fix it. Seems an error inside Microsoft.ML.DataViewSchema.

Is there anyone who can help me? Thanks

https://github.com/dotnet/machinelearning-samples/blob/c778296f22edaa21956f55db9e0a4a44d8ccf4b9/samples/csharp/end-to-end-apps/MulticlassClassification-GitHubLabeler/GitHubLabeler/GitHubLabelerConsoleApp/Labeler.cs#L81

agerewines avatar Jun 28 '19 15:06 agerewines

@ImGere Hey, what is the error you are getting?

AbhiAgarwal192 avatar Jul 16 '19 13:07 AbhiAgarwal192

Error

agerewines avatar Jul 17 '19 07:07 agerewines

@Ivanidzo4ka - Ivan, since you are "the man" for this feature (Scores per prediction) could you help with this issue please? 👍

CESARDELATORRE avatar Jul 17 '19 21:07 CESARDELATORRE

Help would be appreciated because I'm stuck with the development of this ML model since I need to be able to get back multiple values

agerewines avatar Jul 18 '19 06:07 agerewines

Can you use GetKeyValues rather than GetSlotNames?

https://github.com/dotnet/machinelearning/blob/45b6c43387294d19cad843a21e87539213e8d34c/src/Microsoft.ML.Data/Data/SchemaAnnotationsExtensions.cs By the time we wrote sample GetKeyValues wasn't present, and I was confused by slot names.

Ivanidzo4ka avatar Jul 18 '19 18:07 Ivanidzo4ka

error Hi I tried what you suggested but stiil have the same error. The library version is 1.2.0

agerewines avatar Jul 22 '19 10:07 agerewines

Any progress on this issue?

GMihalkow avatar Nov 14 '19 09:11 GMihalkow

Hi , Any progress on this issue?

GioGallo avatar Feb 24 '20 17:02 GioGallo

Not from my side. I moved my work to Python and Scikit learn library.

agerewines avatar Feb 24 '20 17:02 agerewines

I also check with GetSlotNames and GetKeyValues. But getting same error in both. I am using version 1.5.0-preview. Any further updates for this issue?

mehtanilay10 avatar Mar 09 '20 16:03 mehtanilay10

I have the same error! I'm using version 1.4.0 Have you found a solution?

Webritter avatar Mar 18 '20 22:03 Webritter

Unfortunately guys I'm not working on ML.NET anymore. You should create a new Issue under this repo since this can be hard to find.

Have a nice day!

agerewines avatar Mar 19 '20 12:03 agerewines

using 1.5 and still get the same error! I recreated project with data now it is working and then I tried to update my old project with but again I got the same error. :(

udonmez avatar Jun 14 '20 14:06 udonmez

How is this still not solved? I am getting the same error. I tried both GetKeyValues and GetSlotNames. cc @Ivanidzo4ka @CESARDELATORRE I am using 1.5.2

mhmd-azeez avatar Sep 15 '20 18:09 mhmd-azeez

Hi guys, this issue can easily be resolved by building the pipeline properly and extracting only the desired values. Check out my StackOverflow answer. I hope it helps, had a hard time figuring out a workaround. You don't necessarily need GetSlotNames or GetKeyValues to get your raw data.

AmSmart avatar Sep 23 '20 13:09 AmSmart

I know this is an old question and you've either given up or solved it another way but I hope this helps someone.

I also struggled with this. I took the code from the "github tag" example project and used it in my project. I discovered that it only worked with "text" data types. In my need, if I made my inputs (which are naturally Single) into strings the above "GetSlotNames" f(x) worked. If I switched it back, it broke.

I can only assume this is an issue with the underlying framework not having the correct GetValue because if you inspect the data with the debugger the key mappings are there.

ccheinemann avatar Jan 04 '22 16:01 ccheinemann

This can also be fixed by specifying addKeyValueAnnotationsAsText when mapping values to keys:

// e.g. CategoryId is an int column...
ml.Transforms.Conversion.MapValueToKey("Label", "CategoryId", addKeyValueAnnotationsAsText: true)

m-wild avatar Sep 10 '22 23:09 m-wild