-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Updating the DatabaseLoader to not force vector for single element columns #4403
Conversation
CC. @eerhardt, @CESARDELATORRE |
@@ -333,7 +333,14 @@ public Range(int min, int max) | |||
internal static Range FromTextLoaderRange(TextLoader.Range range) | |||
{ | |||
Contracts.Assert(range.Max.HasValue); | |||
return new Range(range.Min, range.Max.Value); | |||
if ((range.Max.Value == range.Min) && !range.ForceVector) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another option might be:
Range result = new Range();
result.Min = range.Min;
result.Max = range.Max.Value;
result.ForceVector = range.ForceVector;
return result;
It feels a little more straight forward than having to parse this if
condition, and know which constructors will set ForceVector and which won't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I changed to the following as it allows some of the other asserts to be kept:
var dbRange = new Range(range.Min, range.Max.Value);
dbRange.ForceVector = range.ForceVector;
return dbRange;
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The change looks good to me. You can choose to use my suggestion, or leave the code as-is. Either way is fine with me.
…lumns (dotnet#4403) * Updating the DatabaseLoaderTests to cover a single load column * Updating the DatabaseLoader to not force vector for single element columns
…lumns (dotnet#4403) * Updating the DatabaseLoaderTests to cover a single load column * Updating the DatabaseLoader to not force vector for single element columns resolve conflict
This resolves dotnet/machinelearning-samples#722