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

Model Prediction and Model loading #2

Open
charleswg opened this issue Aug 8, 2017 · 3 comments
Open

Model Prediction and Model loading #2

charleswg opened this issue Aug 8, 2017 · 3 comments

Comments

@charleswg
Copy link

charleswg commented Aug 8, 2017

I found that it doesn't load model for some reason. Maybe it's windows specific?

A quick fix change path checking in predict function from:

assert os.path.exists(self.params.modelPath)
to
assert os.path.exists(os.path.dirname(self.params.modelPath))

But when I try to predict after training,
ds_tf = deepsurv_tf.DeepSurvTF(params)
stats = ds_tf.train(train, valid)
ds_tf.predict(valid['x'])

The follow error occur:
--> 291 risk = sess.run([risk], feed_dict = {self.x : testXdata})

UnboundLocalError: local variable 'risk' referenced before assignment

@charleswg charleswg changed the title Predict path issue Model Prediction and Model loading Aug 8, 2017
@alexhallam
Copy link
Owner

alexhallam commented Aug 10, 2017

Thanks for giving the code a shot!

Could you provide more information about [risk]?

From this line

--> 291 risk = sess.run([risk], feed_dict = {self.x : testXdata})

@charleswg
Copy link
Author

Actually I was trying to load the trained model to predict the hazard ratio of incoming data.

But I took a step back and tried in-session prediction right after training.

Would you provide example on how to do prediction (hazard_ratio, log_risk etc) using saved model?

@alexhallam
Copy link
Owner

alexhallam commented Aug 10, 2017

At the moment I am focusing on some other projects. I may not get to that in a timely manner. I tried to make the demo helpful, but of course I am sure there are many things (such as using a saved model) missing that would be helpful to many users. If other users are willing to push more ipython notebook examples that would be welcomed, as I do not plan on adding more examples any time soon. Also, freely submit pull requests as you try new things. Even if they are small things. I would be very accepting of ipython notebook demos. I am sure more examples could benefit someone else.

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