Skip to content

Commit 875efa0

Browse files
authored
Sort imports in another 9 notebooks (#4074)
* another 10 notebooks * 10th notebook * put magic at bottom of cell * separate first-party imports
1 parent b51b32f commit 875efa0

9 files changed

+29
-24
lines changed

docs/source/notebooks/GLM-robust.ipynb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,9 @@
4040
"source": [
4141
"%matplotlib inline\n",
4242
"\n",
43-
"import pymc3 as pm\n",
44-
"\n",
4543
"import matplotlib.pyplot as plt\n",
4644
"import numpy as np\n",
47-
"\n",
45+
"import pymc3 as pm\n",
4846
"import theano"
4947
]
5048
},

docs/source/notebooks/GP-MeansAndCovs.ipynb

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,16 @@
1111
},
1212
"outputs": [],
1313
"source": [
14-
"import matplotlib.pyplot as plt\n",
1514
"import matplotlib.cm as cmap\n",
16-
"%matplotlib inline\n",
17-
"\n",
15+
"import matplotlib.pyplot as plt\n",
1816
"import numpy as np\n",
19-
"np.random.seed(206)\n",
20-
"\n",
17+
"import pymc3 as pm\n",
2118
"import theano\n",
2219
"import theano.tensor as tt\n",
23-
"import pymc3 as pm"
20+
"\n",
21+
"%matplotlib inline\n",
22+
"\n",
23+
"np.random.seed(206)"
2424
]
2525
},
2626
{

docs/source/notebooks/bayes_param_survival_pymc3.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@
3030
"from matplotlib import pyplot as plt\n",
3131
"from matplotlib.ticker import StrMethodFormatter\n",
3232
"from statsmodels import datasets\n",
33-
"from theano import shared, tensor as tt\n",
33+
"from theano import shared\n",
34+
"from theano import tensor as tt\n",
3435
"\n",
3536
"print('Running on PyMC3 v{}'.format(pm.__version__))"
3637
]

docs/source/notebooks/dependent_density_regression.ipynb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@
3939
"import seaborn as sns\n",
4040
"\n",
4141
"from IPython.display import HTML\n",
42-
"from matplotlib import animation as ani, pyplot as plt\n",
43-
"from theano import shared, tensor as tt\n",
42+
"from matplotlib import animation as ani\n",
43+
"from matplotlib import pyplot as plt\n",
44+
"from theano import shared\n",
45+
"from theano import tensor as tt\n",
4446
"\n",
4547
"print('Running on PyMC3 v{}'.format(pm.__version__))"
4648
]
@@ -1109,8 +1111,7 @@
11091111
"\n",
11101112
"with model:\n",
11111113
" step = pm.Metropolis()\n",
1112-
" trace = pm.sample(SAMPLES, step, chains=1, tune=BURN, random_seed=SEED)\n",
1113-
" "
1114+
" trace = pm.sample(SAMPLES, step, chains=1, tune=BURN, random_seed=SEED)"
11141115
]
11151116
},
11161117
{

docs/source/notebooks/dp_mix.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@
8282
"import numpy as np\n",
8383
"import pandas as pd\n",
8484
"import pymc3 as pm\n",
85-
"import seaborn as sns\n",
8685
"import scipy as sp\n",
86+
"import seaborn as sns\n",
8787
"\n",
8888
"from matplotlib import pyplot as plt\n",
8989
"from theano import tensor as tt\n",

docs/source/notebooks/factor_analysis.ipynb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,18 @@
1414
}
1515
],
1616
"source": [
17+
"import warnings\n",
18+
"\n",
1719
"import arviz as az\n",
1820
"import matplotlib\n",
1921
"import numpy as np\n",
2022
"import pymc3 as pm\n",
21-
"import seaborn as sbn\n",
2223
"import scipy as sp\n",
2324
"import scipy.sparse\n",
2425
"import scipy.sparse.linalg\n",
26+
"import seaborn as sbn\n",
2527
"import theano as T\n",
2628
"import theano.tensor as tt\n",
27-
"import warnings\n",
2829
"\n",
2930
"from matplotlib import pyplot as plt\n",
3031
"\n",

docs/source/notebooks/getting_started.ipynb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,6 +875,7 @@
875875
],
876876
"source": [
877877
"import warnings\n",
878+
"\n",
878879
"with warnings.catch_warnings():\n",
879880
" warnings.filterwarnings('ignore', category=UserWarning)\n",
880881
" returns.plot(figsize=(10, 6))\n",
@@ -3407,7 +3408,7 @@
34073408
" labels = [label.get_text() for label in ax.get_xticklabels()]\n",
34083409
" ax.set_xticklabels(labels, rotation=45, ha='right')\n",
34093410
" break\n",
3410-
"plt.draw() "
3411+
"plt.draw()"
34113412
]
34123413
},
34133414
{
@@ -3491,6 +3492,7 @@
34913492
"outputs": [],
34923493
"source": [
34933494
"import theano.tensor as tt\n",
3495+
"\n",
34943496
"from theano.compile.ops import as_op\n",
34953497
"\n",
34963498
"\n",

docs/source/notebooks/multilevel_modeling.ipynb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,14 @@
6464
}
6565
],
6666
"source": [
67+
"import warnings\n",
68+
"\n",
6769
"import arviz as az\n",
6870
"import matplotlib.pyplot as plt\n",
6971
"import numpy as np\n",
7072
"import pandas as pd\n",
7173
"import pymc3 as pm\n",
7274
"import xarray as xr\n",
73-
"import warnings\n",
7475
"\n",
7576
"from theano import tensor as tt\n",
7677
"\n",

docs/source/notebooks/probabilistic_matrix_factorization.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@
2222
],
2323
"source": [
2424
"%matplotlib inline\n",
25-
"import pymc3 as pm\n",
2625
"import numpy as np\n",
2726
"import pandas as pd\n",
27+
"import pymc3 as pm\n",
28+
"\n",
2829
"from matplotlib import pyplot as plt\n",
2930
"\n",
3031
"plt.style.use('seaborn-darkgrid')\n",
@@ -767,11 +768,11 @@
767768
"metadata": {},
768769
"outputs": [],
769770
"source": [
770-
"import time\n",
771771
"import logging\n",
772-
"import theano\n",
773-
"import scipy as sp\n",
772+
"import time\n",
774773
"\n",
774+
"import scipy as sp\n",
775+
"import theano\n",
775776
"\n",
776777
"# Enable on-the-fly graph computations, but ignore\n",
777778
"# absence of intermediate test values.\n",
@@ -1056,7 +1057,7 @@
10561057
" Method = baseline_methods[name]\n",
10571058
" method = Method(train)\n",
10581059
" baselines[name] = method.rmse(test)\n",
1059-
" print('%s RMSE:\\t%.5f' % (method, baselines[name]))\n"
1060+
" print('%s RMSE:\\t%.5f' % (method, baselines[name]))"
10601061
]
10611062
},
10621063
{

0 commit comments

Comments
 (0)