-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0ce33f4
Showing
35 changed files
with
861 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[train] | ||
h5_file = 'data/gaussian/gaussian_survival_data.h5' | ||
epochs = 500 | ||
learning_rate = 3.194e-3 | ||
lr_decay_rate = 3.173e-4 | ||
optimizer = 'Adam' | ||
|
||
[network] | ||
drop = 0.401 | ||
norm = True | ||
dims = [10, 17, 17, 17, 1] | ||
activation = 'ReLU' | ||
l2_reg = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[train] | ||
h5_file = 'data/gbsg/gbsg_cancer_train_test.h5' | ||
epochs = 500 | ||
learning_rate = 0.154 | ||
lr_decay_rate = 5.667e-3 | ||
optimizer = 'Adam' | ||
|
||
[network] | ||
drop = 0.661 | ||
norm = True | ||
dims = [7, 8, 1] | ||
activation = 'SELU' | ||
l2_reg = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[train] | ||
h5_file = 'data/linear/linear_survival_data.h5' | ||
epochs = 500 | ||
learning_rate = 2.922e-3 | ||
lr_decay_rate = 3.579e-4 | ||
optimizer = 'Adam' | ||
|
||
[network] | ||
drop = 0.375 | ||
norm = True | ||
dims = [10, 4, 1] | ||
activation = 'SELU' | ||
l2_reg = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[train] | ||
h5_file = 'data/metabric/metabric_IHC4_clinical_train_test.h5' | ||
epochs = 500 | ||
learning_rate = 0.010 | ||
lr_decay_rate = 4.169e-3 | ||
optimizer = 'Adam' | ||
|
||
[network] | ||
drop = 0.160 | ||
norm = True | ||
dims = [9, 41, 1] | ||
activation = 'SELU' | ||
l2_reg = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[train] | ||
h5_file = 'data/support/support_train_test.h5' | ||
epochs = 500 | ||
learning_rate = 0.047 | ||
lr_decay_rate = 2.573e-3 | ||
optimizer = 'Adam' | ||
|
||
[network] | ||
drop = 0.255 | ||
norm = True | ||
dims = [14, 44, 1] | ||
activation = 'SELU' | ||
l2_reg = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[train] | ||
h5_file = 'data/treatment/sim_treatment_dataset.h5' | ||
epochs = 500 | ||
learning_rate = 0.026 | ||
lr_decay_rate = 1.636e-4 | ||
optimizer = 'Adam' | ||
|
||
[network] | ||
drop = 0.109 | ||
norm = True | ||
dims = [11, 45, 1] | ||
activation = 'SELU' | ||
L2_reg = 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[train] | ||
h5_file = 'data/whas/whas_train_test.h5' | ||
epochs = 500 | ||
learning_rate = 0.067 | ||
lr_decay_rate = 6.494e-4 | ||
optimizer = 'Adam' | ||
|
||
[network] | ||
drop = 0.147 | ||
norm = True | ||
dims = [6, 48, 48, 1] | ||
activation = 'ReLU' | ||
l2_reg = 0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+40 Bytes
..._data.h5_320635bd-e6f6-49f9-ba02-2d2aba6d25d2/events.out.tfevents.1501950449.ebe916c018ac
Binary file not shown.
Binary file added
BIN
+3.18 KB
..._data.h5_88d7b4e3-5a3b-4380-8b22-7c7a4b0aa1ee/events.out.tfevents.1501951016.152ea285d90e
Binary file not shown.
Binary file added
BIN
+63.6 KB
..._data.h5_e215d084-3302-4248-939d-f5e43cfe63b5/events.out.tfevents.1501950494.152ea285d90e
Binary file not shown.
Binary file added
BIN
+40 Bytes
..._data.h5_ea209c15-00d7-4a57-8fc8-046e08038eba/events.out.tfevents.1501950372.411602be3a6f
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+40 Bytes
..._test.h5_b1f908ae-d03c-4f7c-aab9-ae01ac9d31f7/events.out.tfevents.1501953943.cd9ea224808d
Binary file not shown.
Binary file added
BIN
+101 KB
..._test.h5_df8bcb48-c77e-46f8-b33c-112cb940a285/events.out.tfevents.1501954035.bf1b5f1da709
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# ------------------------------------------------------------------------------ | ||
# --coding='utf-8'-- | ||
# Written by czifan (czifan@pku.edu.cn) | ||
# ------------------------------------------------------------------------------ | ||
from __future__ import absolute_import | ||
from __future__ import division | ||
from __future__ import print_function | ||
|
||
import h5py | ||
import numpy as np | ||
import pandas as pd | ||
import torch | ||
|
||
from torch.utils.data import Dataset | ||
|
||
class SurvivalDataset(Dataset): | ||
''' The dataset class performs loading data from .h5 file. ''' | ||
def __init__(self, h5_file, is_train): | ||
''' Loading data from .h5 file based on (h5_file, is_train). | ||
:param h5_file: (String) the path of .h5 file | ||
:param is_train: (bool) which kind of data to be loaded? | ||
is_train=True: loading train data | ||
is_train=False: loading test data | ||
''' | ||
# loads data | ||
self.X, self.e, self.y = \ | ||
self._read_h5_file(h5_file, is_train) | ||
# normalizes data | ||
self._normalize() | ||
|
||
print('=> load {} samples'.format(self.X.shape[0])) | ||
|
||
def _read_h5_file(self, h5_file, is_train): | ||
''' The function to parsing data from .h5 file. | ||
:return X: (np.array) (n, m) | ||
m is features dimension. | ||
:return e: (np.array) (n, 1) | ||
whether the event occurs? (1: occurs; 0: others) | ||
:return y: (np.array) (n, 1) | ||
the time of event e. | ||
''' | ||
split = 'train' if is_train else 'test' | ||
with h5py.File(h5_file, 'r') as f: | ||
X = f[split]['x'][()] | ||
e = f[split]['e'][()].reshape(-1, 1) | ||
y = f[split]['t'][()].reshape(-1, 1) | ||
return X, e, y | ||
|
||
def _normalize(self): | ||
''' Performs normalizing X data. ''' | ||
self.X = (self.X-self.X.min(axis=0)) / \ | ||
(self.X.max(axis=0)-self.X.min(axis=0)) | ||
|
||
def __getitem__(self, item): | ||
''' Performs constructing torch.Tensor object''' | ||
# gets data with index of item | ||
X_item = self.X[item] # (m) | ||
e_item = self.e[item] # (1) | ||
y_item = self.y[item] # (1) | ||
# constructs torch.Tensor object | ||
X_tensor = torch.from_numpy(X_item) | ||
e_tensor = torch.from_numpy(e_item) | ||
y_tensor = torch.from_numpy(y_item) | ||
return X_tensor, y_tensor, e_tensor | ||
|
||
def __len__(self): | ||
return self.X.shape[0] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
2020-04-10 16:21:55,239 - utils - INFO - Running Simulated Linear(linear.ini)... | ||
2020-04-10 16:23:38,320 - utils - INFO - The best valid c-index: 0.7787218145430287 | ||
2020-04-10 16:23:38,320 - utils - INFO - | ||
2020-04-10 16:23:38,320 - utils - INFO - Running Simulated Nonlinear(gaussian.ini)... | ||
2020-04-10 16:24:17,832 - utils - INFO - The best valid c-index: 0.5005123415610407 | ||
2020-04-10 16:24:17,833 - utils - INFO - | ||
2020-04-10 16:24:17,833 - utils - INFO - Running WHAS(whas.ini)... | ||
2020-04-10 16:24:53,124 - utils - INFO - The best valid c-index: 0.8449728673025717 | ||
2020-04-10 16:24:53,125 - utils - INFO - | ||
2020-04-10 16:24:53,125 - utils - INFO - Running SUPPORT(support.ini)... | ||
2020-04-10 16:33:32,915 - utils - INFO - The best valid c-index: 0.6173979652937414 | ||
2020-04-10 16:33:32,924 - utils - INFO - | ||
2020-04-10 16:33:32,924 - utils - INFO - Running METABRIC(metabric.ini)... | ||
2020-04-10 16:33:47,937 - utils - INFO - The best valid c-index: 0.6371630149173443 | ||
2020-04-10 16:33:47,938 - utils - INFO - | ||
2020-04-10 16:33:47,938 - utils - INFO - Running Simulated Treatment(treatment.ini)... | ||
2020-04-10 16:34:41,391 - utils - INFO - The best valid c-index: 0.5599653102068045 | ||
2020-04-10 16:34:41,391 - utils - INFO - | ||
2020-04-10 16:34:41,391 - utils - INFO - Running Rotterdam & GBSG(gbsg.ini)... | ||
2020-04-10 16:35:21,385 - utils - INFO - The best valid c-index: 0.670171035229049 | ||
2020-04-10 16:35:21,386 - utils - INFO - | ||
2020-04-10 16:35:21,386 - utils - INFO - +------------------+---------------------+----------+----------+----------+---------------------+------------------+ | ||
| Simulated Linear | Simulated Nonlinear | WHAS | SUPPORT | METABRIC | Simulated Treatment | Rotterdam & GBSG | | ||
+------------------+---------------------+----------+----------+----------+---------------------+------------------+ | ||
| 0.778722 | 0.500512 | 0.844973 | 0.617398 | 0.637163 | 0.559965 | 0.670171 | | ||
+------------------+---------------------+----------+----------+----------+---------------------+------------------+ |
Oops, something went wrong.