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: tf 'module' object has no attribute 'sub' #2

Open
wenruij opened this issue Oct 21, 2017 · 2 comments
Open

AttributeError: tf 'module' object has no attribute 'sub' #2

wenruij opened this issue Oct 21, 2017 · 2 comments

Comments

@wenruij
Copy link

wenruij commented Oct 21, 2017

Q1:
It seems there's a deprecated API tf.sub in your implementation, which will throw exception like
AttributeError: 'module' object has no attribute 'sub'
in tensorflow 1.3.0+.

Change that to tf.subtract will fix it.

Q2:
Furthermore, have you ever consider using the tf.estimator.Estimator to replace sklearn.base.BaseEstimator ?
A tf.estimator.Estimator model with model.export_model will enable you to deploy a trained model with tensorflow Serving for a product env, while it can also make your training parallelized with high level api tf.contrib.learn.Experiment.

@hexiangnan
Copy link
Owner

hexiangnan commented Oct 21, 2017 via email

@wenruij
Copy link
Author

wenruij commented Oct 22, 2017

@hexiangnan
I just tried --loss_type=log_loss, there maybe some points need be updated:

  1. Line 149: self.lambda_bilinear > 0, the typo is different from the one self.lamda_bilinear in __init__

  2. Line 150 and Line 152: parameter oftf.contrib.losses.log_loss should be weights, not weight. Maybe TF 1.0 using weight, but TF 1.2+ using weights

  3. Line 304: decision condition of early_stop for self.loss_type == 'log_loss' should be the same as self.loss_type == 'square_loss', or the train loops will always stop at the 6th epoch.

  4. there exist 2 different loss calculation rules: tf.contrib.losses.log_loss and sklearn.metrics.log_loss. Should it be better to unify the calculation rule? But maybe you have your own consideration to use 2 rules. Please ignore my advice, if that is the case.

At last, if you consider using the tf.estimator.Estimator and tf.contrib.learn.Experiment, please let me know. I'm pleasure to join the contribution of this part. Your idea of neural factorization machine looks great ~

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