Coder Social home page Coder Social logo

liupei101 / tfdeepsurv Goto Github PK

View Code? Open in Web Editor NEW
96.0 96.0 27.0 587 KB

COX Proportional risk model and survival analysis implemented by tensorflow.

License: MIT License

Python 100.00%
cox-model cox-regression deeplearning survival-analysis tensorflow

tfdeepsurv's Issues

Cannot restore variables (weights and bias)

Hi Liupei,
Thanks for your awsome work TFDeepSurv. But I have problems to restore variables from the saved checkpoint file.
saver = tf.train.import_meta_graph(load_model+'final.ckpt.meta')
saver.restore(self.sess, load_model+'final.ckpt')
all_vars = tf.get_collection(tf.GraphKeys.GLOBAL_VARIABLES)
print(all_vars)
for v in all_vars:
v_ = sess.run(v)
print(v_)
It appears errors. Could you have ideas to fix this? Thanks a lot!
Traceback (most recent call last):
File "c:\users\shuyan\anaconda3\lib\site-packages\tensorflow_core\python\client\session.py", line 1365, in _do_call
return fn(*args)
File "c:\users\shuyan\anaconda3\lib\site-packages\tensorflow_core\python\client\session.py", line 1350, in _run_fn
target_list, run_metadata)
File "c:\users\shuyan\anaconda3\lib\site-packages\tensorflow_core\python\client\session.py", line 1443, in _call_tf_sessionrun
run_metadata)
tensorflow.python.framework.errors_impl.FailedPreconditionError: Attempting to use uninitialized value encoder_layer1/biases
[[{{node encoder_layer1/biases/read}}]]

During handling of the above exception, another exception occurred:

Demonstration data error

Hello, I reported an error while running the TFDeepSurv demo data. Do you know what caused it? Thank you for your guidance.
捕获2

gpu support

@liupei101 Thank you so much for the package.

Could you please advise is it possible to use GPU support for this TFDeepSurv package?

Thank you!

The NAN value appears when used Bayesian Hyperparameters Optimization

Hello!When I used hpopt.py to search hyperparameters ,the following error occurred:ValueError: NaNs detected in inputs, please correct or drop. Do you know why?

File "D:/pythonProject1/femaletiaocan.py", line 101, in train_dsl_by_vd
ds.train(train_X, train_y, num_steps=params['num_rounds'], silent=True)
File "D:\Program Files\Python\lib\site-packages\tfdeepsurv\dsl.py", line 238, in train
watch_list['metrics'].append(concordance_index(self.train_data_y.values, -y_hat))
File "D:\Program Files\Python\lib\site-packages\tfdeepsurv\utils.py", line 106, in concordance_index
ci_value = ci(t, y_pred, e)
File "D:\Program Files\Python\lib\site-packages\lifelines\utils\concordance.py", line 91, in concordance_index
event_times, predicted_scores, event_observed = _preprocess_scoring_data(event_times, predicted_scores, event_observed)
File "D:\Program Files\Python\lib\site-packages\lifelines\utils\concordance.py", line 301, in _preprocess_scoring_data
raise ValueError("NaNs detected in inputs, please correct or drop.")
ValueError: NaNs detected in inputs, please correct or drop.

How to test this with a new data set sample?

Hi Liupei101,

This package looks great. Wondering if we cud play/test this package with a new sample data set. If ok, can you please guide thru initial steps to start with - newbie pls..thanks...or wud like to discuss a couple of questions - u may pls advise about the best way to contact/communicate, thanq so much, appreciate ur time/help...

loss diverges to NaN

In the _create_loss function, the loss_breslow is something divided by Obs. However the variable Obs is the count of events in a batch, which is likely to be 0.

How do you solve this problem?

why `batch` is not appropriate in survival analysis?

@liupei101 in the dsl.py you have added this comment "Since style of batch is not appropriate in survival analysis."

Could you please advise why batch (mini-batch) training is not appropriate in survival analysis? I notice that the DeepSur (https://github.com/jaredleekatzman/DeepSurv ) also does not support the mini-batch training.

Based on my understanding, mini-batch should be suitable for any ML problem as long as we train enough epoch. Feel free to correct me if I misunderstand this.

Thank you so much!

hyptop issues

Hyopt tuning - i can't seem to change the numbers of hidden layers to any other of the [6,3,1] - any other turns an error of hidden layers.
also is there any way of tuning this as part of the parameters?

on 6,3,1 - it's thrown away after 16% saying there are NA's? (the dataset has no NA).

TypeError: Object of type int32 is not JSON serializable

Hello,
Thank you for your great packages.
I run hpopt.py but at the end of the process, nothing has been written in JSON output file due to bellow error
Any help would be greatly appreciated

raise TypeError(f'Object of type {o.__class__.__name__} '

TypeError: Object of type int32 is not JSON serializable`

Hyper parameter search with real data set - a concern on CI values...

Hi liupei101,

  1. I tested the hyper parameter search piece with real data set - using hyopt script - as per instructions at bysopt. It works fine and generates a list of hyper parameters in log file (for example: log_hpopt_xxx.json) - similar to the one generated with simulated_data.
  1. a) I loaded the real data - per 4.2.1, [refer code snippet# 2 below]

b) included the best parameters obtained from 1 (refer example parameters in code snippet# 1 below ] to the real data set, and initialized the neural n/w, as per 4.1.3

c) trained the n/w as per 4.1.4 - via model.train and/or model.learn (tried both too), and attempted to evaluate performance and got learning curves - as described in 4.1.4a and 4.1.4b. Up to this point works great with no issues.

However, I have a concern/question on finanl CI value mismatches - final ones on learning curve or from 4.1.5 - are lower than the ones generated in log_hpopt_xxx.json file. [For example, Final CI values thru model.train or model.learn are way lesser than the ones mentioned in code snippet # 1 values; ci_train and ci_valid are supposed to be in the range 0.7745, 0.7485 respectively - but I'm seeing in the range of 0.65 - 0.7 (Ci_train_set) and 0.55- 0.62 (ci_test_set).

Question for you:
Why is it not able to generate the ci values - close to ones obtained in search-space in json file? am i missing anything? One thing, I coudl see is - in hyopt script, the spilit seed = 42; but there is no seeding applied when I ran with real data, as per 4.2.1, using one time split (refer code snippet# 2 below) - so, would that be a cause for total mismatch or lower ci values? Can you thow some light on this and point me to the right direction - if any thing missing...

Hope I explained the issue clearly - if you need more info ro have any questions for me, please let me know. Appreciate your help/suggestions, pls.

Code snippet# 1:
{"params": {"dropout": 1.0, "activation": "tanh", "L2_reg": 0.00027453142563396016, "learning_rate_decay": 1.0, "L1_reg": 0.0008515639202782554, "num_rounds": 1500, "learning_rate": 0.6, "optimizer": "adam"}, "ci_validation": 0.748552011474626, "ci_train": 0.7757347200677045},

Code snippet# 2:
train_X, train_y, test_X, test_y = load_data('full_data.csv', excluded_col=['ID'], surv_col={'e': 'event', 't': 'time'}, split_ratio=0.8)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.