Skip to content
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

Merged
merged 3 commits into from
Oct 29, 2019
Merged

Updating the DatabaseLoader to not force vector for single element columns #4403

merged 3 commits into from
Oct 29, 2019

Conversation

tannergooding
Copy link
Member

@tannergooding tannergooding requested a review from a team as a code owner October 28, 2019 22:07
@tannergooding
Copy link
Member Author

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)
Copy link
Member

@eerhardt eerhardt Oct 29, 2019

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.

Copy link
Member Author

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;

Copy link
Member

@eerhardt eerhardt left a 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.

@eerhardt eerhardt merged commit 1b10a2e into dotnet:master Oct 29, 2019
frank-dong-ms-zz pushed a commit to frank-dong-ms-zz/machinelearning that referenced this pull request Nov 4, 2019
…lumns (dotnet#4403)

* Updating the DatabaseLoaderTests to cover a single load column

* Updating the DatabaseLoader to not force vector for single element columns
frank-dong-ms-zz pushed a commit to frank-dong-ms-zz/machinelearning that referenced this pull request Nov 4, 2019
…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
@ghost ghost locked as resolved and limited conversation to collaborators Mar 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Problem with Database Loader
2 participants