-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexplained IndexOutOfRangeException #25
Comments
What you are doing looks perfect. I suspect this is related to #24 |
So, I tried out the changes. Bad news. :-( Looks like this is still occurring. After debugging the code in _Learner.cs_ in the
The NaN value being passed into the Convert method is causing the IndexOutOfRange exception. In the _StringProperty.cs_ file in the Convert method, the AsEnum is set to true and then it looks for the value in the dictionary and croaks. if (AsEnum)
return Dictionary[(int)val];
else
return val.ToString(); That is as far as I have time for tonight. I'm going to update my sample code above with what I did to create this issue. I expanded my example slightly. |
It might also be the case that the string in question has never been seen by the classifier (this would be a problem). |
Issue reopened. Proposed solution is to use a weighted feature hashing / extraction algorithm for string types to resolve this issue. |
Hey @bdschrisk I just pulled master and tried it out. Looks like the NeuralNetworkGenerator winds up returning NaN values that can't be converted into an appropriate index entry. I also tried out the PerceptronGenerator and wound up with values that were WAY outside the range of possible values for the Dictionary. Since this is happening in the GenerateModel call stack, we should just trap the exception (or check for failure by extending the StringProperty) and use that value to correctly determine if the model is predicting correctly. If the values returned from the model are so off they cannot be converted back into appropriate labels, isn't that an indication of poor model fit to the data? |
Thanks @normanhh3, we plan to add a default value on the Property object to cover this scenario. |
Sounds like a good solution then. |
Shall we close this? |
If we implement stratification in the labels at training time we can - that will resolve the issue for the most part. Once feature hashing is added in that will resolve any further issues down the track. |
Perhaps an example of what you mean? In the DT for example I have a model default Hint value that represents what the model should select if it gets into a confused state (it just returns the Hint). Should we codify this into the generic IModel/Model class so this issue is resolved across all models? Or are you referring to something else? |
Hi Seth,
Had an idea to do a REALLY simple attempt to learn a function that I would have ordinarily implemented as a switch statement, just for the mind-bending. :-)
The code was written to be run in LinqPad.
However, running the above Main function results in the following IndexOutOfRangeException.
I have looked at the relevant files here and I can't find the cause of the exception at the relevant lines.
I am using the NuGet 0.8.17.0 build when I am getting this exception.
Have I failed to follow the documentation correctly?
Thoughts?
The text was updated successfully, but these errors were encountered: