From 57e56bd93faac249375627f9a82b2ee297202964 Mon Sep 17 00:00:00 2001 From: Max Zwiessele Date: Wed, 29 Oct 2014 08:22:11 +0000 Subject: [PATCH] [pickling] load added to gpy, allows for easy loading of pickled models --- GPy/__init__.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/GPy/__init__.py b/GPy/__init__.py index 819f54bf..ceff68a0 100644 --- a/GPy/__init__.py +++ b/GPy/__init__.py @@ -25,3 +25,15 @@ from core.parameterization import Param, Parameterized, ObsAr @nottest def tests(): Tester(testing).test(verbose=10) + + +def load(file_path): + """ + Load a previously pickled model, using `m.pickle('path/to/file.pickle)' + + :param file_name: path/to/file.pickle + """ + import cPickle as pickle + with open(file_path, 'rb') as f: + m = pickle.load(f) + return m \ No newline at end of file