Skip to content
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

AttributeError: 'int' object has no attribute 'predict' #16

Open
maheerb opened this issue Aug 23, 2019 · 7 comments
Open

AttributeError: 'int' object has no attribute 'predict' #16

maheerb opened this issue Aug 23, 2019 · 7 comments

Comments

@maheerb
Copy link

maheerb commented Aug 23, 2019

Traceback (most recent call last): File "c:\users\focus\anaconda3\envs\tensorflow\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\focus\anaconda3\envs\tensorflow\lib\runpy.py", line 85, in run_code exec(code, run_globals) File "C:\Users\Focus\Anaconda3\envs\tensorflow\Scripts\tindetheus.exe_main.py", line 9, in File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\tindetheus\tindetheus.py", line 781, in command_line_run main(args, defaults['facebook_token'], defaults['XAuthToken']) File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\tindetheus\tindetheus.py", line 644, in main my_sess.like() File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\tindetheus\tindetheus.py", line 560, in like self.like_or_dislike_users(users) File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\tindetheus\tindetheus.py", line 489, in like_or_dislike_users yhat = self.model.predict(X) AttributeError: 'int' object has no attribute 'predict'

Hey @cjekel, I am not sure what to do here. All the other errors that came up so far, I have managed to debug. But stuck on this error. Any insights on how to solve this error? Thanks!

@cjekel
Copy link
Owner

cjekel commented Aug 23, 2019

What's the final output when you run tindetheus train?

You should see something like

Summary statistics of profiles with at least one detectable face
count    164.000000
mean       5.213415
std        2.041788
min        1.000000
25%        4.000000
50%        5.000000
75%        7.000000
max        9.000000
dtype: float64
Train size:  164
Training accuracy 0.7439024390243902
Recall/ Like accuracy 0.8051948051948052
specificity/ Dislike accuracy 0.6896551724137931

Then if you open the pickled model

import joblib
model = joblib.load('log_reg_model.pkl') 
print(model)

You should see something like this

LogisticRegression(C=1.0, class_weight='balanced', dual=False,
          fit_intercept=True, intercept_scaling=1, max_iter=100,
          multi_class='ovr', n_jobs=1, penalty='l2', random_state=None,
          solver='liblinear', tol=0.0001, verbose=0, warm_start=False)

@maheerb
Copy link
Author

maheerb commented Aug 24, 2019

Total number of images: 918
Number of successfully aligned images: 802
Model directory: 20170512-110547
Metagraph file: model-20170512-110547.meta
Checkpoint file: model-20170512-110547.ckpt-250000
WARNING:tensorflow:The saved meta_graph is possibly from an older release:
'model_variables' collection should be of type 'byte_list', but instead is of type 'node_list'.
Number of images:  802
Number of batches:  1
Completed batch 1 of 1
Run time:  132.94302654266357
Summary statistics of profiles with at least one detectable face
count    154.000000
mean       5.207792
std        2.168326
min        1.000000
25%        4.000000
50%        5.000000
75%        7.000000
max        9.000000
dtype: float64
c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\sklearn\linear_model\logistic.py:432: FutureWarning: Default solver will be changed to 'lbfgs' in 0.22. Specify a solver to silence this warning.
  FutureWarning)
Train size:  154
Training accuracy 0.7922077922077922
Recall/ Like accuracy 0.782608695652174
specificity/ Dislike accuracy 0.7962962962962963
LogisticRegression(C=1.0, class_weight='balanced', dual=False,
         fit_intercept=True, intercept_scaling=1, max_iter=100,
         multi_class='warn', n_jobs=None, penalty='l2', random_state=None,
         solver='warn', tol=0.0001, verbose=0, warm_start=False)

please advise.
did I open the pickled model correct? I am not sure what that is but I am assuming that produces the logisticregression part

@cjekel
Copy link
Owner

cjekel commented Aug 24, 2019

Hmm... it looks like the model is working.

Do you get the same error when you run tindetheus like now?

@maheerb
Copy link
Author

maheerb commented Aug 24, 2019

Actually I am getting this error now if i do tindetheus browse or tindetheus like. I tried to fix this too via this solution: charliewolf/pynder#193 but no avail.

main(args, defaults['facebook_token'], defaults['XAuthToken'])
  File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\tindetheus\tindetheus.py", line 126, in main
    x_auth_token=x_auth_token)
  File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\tindetheus\tinder_client.py", line 89, in __init__
    self.session = self.login(facebook_token, x_auth_token)
  File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\tindetheus\tinder_client.py", line 128, in login
    print('Hello ', session.profile)
  File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\cached_property.py", line 35, in __get__
    value = obj.__dict__[self.func.__name__] = self.func(obj)
  File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\pynder\session.py", line 22, in profile
    return Profile(self._api.profile(), self._api)
  File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\pynder\api.py", line 87, in profile
    return self._get("/profile")
  File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\pynder\api.py", line 52, in _get
    return self._request("get", url)
  File "c:\users\focus\anaconda3\envs\tensorflow\lib\site-packages\pynder\api.py", line 46, in _request
    raise errors.RequestError(result.status_code)
pynder.errors.RequestError: 400

@cjekel
Copy link
Owner

cjekel commented Aug 25, 2019

How are you logging in? If you use sms you may need to resubmit a token.

@maheerb
Copy link
Author

maheerb commented Aug 25, 2019 via email

@cjekel
Copy link
Owner

cjekel commented Aug 25, 2019

XAuthToken expires after sometime (perhaps 24 hours). Try to grab a new XAuthToken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants