-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Turned TensorFlowEstimator into non-trivial estimator and removed shuffling as part of TensorFlowTransform. #1208
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
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.
// https://github.com/dotnet/machinelearning/issues/1106 | ||
//if(args.Shuffle) | ||
//{ | ||
// input = new ShuffleTransform(env, new ShuffleTransform.Arguments(), input); |
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.
input [](start = 22, length = 5)
frankly, I think the shuffle functionality could be preserved quite easily. You just need to make sure that ShuffleTransform
is only applied at training time, and doesn't get applied after training.
So, don't do
input = new Shuffle(input)
but rather
trainData = new Shuffle(input)
.
#Closed
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.
Then again, I don't know how important it is to shuffle, so I'm fine either way.
In reply to: 224558825 [](ancestors = 224558825)
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.
Not quite sure how helpful it is to remove vs keep it , esp. since tests for it are also commented out.
In reply to: 224558981 [](ancestors = 224558981,224558825)
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.
@pete, Shuffle is important as can be witnessed by the performance of the tests(shuffle vs. non-shuffle). The test dataset is small but on larger datasets performance gains are much better. I have moved the shuffling out of transform to give user more control over the shuffling.
I have done the way you have mentioned but I am currently not sure what the end user scenario will be for transforms like "Shuffle", "Filter" etc.. If this would be the same in Estimator/Pigsty world that would be great then.
@abhishek, code was commented for tests because of error. Now its no longer commented out as I have fixed it.
In reply to: 224568214 [](ancestors = 224568214,224558981,224558825)
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.
This is not what I meant. You can have the same logic (train on shuffle, then apply without shuffle) right here in this code, it doesn't have to be done by the caller.
In reply to: 224573294 [](ancestors = 224573294,224568214,224558981,224558825)
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.
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.
Ahh I see. That's actually I did not intend to do inside TFTransform. The reason being is that Shuffle has its own parameters e.g. ForceShuffleSeed
which I will have to expose as another parameter in TFTransform.Arguments
in addition to Shuffle
(or may be more depending on usage). But I am fine if you think that's ok to have those parameters as TFTransform.Arguments
.
I will change it to what you said unless you agree with my thinking...:)
In reply to: 224594321 [](ancestors = 224594321,224573294,224568214,224558981,224558825)
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.
Sorry wrong Pete...CodeFlow seems to have issue with tagging people.
In reply to: 224607610 [](ancestors = 224607610)
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.
So, I would be OK with either:
- Having no 'shuffle' at all, performing shuffling in the test, but still don't make the training constructor public: use estimator to
Fit
the transform. - Having Shuffle available without extra shuffling params and doing training as I outlined above.
- Same, but with additional params to Shuffle also available.
My preference would be to do 2, or 1, but not 3, unless it is obvious that having extra args to Shuffle is actually helpful
In reply to: 224617477 [](ancestors = 224617477,224594321,224573294,224568214,224558981,224558825)
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.
hmm...1 or 2 requires TensorFlowEstimator
to be non-trivial estimator then. Currently, TensorFlowEstimator
is trivial estimator. I will change the TensorFlowEstimator
to non-trivial one and update the PR title and description to reflect changes.
In reply to: 224640105 [](ancestors = 224640105,224617477,224594321,224573294,224568214,224558981,224558825)
@@ -290,7 +284,7 @@ public static IDataTransform Create(IHostEnvironment env, Arguments args, IDataV | |||
return new TensorFlowTransform(env, args, input).MakeDataTransform(input); | |||
} | |||
|
|||
internal TensorFlowTransform(IHostEnvironment env, Arguments args, IDataView input) | |||
public TensorFlowTransform(IHostEnvironment env, Arguments args, IDataView input) |
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.
public [](start = 8, length = 6)
This is a mistake. Training constructor should not be public. #Closed
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.
🕐
env.CheckValue(input, nameof(input)); | ||
|
||
CheckTrainingParameters(args); | ||
|
||
if(args.Shuffle) |
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.
Shuffle [](start = 24, length = 7)
how is this bypassing the row mapper problem? #Closed
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.
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.
public TensorFlowEstimator(IHostEnvironment env, string model, string[] inputs, string[] outputs) | ||
: this(env, new TensorFlowTransform(env, TensorFlowUtils.GetSession(env, model), inputs, outputs, TensorFlowUtils.IsSavedModel(env, model) ? model : null, false)) | ||
private readonly IHost _host; | ||
private readonly TensorFlowTransform.Arguments _args; |
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.
TensorFlowTransform.Arguments _args [](start = 25, length = 35)
@Zruty0, are you ok with that? Or you ok with check this in, and clean it after?
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.
Let me know if this needs to be done in different way. I will update it.
In reply to: 227577377 [](ancestors = 227577377)
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.
This PR fixes #1106 and it also fixes #1110.