Open ryanmcfall opened 4 years ago
This is related to #2776. It seems most of our models can not be used from inside of an SFrame.apply
.
@ryanmcfall -
Instead of doing:
test_set['new'] = test_set.apply(classify)
I would call:
temp = classifier.query(test_set, verbose=False)
Then do a filter_by
or groupby
on temp
to get what you want. I'm not sure what you're trying to do here, if you let me know I can try to help you.
I am trying to use the
apply
method to add a new column to an SFrame, containing the result of the prediction created by a nearest_neighbor classifier.Here's the code
The call to the
classify
function gives the expected output, a string containing the file name of the predicted most similar paper. But, calling theapply
method at the bottom results in an error message which boils down to:Strangely, this error appears to be a side-effect of calling
classifier.query
. If I change theclassify
function to be:I don't get the error, but uncommenting the call to
classifier.query
in the above version does cause the error, even though the result of that call is not even used.I tried uploading a sample data file, but I don't see anything happening when I upload. But I tried just a small sample tab-delimited file with string columns
Filename
,Book
, andReview
and the issue occurred with both that file and the actual data file that I used.