Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8329692

Browse filesBrowse files
authored
Merge pull request #4 from pymc-learn/dev
added tests for linear regression
2 parents 562c8e0 + 9ac9a1d commit 8329692
Copy full SHA for 8329692

File tree

Expand file treeCollapse file tree

12 files changed

+420
-403
lines changed
Filter options
Expand file treeCollapse file tree

12 files changed

+420
-403
lines changed

‎.travis.yml

Copy file name to clipboardExpand all lines: .travis.yml
+4-11Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,10 @@ install:
2222
- pip install coveralls travis-sphinx==2.0.0
2323

2424
env:
25-
- PYTHON_VERSION=2.7 FLOATX='float32' TESTCMD="--durations=10 --cov-append"
26-
- PYTHON_VERSION=2.7 FLOATX='float32' RUN_PYLINT="true" TESTCMD="--durations=10 --cov-append"
27-
- PYTHON_VERSION=2.7 FLOATX='float32' TESTCMD="--durations=10 --cov-append"
28-
- PYTHON_VERSION=2.7 FLOATX='float32' TESTCMD="--durations=10 --cov-append"
29-
- PYTHON_VERSION=2.7 FLOATX='float64' TESTCMD="--durations=10"
30-
- PYTHON_VERSION=2.7 FLOATX='float64' RUN_PYLINT="true" TESTCMD="--durations=10 --cov-append"
31-
- PYTHON_VERSION=2.7 FLOATX='float64' TESTCMD="--durations=10 --cov-append"
32-
- PYTHON_VERSION=3.6 FLOATX='float64' TESTCMD="--durations=10 --cov-append"
33-
- PYTHON_VERSION=3.6 FLOATX='float64' TESTCMD="--durations=10 --cov-append"
34-
- PYTHON_VERSION=3.6 FLOATX='float64' BUILD_DOCS="true" TESTCMD="--durations=10 --cov-append"
35-
- PYTHON_VERSION=3.6 FLOATX='float64' TESTCMD="--durations=10 --cov-append pmlearn/tests/test_base.py"
25+
- PYTHON_VERSION=2.7 FLOATX='float32' RUN_PYLINT="true" TESTCMD="--durations=10 --cov-append pmlearn/tests/test_base.py pmlearn/linear_model/tests/test_base.py --ignore=pmlearn/linear_model/tests/test_logistic.py --ignore=pmlearn/gaussian_process/tests/test_gpr.py --ignore=pmlearn/mixture/tests/test_gaussian_mixture.py --ignore=pmlearn/mixture/tests/test_dirichlet_process.py --ignore=pmlearn/naive_bayes/tests/test_naive_bayes.py --ignore=pmlearn/neural_network/test_multilayer_perceptron.py"
26+
- PYTHON_VERSION=2.7 FLOATX='float64' RUN_PYLINT="true" TESTCMD="--durations=10 --cov-append pmlearn/tests/test_base.py pmlearn/linear_model/tests/test_base.py --ignore=pmlearn/linear_model/tests/test_logistic.py --ignore=pmlearn/gaussian_process/tests/test_gpr.py --ignore=pmlearn/mixture/tests/test_gaussian_mixture.py --ignore=pmlearn/mixture/tests/test_dirichlet_process.py --ignore=pmlearn/naive_bayes/tests/test_naive_bayes.py --ignore=pmlearn/neural_network/test_multilayer_perceptron.py"
27+
- PYTHON_VERSION=3.6 FLOATX='float64' RUN_PYLINT="true" TESTCMD="--durations=10 --cov-append pmlearn/tests/test_base.py pmlearn/linear_model/tests/test_base.py --ignore=pmlearn/linear_model/tests/test_logistic.py --ignore=pmlearn/gaussian_process/tests/test_gpr.py --ignore=pmlearn/mixture/tests/test_gaussian_mixture.py --ignore=pmlearn/mixture/tests/test_dirichlet_process.py --ignore=pmlearn/naive_bayes/tests/test_naive_bayes.py --ignore=pmlearn/neural_network/test_multilayer_perceptron.py"
28+
- PYTHON_VERSION=3.6 FLOATX='float64' RUN_PYLINT="true" TESTCMD="--durations=10 --cov-append pmlearn/tests/test_base.py pmlearn/linear_model/tests/test_base.py --ignore=pmlearn/linear_model/tests/test_logistic.py --ignore=pmlearn/gaussian_process/tests/test_gpr.py --ignore=pmlearn/mixture/tests/test_gaussian_mixture.py --ignore=pmlearn/mixture/tests/test_dirichlet_process.py --ignore=pmlearn/naive_bayes/tests/test_naive_bayes.py --ignore=pmlearn/neural_network/test_multilayer_perceptron.py"
3629

3730
script:
3831
- . ./scripts/test.sh $TESTCMD

‎pmlearn/base.py

Copy file name to clipboardExpand all lines: pmlearn/base.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from sklearn.base import BaseEstimator
1313
from sklearn.base import RegressorMixin, ClassifierMixin, DensityMixin
1414

15-
from .exceptions import PymcLearnError
15+
from .exceptions import NotFittedError
1616

1717

1818
class BayesianModel(BaseEstimator):
@@ -64,7 +64,7 @@ def _inference(self, inference_type='advi', inference_args=None):
6464
elif inference_type == 'nuts':
6565
self._nuts_inference(inference_args)
6666
else:
67-
raise PymcLearnError('{} is not a supported type'
67+
raise NotFittedError('{} is not a supported type'
6868
' of inference'.format(inference_type))
6969

7070
def _advi_inference(self, inference_args):
@@ -185,7 +185,7 @@ def plot_elbo(self):
185185
Plot the ELBO values after running ADVI minibatch.
186186
"""
187187
if self.inference_type != 'advi':
188-
raise PymcLearnError(
188+
raise NotFittedError(
189189
'This method should only be called after calling fit with '
190190
'ADVI minibatch.'
191191
)
@@ -266,7 +266,7 @@ def predict(self, X, return_std=False):
266266
"""
267267

268268
if self.trace is None:
269-
raise PymcLearnError('Run fit on the model before predict.')
269+
raise NotFittedError('Run fit on the model before predict.')
270270

271271
num_samples = X.shape[0]
272272

@@ -354,7 +354,7 @@ def predict_proba(self, X, return_std=False):
354354
"""
355355

356356
if self.trace is None:
357-
raise PymcLearnError('Run fit on the model before predict.')
357+
raise NotFittedError('Run fit on the model before predict.')
358358

359359
num_samples = X.shape[0]
360360

@@ -463,7 +463,7 @@ def predict_proba(self, X, return_std=False):
463463
"""
464464

465465
if self.trace is None:
466-
raise PymcLearnError('Run fit on the model before predict.')
466+
raise NotFittedError('Run fit on the model before predict.')
467467

468468
# num_samples = X.shape[0]
469469

‎pmlearn/exceptions.py

Copy file name to clipboardExpand all lines: pmlearn/exceptions.py
+1-6Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
classes used across pymc-learn.
55
"""
66

7-
__all__ = ['NotFittedError',
8-
'PymcLearnError']
7+
__all__ = ['NotFittedError']
98

109

1110
class NotFittedError(ValueError, AttributeError):
@@ -23,7 +22,3 @@ class NotFittedError(ValueError, AttributeError):
2322
... # doctest: +NORMALIZE_WHITESPACE +ELLIPSIS
2423
NotFittedError('This GaussianProcessRegressor instance is not fitted yet'.)
2524
"""
26-
27-
28-
class PymcLearnError(Exception):
29-
pass

‎pmlearn/gaussian_process/gpr.py

Copy file name to clipboardExpand all lines: pmlearn/gaussian_process/gpr.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import pymc3 as pm
99
import theano
1010

11-
from ..exceptions import PymcLearnError
11+
from ..exceptions import NotFittedError
1212
from ..base import BayesianModel, BayesianRegressorMixin
1313

1414
from .kernels import RBF
@@ -34,7 +34,7 @@ def predict(self, X, return_std=False):
3434
"""
3535

3636
if self.trace is None:
37-
raise PymcLearnError('Run fit on the model before predict.')
37+
raise NotFittedError('Run fit on the model before predict.')
3838

3939
num_samples = X.shape[0]
4040

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.