Skip to content

Commit 95a536a

Browse files
committed
Run notebook completely
1 parent 9c09232 commit 95a536a

File tree

2 files changed

+28
-16
lines changed

2 files changed

+28
-16
lines changed

notebooks/MNIST-torchvision.ipynb

+28-16
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@
674674
},
675675
{
676676
"cell_type": "code",
677-
"execution_count": 124,
677+
"execution_count": 50,
678678
"metadata": {},
679679
"outputs": [],
680680
"source": [
@@ -683,20 +683,34 @@
683683
},
684684
{
685685
"cell_type": "code",
686-
"execution_count": 145,
686+
"execution_count": 51,
687687
"metadata": {},
688688
"outputs": [],
689689
"source": [
690690
"params = {\n",
691691
" 'module__dropout': [0, 0.5, 0.8],\n",
692-
" 'max_epochs': [1],\n",
692+
" 'max_epochs': [2],\n",
693693
" 'verbose': [False],\n",
694+
" 'train_split': [False],\n",
694695
"}"
695696
]
696697
},
698+
{
699+
"cell_type": "markdown",
700+
"metadata": {},
701+
"source": [
702+
"The parameter we are interested in here is the dropout rate. We want to see which of the values (no dropout, 50%, 80%) is the best choice for our network.\n",
703+
"\n",
704+
"Additionally:\n",
705+
"\n",
706+
"- We use only two epochs (`max_epochs: [2]`) for each `.fit` (only to reduce execution time, normally we wouldn't change this and possibly add an `EarlyStopping` callback).\n",
707+
"- Disable the network output (`verbose: [False]`)\n",
708+
"- Disable the internal train/validation split (`train_split: [False]`) since the grid search will do k-fold validation anyway"
709+
]
710+
},
697711
{
698712
"cell_type": "code",
699-
"execution_count": 151,
713+
"execution_count": 52,
700714
"metadata": {},
701715
"outputs": [
702716
{
@@ -714,7 +728,7 @@
714728
},
715729
{
716730
"cell_type": "code",
717-
"execution_count": 147,
731+
"execution_count": 53,
718732
"metadata": {},
719733
"outputs": [],
720734
"source": [
@@ -723,7 +737,7 @@
723737
},
724738
{
725739
"cell_type": "code",
726-
"execution_count": 148,
740+
"execution_count": 54,
727741
"metadata": {},
728742
"outputs": [],
729743
"source": [
@@ -732,7 +746,7 @@
732746
},
733747
{
734748
"cell_type": "code",
735-
"execution_count": 149,
749+
"execution_count": 55,
736750
"metadata": {
737751
"scrolled": false
738752
},
@@ -748,16 +762,14 @@
748762
"name": "stderr",
749763
"output_type": "stream",
750764
"text": [
751-
"/home/marian/anaconda3/envs/skorch/lib/python3.6/site-packages/sklearn/model_selection/_split.py:1943: FutureWarning: You should specify a value for 'cv' instead of relying on the default value. The default value will change from 3 to 5 in version 0.22.\n",
752-
" warnings.warn(CV_WARNING, FutureWarning)\n",
753765
"[Parallel(n_jobs=1)]: Using backend SequentialBackend with 1 concurrent workers.\n",
754-
"[Parallel(n_jobs=1)]: Done 9 out of 9 | elapsed: 2.1min finished\n"
766+
"[Parallel(n_jobs=1)]: Done 9 out of 9 | elapsed: 7.0min finished\n"
755767
]
756768
},
757769
{
758770
"data": {
759771
"text/plain": [
760-
"GridSearchCV(cv='warn', error_score='raise-deprecating',\n",
772+
"GridSearchCV(cv=3, error_score='raise-deprecating',\n",
761773
" estimator=<class 'skorch.classifier.NeuralNetClassifier'>[initialized](\n",
762774
" module_=Cnn(\n",
763775
" (conv1): Conv2d(1, 32, kernel_size=(3, 3), stride=(1, 1))\n",
@@ -769,12 +781,12 @@
769781
" ),\n",
770782
"),\n",
771783
" fit_params=None, iid='warn', n_jobs=None,\n",
772-
" param_grid={'module__dropout': [0, 0.5, 0.8], 'max_epochs': [1], 'verbose': [False]},\n",
784+
" param_grid={'module__dropout': [0, 0.5, 0.8], 'max_epochs': [2], 'verbose': [False], 'train_split': [False]},\n",
773785
" pre_dispatch='2*n_jobs', refit=True, return_train_score='warn',\n",
774786
" scoring='accuracy', verbose=1)"
775787
]
776788
},
777-
"execution_count": 149,
789+
"execution_count": 55,
778790
"metadata": {},
779791
"output_type": "execute_result"
780792
}
@@ -792,16 +804,16 @@
792804
},
793805
{
794806
"cell_type": "code",
795-
"execution_count": 150,
807+
"execution_count": 56,
796808
"metadata": {},
797809
"outputs": [
798810
{
799811
"data": {
800812
"text/plain": [
801-
"{'max_epochs': 1, 'module__dropout': 0, 'verbose': False}"
813+
"{'max_epochs': 2, 'module__dropout': 0, 'train_split': False, 'verbose': False}"
802814
]
803815
},
804-
"execution_count": 150,
816+
"execution_count": 56,
805817
"metadata": {},
806818
"output_type": "execute_result"
807819
}

skorch/tests/net_cuda.pkl

880 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)