Skip to content

Commit

Permalink
Testing stripping
Browse files Browse the repository at this point in the history
  • Loading branch information
vsyrgkanis committed Jul 22, 2024
1 parent e68c336 commit 345979b
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/strip-python-notebooks.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Strip Python Jupyter Notebooks from Outputs
name: Strip Python and R Notebooks from Outputs

on:
push:

concurrency:
group: strip-python-notebooks-${{ github.ref }}
group: strip-notebooks-${{ github.ref }}
cancel-in-progress: true

jobs:
strip-python-notebooks:
strip-notebooks:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -43,6 +43,16 @@ jobs:
nbstripout "$notebook"
fi
done
for notebook in "$dir"/*.irnb; do
# Check if there are any .irnb files
if [ -e "$notebook" ]; then
echo "Stripping output from notebook: $notebook"
ipynb_notebook="${notebook%.irnb}.ipynb"
mv "$notebook" "$ipynb_notebook"
nbstripout "$ipynb_notebook"
mv "$ipynb_notebook" "$notebook"
fi
done
else
echo "Directory $dir does not exist."
fi
Expand All @@ -56,7 +66,7 @@ jobs:
# Check if directory exists
if [ -d "$dir" ]; then
echo "Processing directory: $dir"
if git diff --quiet "$dir"/*.ipynb; then
if git diff --quiet "$dir"/*.ipynb "$dir"/*.irnb; then
echo "changed=true" >> $GITHUB_OUTPUT
break 1
fi
Expand All @@ -75,7 +85,7 @@ jobs:
# Check if directory exists
if [ -d "$dir" ]; then
echo "Adding changed files from directory: $dir"
git add "$dir"/*.ipynb
git add "$dir"/*.ipynb "$dir"/*.irnb
else
echo "Directory $dir does not exist."
fi
Expand Down
22 changes: 19 additions & 3 deletions PM1/python-linear-model-overfitting.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 5,
"metadata": {
"id": "YTaOmenI7TfT"
},
Expand All @@ -44,7 +44,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 6,
"metadata": {
"id": "C57WYtYM7OL0",
"papermill": {
Expand All @@ -56,7 +56,23 @@
},
"tags": []
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"p/n is: 1.0\n",
"R^2 is 1.0\n",
"Adjusted R^2 is nan\n",
"p/n is: 0.5\n",
"R^2 is 0.5232392347513539\n",
"Adjusted R^2 is 0.04647846950270784\n",
"p/n is: 0.05\n",
"R^2 is 0.05610356497156044\n",
"Adjusted R^2 is 0.006424805233221531\n"
]
}
],
"source": [
"regression_stats(1000, 1000)\n",
"regression_stats(1000, 500)\n",
Expand Down
4 changes: 3 additions & 1 deletion PM1/r-linear-model-overfitting.irnb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@
"languageId": "r"
}
},
"outputs": [],
"outputs": [
"text": ["asdfas\n"]
],
"source": [
"\n",
"set.seed(123)\n",
Expand Down

0 comments on commit 345979b

Please sign in to comment.