Skip to content

Commit

Permalink
Added outputs to regression example
Browse files Browse the repository at this point in the history
  • Loading branch information
evancofer committed Dec 9, 2018
1 parent 838391c commit 4eabae5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
5 changes: 3 additions & 2 deletions tutorials/regression_mpra_example/download_data.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import io
import gzip
import os
import urllib
import urllib.request
import tarfile

import numpy
import pandas
import scipy.io
import selene_sdk.sequences
Expand All @@ -14,7 +15,7 @@ def run():
local_file = "sample_et_al.tar"

# Download the data.
urllib.retrieve("https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE114002&format=file", local_file)
urllib.request.urlretrieve("https://www.ncbi.nlm.nih.gov/geo/download/?acc=GSE114002&format=file", local_file)
with tarfile.open(local_file, "r") as archive:
contents = archive.extractfile("GSM3130435_egfp_unmod_1.csv.gz").read()
contents = gzip.decompress(contents).decode("utf-8")
Expand Down
22 changes: 17 additions & 5 deletions tutorials/regression_mpra_example/regression_mpra_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"Selene is a flexible framework, and can be used for tasks beyond simple classification.\n",
"This tutorial serves as an introduction to training regression models with Selene.\n",
"For this tutorial, we will predict mean ribosomal load (MRL) from 50 base pair 5' UTR sequences using models and data from [*Human 5′ UTR design and variant effect prediction from a massively parallel translation assay*](https://doi.org/10.1101/310375) by Sample et al.\n",
"This data was generated from a massively parallel reporter assay (MPRA), which you can read more about in the preprint [on *bioRxiv*](https://doi.org/10.1101/310375).\n",
"This data was generated from a massively parallel reporter assay (MPRA), which you can read more about it in the preprint [on *bioRxiv*](https://doi.org/10.1101/310375).\n",
"\n",
"## Setup\n",
"\n",
Expand Down Expand Up @@ -62,7 +62,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -71,9 +71,21 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 7,
"metadata": {},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Outputs and logs saved to ./2018-12-08-22-08-14\n",
"[VALIDATE] average r2: 0.8641705948994154\n",
"[VALIDATE] average r2: 0.8767916124114791\n",
"[VALIDATE] average r2: 0.8817297326343803\n",
"[TEST] average r2: 0.9232683662644537\n"
]
}
],
"source": [
"parse_configs_and_run(configs, lr=0.001)"
]
Expand All @@ -95,7 +107,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.3"
"version": "3.6.5"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 4eabae5

Please sign in to comment.