Skip to content

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

Merged
merged 15 commits into from
Jul 28, 2018

Conversation

xadupre
Copy link
Contributor

@xadupre xadupre commented Jul 27, 2018

Fixes #586. DataViewConstructionUtils's methods to create dataviews over .NET types will now have correctly inferred getters in the case of sparse vectors.

@dnfclas
Copy link

dnfclas commented Jul 27, 2018

CLA assistant check
All CLA requirements met.

Done();
}

void GenericDenseDataView<T>(T[] v1, T[] v2)
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy paste without thinking :)

@TomFinley
Copy link
Contributor

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;
Copy link
Contributor

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();
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Jul 27, 2018

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();
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Jul 27, 2018

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]
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka Jul 27, 2018

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

Copy link
Contributor Author

@xadupre xadupre Jul 27, 2018

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

@xadupre xadupre changed the title Fix the creation of getters on dataviews having sparse vectors (#586) Fixes #586, the creation of getters on dataviews having sparse vectors Jul 27, 2018
Copy link
Contributor

@Ivanidzo4ka Ivanidzo4ka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@TomFinley
Copy link
Contributor

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.

@TomFinley TomFinley changed the title Fixes #586, the creation of getters on dataviews having sparse vectors Fix creation of dataviews inferred with .NET types with sparse vectors Jul 28, 2018
Copy link
Contributor

@TomFinley TomFinley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @xadupre

@TomFinley TomFinley merged commit 2107b82 into dotnet:master Jul 28, 2018
@xadupre
Copy link
Contributor Author

xadupre commented Jul 30, 2018 via email

codemzs pushed a commit to codemzs/machinelearning that referenced this pull request Aug 1, 2018
dotnet#587)

`DataViewConstructionUtils`'s methods to create dataviews over .NET types will now have correctly inferred "getters" in the case of sparse vectors.
@ghost ghost locked as resolved and limited conversation to collaborators Mar 29, 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.

5 participants