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

How to Use DeepSurv Exactly? #34

Open
koji1225shasha opened this issue Jan 20, 2018 · 3 comments
Open

How to Use DeepSurv Exactly? #34

koji1225shasha opened this issue Jan 20, 2018 · 3 comments

Comments

@koji1225shasha
Copy link

koji1225shasha commented Jan 20, 2018

I am still quite new to Python, and am trying to apply my data to deepsurv. Would you mind sharing the exact code you wrote between the two paragraphs below? I appreciate your help.

Training DeepSurv can be done in a few lines. First, all you need to do is prepare the datasets to have the following keys:
{
'x': (n,d) observations (dtype = float32),
't': (n) event times (dtype = float32),
'e': (n) event indicators (dtype = int32)
}

Then prepare a dictionary of hyper-parameters. And it takes only two lines to train a network:
network = deepsurv.DeepSurv(**hyperparams)
log = network.train(train_data, valid_data, n_epochs=500)

@jaredleekatzman
Copy link
Owner

I just uploaded a simple notebook showing how to take a CSV file and create a dataset to use with DeepSurv.

Take a look at that and see if you understand it more. And then let me know if you have any other questions

@koji1225shasha
Copy link
Author

Thank you so much for your comment. I can run mots of the codes without an issues. At the end, I cannot run the last two part of the codes as below:

KeyError Traceback (most recent call last)
in ()
1 # Print the final metrics
----> 2 print('Train C-Index:', metrics['c-index'][-1])

KeyError: 'c-index'


KeyError Traceback (most recent call last)
in ()
1 # Plot the training / validation curves
----> 2 viz.plot_log(metrics)

/Users/ksasaki1/AppData/Local/Programs/Python/Python36/Lib/site-packages/DeepSurv-master/deepsurv\viz.py in plot_log(log)
36 VALID_CI = 'valid_c-index'
37
---> 38 num_epochs = len(log[TRAIN_LOSS])
39
40 # Plots Negative Log Likelihood vs. Epoch

KeyError: 'loss'

P.S.
I have one favor. Could you share how we should add code for the treatment recommendation?

@nishan2204
Copy link

I'm getting the same error for last two lines of code, with loss as a KeyError.

Adding to messenger's point above, some code on how to obtain the personalized treatment recommendation would be appreciated. Sorry, I'm actually giving a literature review with your paper as part of a PoC for a project.

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

3 participants