Open IliaOzhmegov opened 2 years ago
change the following code: older: elif self.name in ['RandomSurvForest']: surv = self.model.predict_survival_function(X) #returns numpy array new: elif self.name in ['RandomSurvForest']: surv = self.model.predict_survival_function(X, True) #returns numpy array
Thank you, it works.
I have tried to run your jupyter notebook on a few different machines and that what I got.
initial training of underlying models... CV.. 1/10 Traceback (most recent call last): File "/usr/lib/python3/dist-packages/IPython/core/interactiveshell.py", line 3331, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-2-0a4c289817d5>", line 1, in <module> runfile('/home/ilia/Projects/SurvivalQuilts/main.py', wdir='/home/ilia/Projects/SurvivalQuilts') File "/home/ilia/IDEs/pycharm-2021.1.3/plugins/python/helpers/pydev/_pydev_bundle/pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "/home/ilia/IDEs/pycharm-2021.1.3/plugins/python/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/ilia/Projects/SurvivalQuilts/main.py", line 68, in <module> model_sq.train(tr_X, tr_T, tr_Y) File "/home/ilia/Projects/SurvivalQuilts/class_SurvivalQuilts.py", line 57, in train pulled_models, tmp_CINDEX, tmp_BRIER = self._get_models_pulled_CV(X, T, Y, seed=cv_idx) File "/home/ilia/Projects/SurvivalQuilts/class_SurvivalQuilts.py", line 289, in _get_models_pulled_CV pred = model.predict(X_va, self.time_horizons) File "/home/ilia/Projects/SurvivalQuilts/class_UnderlyingModels.py", line 53, in predict preds_[:, t] = 1. - surv[:, tmp_time[0]] IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed