From a8c05563d42dfd1240e53c55b09ac90b2d6a2ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=C3=B4nio=20C=C3=A2ndido?= Date: Fri, 16 Nov 2018 10:33:36 -0200 Subject: [PATCH] Improvements on hyperparam; Bugfix in mvfts --- pyFTS/hyperparam/GridSearch.py | 2 ++ pyFTS/models/multivariate/mvfts.py | 2 +- pyFTS/tests/hyperparam.py | 19 +++++++++++++++---- 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/pyFTS/hyperparam/GridSearch.py b/pyFTS/hyperparam/GridSearch.py index 45de215..5110f54 100644 --- a/pyFTS/hyperparam/GridSearch.py +++ b/pyFTS/hyperparam/GridSearch.py @@ -68,6 +68,8 @@ def process_jobs(jobs, datasetname, conn): record = (datasetname, 'GridSearch', 'WHOFTS', None, result['mf'], result['order'], result['partitioner'], result['npart'], result['alpha'], str(result['lags']), metric, metrics[metric]) + + print(record) hUtil.insert_hyperparam(record, conn) diff --git a/pyFTS/models/multivariate/mvfts.py b/pyFTS/models/multivariate/mvfts.py index 4522e92..cf3ac12 100644 --- a/pyFTS/models/multivariate/mvfts.py +++ b/pyFTS/models/multivariate/mvfts.py @@ -38,7 +38,7 @@ class MVFTS(fts.FTS): def apply_transformations(self, data, params=None, updateUoD=False, **kwargs): ndata = data.copy(deep=True) for var in self.explanatory_variables: - if self.uod_clip: + if self.uod_clip and var.partitioner.type == 'common': ndata[var.data_label] = np.clip(ndata[var.data_label].values, var.partitioner.min, var.partitioner.max) diff --git a/pyFTS/tests/hyperparam.py b/pyFTS/tests/hyperparam.py index de1eccc..4b897c3 100644 --- a/pyFTS/tests/hyperparam.py +++ b/pyFTS/tests/hyperparam.py @@ -4,13 +4,14 @@ from pyFTS.hyperparam import GridSearch def get_train_test(): from pyFTS.data import Malaysia - ds = Malaysia.get_data('temperature')[:2000] + ds = Malaysia.get_data('temperature')[:1000] # ds = pd.read_csv('Malaysia.csv',delimiter=',' )[['temperature']].values[:2000].flatten().tolist() - train = ds[:1000] - test = ds[1000:] + train = ds[:800] + test = ds[800:] return 'Malaysia.temperature', train, test +""" hyperparams = { 'order':[1, 2, 3], 'partitions': np.arange(10,100,3), @@ -19,8 +20,18 @@ hyperparams = { 'lags': np.arange(1,35,2), 'alpha': np.arange(.0, .5, .05) } +""" -nodes = ['192.168.0.106', '192.168.0.110'] #, '192.168.0.107'] +hyperparams = { + 'order':[3], #[1, 2], + 'partitions': np.arange(10,100,10), + 'partitioner': [1,2], + 'mf': [1] ,#, 2, 3, 4], + 'lags': np.arange(1, 10), + 'alpha': [.0, .3, .5] +} + +nodes = ['192.168.0.106', '192.168.0.110', '192.168.0.107'] ds, train, test = get_train_test()