Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Make FTRL algo to work properly on views #1505
Make FTRL algo to work properly on views #1505
Changes from 3 commits
aef7751
d707768
d3a586b
33801f1
5adc42c
eca693e
771d92f
1a47ca7
84e7e46
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
@st-pasha, this is something I don't understand. If I just do
model = dt.Frame(ft.model)
, thenmodel
is still a reference toft.model
. Why is it so?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.
dt.Frame(DT)
creates a shallow copy ofDT
. This is equivalent toDT.copy()
. What makes you think it doesn't work?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.
Ah, I see. I don't say it doesn't work. I just didn't expect
dt.Frame(DT)
to return a shallow copy. What is the best way to make a deep copy then? I managed to do it asdt.Frame(ft.model.to_dict())
, but it doesn't seem to be an elegant solution. Is there any datatable way to do it, or I better just docopy.deepcopy(DT)
?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 believe
copy.deepcopy()
just pickles and then unpickles the object. The more important question is why do you need a deep copy? The datatable should work correctly even with shallow copies.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.
Because I need a copy of the model here, otherwise if I simply do
model
also resets.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've looked into this a little, and I think there could be a problem with pointers
z
andn
. Even though they are acquired ascolumn->data_w()
pointers, they are kept for an arbitrary long period of time. During that time the pointers may become invalid (in particular, they may become invalid for writing if you create a copy of the Frame). It might be better to re-acquire these pointers at the beginning of each python call that needs them.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, I've made changes to re-acquire them at each Python call. Didn't solve the problem with this test though.
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.
Are you sure? Here's what I'm getting:
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've recompiled datatable from scratch and it seems like this problem has been fixed. I will update tests. Thanks!
Actually there was also another problem. When I just did
df_train_range = dt.Frame(df_train[rows,:])
, it kind of inherited rowindex anddf_train_range
was still a view. That is why I had to dodf_train_range = dt.Frame(df_train[rows,:].to_list())
. Is it something we expect due to shallow copying? If yes, then what is the best way to create a real frame based on the view?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.
for any frame you can write
frame.materialize()
, and it will be converted from "view" into a "real" data frame, in-place.