An error in training SPCE models

Hi everyone,

I was training SPCE models using an existing dataset and encountered the following error. The error does not always occur, most of the time, it works when I change the training set. It appears to happen after the coefficient calculation. What could be the possible causes?

---   Calculating the stochastic polynomial chaos expansion by regression...   ---
The construction of SPCE stopped at latent variable of type Gaussian with 
parameters [ 0.0 1.0 ] polynomial degree 5 and qNorm 1.00 for output variable 1
Final CV score: -1.807380e+02
---                        Calculation finished!                               ---
Error using uq_eval_univ_basis (line 46)
Index in position 1 exceeds array bounds. Index must not exceed 4.

Error in uq_PCE_eval_unipoly (line 33)
univ_p_val = uq_eval_univ_basis(U, BasisParameters);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_PCE_eval (line 84)
univ_p_val = uq_PCE_eval_unipoly(current_model, U(:,nonConstIdx));
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_eval_uq_metamodel (line 10)
        [varargout{1:nargout}] = uq_PCE_eval(current_model,X);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_evalModel (line 100)
    [varargout{1:nargout}]  = current_model.eval(current_model,varargin{:});
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_SPCE_LatentPCECoeff (line 42)
coefZ = uq_evalModel(PCECoef,X)';
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_SPCE_evalModelSampleMetrics (line 139)
        [coefZ,Zdegree] = uq_SPCE_LatentPCECoeff(mySPCE,X,oo);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_evalStochSimMetrics (line 6)
        metrics = uq_SPCE_evalModelSampleMetrics(module,X,Y,varargin);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_initialize_uq_metamodel (line 493)
        metrics=uq_evalStochSimMetrics(current_model,VSet.X,VSet.Y);
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_core_module/run_initialization_script (line 201)
                            initHandle(obj);
                            ^^^^^^^^^^^^^^^^
Error in uq_core_model/add_module (line 91)
                success = this.run_initialization_script(obj);
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error in uq_createModel (line 107)
eval(str);
^^^^^^^^^^

Hi @HZhang

Can you provide us with a minimal executable example to help us diagnose the problem?

Best regards
Styfen

Hi @styfen.schaer ,

Please see the following links for downloading the data and script. I also noticed that the error disappears when MetaOpts.ValidationSet is not specified.

SPCE_data_for_training.mat

SPCE_training_debug.m

Thank you very much for your help with this!

Best,

Hongzhou