-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix creation of dataviews inferred with .NET types with sparse vectors #587
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
Conversation
Done(); | ||
} | ||
|
||
void GenericDenseDataView<T>(T[] v1, T[] v2) |
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.
void [](start = 8, length = 4)
Explicit access modifier please. Here and everywhere.
|
||
namespace Microsoft.ML.Runtime.RunTests | ||
{ | ||
public sealed partial class TestSparseDataView : TestDataViewBase |
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.
partial [](start = 18, length = 7)
Why partial?
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.
Copy paste without thinking :)
Hi @xadupre thanks for adding this fix plus the extensive tests. Right now the PR description is just the default description. Perhaps something real could be written there. If we were to merge right now it would be very hard to come up with an adequate commit message. (Complicated also by the fact that this PR appears to be based on merges rather than rebases.) Also if you write something like "fixes #586" in your description, then it will associate the issue and the PR, and close the issue when the PR is merged. You put the thing in the title, but if you check the issue page it was not actually associated. (Well, it will be now since I just mentioned it, but of course as the PR author it should be in the head description, rather than some random reviewer mentioning it in a comment far down the page. |
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Microsoft.ML.Runtime.Command; |
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'm fairly certain not all of these are used.
new SparseExample<T>() { X = new VBuffer<T> (5, 3, v1, new int[] { 0, 2, 4 }) }, | ||
new SparseExample<T>() { X = new VBuffer<T> (5, 3, v2, new int[] { 0, 1, 3 }) } | ||
}; | ||
var host = new TlcEnvironment(); |
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.
var host = new TlcEnvironment(); [](start = 12, length = 32)
can you wrap it in using? #Resolved
GenericSparseDataView(new double[] { 1, 2, 3 }, new double[] { 1, 10, 100 }); | ||
GenericSparseDataView(new DvText[] { new DvText("a"), new DvText("b"), new DvText("c") }, | ||
new DvText[] { new DvText("aa"), new DvText("bb"), new DvText("cc") }); | ||
Done(); |
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.
Done(); [](start = 12, length = 7)
You don't have to call Done if you don't do any basefiles comparison #Resolved
Assert.True(n == 2); | ||
} | ||
|
||
[Fact] |
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.
Fact [](start = 9, length = 4)
Thank you for fixing my mess!
Your code definitely do right thing, and it's nice to have tests, but I want to point one thing. Your tests never hit TypedCursor changes.
There is two conversions: one from some collection to IDataview through code in DataViewConstructionUltis, and from IDataVIew to Collection via TypedCursor and your tests cover only first case.
In order to invoke second case you need to do something like:
dataView.AsEnumerable(env, false).GetEnumerator() and enumerate over it.
#Resolved
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'll do it. #Resolved
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.
Hi @xadupre thanks for addressing the comment! Clarifying note for the future, when I asked to modify the description, I meant the PR's description, not the PR's title. The description is still the little "we are excited to review your PR" built in text that we intend for people to write. I hope you don't mind, just going to change it so we can get this in since otherwise it looks good. |
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.
Thanks @xadupre
dotnet#587) `DataViewConstructionUtils`'s methods to create dataviews over .NET types will now have correctly inferred "getters" in the case of sparse vectors.
Fixes #586.
DataViewConstructionUtils
's methods to create dataviews over .NET types will now have correctly inferred getters in the case of sparse vectors.