From b174b58b79403185615f74586569f661841df316 Mon Sep 17 00:00:00 2001 From: Neil Lawrence Date: Mon, 24 May 2021 09:19:45 +0100 Subject: [PATCH] Fix MPL_AVAILABLE error. --- GPy/examples/classification.py | 1 + GPy/examples/non_gaussian.py | 9 +++++++-- GPy/examples/regression.py | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/GPy/examples/classification.py b/GPy/examples/classification.py index 3f3eb447..1c5318e5 100644 --- a/GPy/examples/classification.py +++ b/GPy/examples/classification.py @@ -3,6 +3,7 @@ """ Gaussian Processes classification examples """ +MPL_AVAILABLE = True try: import matplotlib.pyplot as plt except ImportError: diff --git a/GPy/examples/non_gaussian.py b/GPy/examples/non_gaussian.py index c685c4db..a9ee34d9 100644 --- a/GPy/examples/non_gaussian.py +++ b/GPy/examples/non_gaussian.py @@ -3,8 +3,8 @@ import GPy import numpy as np -from GPy.util import datasets +MPL_AVAILABLE = True try: import matplotlib.pyplot as plt except ImportError: @@ -141,7 +141,12 @@ def boston_example(optimize=True, plot=True): optimizer = "bfgs" messages = 0 - data = datasets.boston_housing() + try: + import pods + except ImportError: + print("pods unavailable, see https://github.com/sods/ods for example datasets") + return + data = pods.datasets.boston_housing() degrees_freedoms = [3, 5, 8, 10] X = data["X"].copy() Y = data["Y"].copy() diff --git a/GPy/examples/regression.py b/GPy/examples/regression.py index fb1c9323..9c6b68ab 100644 --- a/GPy/examples/regression.py +++ b/GPy/examples/regression.py @@ -4,6 +4,7 @@ """ Gaussian Processes regression examples """ +MPL_AVAILABLE = True try: import matplotlib.pyplot as plt except ImportError: