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

Documentation for Cox data #24

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions examples/cox_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
from lassonet import LassoNetCoxRegressor, plot_path

data = Path(__file__).parent / "data"
X = np.genfromtxt(data / "hnscc_x.csv", delimiter=",", skip_header=1)
y = np.genfromtxt(data / "hnscc_y.csv", delimiter=",", skip_header=1)
X = np.genfromtxt(data / "my_dataset_x.csv", delimiter=",", skip_header=1)
y = np.genfromtxt(data / "my_dataset_y.csv", delimiter=",", skip_header=1)


X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)
Expand Down
12 changes: 12 additions & 0 deletions examples/data/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Customizing datasets for Cox experiments

You can customize your dataset to use LassoNet on survival analysis.

## Usage
- Put the input matrix in `my_dataset_x.csv` and outcome matrix in `my_dataset_y.csv` under the `data/` folder.
- `my_dataset_x.csv`: For N samples and T features, the input matrix should be of size [N, T].
- `my_dataset_y.csv`: The outcome matrix should be of size [N, 2] with the first column as time and the second column as event (1 for uncensored and 0 otherwise).
- You can optionally include the feature name as the header of csv file by setting `skip_header=1` in `cox_regression.py`.
- To run LassoNet using customized datasets:
```python cox_regression.py```

Loading