tindetheus icon indicating copy to clipboard operation
tindetheus copied to clipboard

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

Open maheerb opened this issue 6 years ago • 7 comments

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!

maheerb avatar Aug 23 '19 17:08 maheerb

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)

cjekel avatar Aug 23 '19 17:08 cjekel

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

maheerb avatar Aug 24 '19 20:08 maheerb

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

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

cjekel avatar Aug 24 '19 20:08 cjekel

Actually I am getting this error now if i do tindetheus browse or tindetheus like. I tried to fix this too via this solution: https://github.com/charliewolf/pynder/issues/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

maheerb avatar Aug 24 '19 20:08 maheerb

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

cjekel avatar Aug 25 '19 15:08 cjekel

I am logging in through XAuthToken. It was working fine so far. Not sure. Its a login issue right now no?

On Sun, Aug 25, 2019 at 11:03 AM Charles Jekel [email protected] wrote:

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

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cjekel/tindetheus/issues/16?email_source=notifications&email_token=AM7NOQ4JCRYUIA5RW3X2753QGKNN5A5CNFSM4IPBS7V2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5CVICY#issuecomment-524637195, or mute the thread https://github.com/notifications/unsubscribe-auth/AM7NOQZ5EVZP4IFOAVINZ3LQGKNN5ANCNFSM4IPBS7VQ .

maheerb avatar Aug 25 '19 16:08 maheerb

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

cjekel avatar Aug 25 '19 17:08 cjekel