From 7fd4ac6225f2fc4808a2fd3f8933a64064923e7f Mon Sep 17 00:00:00 2001 From: flatberg Date: Thu, 26 Jul 2007 18:32:27 +0000 Subject: [PATCH] pls opt fix --- fluents/lib/blmfuncs.py | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/fluents/lib/blmfuncs.py b/fluents/lib/blmfuncs.py index e26a672..33a5be8 100644 --- a/fluents/lib/blmfuncs.py +++ b/fluents/lib/blmfuncs.py @@ -426,7 +426,7 @@ class LPLS(Model): No ids matching """ if name not in self.model.keys(): - return + raise ValueError("There is no key named: %s in model" %name) DX, DY, DZ = self._dataset['X'], self._dataset['Y'], self._dataset['Z'] dim_name_0, dim_name_1 = DX.get_dim_name() dim_name_2, dim_name_3 = DY.get_dim_name() @@ -455,11 +455,17 @@ class LPLS(Model): 'tsqx' : [ids_1, zero_dim], 'tsqz' : [ids_4, zero_dim], 'K' : [ids_1, pc_ids], - 'rmsep' : [ids_3, pc_ids] + 'rmsep' : [ids_3, pc_ids], + 'Rx' : [ids_1, pc_ids], + 'Rz' : [ids_4, pc_ids] } - array = self.model[name] - M = Dataset(array, identifiers=match_ids[name], name=name) + try: + array = self.model[name] + ids = match_ids[name] + except: + raise ValueError("There are no identifers stored for: %s in model" %name) + M = Dataset(array, identifiers=ids, name=name) return M def get_out_plots(self, options): @@ -645,7 +651,10 @@ class PlsOptions(Options): 'strict', 'crot', 'cov_center'] return self._copy_from_list(opt_list) - + def validation_options(self): + opt_list = ['amax', 'n_sets', 'cv_val_method'] + return self._copy_from_list(opt_list) + def permutation_confidence(self): opt_list = ['q_pert_method', 'q_iter'] return self._copy_from_list(opt_list) @@ -663,17 +672,17 @@ class LplsOptions(Options): opt['engine'] = nipals_lpls opt['mode'] = 'normal' # how much info to calculate opt['amax'] = 10 - opt['aopt'] = 9 - opt['xz_alpha'] = .5 + opt['aopt'] = 4 + opt['xz_alpha'] = .6 opt['auto_aopt'] = False opt['center'] = True opt['center_mth'] = [2, 0, 1] opt['scale'] = 'scores' opt['calc_conf'] = True - opt['n_sets'] = 20 + opt['n_sets'] = 75 opt['strict'] = False opt['p_center'] = 'med' - opt['alpha'] = .3 + opt['alpha'] = .4 opt['cov_center'] = 'med' opt['crot'] = True @@ -695,11 +704,18 @@ class LplsOptions(Options): (blmplots.LineViewXc, 'Line view', True), (blmplots.PredictionErrorPlot, 'Residual Error', False), (blmplots.RMSEPPlot, 'RMSEP', False), - (blmplots.LplsHypoidCorrelationPlot, 'Hypoid corr.', False) + (blmplots.LplsHypoidCorrelationPlot, 'Hypoid corr.', False), + (blmplots.LplsXCorrelationPlot, 'X corr.', True), + (blmplots.LplsZCorrelationPlot, 'Z corr.', True) ] - opt['out_data'] = ['T','P', 'tsqx'] - opt['out_plots'] = [blmplots.PlsScorePlot,blmplots.LplsXLoadingPlot,blmplots.LplsZLoadingPlot, blmplots.LineViewXc] + opt['out_data'] = ['T','P', 'tsqx', 'tsqz', 'L','K'] + opt['out_plots'] = [blmplots.PlsScorePlot, + blmplots.LplsXLoadingPlot, + blmplots.LplsZLoadingPlot, + blmplots.LplsXCorrelationPlot, + blmplots.LplsZCorrelationPlot, + blmplots.LineViewXc] #opt['out_data'] = None