├── .gitignore ├── ChangeLog.txt ├── License.txt ├── README-R.md ├── README.md ├── diag ├── Contents.m ├── License.txt ├── Readme.txt ├── acorr.m ├── acorr2.m ├── acorrtime.m ├── aucs.m ├── auct.m ├── cipsrf.m ├── cmpsrf.m ├── cpsrf.m ├── custats.m ├── cusum.m ├── derivativecheck.m ├── diag_install.m ├── ext_auc.m ├── gbinit.m ├── gbiter.m ├── geyer_icse.m ├── geyer_imse.m ├── gradcheck.m ├── hair.m ├── hcs.m ├── hct.m ├── hpdi.m ├── idis.m ├── ipsrf.m ├── kernel1.m ├── kernelp.m ├── kernels.m ├── ksstat.m ├── linuxCsource │ ├── bbprctile.c │ └── convert_for_win ├── mpsrf.m ├── ndhist.m ├── psrf.m ├── rsqr.m ├── score.m └── winCsource │ └── bbprctile.c ├── dist ├── Contents.m ├── License.txt ├── beta_cdf.m ├── beta_inv.m ├── beta_lpdf.m ├── beta_pdf.m ├── betarand.m ├── catrand.m ├── dir_lpdf.m ├── dir_pdf.m ├── dirrand.m ├── dist_install.m ├── exprand.m ├── gam_cdf.m ├── gam_lpdf.m ├── gam_pdf.m ├── gamrand.m ├── gamrand1.m ├── geo_lpdf.m ├── hammersley.m ├── intrand.m ├── invgam_lpdf.m ├── invgam_pdf.m ├── invgamrand.m ├── invgamrand1.m ├── invwishrand.m ├── laplace_lpdf.m ├── laplace_pdf.m ├── linuxCsource │ ├── ars.c │ ├── ars.h │ ├── binsgeq.c │ ├── binsgeq.h │ ├── cond_invgam_invgam1.c │ ├── convert_for_win │ ├── digamma1.c │ ├── dirrand.c │ ├── exprand.c │ ├── gamrand.c │ ├── gamrand1.c │ ├── invgamrand.c │ ├── invgamrand1.c │ ├── rand.c │ ├── rand.h │ ├── tanh_f.c │ └── trand.c ├── logn_lpdf.m ├── logt_lpdf.m ├── mnorm_lpdf.m ├── mnorm_pdf.m ├── nbin_cdf.m ├── nbin_inv.m ├── nbin_pdf.m ├── negbin_lpdf.m ├── negbin_pdf.m ├── negbinztr_lpdf.m ├── negbinztr_pdf.m ├── norm_cdf.m ├── norm_inv.m ├── norm_lpdf.m ├── norm_pdf.m ├── normltrand.m ├── normrtrand.m ├── normtrand.m ├── normtzrand.m ├── poiss_lpdf.m ├── poiss_pdf.m ├── prior_corrunif.m ├── prior_fixed.m ├── prior_gamma.m ├── prior_gaussian.m ├── prior_invgamma.m ├── prior_invt.m ├── prior_invunif.m ├── prior_laplace.m ├── prior_loggaussian.m ├── prior_loglogunif.m ├── prior_logt.m ├── prior_logunif.m ├── prior_sinvchi2.m ├── prior_sqinvgamma.m ├── prior_sqinvlogunif.m ├── prior_sqinvsinvchi2.m ├── prior_sqinvunif.m ├── prior_sqrtinvt.m ├── prior_sqrtinvunif.m ├── prior_sqrtt.m ├── prior_sqrtunif.m ├── prior_t.m ├── prior_unif.m ├── private │ ├── digamma1.mexaxp │ ├── digamma1.mexlx │ └── digamma1.mexsol ├── sinvchi2_lpdf.m ├── sinvchi2_pdf.m ├── sinvchi2rand.m ├── t_cdf.m ├── t_inv.m ├── t_lpdf.m ├── t_pdf.m ├── trand.m ├── unifrand.m ├── winCsource │ ├── ars.c │ ├── ars.h │ ├── binsgeq.c │ ├── binsgeq.h │ ├── cond_invgam_invgam1.c │ ├── digamma1.c │ ├── dirrand.c │ ├── exprand.c │ ├── gamrand.c │ ├── gamrand1.c │ ├── invgamrand.c │ ├── invgamrand1.c │ ├── rand.c │ ├── rand.h │ ├── tanh_f.c │ └── trand.c └── wishrand.m ├── doc ├── GPstuff-nodoi.bib ├── GPstuffManual.pdf ├── GPstuffManual.tex ├── ccd_integration.pdf ├── demo_lgcp_fig1.pdf ├── demo_lgcp_fig2.pdf ├── demo_lgpdens_fig1.pdf ├── demo_lgpdens_fig2.pdf ├── demo_monotonic2_fig1.pdf ├── demo_ppcsCov1.jpg ├── demo_ppcsCov2.pdf ├── demo_regression1_fig1.pdf ├── demo_regression1_fig3.pdf ├── demo_spatial1_fig1a.pdf ├── demo_spatial1_fig1b.pdf ├── grid_based_integration.pdf ├── hist1.pdf ├── hist2.pdf ├── is_integration.pdf ├── jmlr2e.sty ├── neal_data_pic1.pdf └── neal_data_pic2.pdf ├── gp ├── Contents.m ├── License.txt ├── cf_exp_to_ss.m ├── cf_matern32_to_ss.m ├── cf_matern52_to_ss.m ├── cf_periodic_to_ss.m ├── cf_prod_to_ss.m ├── cf_quasiperiodic_to_ss.m ├── cf_rq_to_ss.m ├── cf_se_to_ss.m ├── cf_sum_to_ss.m ├── demo_additive.m ├── demo_bayesoptimization1.m ├── demo_bayesoptimization2.m ├── demo_bayesoptimization3.m ├── demo_binomial1.m ├── demo_binomial2.m ├── demo_binomial_apc.m ├── demo_classific.m ├── demo_derivativeobs.m ├── demo_derivatives.m ├── demo_epinf.m ├── demo_hierprior.m ├── demo_hurdle.m ├── demo_improvemarginals.m ├── demo_improvemarginals2.m ├── demo_inputdependentnoise.m ├── demo_inputdependentweibull.m ├── demo_kalman1.m ├── demo_kalman2.m ├── demo_lgcp.m ├── demo_lgpdens.m ├── demo_loopred.m ├── demo_mcmc.m ├── demo_memorysave.m ├── demo_minimal.m ├── demo_modelassesment1.m ├── demo_modelassesment2.m ├── demo_monotonic.m ├── demo_monotonic2.m ├── demo_multiclass.m ├── demo_multiclass_nested_ep.m ├── demo_multinom.m ├── demo_multivariategp.m ├── demo_neuralnetcov.m ├── demo_passgp.m ├── demo_periodic.m ├── demo_quantilegp.m ├── demo_regression1.m ├── demo_regression_additive1.m ├── demo_regression_additive2.m ├── demo_regression_hier.m ├── demo_regression_meanf.m ├── demo_regression_ppcs.m ├── demo_regression_robust.m ├── demo_regression_sparse1.m ├── demo_regression_sparse2.m ├── demo_spatial1.m ├── demo_spatial2.m ├── demo_survival_aft.m ├── demo_survival_coxph.m ├── demo_svi_classific.m ├── demo_svi_regression.m ├── demo_ziloggaussian.m ├── demo_zinegbin.m ├── demodata │ ├── USprec1.txt │ ├── USprec2.txt │ ├── binodata.txt │ ├── broffit.txt │ ├── cdata.txt │ ├── coal.txt │ ├── dat.1 │ ├── drowning.txt │ ├── enso.txt │ ├── faithful.txt │ ├── galaxy.txt │ ├── leukemia.txt │ ├── maunaloa_data.txt │ ├── odata.txt │ ├── predpreydata.txt │ ├── rats.mat │ ├── redwoodfull.txt │ ├── samples_marginal.mat │ ├── spatial1.txt │ ├── spatial2.txt │ ├── synth.tr │ └── synth.ts ├── esls.m ├── expectedimprovement_eg.m ├── expectedvariance_eg.m ├── expm2.m ├── gp_avpredcomp.m ├── gp_cov.m ├── gp_cpred.m ├── gp_dcov.m ├── gp_dic.m ├── gp_dtrcov.m ├── gp_e.m ├── gp_eg.m ├── gp_g.m ├── gp_ia.m ├── gp_install.m ├── gp_jpred.m ├── gp_kfcv.m ├── gp_kfcv_cdf.m ├── gp_kfcve.m ├── gp_looe.m ├── gp_looeg.m ├── gp_loog.m ├── gp_loopred.m ├── gp_mc.m ├── gp_monotonic.m ├── gp_optim.m ├── gp_pak.m ├── gp_peff.m ├── gp_plot.m ├── gp_pred.m ├── gp_predcdf.m ├── gp_predcm.m ├── gp_predprctmu.m ├── gp_predprcty.m ├── gp_rnd.m ├── gp_set.m ├── gp_trcov.m ├── gp_trvar.m ├── gp_unpak.m ├── gp_waic.m ├── gpcf_additive.m ├── gpcf_cat.m ├── gpcf_constant.m ├── gpcf_covar.m ├── gpcf_exp.m ├── gpcf_linear.m ├── gpcf_linearLogistic.m ├── gpcf_linearMichelismenten.m ├── gpcf_mask.m ├── gpcf_matern32.m ├── gpcf_matern52.m ├── gpcf_neuralnetwork.m ├── gpcf_noise.m ├── gpcf_periodic.m ├── gpcf_ppcs0.m ├── gpcf_ppcs1.m ├── gpcf_ppcs2.m ├── gpcf_ppcs3.m ├── gpcf_prod.m ├── gpcf_rq.m ├── gpcf_scaled.m ├── gpcf_sexp.m ├── gpcf_squared.m ├── gpcf_sum.m ├── gpep_e.m ├── gpep_g.m ├── gpep_jpred.m ├── gpep_looe.m ├── gpep_loog.m ├── gpep_loopred.m ├── gpep_pred.m ├── gpep_predgrad.m ├── gpia_jpred.m ├── gpia_jpreds.m ├── gpia_loopred.m ├── gpia_pak.m ├── gpia_pred.m ├── gpia_unpak.m ├── gpla_e.m ├── gpla_g.m ├── gpla_jpred.m ├── gpla_looe.m ├── gpla_loopred.m ├── gpla_pred.m ├── gpmc_jpred.m ├── gpmc_jpreds.m ├── gpmc_loopred.m ├── gpmc_loopreds.m ├── gpmc_pak.m ├── gpmc_pred.m ├── gpmc_preds.m ├── gpmc_unpak.m ├── gpmf_constant.m ├── gpmf_linear.m ├── gpmf_squared.m ├── gpsvi_e.m ├── gpsvi_g.m ├── gpsvi_pred.m ├── gpsvi_predgrad.m ├── lgcp.m ├── lgpdens.m ├── lgpdens_cum.m ├── lik_binomial.m ├── lik_coxph.m ├── lik_epgaussian.m ├── lik_gaussian.m ├── lik_gaussiansmt.m ├── lik_inputdependentnoise.m ├── lik_inputdependentweibull.m ├── lik_laplace.m ├── lik_lgp.m ├── lik_lgpc.m ├── lik_liks.m ├── lik_loggaussian.m ├── lik_logit.m ├── lik_loglogistic.m ├── lik_multinom.m ├── lik_multinomprobit.m ├── lik_negbin.m ├── lik_negbinztr.m ├── lik_poisson.m ├── lik_probit.m ├── lik_qgp.m ├── lik_softmax.m ├── lik_t.m ├── lik_weibull.m ├── lik_ziloggaussian.m ├── lik_zinegbin.m ├── linuxCsource │ ├── convert_for_win │ ├── dist_euclidean.c │ ├── ldlrowmodify.c │ ├── ldlrowupdate.c │ ├── spinv.c │ └── trcov.c ├── metric_distancematrix.m ├── metric_euclidean.m ├── passgp.m ├── pred_coxph.m ├── pred_coxphhs.m ├── pred_coxphp.m ├── private │ ├── dist_euclidean.m │ ├── gp_finddeltadist.m │ ├── gp_looprep.m │ ├── hash_sha512.m │ ├── ldlrowmodify.m │ ├── mean_gf.m │ ├── mean_jpredf.m │ ├── mean_predf.m │ ├── mean_prep.m │ ├── mvm_fft.m │ ├── mvm_kron.m │ ├── quad_moments.m │ ├── spinv.m │ └── trcov.m ├── scaled_hmc.m ├── scaled_mh.m ├── ss_balance.m ├── surrogate_sls.m ├── svigp.m └── winCsource │ ├── dist_euclidean.c │ ├── ldlrowmodify.c │ ├── ldlrowupdate.c │ ├── spinv.c │ └── trcov.c ├── matlab_install.m ├── mc ├── Contents.m ├── License.txt ├── batchmc.m ├── bbmean.m ├── bbprctile.m ├── gibbs.m ├── hmc2.m ├── hmc2_opt.m ├── hmc_nuts.m ├── join.m ├── linuxCsource │ ├── ars.c │ ├── ars.h │ ├── bbmean.c │ ├── binsgeq.c │ ├── binsgeq.h │ ├── convert_for_win │ ├── resampdet.c │ ├── resampres.c │ ├── resampsim.c │ └── resampstr.c ├── mc_install.m ├── metrop2.m ├── metrop2_opt.m ├── private │ └── nchooseks.m ├── randpick.m ├── resampdet.m ├── resampres.m ├── resampsim.m ├── resampstr.m ├── resampwor.m ├── sls.m ├── sls1mm.m ├── sls1mm_opt.m ├── sls_opt.m ├── take_nth.m ├── thin.m └── winCsource │ ├── ars.c │ ├── ars.h │ ├── bbmean.c │ ├── binsgeq.c │ ├── binsgeq.h │ ├── resampdet.c │ ├── resampres.c │ ├── resampsim.c │ └── resampstr.c ├── misc ├── Contents.m ├── License.txt ├── addlogs.m ├── binsgeq.m ├── cvit.m ├── denormdata.m ├── gpdfitnew.m ├── gpstuff_version.m ├── hmean.m ├── logit.m ├── logitinv.m ├── m2kml.m ├── mapcolor.m ├── mapcolor2.m ├── mapcolor_log.m ├── normdata.m ├── psislw.m ├── set_PIC.m ├── setrandstream.m ├── softmax2.m ├── str2fun.m ├── sumlogs.m ├── violinplot.m ├── wmean.m └── wprctile.m ├── optim ├── Contents.m ├── License.txt ├── bsearch.m ├── bsearch_opt.m ├── fminlbfgs.m ├── fminscg.m ├── fsearch.m ├── fsearch_opt.m ├── scg2.m ├── scg2_opt.m ├── scges.m └── scges_opt.m ├── startup.m └── tests ├── Readme.txt ├── realValues ├── bayesoptimization1.mat ├── bayesoptimization2.mat ├── bayesoptimization3.mat ├── binomial1.mat ├── binomial1.txt ├── binomial1_fig1.fig ├── binomial1_fig2.fig ├── binomial1_fig3.fig ├── binomial2.mat ├── binomial2.txt ├── binomial2_fig1.fig ├── binomial_apc.mat ├── binomial_apc.txt ├── binomial_apc_fig1.fig ├── binomial_apc_fig2.fig ├── classific.mat ├── classific.txt ├── classific_fig1.fig ├── classific_fig2.fig ├── classific_fig3.fig ├── classific_fig4.fig ├── classific_fig5.fig ├── classific_fig6.fig ├── classific_fig7.fig ├── derivativeobs.mat ├── derivativeobs.txt ├── derivativeobs_fig1.fig ├── derivatives.mat ├── derivatives.txt ├── derivatives_fig1.fig ├── derivatives_fig2.fig ├── derivatives_fig3.fig ├── derivatives_fig4.fig ├── derivatives_fig5.fig ├── derivatives_fig6.fig ├── derivatives_fig7.fig ├── derivatives_fig8.fig ├── derivatives_fig9.fig ├── epinf.mat ├── epinf.txt ├── epinf_fig1.fig ├── epinf_fig2.fig ├── hierprior.mat ├── hierprior.txt ├── hierprior_fig1.fig ├── hurdle.mat ├── hurdle.txt ├── hurdle_fig1.fig ├── improvemarginals.mat ├── improvemarginals.txt ├── improvemarginals_fig1.fig ├── improvemarginals_fig2.fig ├── kalman1.mat ├── kalman1.txt ├── kalman1_fig1.fig ├── kalman1_fig2.fig ├── kalman2.mat ├── kalman2.txt ├── kalman2_fig1.fig ├── kalman2_fig2.fig ├── kalman2_fig3.fig ├── lgcp.mat ├── lgcp.txt ├── lgcp_fig1.fig ├── lgcp_fig2.fig ├── loopred.mat ├── loopred.txt ├── loopred_fig1.fig ├── loopred_fig2.fig ├── memorysave.txt ├── modelassesment1.mat ├── modelassesment1.txt ├── modelassesment2.mat ├── modelassesment2.txt ├── monotonic2.mat ├── monotonic2.txt ├── monotonic2_fig1.fig ├── multiclass.mat ├── multiclass.txt ├── multiclass_fig1.fig ├── multiclass_fig2.fig ├── multiclass_fig3.fig ├── multiclass_nested_ep.mat ├── multiclass_nested_ep.txt ├── multiclass_nested_ep_fig1.fig ├── multinom.mat ├── multinom.txt ├── multinom_fig1.fig ├── multinom_fig2.fig ├── multinom_fig3.fig ├── multivariategp.mat ├── multivariategp.txt ├── multivariategp_fig1.fig ├── multivariategp_fig2.fig ├── neuralnetcov.mat ├── neuralnetcov.txt ├── neuralnetcov_fig1.fig ├── neuralnetcov_fig2.fig ├── neuralnetcov_fig3.fig ├── neuralnetcov_fig4.fig ├── periodic.mat ├── periodic.txt ├── periodic_fig1.fig ├── periodic_fig2.fig ├── periodic_fig3.fig ├── periodic_fig4.fig ├── quantilegp.mat ├── quantilegp.txt ├── quantilegp_fig1.fig ├── regression1.mat ├── regression1.txt ├── regression1_fig1.fig ├── regression1_fig2.fig ├── regression1_fig3.fig ├── regression1_fig4.fig ├── regression_additive1.mat ├── regression_additive1.txt ├── regression_additive1_fig1.fig ├── regression_additive1_fig2.fig ├── regression_additive1_fig3.fig ├── regression_additive1_fig4.fig ├── regression_additive1_fig5.fig ├── regression_additive2.mat ├── regression_additive2.txt ├── regression_additive2_fig1.fig ├── regression_additive2_fig2.fig ├── regression_additive2_fig3.fig ├── regression_additive2_fig4.fig ├── regression_additive2_fig5.fig ├── regression_additive2_fig6.fig ├── regression_hier.mat ├── regression_hier.txt ├── regression_hier_fig1.fig ├── regression_hier_fig2.fig ├── regression_meanf.mat ├── regression_meanf.txt ├── regression_meanf_fig1.fig ├── regression_ppcs.mat ├── regression_ppcs.txt ├── regression_ppcs_fig1.fig ├── regression_ppcs_fig2.fig ├── regression_ppcs_fig3.fig ├── regression_robust.mat ├── regression_robust.txt ├── regression_robust_fig1.fig ├── regression_robust_fig2.fig ├── regression_robust_fig3.fig ├── regression_robust_fig4.fig ├── regression_robust_fig5.fig ├── regression_robust_fig6.fig ├── regression_robust_fig7.fig ├── regression_robust_fig8.fig ├── regression_sparse1.mat ├── regression_sparse1.txt ├── regression_sparse1_fig1.fig ├── regression_sparse1_fig2.fig ├── regression_sparse1_fig3.fig ├── regression_sparse1_fig4.fig ├── regression_sparse1_fig5.fig ├── regression_sparse2.mat ├── regression_sparse2.txt ├── regression_sparse2_fig1.fig ├── spatial1.mat ├── spatial1.txt ├── spatial1_fig1.fig ├── spatial1_fig2.fig ├── spatial1_fig3.fig ├── spatial1_fig4.fig ├── spatial1_fig5.fig ├── spatial1_fig6.fig ├── spatial1_fig7.fig ├── spatial2.mat ├── spatial2.txt ├── spatial2_fig1.fig ├── spatial2_fig2.fig ├── spatial2_fig3.fig ├── spatial2_fig4.fig ├── spatial2_fig5.fig ├── spatial2_fig6.fig ├── survival_aft.mat ├── survival_aft.txt ├── survival_aft_fig1.fig ├── survival_coxph.mat ├── survival_coxph.txt ├── survival_coxph_fig1.fig ├── svi_classific.mat ├── svi_classific.txt ├── svi_classific_fig1.fig ├── svi_regression.mat ├── svi_regression.txt ├── svi_regression_fig1.fig ├── svi_regression_fig2.fig ├── zinegbin.mat ├── zinegbin.txt ├── zinegbin_fig1.fig └── zinegbin_fig2.fig ├── rundemo.m ├── runtestset.m ├── test_bayesoptimization1.m ├── test_bayesoptimization2.m ├── test_bayesoptimization3.m ├── test_binomial1.m ├── test_binomial2.m ├── test_binomial_apc.m ├── test_classific.m ├── test_derivativeobs.m ├── test_derivatives.m ├── test_epinf.m ├── test_hierprior.m ├── test_hurdle.m ├── test_improvemarginals.m ├── test_kalman1.m ├── test_kalman2.m ├── test_lgcp.m ├── test_loopred.m ├── test_memorysave.m ├── test_modelassesment1.m ├── test_modelassesment2.m ├── test_monotonic2.m ├── test_multiclass.m ├── test_multiclass_nested_ep.m ├── test_multinom.m ├── test_multivariategp.m ├── test_neuralnetcov.m ├── test_periodic.m ├── test_quantilegp.m ├── test_regression1.m ├── test_regression_additive1.m ├── test_regression_additive2.m ├── test_regression_hier.m ├── test_regression_meanf.m ├── test_regression_ppcs.m ├── test_regression_robust.m ├── test_regression_sparse1.m ├── test_regression_sparse2.m ├── test_spatial1.m ├── test_spatial2.m ├── test_survival_aft.m ├── test_survival_coxph.m ├── test_svi_classific.m ├── test_svi_regression.m ├── test_zinegbin.m └── verifyVarsEqual.m /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | *.aux 3 | *.bbl 4 | *.blg 5 | *.toc 6 | *.tmp 7 | *.log 8 | *.nav 9 | *.snm 10 | auto 11 | _region_.* 12 | \#*\# 13 | SuiteSparse/ 14 | *.mexa64 15 | -------------------------------------------------------------------------------- /README-R.md: -------------------------------------------------------------------------------- 1 | Using GPstuff from R 2 | -------------------- 3 | 4 | GPstuff can be used from R by using RcppOctave package. RcppOctave 5 | allows to call any Octave functions and browse their documentation 6 | from R, and pass variables between R and Octave. 7 | 8 | See instructions at 9 | 10 | -------------------------------------------------------------------------------- /diag/Readme.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/Readme.txt -------------------------------------------------------------------------------- /diag/acorr.m: -------------------------------------------------------------------------------- 1 | function c = acorr(x,maxlag) 2 | %ACORR Estimate autocorrelation function of time series 3 | % 4 | % C = ACORR(X,MAXLAG) returns normalized autocorrelation 5 | % sequences for each column of X using 6 | % C(:,i)=XCORR(X(:,i)-MEAN(X(:,i)),MAXLAG,'coeff'), but returns only 7 | % lags 1:MAXLAG. Default MAXLAG = M-1; 8 | % 9 | % See also 10 | % XCORR 11 | % 12 | % Copyright (C) 2000 Aki Vehtari 13 | 14 | % This software is distributed under the GNU General Public 15 | % Licence (version 3 or later); please refer to the file 16 | % Licence.txt, included with the software, for details. 17 | 18 | if nargin < 1 19 | error('Not enough input arguments.'); 20 | end 21 | if nargin < 2 22 | maxlag=length(x)-1; 23 | end 24 | [m,n]=size(x); 25 | c=zeros(maxlag,n); 26 | for i1=1:n 27 | ct=xcorr(x(:,i1)-mean(x(:,i1)),maxlag,'coeff'); 28 | ct=ct(maxlag+2:end); 29 | c(:,i1)=ct; 30 | end 31 | -------------------------------------------------------------------------------- /diag/acorr2.m: -------------------------------------------------------------------------------- 1 | function c = acorr2(x,maxlag) 2 | %ACORR Estimate autocorrelation function of time series 3 | % 4 | % C = ACORR(X,MAXLAG) returns normalized autocorrelation 5 | % sequences for each column of X computing correlation via FFT 6 | % 7 | % Copyright (C) 2000-2008 Aki Vehtari 8 | % 9 | % This software is distributed under the GNU General Public 10 | % Licence (version 3 or later); please refer to the file 11 | % Licence.txt, included with the software, for details. 12 | 13 | if nargin < 1 14 | error('Not enough input arguments.'); 15 | end 16 | if nargin < 2 17 | maxlag=length(x)-1; 18 | end 19 | [m,n]=size(x); 20 | c=zeros(maxlag,n); 21 | for i1=1:n 22 | xn = x(:,i1)-mean(x(:,i1)); 23 | xf = fft(xn,2^nextpow2(2*m-1)); 24 | cf = ifft(abs(xf).^2); 25 | c(:,i1) = cf(2:(maxlag+1))./cf(1); 26 | end 27 | -------------------------------------------------------------------------------- /diag/aucs.m: -------------------------------------------------------------------------------- 1 | function [a,fps,tps] = aucs(crit,z) 2 | %AUCS Compute area under curve for survival model 3 | % 4 | % Description 5 | % A = AUCS(CRIT,Z) Compute are under curve for survival model 6 | % using criteria vector CRIT (where larger value means larger 7 | % risk of incidence) and censoring indicator column vector Z 8 | % (0=event, 1=censored). 9 | % 10 | % [A,FPS,TPS] = AUCS(CRIT,Z) Return also a vector of false 11 | % positive rates FPS and a vector of true positive rates TPS. 12 | % 13 | % Reference 14 | % L. E. Chambless, C. P. Cummiskey, and G. Cui (2011). Several 15 | % methods to assess improvement in risk prediction models: 16 | % Extension to survival analysis. Statistics in Medicine 17 | % 30(1):22-38. 18 | % 19 | % Copyright (C) 2012 Ernesto Ulloa, Aki Vehtari 20 | 21 | % This software is distributed under the GNU General Public 22 | % License (version 3 or later); please refer to the file 23 | % License.txt, included with the software, for details. 24 | 25 | ip=inputParser; 26 | ip.addRequired('crit',@(x) ~isempty(x) && isreal(x) && all(isfinite(x(:)))) 27 | ip.addRequired('z', @(x) isreal(x) && all(isfinite(x(:)))) 28 | ip.parse(crit,z) 29 | 30 | ye=z; 31 | tps=0; 32 | fps=0; 33 | qs=sort(crit,'descend'); 34 | 35 | for i2=1:numel(crit) 36 | tps(i2+1)=mean(crit>=qs(i2) & 1-ye)./mean(1-ye); 37 | fps(i2+1)=mean(crit>=qs(i2) & ye)./(mean(ye)); 38 | end 39 | 40 | if (mean(1-ye)==0)||(mean(ye)==0) 41 | warning('z vector has no different values, function will return 0'); 42 | a=0; 43 | else 44 | a=sum([diff(fps).*mean([tps(1:end-1);tps(2:end)],1)]); 45 | end 46 | 47 | end 48 | -------------------------------------------------------------------------------- /diag/auct.m: -------------------------------------------------------------------------------- 1 | function at = auct(crit,y,z,tt) 2 | %AUCT Compute area under curve for survival model at given time 3 | % 4 | % Description 5 | % A = AUCT(CRIT,Y,Z,TT) Compute are under curve for survival model 6 | % at given time using criteria vector CRIT (where larger value 7 | % means larger risk of incidence), observed time vector Y, 8 | % censoring indicator matrix Z at times TT (0=event, 1=censored) 9 | % and a time vector TT. 10 | % 11 | % Reference 12 | % L. E. Chambless, C. P. Cummiskey, and G. Cui (2011). Several 13 | % methods to assess improvement in risk prediction models: 14 | % Extension to survival analysis. Statistics in Medicine 15 | % 30(1):22-38. 16 | % 17 | % Copyright (C) 2012 Ernesto Ulloa, Aki Vehtari 18 | 19 | % This software is distributed under the GNU General Public 20 | % License (version 3 or later); please refer to the file 21 | % License.txt, included with the software, for details. 22 | 23 | ip=inputParser; 24 | ip.addRequired('crit',@(x) ~isempty(x) && isreal(x) && all(isfinite(x(:)))) 25 | ip.addRequired('y', @(x) isreal(x) && all(isfinite(x(:)))) 26 | ip.addRequired('z', @(x) isreal(x) && all(isfinite(x(:)))) 27 | ip.addRequired('tt', @(x) isreal(x) && all(isfinite(x(:)))) 28 | ip.parse(crit,y,z,tt) 29 | 30 | for i=1:size(tt,2) 31 | comp=bsxfun(@times,bsxfun(@and,y(:,i)<=tt(i),1-z(:,i)),bsxfun(@or,bsxfun(@and,y(:,i)<=tt(i),z(:,i)),y(:,i)>=tt(i))'); 32 | conc=bsxfun(@times,bsxfun(@gt,crit(:,i),crit(:,i)'),comp); 33 | at(i,1)=sum(conc(:))./sum(comp(:)); 34 | end 35 | 36 | end 37 | 38 | -------------------------------------------------------------------------------- /diag/cipsrf.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/cipsrf.m -------------------------------------------------------------------------------- /diag/cmpsrf.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/cmpsrf.m -------------------------------------------------------------------------------- /diag/cpsrf.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/cpsrf.m -------------------------------------------------------------------------------- /diag/custats.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/custats.m -------------------------------------------------------------------------------- /diag/cusum.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/cusum.m -------------------------------------------------------------------------------- /diag/diag_install.m: -------------------------------------------------------------------------------- 1 | function diag_install 2 | 3 | if ispc % A windows version of Matlab 4 | mex -O -output bbprctile winCsource\bbprctile.c 5 | else 6 | mex -O -output bbprctile linuxCsource/bbprctile.c 7 | end -------------------------------------------------------------------------------- /diag/gbinit.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/gbinit.m -------------------------------------------------------------------------------- /diag/gbiter.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/gbiter.m -------------------------------------------------------------------------------- /diag/hair.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/hair.m -------------------------------------------------------------------------------- /diag/hct.m: -------------------------------------------------------------------------------- 1 | function ct = hct(crit,y,z,tt) 2 | %HCT Compute Harrel's C for survival model at several time points 3 | % 4 | % Description 5 | % CT = HCT(CRIT,Y,Z,TT) Compute Harrel's C statistic estimate at 6 | % times TT using criteria vector CRIT (where larger value means 7 | % larger risk of incidence), observed time vector Y and event 8 | % indicator vector Z (0=event, 1=censored) 9 | % 10 | % Reference 11 | % L. E. Chambless, C. P. Cummiskey, and G. Cui (2011). Several 12 | % methods to assess improvement in risk prediction models: 13 | % Extension to survival analysis. Statistics in Medicine 14 | % 30(1):22-38. 15 | % 16 | % Copyright (C) 2012 Ernesto Ulloa, Aki Vehtari 17 | 18 | % This software is distributed under the GNU General Public 19 | % License (version 3 or later); please refer to the file 20 | % License.txt, included with the software, for details. 21 | 22 | ip=inputParser; 23 | ip.addRequired('crit',@(x) ~isempty(x) && isreal(x) && all(isfinite(x(:)))) 24 | ip.addRequired('y',@(x) ~isempty(x) && isreal(x)) 25 | ip.addRequired('z', @(x) ~isempty(x) && isreal(x)) 26 | ip.addRequired('tt', @(x) ~isempty(x) && isreal(x)) 27 | 28 | ip.parse(crit,y,z,tt) 29 | 30 | if size(y,2) ~= size(z,2) 31 | error('y and z dimensions must match') 32 | end 33 | 34 | for i=1:size(tt,2) 35 | comp=bsxfun(@and,bsxfun(@and,bsxfun(@lt,y(:,i),y(:,i)'),y(:,i)<=tt(i)),z(:,end)==0); 36 | conc=bsxfun(@gt,crit(:,i),crit(:,i)').*comp; 37 | ct(i,1)=sum(conc(:))./sum(comp(:)); 38 | end 39 | 40 | end 41 | 42 | -------------------------------------------------------------------------------- /diag/hpdi.m: -------------------------------------------------------------------------------- 1 | function hpdi = hpdi(x, p) 2 | % HPDI - Estimates the Bayesian HPD intervals 3 | % 4 | % Y = HPDI(X,P) returns a Highest Posterior Density (HPD) interval 5 | % for each column of X. P must be a scalar. Y is a 2 row matrix 6 | % where ith column is HPDI for ith column of X. 7 | 8 | % References: 9 | % [1] Chen, M.-H., Shao, Q.-M., and Ibrahim, J. Q., (2000). 10 | % Monte Carlo Methods in Bayesian Computation. Springer-Verlag. 11 | % 12 | % Copyright (C) 2001 Aki Vehtari 13 | 14 | % This software is distributed under the GNU General Public 15 | % Licence (version 3 or later); please refer to the file 16 | % Licence.txt, included with the software, for details. 17 | 18 | if nargin < 2 19 | error('Not enough arguments') 20 | end 21 | 22 | m=size(x,2); 23 | pts=linspace(0.1,99.9-p,20); 24 | pt1=prctile(x,pts); 25 | pt2=prctile(x,p+pts); 26 | cis=abs(pt2-pt1); 27 | [foo,hpdpi]=min(cis); 28 | if m==1 29 | hpdi=[pt1(hpdpi); pt2(hpdpi)]; 30 | else 31 | hpdpi=sub2ind(size(pt1),hpdpi,1:m); 32 | hpdi=[pt1(hpdpi); pt2(hpdpi)]; 33 | end 34 | -------------------------------------------------------------------------------- /diag/kernel1.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/kernel1.m -------------------------------------------------------------------------------- /diag/kernelp.m: -------------------------------------------------------------------------------- 1 | function [p,xx,sh]=kernelp(x,xx) 2 | %KERNELP 1D Kernel density estimation of data, with automatic kernel width 3 | % 4 | % [P,XX]=KERNELP(X,XX) return density estimates P in points XX, 5 | % given data and optionally evaluation points XX. Density 6 | % estimate is based on simple Gaussian kernel density estimate 7 | % where all kernels have equal width and this width is selected by 8 | % optimising plug-in partial predictive density. Works well with 9 | % reasonable sized X. 10 | % 11 | % Copyright (C) 2001-2003,2010 Aki Vehtari 12 | 13 | % This software is distributed under the GNU General Public 14 | % Licence (version 3 or later); please refer to the file 15 | % Licence.txt, included with the software, for details. 16 | 17 | if nargin < 1 18 | error('Too few arguments'); 19 | end 20 | [n,m]=size(x); 21 | if n>1 && m>1 22 | error('X must be a vector'); 23 | end 24 | x=x(:); 25 | [n,m]=size(x); 26 | 27 | xa=min(x);xb=max(x);xab=xb-xa; 28 | if nargin < 2 29 | nn=200; 30 | xa=xa-xab/20;xb=xb+xab/20; 31 | xx=linspace(xa,xb,nn); 32 | else 33 | [mm,nn]=size(xx); 34 | if nn>1 && mm>1 35 | error('XX must be a vector'); 36 | end 37 | end 38 | xx=xx(:); 39 | m=length(x)/2; 40 | rp=randperm(n); 41 | xd=bsxfun(@minus,x(rp(1:m)),x(rp(m+1:end))'); 42 | sh=fminbnd(@(s) err(s,xd),xab/n*4,xab,optimset('TolX',xab/n*4)); 43 | p=mean(normpdf(bsxfun(@minus,x(rp(1:m)),xx'),0,sh)); 44 | 45 | function e=err(s,xd) 46 | e=-sum(log(sum(normpdf(xd,0,s)))); 47 | 48 | function y = normpdf(x,mu,sigma) 49 | y = -0.5 * ((x-mu)./sigma).^2 -log(sigma) -log(2*pi)/2; 50 | y=exp(y); 51 | -------------------------------------------------------------------------------- /diag/kernels.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/kernels.m -------------------------------------------------------------------------------- /diag/linuxCsource/convert_for_win: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | mkdir ../winCsource 3 | cp *.c ../winCsource 4 | cd ../winCsource 5 | 6 | baddies=`grep -l '_(' *.c` 7 | 8 | echo "$baddies" 9 | for i in $baddies;do 10 | ed -s $i << EOF_INPUT 11 | 1,\$s/_(/(/g 12 | w 13 | q 14 | EOF_INPUT 15 | done 16 | -------------------------------------------------------------------------------- /diag/mpsrf.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/mpsrf.m -------------------------------------------------------------------------------- /diag/ndhist.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/ndhist.m -------------------------------------------------------------------------------- /diag/psrf.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/psrf.m -------------------------------------------------------------------------------- /diag/score.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/diag/score.m -------------------------------------------------------------------------------- /dist/beta_cdf.m: -------------------------------------------------------------------------------- 1 | function bcdf = beta_cdf (x, a, b) 2 | % BETA_CDF Beta cumulative distribution function. 3 | % P = BETA_CDF(X,A,B) returns the beta cumulative distribution 4 | % function with parameters A and B at the values in X. 5 | % 6 | % Copyright (c) 1995-1997, 2005-2007 Kurt Hornik 7 | 8 | % This software is distributed under the GNU General Public 9 | % License (version 3 or later); please refer to the file 10 | % License.txt, included with the software, for details. 11 | if (nargin ~= 3) 12 | error('must provide 3 parameters') 13 | end 14 | 15 | if (~isscalar (a) || ~isscalar(b)) 16 | if ((size(a,1) ~= size(b,1)) || (size(b,1) ~= size(x,1))) 17 | error ('betainv: x, a and b must be of common size or scalars'); 18 | end 19 | end 20 | 21 | [n,nin] = size(x); 22 | bcdf = zeros(n,nin); 23 | 24 | k = find ((a < 0) || (b < 0) || isnan (x)); 25 | if (any(k)) 26 | bcdf(k) = NaN; 27 | end 28 | 29 | k = find((x >= 1) && (a > 0) && (b > 0)); 30 | if (any(k)) 31 | bcdf(k) = 1; 32 | end 33 | 34 | k = find ((x > 0) && (x < 1) && (a > 0) && (b > 0)); 35 | if (any (k)) 36 | if (isscalar(a) && isscalar(b)) 37 | bcdf(k) = betainc(x(k), a, b); 38 | else 39 | bcdf(k) = betainc(x(k), a(k), b(k)); 40 | end 41 | end 42 | 43 | end -------------------------------------------------------------------------------- /dist/beta_lpdf.m: -------------------------------------------------------------------------------- 1 | function y = beta_lpdf(x,a,b) 2 | %BETA_LPDF Beta log-probability density function (lpdf). 3 | % 4 | % Y = BETA_LPDF(X,A,B) Returns the log of the Beta pdf with 5 | % parameters A and B, at the values in X. 6 | % 7 | % The size of Y is the common size of the input arguments. A scalar input 8 | % functions as a constant matrix of the same size as the other inputs. 9 | % 10 | % Default value for A and B is 1. 11 | % 12 | % Copyright (c) 2005 Aki Vehtari 13 | 14 | % This software is distributed under the GNU General Public 15 | % License (version 3 or later); please refer to the file 16 | % License.txt, included with the software, for details. 17 | 18 | if nargin < 3, 19 | a = 1; 20 | end 21 | 22 | if nargin < 2; 23 | b = 1; 24 | end 25 | 26 | if nargin < 1, 27 | error('Requires at least one input argument.'); 28 | end 29 | 30 | y= (a-1).*log(x) +(b-1).*log(1-x) -betaln(a,b); 31 | -------------------------------------------------------------------------------- /dist/beta_pdf.m: -------------------------------------------------------------------------------- 1 | function y = beta_pdf(x,a,b) 2 | %BETA_PDF Beta probability density function (pdf). 3 | % 4 | % Y = BETA_PDF(X,A,B) Returns the Beta pdf with 5 | % parameters A and B, at the values in X. 6 | % 7 | % The size of Y is the common size of the input arguments. A 8 | % scalar input functions as a constant matrix of the same size as 9 | % the other inputs. 10 | % 11 | % Default value for A and B is 1. 12 | % 13 | % Copyright (c) 2005 Aki Vehtari 14 | 15 | % This software is distributed under the GNU General Public 16 | % License (version 3 or later); please refer to the file 17 | % License.txt, included with the software, for details. 18 | 19 | if nargin < 3, 20 | a = 1; 21 | end 22 | 23 | if nargin < 2; 24 | b = 1; 25 | end 26 | 27 | if nargin < 1, 28 | error('Requires at least one input argument.'); 29 | end 30 | 31 | y=exp((a-1).*log(x) +(b-1).*log(1-x) -betaln(a,b)); 32 | -------------------------------------------------------------------------------- /dist/catrand.m: -------------------------------------------------------------------------------- 1 | function r = catrand(p, m, n); 2 | %CATRAND Random matrices from categorical distribution. 3 | % 4 | % Description 5 | % R = CATRAND(P) returns a matrix of random numbers chosen from 6 | % the categorical distribution with parameter P. P is array of 7 | % probabilities, which are not necessarily normalized, though 8 | % they must be non-negative, and not all zero. The size of R 9 | % is the size of P. 10 | % 11 | % R = CATRAND(P,M,N) returns an M by N matrix. 12 | % 13 | % Copyright (c) 1999-2004 Aki Vehtari 14 | 15 | % This software is distributed under the GNU General Public 16 | % License (version 3 or later); please refer to the file 17 | % License.txt, included with the software, for details. 18 | 19 | 20 | p=p(:); 21 | pc=cumsum(p); 22 | pc=pc./pc(end); 23 | if nargin < 2 24 | m=1;n=1; 25 | elseif nargin <3 26 | n=m; 27 | end 28 | r=binsgeq(pc,rand(m,n)); 29 | -------------------------------------------------------------------------------- /dist/dir_lpdf.m: -------------------------------------------------------------------------------- 1 | function lp=dir_lpdf(x,a) 2 | %DIR_LPDF Log probability density function of uniform Dirichlet 3 | % distribution 4 | % 5 | % Description: 6 | % LP = DIR_LPDF(X, A) returns the lpdf of Dirichlet distribution 7 | % with A at X 8 | % 9 | % Copyright (c) 2000 Aki Vehtari 10 | 11 | % This software is distributed under the GNU General Public 12 | % License (version 3 or later); please refer to the file 13 | % License.txt, included with the software, for details. 14 | 15 | 16 | lp=gammaln(sum(a))-sum(gammaln)+sum(log(x).^(a-1)); 17 | -------------------------------------------------------------------------------- /dist/dir_pdf.m: -------------------------------------------------------------------------------- 1 | function p=dir_pdf(x,a) 2 | %DIR_PDF Probability density function of uniform Dirichlet 3 | % distribution 4 | % 5 | % Description: 6 | % P = DIR_PDF(X, A) returns the pdf of Dirichlet distribution 7 | % with A at X 8 | % 9 | % Copyright (c) 2000 Aki Vehtari 10 | 11 | % This software is distributed under the GNU General Public 12 | % License (version 3 or later); please refer to the file 13 | % License.txt, included with the software, for details. 14 | 15 | 16 | p=exp(gammaln(sum(a))-sum(gammaln)+sum(log(x).^(a-1))); 17 | -------------------------------------------------------------------------------- /dist/dirrand.m: -------------------------------------------------------------------------------- 1 | function r = dirrand(m,n) 2 | % DIRRAND - Uniform Dirichlet random vectors 3 | % 4 | % R = DIRRAND(M) returns vector of length M chosen from 5 | % Dirichlet(1,...,1) distribution. 6 | % R = DIRRAND(M,N) returns N such vectors in MxN matrix. 7 | % 8 | % References: Gelman, Carlin, Stern, Dunson, Vehtari & Rubin (2013), 9 | % Bayesian Data Analysis, third edition, p. 583. 10 | % 11 | % Copyright (c) 1998-2004 Aki Vehtari 12 | 13 | % This software is distributed under the GNU General Public 14 | % License (version 3 or later); please refer to the file 15 | % License.txt, included with the software, for details. 16 | 17 | if nargin < 2 18 | n=1; 19 | end 20 | 21 | % Generate random numbers from Gamma(1,1) distribution... 22 | r=rand(m,n); 23 | r=-reallog(r); 24 | % ...and scale sum to unity 25 | rs=sum(r); 26 | for i1=1:m 27 | r(i1,:)=r(i1,:)./rs; 28 | end 29 | -------------------------------------------------------------------------------- /dist/dist_install.m: -------------------------------------------------------------------------------- 1 | function dist_install 2 | 3 | if ispc % A windows version of Matlab 4 | mex -O -output cond_invgam_invgam1 winCsource\cond_invgam_invgam1.c winCsource\ars.c winCsource\rand.c 5 | mex -O -output digamma1 winCsource\digamma1.c 6 | mex -O -output dirrand winCsource\dirrand.c 7 | mex -O -output exprand winCsource\exprand.c 8 | mex -O -output gamrand winCsource\gamrand.c winCsource\rand.c 9 | mex -O -output gamrand1 winCsource\gamrand1.c winCsource\rand.c 10 | mex -O -output invgamrand winCsource\invgamrand.c winCsource\rand.c 11 | mex -O -output invgamrand1 winCsource\invgamrand1.c winCsource\rand.c 12 | mex -O -output tanh_f winCsource\tanh_f.c 13 | mex -O -output trand winCsource\trand.c winCsource\rand.c 14 | else 15 | mex -O -output cond_invgam_invgam1 linuxCsource/cond_invgam_invgam1.c linuxCsource/ars.c linuxCsource/rand.c; 16 | mex -O -output digamma1 linuxCsource/digamma1.c; 17 | mex -O -output dirrand linuxCsource/dirrand.c; 18 | mex -O -output exprand linuxCsource/exprand.c; 19 | mex -O -output gamrand linuxCsource/gamrand.c linuxCsource/rand.c; 20 | mex -O -output gamrand1 linuxCsource/gamrand1.c linuxCsource/rand.c; 21 | mex -O -output invgamrand linuxCsource/invgamrand.c linuxCsource/rand.c; 22 | mex -O -output invgamrand1 linuxCsource/invgamrand1.c linuxCsource/rand.c; 23 | mex -O -output tanh_f linuxCsource/tanh_f.c; 24 | mex -O -output trand linuxCsource/trand.c linuxCsource/rand.c; 25 | end 26 | -------------------------------------------------------------------------------- /dist/exprand.m: -------------------------------------------------------------------------------- 1 | function r = exprand(mu,m,n) 2 | % EXPRAND Random matrices from exponential distribution. 3 | % 4 | % R = EXPRAND(MU) returns a matrix of random numbers chosen 5 | % from the exponential distribution with parameter MU. 6 | % The size of R is the size of MU. 7 | % Alternatively, R = EXPRAND(MU,M,N) returns an M by N matrix. 8 | % 9 | % Copyright (c) 1998-2004 Aki Vehtari 10 | 11 | % This software is distributed under the GNU General Public 12 | % License (version 3 or later); please refer to the file 13 | % License.txt, included with the software, for details. 14 | 15 | error('No mex-file for this architecture. See Matlab help and convert.m in ./linuxCsource or ./winCsource for help.') 16 | -------------------------------------------------------------------------------- /dist/gam_cdf.m: -------------------------------------------------------------------------------- 1 | function p = gam_cdf(x,a,b) 2 | %GAM_CDF Cumulative of Gamma probability density function (cdf). 3 | % 4 | % P = GAM_CDF(X,A,B) Returns the gamma cdf with 5 | % shape A and inverse scale B, at the values in X. 6 | % 7 | % The size of X is the common size of the input arguments. A 8 | % scalar input functions as a constant matrix of the same size as 9 | % the other inputs. 10 | % 11 | % The parameterization is as in Gelman, Carlin, Stern, Dunson, Vehtari, 12 | % and Rubin (2013). Bayesian Data Analysis, third edition. 13 | % 14 | % Copyright (c) 1998-2004 Aki Vehtari 15 | 16 | % This software is distributed under the GNU General Public 17 | % License (version 3 or later); please refer to the file 18 | % License.txt, included with the software, for details. 19 | 20 | if nargin < 3, 21 | error('Requires three input arguments.'); 22 | end 23 | 24 | p=gammainc(b*x,a); 25 | -------------------------------------------------------------------------------- /dist/gam_lpdf.m: -------------------------------------------------------------------------------- 1 | function y = gam_lpdf(x,a,b) 2 | %GAM_LPDF Log of Gamma probability density function (lpdf). 3 | % 4 | % Y = GAM_LPDF(X,A,B) Returns the gamma lpdf with 5 | % shape A and inverse scale B, at the values in X. 6 | % 7 | % The size of X is the common size of the input arguments. A 8 | % scalar input functions as a constant matrix of the same size as 9 | % the other inputs. 10 | % 11 | % The parameterization is as in Gelman, Carlin, Stern, Dunson, Vehtari, 12 | % and Rubin (2013). Bayesian Data Analysis, third edition. 13 | % 14 | % Copyright (c) 1998-2004 Aki Vehtari 15 | 16 | % This software is distributed under the GNU General Public 17 | % License (version 3 or later); please refer to the file 18 | % License.txt, included with the software, for details. 19 | 20 | if nargin < 3, 21 | error('Requires three input arguments.'); 22 | end 23 | 24 | %y = b.^a/gamma(a)*x^(a-1)*exp(-b*x); 25 | y = a.*log(b)-gammaln(a)+(a-1).*log(x)-b.*x; 26 | -------------------------------------------------------------------------------- /dist/gam_pdf.m: -------------------------------------------------------------------------------- 1 | function y = gam_pdf(x,s2,nu) 2 | %GAM_PDF Gamma probability density function (pdf). 3 | % 4 | % Y = GAM_PDF(X,S2,NU) Returns the gamma pdf with 5 | % X ~ Gamma(s2, nu), where s2 is the shape and nu the inverse scale. 6 | % 7 | % The size of X is the common size of the input arguments. A 8 | % scalar input functions as a constant matrix of the same size as 9 | % the other inputs. 10 | % 11 | % The parameterization is as in Gelman, Carlin, Stern, Dunson, Vehtari, 12 | % and Rubin (2013). Bayesian Data Analysis, third edition. 13 | % 14 | % Copyright (c) 1998-2004 Aki Vehtari 15 | 16 | % This software is distributed under the GNU General Public 17 | % License (version 3 or later); please refer to the file 18 | % License.txt, included with the software, for details. 19 | 20 | if nargin < 3, 21 | error('Requires three input arguments.'); 22 | end 23 | 24 | %y = b.^a/gamma(a)*x^(a-1)*exp(-b*x); 25 | y = exp(s2.*log(nu)-gammaln(s2)+(s2-1).*log(x)-nu.*x); 26 | -------------------------------------------------------------------------------- /dist/gamrand.m: -------------------------------------------------------------------------------- 1 | function r = gamrand(a, b, varargin); 2 | %GAMRAND Random matrices from gamma distribution. 3 | % 4 | % R = GAMRAND(A,B) returns a matrix of random numbers chosen 5 | % from the gamma distribution with parameters A and B. 6 | % The size of R is the common size of A and B if both are matrices. 7 | % If either parameter is a scalar, the size of R is the size of the other 8 | % parameter. Alternatively, R = GAMRAND(A,B,M,N) returns an M by N matrix. 9 | % 10 | % Note: Parameterization as in (Neal, 1996). 11 | % A is mean of the distribution 12 | % B is degrees of freedom 13 | % 14 | % See also INVGAMRAND 15 | % 16 | % Copyright (c) 1999 Aki Vehtari 17 | 18 | 19 | % This software is distributed under the GNU General Public 20 | % License (version 3 or later); please refer to the file 21 | % License.txt, included with the software, for details. 22 | 23 | error('No mex-file for this architecture. See Matlab help and convert.m in ./linuxCsource or ./winCsource for help.') 24 | -------------------------------------------------------------------------------- /dist/gamrand1.m: -------------------------------------------------------------------------------- 1 | function R = gamrand1(A, B) 2 | %GAMRAND1 Random matrices from gamma distribution. 3 | % 4 | % R = GAMRAND1(A,B) returns a matrix of random numbers chosen 5 | % from the gamma distribution with parameters A and B. 6 | % Both parameters have to be scalar. 7 | % 8 | % Note: Parameterization as in (Neal, 1996). 9 | % A is mean of the distribution 10 | % B is degrees of freedom 11 | % 12 | % See also INVGAMRAND 13 | % 14 | % Copyright (c) 1999 Aki Vehtari 15 | 16 | % This software is distributed under the GNU General Public 17 | % License (version 3 or later); please refer to the file 18 | % License.txt, included with the software, for details. 19 | 20 | error('No mex-file for this architecture. See Matlab help and convert.m in ./linuxCsource or ./winCsource for help.') 21 | -------------------------------------------------------------------------------- /dist/geo_lpdf.m: -------------------------------------------------------------------------------- 1 | function y = geo_lpdf(x,p) 2 | %GEO_LPDF Geometric log probability density function (lpdf). 3 | % Y = GEO_LPDF(X,P) returns the log of geometric pdf with probability, P, 4 | % at the values in X. 5 | % 6 | % The size of Y is the common size of X and P. A scalar input 7 | % functions as a constant matrix of the same size as the other input. 8 | % 9 | % Copyright (c) 1999-2000 Aki Vehtari 10 | 11 | % This software is distributed under the GNU General Public 12 | % License (version 3 or later); please refer to the file 13 | % License.txt, included with the software, for details. 14 | 15 | y = log(p) + log(1-p) * x; 16 | -------------------------------------------------------------------------------- /dist/hammersley.m: -------------------------------------------------------------------------------- 1 | function S = hammersley(D,N) 2 | % HAMMERSLEY - Hammersley quasi-random sequence 3 | % 4 | % S = HAMMERSLEY(D,N) Generates N numbers from a D-dimensional 5 | % Hammersley quasirandom sequence using successive primes 6 | % as bases except for the last dimension which has the form 7 | % [1:N]'/N-1/2/N (where the last term modifies usual Hammersley 8 | % sequence to produce sequence in open interval (0,1)). The 9 | % matrix S is of size DxN. 10 | % 11 | % Copyright (c) 2008 Aki Vehtari 12 | 13 | % This software is distributed under the GNU General Public 14 | % Licence (version 3 or later); please refer to the file 15 | % Licence.txt, included with the software, for details. 16 | 17 | S=zeros(N,D); 18 | % Last column is easy 19 | S(:,D)=([1:N]'/N)-1/(2*N); 20 | % Matlab's PRIMES returns primes smaller than given value, 21 | % but we need D-1 primes 22 | pn=2*D; 23 | p=primes(pn); 24 | while(numel(p)1 40 | n=n-1; 41 | bj=floor(bj/pk); 42 | b(n)=rem(bj,pk); 43 | end 44 | S(j,k)=sum(fliplr(b)./pk.^[1:numel(b)]); 45 | end 46 | end 47 | 48 | S = S'; -------------------------------------------------------------------------------- /dist/intrand.m: -------------------------------------------------------------------------------- 1 | function r = intrand(p, m, n); 2 | %INTRAND Random matrices from uniform integer distribution. 3 | % 4 | % R = INTRAND(P) returns a matrix of random numbers chosen 5 | % from the uniform integer distribution with parameter P. The 6 | % minimum and maximum output integer numbers are P(1) and P(2). 7 | % R = INTRAND(P,M,N) returns an M by N matrix. 8 | % 9 | % 10 | % Copyright (c) 2000 Aki Vehtari 11 | 12 | % This software is distributed under the GNU General Public 13 | % License (version 3 or later); please refer to the file 14 | % License.txt, included with the software, for details. 15 | 16 | 17 | if nargin < 1 | any(size([p(:)])~=[2 1]) 18 | error('Incorrect range assignment in INTRAND'); 19 | end 20 | if p(1) 4 | * of length for a first element which is greater than or equal 5 | * to a key . If no greater element is found, returns . 6 | */ 7 | 8 | 9 | /* Copyright (c) 1998-2004 Aki Vehtari 10 | * 11 | *This software is distributed under the GNU General Public 12 | *License (version 3 or later); please refer to the file 13 | *License.txt, included with the software, for details. 14 | * 15 | */ 16 | 17 | double binsgeq(double *vec, int len, double item) 18 | { 19 | int low=0, high=len-1, mid; 20 | if (item<=vec[0]) { 21 | return 1.0; 22 | } 23 | while ((high-low) > 1) { 24 | mid=(high+low)/2; 25 | if (item>vec[mid]) 26 | low = mid; 27 | else 28 | high = mid; 29 | } 30 | return high+1.0; 31 | } 32 | -------------------------------------------------------------------------------- /dist/linuxCsource/binsgeq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998-2004 Aki Vehtari 2 | * 3 | *This software is distributed under the GNU General Public 4 | *License (version 3 or later); please refer to the file 5 | *License.txt, included with the software, for details. 6 | * 7 | */ 8 | 9 | double binsgeq(double *, int, double); 10 | -------------------------------------------------------------------------------- /dist/linuxCsource/convert_for_win: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir ../winCsource 4 | cp *.c ../winCsource 5 | cp *.h ../winCsource 6 | cd ../winCsource 7 | 8 | baddies=`grep -l '_(' *.c` 9 | 10 | echo "$baddies" 11 | for i in $baddies;do 12 | ed -s $i << EOF_INPUT 13 | 1,\$s/_(/(/g 14 | w 15 | q 16 | EOF_INPUT 17 | done 18 | -------------------------------------------------------------------------------- /dist/linuxCsource/gamrand1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * GAMRAND1 Random matrices from gamma distribution. 3 | * 4 | * R = GAMRAND1(A,B) returns a matrix of random numbers chosen 5 | * from the gamma distribution with parameters A and B. 6 | * The size of R is the common size of A and B if both are matrices. 7 | * If either parameter is a scalar, the size of R is the size of the other 8 | * parameter. Alternatively, R = GAMRAND(A,B,M,N) returns an M by N matrix. 9 | * 10 | * Note: Parameterization as in (Neal, 1996). 11 | * A is mean of the distribution 12 | * B is degrees of freedom 13 | * 14 | * 15 | * Last modified: 2000-05-31 12:16:57 EEST 16 | * 17 | */ 18 | 19 | /* Copyright (C) 1998-2000 Aki Vehtari 20 | * 21 | *This software is distributed under the GNU General Public 22 | *License (version 2 or later); please refer to the file 23 | *License.txt, included with the software, for details. 24 | * 25 | */ 26 | 27 | #include 28 | #include "mex.h" 29 | #include "rand.h" 30 | 31 | void mexFunction(const int nlhs_, mxArray *plhs_[], 32 | const int nrhs_, const mxArray *prhs_[]) 33 | { 34 | if (nrhs_ != 2 ) 35 | mexErrMsgTxt( "Wrong number of input arguments." ); 36 | 37 | if (nlhs_ > 1 ) 38 | mexErrMsgTxt( "Too many output arguments." ); 39 | 40 | { 41 | double a, b; 42 | a=mxGetScalar(prhs_[0]); 43 | b=mxGetScalar(prhs_[1]); 44 | 45 | plhs_[0]=mxCreateDoubleMatrix(1,1,mxREAL); 46 | *mxGetPr(plhs_[0]) = 47 | rand_gamma(b/2)*2*a/b; 48 | } 49 | return; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /dist/linuxCsource/invgamrand1.c: -------------------------------------------------------------------------------- 1 | /*INVGAMRAND1 Random matrices from inverse gamma distribution 2 | * 3 | * R = INVGAMRAND1(A,B) returns a matrix of random numbers chosen 4 | * from the inverse gamma distribution with parameters A and B. 5 | * The size of R is the common size of A and B if both are matrices. 6 | * If either parameter is a scalar, the size of R is the size of the other 7 | * parameter. Alternatively, R = GAMRND(A,B,M,N) returns an M by N matrix. 8 | * 9 | * Note: Parameterization as in (Neal, 1996). 10 | * A is mean of the distribution 11 | * B is degrees of freedom 12 | * 13 | * Last modified: 2000-05-31 12:06:08 EEST 14 | * 15 | */ 16 | 17 | /* Copyright (C) 1998-2000 Aki Vehtari 18 | * 19 | *This software is distributed under the GNU General Public 20 | *License (version 3 or later); please refer to the file 21 | *License.txt, included with the software, for details. 22 | * 23 | */ 24 | 25 | #include 26 | #include "mex.h" 27 | #include "rand.h" 28 | 29 | void mexFunction(const int nlhs_, mxArray *plhs_[], 30 | const int nrhs_, const mxArray *prhs_[]) 31 | { 32 | if (nrhs_ != 2 ) 33 | mexErrMsgTxt( "Wrong number of input arguments." ); 34 | 35 | if (nlhs_ > 1 ) 36 | mexErrMsgTxt( "Too many output arguments." ); 37 | 38 | { 39 | double a, b; 40 | a=mxGetScalar(prhs_[0]); 41 | b=mxGetScalar(prhs_[1]); 42 | 43 | plhs_[0]=mxCreateDoubleMatrix(1,1,mxREAL); 44 | *mxGetPr(plhs_[0]) = 45 | a*b/2/rand_gamma(b/2); 46 | 47 | } 48 | return; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /dist/linuxCsource/rand.h: -------------------------------------------------------------------------------- 1 | /* RAND.H - Interface to random number generation procedures. */ 2 | 3 | 4 | /* Copyright (c) 1995-2003 by Radford M. Neal 5 | * 6 | * Permission is granted for anyone to copy, use, modify, or distribute this 7 | * program and accompanying programs and documents for any purpose, provided 8 | * this copyright notice is retained and prominently displayed, along with 9 | * a note saying that the original programs are available from Radford Neal's 10 | * web page, and note is made of any changes made to the programs. The 11 | * programs and documents are distributed without any warranty, express or 12 | * implied. As the programs were written for research purposes only, they have 13 | * not been tested to the degree that would be advisable in any important 14 | * application. All use of these programs is entirely at the user's own risk. 15 | */ 16 | 17 | /* GENERATORS FOR VARIOUS DISTRIBUTIONS. */ 18 | 19 | double rand_uniform (void); /* Uniform from [0,1) */ 20 | double rand_uniopen (void); /* Uniform from (0,1) */ 21 | 22 | int rand_int (int); /* Uniform from 0, 1, ... (n-1) */ 23 | int rand_pickd (double *, int); /* From 0 ... (n-1), with given distribution */ 24 | int rand_pickf (float *, int); /* Same as above, but with floats */ 25 | 26 | double rand_gaussian (void); /* Gaussian with mean zero and unit variance */ 27 | double rand_exp (void); /* Exponential with mean one */ 28 | double rand_cauchy (void); /* Cauchy centred at zero with unit width */ 29 | double rand_gamma (double); /* Gamma with given shape parameter */ 30 | double rand_beta (double, double); /* Beta with given parameters */ 31 | -------------------------------------------------------------------------------- /dist/linuxCsource/tanh_f.c: -------------------------------------------------------------------------------- 1 | /* 2 | * TANH 75 % faster hyperbolic tangent. 3 | * TANH(X) is the hyperbolic tangent of the elements of X. 4 | * 5 | */ 6 | 7 | /* (c) 1998-2001 Aki Vehtari 8 | * 9 | *This software is distributed under the GNU General Public 10 | *License (version 3 or later); please refer to the file 11 | *License.txt, included with the software, for details. 12 | * 13 | */ 14 | 15 | #include "mex.h" 16 | #include 17 | 18 | void mexFunction(int nlhs, mxArray *plhs[], 19 | int nrhs, const mxArray *prhs[]) 20 | { 21 | double *x, *y, xa; 22 | const int *dims; 23 | int len, i; 24 | 25 | dims = mxGetDimensions(prhs[0]); 26 | len = dims[0]*dims[1]; 27 | plhs[0] = mxCreateDoubleMatrix(dims[0], dims[1], mxREAL); 28 | x = mxGetPr(prhs[0]); 29 | y = mxGetPr(plhs[0]); 30 | 31 | for (i = len; i > 0; i--, x++, y++) { 32 | xa=fabs(*x); 33 | *y = (xa > 18) ? (*x>0 ? 1.0 : -1.0) 34 | : ((xa > 1.5e-8) ? 1.0-2.0/(exp(2.0**x)+1.0) : *x); 35 | } 36 | 37 | return; 38 | } 39 | -------------------------------------------------------------------------------- /dist/logn_lpdf.m: -------------------------------------------------------------------------------- 1 | function y = logn_lpdf(x,mu,sigma) 2 | %LOGNPDF Lognormal log-probability density function (lpdf). 3 | % 4 | % Y = LOGN_LPDF(X,MU,SIGMA) Returns the log of the lognormal pdf at 5 | % the values in X. The mean and standard deviation of log(Y) are 6 | % MU and SIGMA. 7 | % 8 | % The size of Y is the common size of the input arguments. A scalar input 9 | % functions as a constant matrix of the same size as the other inputs. 10 | % 11 | % Default values for MU and SIGMA are 0 and 1 respectively. 12 | % 13 | % Copyright (c) 2000 Aki Vehtari 14 | 15 | % This software is distributed under the GNU General Public 16 | % License (version 3 or later); please refer to the file 17 | % License.txt, included with the software, for details. 18 | 19 | y = -0.5 * ((log(x) - mu)./sigma).^2 - log(x .* sqrt(2*pi) .* sigma); 20 | -------------------------------------------------------------------------------- /dist/logt_lpdf.m: -------------------------------------------------------------------------------- 1 | function y = logt_lpdf(x,v,mu,sigma) 2 | %LOGT_LPDF Log probability density function (lpdf) for log Student's T 3 | % 4 | % distribution Y = LOGT_LPDF(X,V,MU,SIGMA) returns the lpdf of 5 | % log Student's T distribution with degrees of freedom, V, mean, MU 6 | % and standard deviation, SIGMA, at the values in X. 7 | % 8 | % The size of Y is the common size of the input arguments. A scalar input 9 | % functions as a constant matrix of the same size as the other inputs. 10 | % 11 | % Default values for MU and SIGMA are 0 and 1 respectively. 12 | % 13 | % References: 14 | % [1] E. Kreyszig, "Introductory Mathematical Statistics", 15 | % John Wiley, New York, 1970, Section 10.3, pages 144-146. 16 | % 17 | % Copyright (c) 1998-2004 Aki Vehtari 18 | 19 | % This software is distributed under the GNU General Public 20 | % License (version 3 or later); please refer to the file 21 | % License.txt, included with the software, for details. 22 | 23 | if nargin < 4, 24 | sigma = 1; 25 | end 26 | 27 | if nargin < 3; 28 | mu = 0; 29 | end 30 | 31 | if nargin < 2, 32 | error('Requires at least two input arguments.'); 33 | end 34 | 35 | term = gammaln((v + 1) / 2) - gammaln(v/2) -log(x.*sqrt(v*pi)); 36 | y = bsxfun(@minus,term,log(sigma .* (1 + (((log(x)-mu)./sigma) .^ 2) ./ v) .^ ((v+1)/2))); 37 | -------------------------------------------------------------------------------- /dist/mnorm_lpdf.m: -------------------------------------------------------------------------------- 1 | function y = mnorm_lpdf(x,mu,S) 2 | %MNORM_LPDF Multivariate-Normal log-probability density function (lpdf). 3 | % 4 | % Description 5 | % Y = MNORM_LPDF(X,MU,S) Returns the log of the multivariate-normal 6 | % pdf with mean, MU, and covariance matrix, S, at the values in X. 7 | % 8 | % Default values for MU and S are 0 and 1 respectively. 9 | % 10 | % Copyright (c) 1998-2004 Aki Vehtari 11 | 12 | % This software is distributed under the GNU General Public 13 | % License (version 3 or later); please refer to the file 14 | % License.txt, included with the software, for details. 15 | 16 | if nargin < 3, 17 | S = 1; 18 | end 19 | 20 | if nargin < 2; 21 | mu = 0; 22 | end 23 | 24 | if nargin < 1, 25 | error('Requires at least one input argument.'); 26 | end 27 | 28 | [n,m]=size(x); 29 | xmu=bsxfun(@minus,x,mu); 30 | if ~issparse(S) 31 | % Use Cholesky decomposition, since it is faster and 32 | % numerically more stable. 33 | L=chol(S,'lower'); 34 | b=L\xmu'; 35 | y=-sum(b.^2,1)'; 36 | y=(.5*y-sum(log(diag(L)))-.5*m*log(2*pi)); 37 | else 38 | LD = ldlchol(S); 39 | y=zeros(n,1); 40 | for i1=1:n 41 | xmui1=xmu(i1,:)'; 42 | y(i1)=-xmui1'*ldlsolve(LD,xmui1); 43 | end 44 | y=(0.5*(y-sum(log(diag(LD)))-m*log(2*pi))); 45 | end 46 | -------------------------------------------------------------------------------- /dist/mnorm_pdf.m: -------------------------------------------------------------------------------- 1 | function y = mnorm_pdf(x,mu,S) 2 | %MNORM_PDF Multivariate-Normal probability density function (pdf). 3 | % 4 | % Description 5 | % Y = MNORM_PDF(X,MU,SIGMA) Returns the multivariate-normal 6 | % pdf with mean, MU, and covariance matrix, SIGMA, at the values in X. 7 | % 8 | % Default values for MU and SIGMA are 0 and 1 respectively. 9 | % 10 | % Copyright (c) 1998-2005 Aki Vehtari 11 | 12 | % This software is distributed under the GNU General Public 13 | % License (version 3 or later); please refer to the file 14 | % License.txt, included with the software, for details. 15 | 16 | if nargin < 3, 17 | S = 1; 18 | end 19 | 20 | if nargin < 2; 21 | mu = 0; 22 | end 23 | 24 | if nargin < 1, 25 | error('Requires at least one input argument.'); 26 | end 27 | 28 | [n,m]=size(x); 29 | xmu=x-repmat(mu,n,1); 30 | if ~issparse(S) 31 | % Use Cholesky decomposition, since it is faster and 32 | % numerically more stable. 33 | L=chol(S,'lower'); 34 | y=zeros(n,1); 35 | for i1=1:n 36 | b=L\xmu(i1,:)'; 37 | y(i1)=-b'*b; 38 | end 39 | y=exp(.5*y-sum(log(diag(L)))-.5*m*log(2*pi)); 40 | else 41 | LD = ldlchol(S); 42 | y=zeros(n,1); 43 | for i1=1:n 44 | xmui1=xmu(i1,:)'; 45 | y(i1)=-xmui1'*ldlsolve(LD,xmui1); 46 | end 47 | y=exp(0.5*(y-sum(log(diag(LD)))-m*log(2*pi))); 48 | end 49 | -------------------------------------------------------------------------------- /dist/nbin_pdf.m: -------------------------------------------------------------------------------- 1 | function pdf = nbin_pdf (x, r, p) 2 | %NBIN_PDF Negative binomial probability density function (pdf). 3 | % 4 | % Y = NBIN_PDF(X,R,P) Returns the Negative binomial pdf with 5 | % parameters R and P, at the values in X. 6 | % 7 | % The size of Y is the common size of the input arguments. A 8 | % scalar input functions as a constant matrix of the same size as 9 | % the other inputs. 10 | % 11 | % Copyright (c) 1995-1997,2007 Kurt Hornik 12 | 13 | % This software is distributed under the GNU General Public 14 | % License (version 3 or later); please refer to the file 15 | % License.txt, included with the software, for details. 16 | % p=1-p 17 | if (nargin ~= 3) 18 | error('3 parameters must be provided'); 19 | end 20 | 21 | if (~isscalar(r) || ~isscalar(p)) 22 | if ((size(x,1) ~= size(r,1)) || (size(r,1) ~= size(p,1))) 23 | error ('nbinpdf: x, r and p must be of common size or scalar'); 24 | end 25 | end 26 | 27 | pdf = zeros (size (x)); 28 | 29 | k = find (isnan (x) | (r < 1) | isinf(r) | (p < 0) | (p > 1)); 30 | if (any (k)) 31 | pdf(k) = NaN; 32 | end 33 | 34 | % Just for the fun of it ... 35 | k = find (isinf(x) & (r > 0) & (r < Inf) & (p == 0)); 36 | if (any (k)) 37 | pdf(k) = 1; 38 | end 39 | 40 | k = find ((x >= 0) & (x < Inf) & (x == round (x)) & (r > 0) & (r < Inf) & (p > 0) & (p <= 1)); 41 | if (any (k)) 42 | if (isscalar (r) && isscalar (p)) 43 | pdf(k) = p^r.*gamma(r+x(k))./(gamma(r).*gamma(x(k)+1)) .* (1-p).^x(k); 44 | % pdf(k) = bincoeff (-n, x(k)) .* (p ^ n) .* ((p - 1) .^ x(k)); 45 | else 46 | pdf(k) = p(k).^r(k).*gamma(r(k)+x(k))./(gamma(r(k)).*gamma(x(k)+1)) .* (1-p(k)).^x(k); 47 | % pdf(k) = bincoeff (-n(k), x(k)) .* (p(k) .^ n(k)) .* ((p(k) - 1) .^ x(k)); 48 | end 49 | end 50 | 51 | end -------------------------------------------------------------------------------- /dist/negbin_pdf.m: -------------------------------------------------------------------------------- 1 | function y = negbin_pdf(x,l,r) 2 | %NEGBIN_PDF Negative binomial probability density function 3 | % 4 | % Description 5 | % Y = NEGBIN_PDF(X,L,R) returns the Negative binomial 6 | % probability density function with location parameter L and 7 | % dispersion parameter R (0= 0 & x == round(x) & l > 0); 26 | if (any(k)) 27 | y(k) = -l(k) +x(k).*log(l(k)) -gammaln(x(k)+1); 28 | end 29 | -------------------------------------------------------------------------------- /dist/poiss_pdf.m: -------------------------------------------------------------------------------- 1 | function y = poiss_pdf(x,l) 2 | %POISS_PDF Poisson probability density function. 3 | % 4 | % Description 5 | % Y = POISS_PDF(X,L) returns the Poisson probability density 6 | % function with location parameter L at the values in X. 7 | % 8 | % The size of Y is the common size of X and L. A scalar input 9 | % functions as a constant matrix of the same size as the other input. 10 | % 11 | % Note that the density function is zero unless X is an integer. 12 | % 13 | % See also POISS_LPDF 14 | % 15 | % Copyright (c) 1998-2004 Aki Vehtari 16 | 17 | % This software is distributed under the GNU General Public 18 | % License (version 3 or later); please refer to the file 19 | % License.txt, included with the software, for details. 20 | 21 | y=exp(poiss_lpdf(x,l)); 22 | -------------------------------------------------------------------------------- /dist/prior_fixed.m: -------------------------------------------------------------------------------- 1 | function p = prior_fixed(varargin) 2 | %PRIOR_UNIF Fix parameter to its current value. Do no infer it. 3 | % 4 | % Description 5 | % P = PRIOR_FIXED returns an empty [], which used as instead of 6 | % a prior structure keeps a parameter fixed to its current 7 | % value. 8 | % 9 | % See also 10 | % PRIOR_*, GPCF_*, LIKELIH_* 11 | % 12 | % Copyright (c) 2010 Aki Vehtari 13 | 14 | % This software is distributed under the GNU General Public 15 | % License (version 3 or later); please refer to the file 16 | % License.txt, included with the software, for details. 17 | 18 | p=[]; 19 | 20 | end 21 | -------------------------------------------------------------------------------- /dist/prior_unif.m: -------------------------------------------------------------------------------- 1 | function p = prior_unif(varargin) 2 | %PRIOR_UNIF Uniform prior structure 3 | % 4 | % Description 5 | % P = PRIOR_UNIF creates uniform prior structure. 6 | % 7 | % See also 8 | % PRIOR_* 9 | % 10 | % Copyright (c) 2009 Jarno Vanhatalo 11 | % Copyright (c) 2010 Aki Vehtari 12 | 13 | % This software is distributed under the GNU General Public 14 | % License (version 3 or later); please refer to the file 15 | % License.txt, included with the software, for details. 16 | 17 | ip=inputParser; 18 | ip.FunctionName = 'PRIOR_UNIFORM'; 19 | ip.addOptional('p', [], @isstruct); 20 | ip.parse(varargin{:}); 21 | p=ip.Results.p; 22 | 23 | if isempty(p) 24 | init=true; 25 | p.type = 'Uniform'; 26 | else 27 | if ~isfield(p,'type') && ~isequal(p.type,'Uniform') 28 | error('First argument does not seem to be a valid prior structure') 29 | end 30 | init=false; 31 | end 32 | 33 | if init 34 | % set functions 35 | p.fh.pak = @prior_unif_pak; 36 | p.fh.unpak = @prior_unif_unpak; 37 | p.fh.lp = @prior_unif_lp; 38 | p.fh.lpg = @prior_unif_lpg; 39 | p.fh.recappend = @prior_unif_recappend; 40 | end 41 | 42 | end 43 | 44 | function [w, s, h] = prior_unif_pak(p, w) 45 | w=[]; 46 | s={}; 47 | h=[]; 48 | end 49 | 50 | function [p, w] = prior_unif_unpak(p, w) 51 | w = w; 52 | p = p; 53 | end 54 | 55 | function lp = prior_unif_lp(x, p) 56 | lp = 0; 57 | end 58 | 59 | function lpg = prior_unif_lpg(x, p) 60 | lpg = zeros(size(x)); 61 | end 62 | 63 | function rec = prior_unif_recappend(rec, ri, p) 64 | % The parameters are not sampled in any case. 65 | rec = rec; 66 | end 67 | 68 | -------------------------------------------------------------------------------- /dist/private/digamma1.mexaxp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/dist/private/digamma1.mexaxp -------------------------------------------------------------------------------- /dist/private/digamma1.mexlx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/dist/private/digamma1.mexlx -------------------------------------------------------------------------------- /dist/private/digamma1.mexsol: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/dist/private/digamma1.mexsol -------------------------------------------------------------------------------- /dist/sinvchi2_lpdf.m: -------------------------------------------------------------------------------- 1 | function y = sinvchi2_lpdf(x,nu,s2) 2 | %SINVCHI2_LPDF Scaled log inverse-chi probability density function. 3 | % 4 | % Description: 5 | % Y = SINVCHI2_LPDF(X,NU,S2) returns the scaled log inverse-chi2 probability 6 | % density function with parameters NU and S2, at the values in X. 7 | % 8 | % The parameterization is as in Gelman, Carlin, Stern, Dunson, Vehtari, 9 | % and Rubin (2013). Bayesian Data Analysis, third edition. 10 | % NU is degrees of freedom 11 | % S2 is scale 12 | % 13 | % Copyright (c) 2003 Aki Vehtari 14 | 15 | % This software is distributed under the GNU General Public 16 | % License (version 3 or later); please refer to the file 17 | % License.txt, included with the software, for details. 18 | 19 | if nargin < 2, 20 | error('Requires at least two input arguments.'); 21 | end 22 | 23 | y = log(nu/2).*(nu/2) -gammaln(nu/2) + log(s2)/2*nu - log(x).*(nu/2+1) -nu.*s2/2./x; 24 | 25 | -------------------------------------------------------------------------------- /dist/sinvchi2_pdf.m: -------------------------------------------------------------------------------- 1 | function y = sinvchi2_pdf(x,nu,s2) 2 | %SINVCHI2_PDF Scaled inverse-chi probability density function. 3 | % Y = SINVCHI2_PDF(X,NU,S2) returns the scaled inverse-chi2 probability 4 | % density function with parameters NU and S2, at the values in X. 5 | % 6 | % The parameterization is as in Gelman, Carlin, Stern, Dunson, Vehtari, 7 | % and Rubin (2013). Bayesian Data Analysis, third edition. 8 | % NU is degrees of freedom 9 | % S2 is scale 10 | % 11 | % Copyright (c) 2003 Aki Vehtari 12 | 13 | % This software is distributed under the GNU General Public 14 | % License (version 3 or later); please refer to the file 15 | % License.txt, included with the software, for details. 16 | 17 | if nargin < 2, 18 | error('Requires at least two input arguments.'); 19 | end 20 | 21 | y = log(nu/2).*(nu/2) -gammaln(nu/2) + log(s2)/2*nu - log(x).*(nu/2+1) -nu.*s2/2./x; 22 | y=exp(y); 23 | -------------------------------------------------------------------------------- /dist/sinvchi2rand.m: -------------------------------------------------------------------------------- 1 | function r = sinvchi2rand(nu, s2, M, N) 2 | % SINVCHI2RAND Random matrices from scaled inverse-chi distribution 3 | % 4 | % R = SINVCHI2RAND(NU, S2) 5 | % R = SINVCHI2RAND(NU, S2, M, N) 6 | % 7 | % Returns a randon number/matrix R from scaled inverse-chi square 8 | % distribution. Nu is the degrees of freedom and S2 is the scale 9 | % squared. 10 | % 11 | % The parameterization is as in Gelman, Carlin, Stern, Dunson, Vehtari, 12 | % and Rubin (2013). Bayesian Data Analysis, third edition. 13 | % 14 | % Copyright (c) 1998-2004 Aki Vehtari 15 | 16 | % This software is distributed under the GNU General Public 17 | % License (version 3 or later); please refer to the file 18 | % License.txt, included with the software, for details. 19 | 20 | if nargin < 2 21 | error('Too few arguments'); 22 | end 23 | if nargin==2 24 | [M,N]=size(s2); 25 | else 26 | if numel(s2)>1 || numel(nu)>1 27 | error('Arguments M and N can only be used if nu and s2 are scalars'); 28 | end 29 | if nargin < 4 30 | N=1; 31 | end 32 | end 33 | r=nu.*s2./chi2rnd(nu,M,N); 34 | -------------------------------------------------------------------------------- /dist/t_cdf.m: -------------------------------------------------------------------------------- 1 | function tcdf = t_cdf (x, v, mu, sigma) 2 | %T_CDF Student's t cumulative distribution function (cdf). 3 | % 4 | % Y = T_CDF(X,V,MU,SIGMA) Returns the Student's t pdf with 5 | % V degrees of freedom, MU mean and SIGMA standard deviation at X. 6 | % 7 | % The size of Y is the common size of the input arguments. A scalar input 8 | % functions as a constant matrix of the same size as the other inputs. 9 | % 10 | % Default values for MU and SIGMA are 0 and 1 respectively. 11 | % 12 | % Copyright (c) 1995-1997, 2005-2007 Kurt Hornik 13 | 14 | % This software is distributed under the GNU General Public 15 | % Licence (version 3 or later); please refer to the file 16 | % Licence.txt, included with the software, for details. 17 | 18 | if nargin < 4 19 | sigma = 1; 20 | end 21 | if nargin < 3 22 | mu = 0; 23 | end 24 | if (~isscalar(mu) || ~isscalar(sigma)) 25 | if ~((size(x,1) == size(mu,1)) && (size(mu,1) == size(sigma,1))) 26 | error ('norm_inv: x, mu and sigma must be of common size or scalars'); 27 | end 28 | end 29 | 30 | x = (x-mu)./sigma; 31 | 32 | if ~isscalar(v) 33 | if (size(v,1) ~= size(x,1)) 34 | error('tcdf: x and v must be of common size or scalar'); 35 | end 36 | end 37 | 38 | tcdf = zeros(size (x)); 39 | 40 | k = find(isnan (x) | (v < 0)); 41 | if (any (k)) 42 | tcdf(k) = NaN; 43 | end 44 | 45 | k = find ((x == Inf) & (v > 0)); 46 | if (any (k)) 47 | cdf(k) = 1; 48 | end 49 | 50 | k = find ((x > -Inf) & (x < Inf) & (v > 0)); 51 | if (any (k)) 52 | if (isscalar (v)) 53 | tcdf(k) = betainc(1./(1+x(k).^2./v),v/2,1/2)/2; 54 | else 55 | tcdf(k) = betainc(1./(1+x(k).^2./v(k)),v(k)/2,1/2)/2; 56 | end 57 | ind = find (x(k) > 0); 58 | if (any (ind)) 59 | tcdf(k(ind)) = 1 - tcdf(k(ind)); 60 | end 61 | end 62 | 63 | end -------------------------------------------------------------------------------- /dist/t_lpdf.m: -------------------------------------------------------------------------------- 1 | function y = t_lpdf(x,v,mu,sigma) 2 | % T_LPDF Log probability density function (lpdf) for Student's T distribution 3 | % 4 | % Y = T_LPDF(X,V,MU,SIGMA) returns the lpdf of Student's T distribution with 5 | % degrees of freedom, V, mean, MU and standard deviation, SIGMA, at the 6 | % values in X. 7 | % 8 | % The size of Y is the common size of the input arguments. A scalar input 9 | % functions as a constant matrix of the same size as the other inputs. 10 | % 11 | % Default values for MU and SIGMA are 0 and 1 respectively. 12 | % 13 | % Copyright (c) 1998-2004 Aki Vehtari 14 | 15 | % This software is distributed under the GNU General Public 16 | % License (version 3 or later); please refer to the file 17 | % License.txt, included with the software, for details. 18 | 19 | if nargin < 4, 20 | sigma = 1; 21 | end 22 | 23 | if nargin < 3; 24 | mu = 0; 25 | end 26 | 27 | if nargin < 2, 28 | error('Requires at least two input arguments.'); 29 | end 30 | 31 | term = gammaln((v + 1) / 2) - gammaln(v/2) -log(v.*pi)/2; 32 | y = term - log(sigma) + log(1 + ((((x-mu)./sigma).^2)./v)) .* (-(v+1)/2); 33 | 34 | -------------------------------------------------------------------------------- /dist/t_pdf.m: -------------------------------------------------------------------------------- 1 | function y = t_pdf(x, v, mu, sigma) 2 | %T_PDF Student's t probability density function (pdf). 3 | % 4 | % Y = T_PDF(X,V,MU,SIGMA) Returns the Student's t pdf with 5 | % V degrees of freedom, MU mean and scale parameter SIGMA at X. 6 | % 7 | % The size of Y is the common size of the input arguments. A scalar input 8 | % functions as a constant matrix of the same size as the other inputs. 9 | % 10 | % Default values for MU and SIGMA are 0 and 1 respectively. 11 | % 12 | % Copyright (c) 1998-2008 Aki Vehtari 13 | 14 | % This software is distributed under the GNU General Public 15 | % Licence (version 3 or later); please refer to the file 16 | % Licence.txt, included with the software, for details. 17 | 18 | if nargin < 4, 19 | sigma = 1; 20 | end 21 | 22 | if nargin < 3; 23 | mu = 0; 24 | end 25 | 26 | if nargin < 2, 27 | error('Requires at least two input arguments.'); 28 | end 29 | 30 | term = gammaln((v + 1) / 2) - gammaln(v/2) -log(v.*pi)/2; 31 | y = term - log(sigma) + log(1 + ((((x-mu)./sigma).^2)./v)) .* (-(v+1)/2); 32 | y = exp(y); 33 | -------------------------------------------------------------------------------- /dist/trand.m: -------------------------------------------------------------------------------- 1 | function r = trand(nu,m,n) 2 | % TRAND - Random numbers from Student's t-distribution 3 | % 4 | % R = TRAND(V) returns a matrix of random numbers chosen 5 | % from the T distribution with V degrees of freedom. 6 | % The size of R is the size of V. 7 | % Alternatively, R = TRAND(V,M,N) returns an M by N matrix. 8 | % 9 | % Copyright (c) 1999 Aki Vehtari 10 | 11 | % This software is distributed under the GNU General Public 12 | % License (version 3 or later); please refer to the file 13 | % License.txt, included with the software, for details. 14 | 15 | error('No mex-file for this archtitecture. See Matlab help and convert.m in ./linuxCsource or ./winCsource for help.') 16 | -------------------------------------------------------------------------------- /dist/unifrand.m: -------------------------------------------------------------------------------- 1 | function r = unifrand(a,b,m,n) 2 | % UNIFRAND - Generate unifrom random numberm from interval [A,B] 3 | % 4 | % R = UNIFRAND(MU) returns a matrix of random numbers chosen 5 | % from the uniform distribution with parameters A and B. 6 | % The size of R is the common size of A and B. 7 | % Alternatively, R = UNIFRAND(A,B,M,N) returns an M by N matrix. 8 | % 9 | 10 | % This software is distributed under the GNU General Public 11 | % License (version 3 or later); please refer to the file 12 | % License.txt, included with the software, for details. 13 | 14 | if nargin<2 15 | error('Not enough arguments') 16 | end 17 | if a>b 18 | error('A must be smaller than B') 19 | end 20 | if nargin<3 21 | if not(all(size(a)==size(b))) 22 | error('A and B must be same size'); 23 | end 24 | [m,n]=size(a); 25 | end 26 | if nargin<4 27 | n=m; 28 | end 29 | d=b-a; 30 | r=rand(m,n)*d+a; 31 | -------------------------------------------------------------------------------- /dist/winCsource/ars.h: -------------------------------------------------------------------------------- 1 | /* ARS.H - Interface to Adaptive Rejection Sampling procedure. */ 2 | 3 | 4 | /* Copyright (c) 1995-2003 by Carl Edward Rasmussen and Radford M. Neal 5 | * 6 | * Permission is granted for anyone to copy, use, modify, or distribute this 7 | * program and accompanying programs and documents for any purpose, provided 8 | * this copyright notice is retained and prominently displayed, along with 9 | * a note saying that the original programs are available from Radford Neal's 10 | * web page, and note is made of any changes made to the programs. The 11 | * programs and documents are distributed without any warranty, express or 12 | * implied. As the programs were written for research purposes only, they have 13 | * not been tested to the degree that would be advisable in any important 14 | * application. All use of these programs is entirely at the user's own risk. 15 | */ 16 | 17 | double ars(double, double, double (*)(double, double *, void *), void *); 18 | -------------------------------------------------------------------------------- /dist/winCsource/binsgeq.c: -------------------------------------------------------------------------------- 1 | /* binsgeq 2 | * 3 | * binary search of a sorted (in ascending order) double array <*vec> 4 | * of length for a first element which is greater than or equal 5 | * to a key . If no greater element is found, returns . 6 | */ 7 | 8 | 9 | /* Copyright (c) 1998-2004 Aki Vehtari 10 | * 11 | *This software is distributed under the GNU General Public 12 | *License (version 3 or later); please refer to the file 13 | *License.txt, included with the software, for details. 14 | * 15 | */ 16 | 17 | double binsgeq(double *vec, int len, double item) 18 | { 19 | int low=0, high=len-1, mid; 20 | if (item<=vec[0]) { 21 | return 1.0; 22 | } 23 | while ((high-low) > 1) { 24 | mid=(high+low)/2; 25 | if (item>vec[mid]) 26 | low = mid; 27 | else 28 | high = mid; 29 | } 30 | return high+1.0; 31 | } 32 | -------------------------------------------------------------------------------- /dist/winCsource/binsgeq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998-2004 Aki Vehtari 2 | * 3 | *This software is distributed under the GNU General Public 4 | *License (version 3 or later); please refer to the file 5 | *License.txt, included with the software, for details. 6 | * 7 | */ 8 | 9 | double binsgeq(double *, int, double); 10 | -------------------------------------------------------------------------------- /dist/winCsource/gamrand1.c: -------------------------------------------------------------------------------- 1 | /* 2 | * GAMRAND1 Random matrices from gamma distribution. 3 | * 4 | * R = GAMRAND1(A,B) returns a matrix of random numbers chosen 5 | * from the gamma distribution with parameters A and B. 6 | * The size of R is the common size of A and B if both are matrices. 7 | * If either parameter is a scalar, the size of R is the size of the other 8 | * parameter. Alternatively, R = GAMRAND(A,B,M,N) returns an M by N matrix. 9 | * 10 | * Note: Parameterization as in (Neal, 1996). 11 | * A is mean of the distribution 12 | * B is degrees of freedom 13 | * 14 | * 15 | * Last modified: 2000-05-31 12:16:57 EEST 16 | * 17 | */ 18 | 19 | /* Copyright (C) 1998-2000 Aki Vehtari 20 | * 21 | *This software is distributed under the GNU General Public 22 | *License (version 2 or later); please refer to the file 23 | *License.txt, included with the software, for details. 24 | * 25 | */ 26 | 27 | #include 28 | #include "mex.h" 29 | #include "rand.h" 30 | 31 | void mexFunction(const int nlhs_, mxArray *plhs_[], 32 | const int nrhs_, const mxArray *prhs_[]) 33 | { 34 | if (nrhs_ != 2 ) 35 | mexErrMsgTxt( "Wrong number of input arguments." ); 36 | 37 | if (nlhs_ > 1 ) 38 | mexErrMsgTxt( "Too many output arguments." ); 39 | 40 | { 41 | double a, b; 42 | a=mxGetScalar(prhs_[0]); 43 | b=mxGetScalar(prhs_[1]); 44 | 45 | plhs_[0]=mxCreateDoubleMatrix(1,1,mxREAL); 46 | *mxGetPr(plhs_[0]) = 47 | rand_gamma(b/2)*2*a/b; 48 | } 49 | return; 50 | } 51 | 52 | -------------------------------------------------------------------------------- /dist/winCsource/invgamrand1.c: -------------------------------------------------------------------------------- 1 | /*INVGAMRAND1 Random matrices from inverse gamma distribution 2 | * 3 | * R = INVGAMRAND1(A,B) returns a matrix of random numbers chosen 4 | * from the inverse gamma distribution with parameters A and B. 5 | * The size of R is the common size of A and B if both are matrices. 6 | * If either parameter is a scalar, the size of R is the size of the other 7 | * parameter. Alternatively, R = GAMRND(A,B,M,N) returns an M by N matrix. 8 | * 9 | * Note: Parameterization as in (Neal, 1996). 10 | * A is mean of the distribution 11 | * B is degrees of freedom 12 | * 13 | * Last modified: 2000-05-31 12:06:08 EEST 14 | * 15 | */ 16 | 17 | /* Copyright (C) 1998-2000 Aki Vehtari 18 | * 19 | *This software is distributed under the GNU General Public 20 | *License (version 3 or later); please refer to the file 21 | *License.txt, included with the software, for details. 22 | * 23 | */ 24 | 25 | #include 26 | #include "mex.h" 27 | #include "rand.h" 28 | 29 | void mexFunction(const int nlhs_, mxArray *plhs_[], 30 | const int nrhs_, const mxArray *prhs_[]) 31 | { 32 | if (nrhs_ != 2 ) 33 | mexErrMsgTxt( "Wrong number of input arguments." ); 34 | 35 | if (nlhs_ > 1 ) 36 | mexErrMsgTxt( "Too many output arguments." ); 37 | 38 | { 39 | double a, b; 40 | a=mxGetScalar(prhs_[0]); 41 | b=mxGetScalar(prhs_[1]); 42 | 43 | plhs_[0]=mxCreateDoubleMatrix(1,1,mxREAL); 44 | *mxGetPr(plhs_[0]) = 45 | a*b/2/rand_gamma(b/2); 46 | 47 | } 48 | return; 49 | } 50 | 51 | -------------------------------------------------------------------------------- /dist/winCsource/rand.h: -------------------------------------------------------------------------------- 1 | /* RAND.H - Interface to random number generation procedures. */ 2 | 3 | 4 | /* Copyright (c) 1995-2003 by Radford M. Neal 5 | * 6 | * Permission is granted for anyone to copy, use, modify, or distribute this 7 | * program and accompanying programs and documents for any purpose, provided 8 | * this copyright notice is retained and prominently displayed, along with 9 | * a note saying that the original programs are available from Radford Neal's 10 | * web page, and note is made of any changes made to the programs. The 11 | * programs and documents are distributed without any warranty, express or 12 | * implied. As the programs were written for research purposes only, they have 13 | * not been tested to the degree that would be advisable in any important 14 | * application. All use of these programs is entirely at the user's own risk. 15 | */ 16 | 17 | /* GENERATORS FOR VARIOUS DISTRIBUTIONS. */ 18 | 19 | double rand_uniform (void); /* Uniform from [0,1) */ 20 | double rand_uniopen (void); /* Uniform from (0,1) */ 21 | 22 | int rand_int (int); /* Uniform from 0, 1, ... (n-1) */ 23 | int rand_pickd (double *, int); /* From 0 ... (n-1), with given distribution */ 24 | int rand_pickf (float *, int); /* Same as above, but with floats */ 25 | 26 | double rand_gaussian (void); /* Gaussian with mean zero and unit variance */ 27 | double rand_exp (void); /* Exponential with mean one */ 28 | double rand_cauchy (void); /* Cauchy centred at zero with unit width */ 29 | double rand_gamma (double); /* Gamma with given shape parameter */ 30 | double rand_beta (double, double); /* Beta with given parameters */ 31 | -------------------------------------------------------------------------------- /dist/winCsource/tanh_f.c: -------------------------------------------------------------------------------- 1 | /* 2 | * TANH 75 % faster hyperbolic tangent. 3 | * TANH(X) is the hyperbolic tangent of the elements of X. 4 | * 5 | */ 6 | 7 | /* (c) 1998-2001 Aki Vehtari 8 | * 9 | *This software is distributed under the GNU General Public 10 | *License (version 3 or later); please refer to the file 11 | *License.txt, included with the software, for details. 12 | * 13 | */ 14 | 15 | #include "mex.h" 16 | #include 17 | 18 | void mexFunction(int nlhs, mxArray *plhs[], 19 | int nrhs, const mxArray *prhs[]) 20 | { 21 | double *x, *y, xa; 22 | const int *dims; 23 | int len, i; 24 | 25 | dims = mxGetDimensions(prhs[0]); 26 | len = dims[0]*dims[1]; 27 | plhs[0] = mxCreateDoubleMatrix(dims[0], dims[1], mxREAL); 28 | x = mxGetPr(prhs[0]); 29 | y = mxGetPr(plhs[0]); 30 | 31 | for (i = len; i > 0; i--, x++, y++) { 32 | xa=fabs(*x); 33 | *y = (xa > 18) ? (*x>0 ? 1.0 : -1.0) 34 | : ((xa > 1.5e-8) ? 1.0-2.0/(exp(2.0**x)+1.0) : *x); 35 | } 36 | 37 | return; 38 | } 39 | -------------------------------------------------------------------------------- /doc/GPstuffManual.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/GPstuffManual.pdf -------------------------------------------------------------------------------- /doc/ccd_integration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/ccd_integration.pdf -------------------------------------------------------------------------------- /doc/demo_lgcp_fig1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_lgcp_fig1.pdf -------------------------------------------------------------------------------- /doc/demo_lgcp_fig2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_lgcp_fig2.pdf -------------------------------------------------------------------------------- /doc/demo_lgpdens_fig1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_lgpdens_fig1.pdf -------------------------------------------------------------------------------- /doc/demo_lgpdens_fig2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_lgpdens_fig2.pdf -------------------------------------------------------------------------------- /doc/demo_monotonic2_fig1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_monotonic2_fig1.pdf -------------------------------------------------------------------------------- /doc/demo_ppcsCov1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_ppcsCov1.jpg -------------------------------------------------------------------------------- /doc/demo_ppcsCov2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_ppcsCov2.pdf -------------------------------------------------------------------------------- /doc/demo_regression1_fig1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_regression1_fig1.pdf -------------------------------------------------------------------------------- /doc/demo_regression1_fig3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_regression1_fig3.pdf -------------------------------------------------------------------------------- /doc/demo_spatial1_fig1a.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_spatial1_fig1a.pdf -------------------------------------------------------------------------------- /doc/demo_spatial1_fig1b.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/demo_spatial1_fig1b.pdf -------------------------------------------------------------------------------- /doc/grid_based_integration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/grid_based_integration.pdf -------------------------------------------------------------------------------- /doc/hist1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/hist1.pdf -------------------------------------------------------------------------------- /doc/hist2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/hist2.pdf -------------------------------------------------------------------------------- /doc/is_integration.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/is_integration.pdf -------------------------------------------------------------------------------- /doc/neal_data_pic1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/neal_data_pic1.pdf -------------------------------------------------------------------------------- /doc/neal_data_pic2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/doc/neal_data_pic2.pdf -------------------------------------------------------------------------------- /gp/cf_periodic_to_ss.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/gp/cf_periodic_to_ss.m -------------------------------------------------------------------------------- /gp/cf_prod_to_ss.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/gp/cf_prod_to_ss.m -------------------------------------------------------------------------------- /gp/cf_quasiperiodic_to_ss.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/gp/cf_quasiperiodic_to_ss.m -------------------------------------------------------------------------------- /gp/demo_multinom.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/gp/demo_multinom.m -------------------------------------------------------------------------------- /gp/demodata/broffit.txt: -------------------------------------------------------------------------------- 1 | age;N;y 2 | 35;1771.5;3 3 | 36;2126.5;1 4 | 37;2743.5;3 5 | 38;2766;2 6 | 39;2463;2 7 | 40;2368;4 8 | 41;2310;4 9 | 42;2306.5;7 10 | 43;2059.5;5 11 | 44;1917;2 12 | 45;1931;8 13 | 46;1746.5;13 14 | 47;1580;8 15 | 48;1580;2 16 | 49;1467.5;7 17 | 50;1516;4 18 | 51;1371.5;7 19 | 52;1343;4 20 | 53;1304;4 21 | 54;1232.5;11 22 | 55;1204.5;11 23 | 56;1113.5;13 24 | 57;1048;12 25 | 58;1155;12 26 | 59;1018.5;19 27 | 60;945;12 28 | 61;853;16 29 | 62;750;12 30 | 63;693;6 31 | 64;594;10 32 | -------------------------------------------------------------------------------- /gp/demodata/drowning.txt: -------------------------------------------------------------------------------- 1 | 2002 3 3 5 12 23 24 47 24 11 16 7 4 2 | 2003 0 2 6 6 18 21 53 30 11 11 11 7 3 | 2004 1 4 1 17 17 15 30 35 16 10 4 9 4 | 2005 7 8 6 10 20 27 35 23 14 14 3 7 5 | 2006 7 2 1 4 15 17 54 32 19 5 12 6 6 | 2007 6 2 10 18 16 26 38 32 6 10 12 6 7 | 2008 14 7 7 20 14 19 15 16 14 8 12 3 8 | 2009 8 3 2 11 17 27 22 21 15 NaN NaN NaN 9 | 2010 0 2 4 18 6 26 53 21 16 12 7 2 10 | 2011 4 1 1 9 7 16 44 16 9 7 9 2 11 | 2012 2 1 2 6 13 23 19 15 10 NaN NaN NaN 12 | -------------------------------------------------------------------------------- /gp/demodata/galaxy.txt: -------------------------------------------------------------------------------- 1 | 9172 2 | 9350 3 | 9483 4 | 9558 5 | 9775 6 | 10227 7 | 10406 8 | 16084 9 | 16170 10 | 18419 11 | 18552 12 | 18600 13 | 18927 14 | 19052 15 | 19070 16 | 19330 17 | 19343 18 | 19349 19 | 19440 20 | 19473 21 | 19529 22 | 19541 23 | 19547 24 | 19663 25 | 19846 26 | 19856 27 | 19863 28 | 19914 29 | 19918 30 | 19973 31 | 19989 32 | 20166 33 | 20175 34 | 20179 35 | 20196 36 | 20215 37 | 20221 38 | 20415 39 | 20629 40 | 20795 41 | 20821 42 | 20846 43 | 20875 44 | 20986 45 | 21137 46 | 21492 47 | 21701 48 | 21814 49 | 21921 50 | 21960 51 | 22185 52 | 22209 53 | 22242 54 | 22249 55 | 22314 56 | 22374 57 | 22495 58 | 22746 59 | 22747 60 | 22888 61 | 22914 62 | 23206 63 | 23241 64 | 23263 65 | 23484 66 | 23538 67 | 23542 68 | 23666 69 | 23706 70 | 23711 71 | 24129 72 | 24285 73 | 24289 74 | 24366 75 | 24717 76 | 24990 77 | 25633 78 | 26960 79 | 26995 80 | 32065 81 | 32789 82 | 34279 -------------------------------------------------------------------------------- /gp/demodata/rats.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/gp/demodata/rats.mat -------------------------------------------------------------------------------- /gp/demodata/samples_marginal.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/gp/demodata/samples_marginal.mat -------------------------------------------------------------------------------- /gp/expectedvariance_eg.m: -------------------------------------------------------------------------------- 1 | function [e, g] = expectedvariance_eg(x_new, gp, x, ~, invC, varargin) 2 | % expectedVariance_eg Calculate the negative expected variance and its 3 | % gradient 4 | % 5 | %expectedVariance_eg(x_new, gp, x, [], invC) 6 | % Arguments to the function are: 7 | % x_new - query point 8 | % gp - GP model for the objective function 9 | % x - previous query points for which we have calculated objective 10 | % function value y 11 | % invC - [~, C] = gp_trcov(gp,x); invC = inv(C); 12 | % 13 | % Copyright (c) 2015 Jarno Vanhatalo 14 | 15 | % This software is distributed under the GNU General Public 16 | % License (version 3 or later); please refer to the file 17 | % License.txt, included with the software, for details. 18 | 19 | 20 | K = gp_cov(gp,x_new,x); 21 | e = - ( gp_trvar(gp,x_new)-diag((K*invC*K')) ); 22 | 23 | if nargout > 1 24 | ncf = length(gp.cf); 25 | tmpK=zeros(1,size(x_new,2)); 26 | tmpC= cell(size(x_new,2),1); 27 | for j1=1:length(tmpC) 28 | tmpC{j1} = zeros(1,size(x,1)); 29 | end 30 | for i1=1:ncf 31 | gpcft = gp.cf{i1}; 32 | tmpK = tmpK + cell2mat(gpcft.fh.ginput(gpcft,x_new)); 33 | apu = gpcft.fh.ginput(gpcft,x_new,x); 34 | for j1= 1:length(apu) 35 | tmpC{j1} = tmpC{j1} + apu{j1}; 36 | end 37 | end 38 | g = tmpK; 39 | for j1=1:length(tmpC) 40 | g(j1) = g(j1) - tmpC{j1}*invC*K' - K*invC*tmpC{j1}'; 41 | end 42 | g=-g; 43 | end -------------------------------------------------------------------------------- /gp/gp_eg.m: -------------------------------------------------------------------------------- 1 | function [e, g] = gp_eg(w, gp, x, y, varargin) 2 | %GP_EG Evaluate the energy function (un-normalized negative marginal 3 | % log posterior) and its gradient 4 | % 5 | % Description 6 | % [E, G] = GP_EG(W, GP, X, Y, OPTIONS) takes a Gaussian process 7 | % structure GP together with a matrix X of input vectors and a 8 | % matrix Y of targets, and evaluates the energy function E and 9 | % its gradient G. Each row of X corresponds to one input vector 10 | % and each row of Y corresponds to one target vector. 11 | % 12 | % The energy is minus log posterior cost function: 13 | % E = EDATA + EPRIOR 14 | % = - log p(Y|X, th) - log p(th), 15 | % where th represents the parameters (lengthScale, 16 | % magnSigma2...), X is inputs and Y is observations (regression) 17 | % or latent values (non-Gaussian likelihood). 18 | % 19 | % OPTIONS is optional parameter-value pair 20 | % z - optional observed quantity in triplet (x_i,y_i,z_i) 21 | % Some likelihoods may use this. For example, in case of 22 | % Poisson likelihood we have z_i=E_i, that is, expected 23 | % value for ith case. 24 | % 25 | % See also 26 | % GP_E, GP_G 27 | % 28 | % Copyright (c) 2010 Aki Vehtari 29 | 30 | % This software is distributed under the GNU General Public 31 | % License (version 3 or later); please refer to the file 32 | % License.txt, included with the software, for details. 33 | 34 | % Single function for some optimization routines, no need for mydeal... 35 | e=gp_e(w, gp, x, y, varargin{:}); 36 | if nargout>1 37 | if isnan(e) 38 | g=NaN; 39 | else 40 | g=gp_g(w, gp, x, y, varargin{:}); 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /gp/gpcf_linearMichelismenten.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/gp/gpcf_linearMichelismenten.m -------------------------------------------------------------------------------- /gp/gpia_pak.m: -------------------------------------------------------------------------------- 1 | function [w, P_TH] = gpia_pak(gp_array) 2 | %GP_PRED Combine parameters of GP-IA cell array into matrix 3 | % 4 | % Description 5 | % [W, P_TH] = GPIA_PAK(GP_ARRAY) 6 | % Combine the hyperparameters in GP_ARRAY into matrix W and IA-weights 7 | % to vector P_TH. 8 | % 9 | % See also 10 | % GPIA_UNPAK, GP_PAK, GP_IA 11 | % 12 | % Copyright (c) 2014 Ville Tolvanen 13 | 14 | % This software is distributed under the GNU General Public 15 | % License (version 3 or later); please refer to the file 16 | % License.txt, included with the software, for details. 17 | 18 | if ~iscell(gp_array) 19 | error('Input must proper GP-IA cell array. See for example gp_ia.m.'); 20 | end 21 | 22 | nsamples=length(gp_array); 23 | P_TH=ones(1,nsamples); 24 | for i1=1:nsamples 25 | w(i1,:)=gp_pak(gp_array{i1}); 26 | P_TH(i1)=gp_array{i1}.ia_weight; 27 | end 28 | 29 | -------------------------------------------------------------------------------- /gp/gpia_unpak.m: -------------------------------------------------------------------------------- 1 | function gp_array = gpia_unpak(gp_array, w, P_TH) 2 | %GP_PRED Set parameters of GP-IA cell array 3 | % 4 | % Description 5 | % GP_ARRAY = GPIA_UPAK(GP_ARRAY, W, P_TH) 6 | % Set the hyperparameters of the GP_ARRAY for corresponding 7 | % hyperparameters in W and weights in P_TH 8 | % 9 | % See also 10 | % GPIA_PAK, GP_PAK, GP_UNPAK, GP_IA 11 | % 12 | % Copyright (c) 2014 Ville Tolvanen 13 | 14 | % This software is distributed under the GNU General Public 15 | % License (version 3 or later); please refer to the file 16 | % License.txt, included with the software, for details. 17 | 18 | if ~iscell(gp_array) 19 | error('Input must proper GP-IA cell array. See for example gp_ia.m.'); 20 | end 21 | 22 | nsamples=length(gp_array); 23 | for i1=1:nsamples 24 | gp_array{i1}=gp_unpak(gp_array{i1}, w(i1,:)); 25 | gp_array{i1}.ia_weight = P_TH(i1); 26 | end 27 | 28 | -------------------------------------------------------------------------------- /gp/gpmc_pak.m: -------------------------------------------------------------------------------- 1 | function [w, f] = gpmc_pak(gp_rec) 2 | %GP_PRED Combine parameters of GP-IA cell array into matrix 3 | % 4 | % Description 5 | % [W, F] = GPIA_PAK(GP_REC) 6 | % Combine the sampled hyperparameters in GP_REC into matrix W and in 7 | % case of non-Gaussian likelihood, the sampled latent values to F. 8 | % 9 | % See also 10 | % GPMC_UNPAK, GP_PAK, GP_MC 11 | % 12 | % Copyright (c) 2014 Ville Tolvanen 13 | 14 | % This software is distributed under the GNU General Public 15 | % License (version 3 or later); please refer to the file 16 | % License.txt, included with the software, for details. 17 | 18 | if ~isstruct(gp_rec) 19 | error('Input must proper sampled structure. See for example gp_mc.m.'); 20 | end 21 | 22 | w=gp_pak(gp_rec); 23 | if isfield(gp_rec, 'latentValues') 24 | f=gp_rec.latentValues; 25 | else 26 | f=[]; 27 | end 28 | 29 | -------------------------------------------------------------------------------- /gp/gpmc_unpak.m: -------------------------------------------------------------------------------- 1 | function gp_rec = gpmc_unpak(gp_rec, w, varargin) 2 | %GPMC_UNPAK Set parameters of GP-MC structure 3 | % 4 | % Description 5 | % GP_REC = GPMC_UNPAK(GP, W) 6 | % Given Gaussian process GP and hyperparameter weight matrix W, 7 | % create GP-MC structure with hyperparameter values filled from W. 8 | % 9 | % See also 10 | % GPMC_PAK, GP_PAK, GP_UNPAK, GP_MC 11 | % 12 | % Copyright (c) 2014 Ville Tolvanen 13 | 14 | % This software is distributed under the GNU General Public 15 | % License (version 3 or later); please refer to the file 16 | % License.txt, included with the software, for details. 17 | 18 | if ~isstruct(gp_rec) 19 | error('Input GP_REC must be either sampled GP (see gp_mc) or normal GP structure (see gp_set).'); 20 | end 21 | 22 | ncf=length(gp_rec.cf); 23 | nsamples=size(w,1); 24 | 25 | % Set covariace function paramaters 26 | ind=0; 27 | if isfield(gp_rec, 'etr') 28 | gptmp=take_nth(gp_rec,1); 29 | else 30 | gptmp=gp_rec; 31 | end 32 | for i1=1:ncf 33 | gpcf=gptmp.cf{i1}; 34 | np=size(gpcf.fh.pak(gpcf),2); 35 | gpcftmp=gpcf; 36 | reccf=gpcftmp.fh.recappend(gpcftmp, gpcftmp); 37 | for i2=1:nsamples 38 | gpcftmp=gpcftmp.fh.unpak(gpcftmp, w(i2, ind+1:ind+np)); 39 | reccf=gpcftmp.fh.recappend(reccf, i2, gpcftmp); 40 | end 41 | ind=ind+np; 42 | gp_rec.cf{i1}=reccf; 43 | end 44 | % Set likelihood function parameters 45 | lik=gptmp.lik; 46 | reclik=lik.fh.recappend(lik, lik); 47 | if ind < size(w,2) 48 | np=size(lik.fh.pak(lik),2); 49 | for i2=1:nsamples 50 | lik=lik.fh.unpak(lik, w(i2, ind+1:ind+np)); 51 | reclik=lik.fh.recappend(reclik, i2, lik); 52 | end 53 | gp_rec.lik=reclik; 54 | end 55 | 56 | 57 | if nargin==3 58 | gp_rec.latentValues=varargin{1}; 59 | end -------------------------------------------------------------------------------- /gp/lgpdens_cum.m: -------------------------------------------------------------------------------- 1 | function [cum] = lgpdens_cum(bb,x1,x2) 2 | % [CUM] = LGPDENS_CUM(BB) 3 | % 4 | % Description 5 | % Given Bayesian Bootstrap estimated density, integrates it from point x1 6 | % to point x2 7 | % 8 | % Copyright (c) 2012 Ernesto Ulloa 9 | % Copyright (c) 2012 Aki Vehtari 10 | 11 | % This software is distributed under the GNU General Public 12 | % License (version 3 or later); please refer to the file 13 | % License.txt, included with the software, for details. 14 | 15 | ip=inputParser; 16 | ip.addRequired('bb',@(x) ~isempty(x) && isreal(x) && all(isfinite(x(:)))) 17 | ip.addRequired('x1',@(x) ~isempty(x) && isreal(x)) 18 | ip.addRequired('x2', @(x) ~isempty(x) && isreal(x)) 19 | ip.parse(bb,x1,x2) 20 | 21 | [p,pq,xt]=lgpdens(bb); 22 | I1=min(find(xt>x1)); 23 | I2=max(find(xt GPCF_SEXP_TRCOV 17 | 18 | % Copyright (c) 2008-2010 Jarno Vanhatalo 19 | 20 | % This software is distributed under the GNU General Public 21 | % License (version 3 or later); please refer to the file 22 | % License.txt, included with the software, for details. 23 | 24 | C = NaN; % If mex file is not compiled return NaN, in which case the 25 | % matrix is evaluated in gpcf_*_trcov 26 | -------------------------------------------------------------------------------- /mc/Contents.m: -------------------------------------------------------------------------------- 1 | % Monte Carlo FUNCTIONS (in the mc-folder): 2 | % 3 | % Markov chain Monte Carlo methods 4 | % GIBBS - Gibbs sampling 5 | % HMC2 - Hybrid Monte Carlo sampling 6 | % HMC2_OPT - Default options for Hybrid Monte Carlo sampling 7 | % HMC_NUTS - No-U-Turn Sampler (NUTS) 8 | % METROP2 - Metropolis algorithm 9 | % METROP2_OPT - Default options for Metropolis sampling 10 | % SLS - Slice Sampling 11 | % SLS_OPT - Default options for Slice Sampling 12 | % SLS1MM - 1-dimensional fast minmax slice sampling 13 | % SLS1MM_OPT - Default options for SLS1MM_OPT 14 | % 15 | % Monte Carlo methods 16 | % BBMEAN - Bayesian bootstrap mean 17 | % BBPRCTILE - Bayesian bootstrap percentile 18 | % RANDPICK - Pick element from x randomly 19 | % If x is matrix, pick row from x randomly. 20 | % RESAMPDET - Deterministic resampling 21 | % RESAMPRES - Residual resampling 22 | % RESAMPSIM - Simple random resampling 23 | % RESAMPSTR - Stratified resampling 24 | % 25 | % Manipulation of MCMC chains 26 | % THIN - Delete burn-in and thin MCMC-chains 27 | % JOIN - Join similar structures of arrays to one structure of arrays 28 | % TAKE_NTH - Take n'th sample from Monte Carlo structure 29 | % BATCHMC - Batch MCMC sample chain and evaluate mean/median of batches 30 | % 31 | -------------------------------------------------------------------------------- /mc/batchmc.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/mc/batchmc.m -------------------------------------------------------------------------------- /mc/bbmean.m: -------------------------------------------------------------------------------- 1 | function bbm = bbmean(x,B,w) 2 | % BBMEAN Bayesian bootstrap mean 3 | % 4 | % Description 5 | % bbm = bbmean(x,B,w) 6 | % x NxM matrix of data 7 | % B number of bootstrap replicates 8 | % w Nx1 vector of weights 9 | % 10 | % Copyright (c) Aki Vehtari, 1998-2004 11 | 12 | % This software is distributed under the GNU General Public 13 | % License (version 3 or later); please refer to the file 14 | % License.txt, included with the software, for details. 15 | 16 | error('No mex-file for this architecture. See Matlab help and convert.m in ./linuxCsource or ./winCsource for help.') -------------------------------------------------------------------------------- /mc/bbprctile.m: -------------------------------------------------------------------------------- 1 | function bbp = bbprctile(x,p,B,w) 2 | % BBPRCTILE Bayesian bootstrap percentile 3 | % 4 | % Description: 5 | % bbp = bbprctile(x,p,B,w) 6 | % x = Mx1 matrix of data 7 | % p = Px1 or 1xP vector of percentiles 8 | % B = number of bootstrap replicates 9 | % w = Mx1 vector of weights 10 | % 11 | % Copyright (c) Aki Vehtari, 1998-2004 12 | 13 | % This software is distributed under the GNU General Public 14 | % License (version 3 or later); please refer to the file 15 | % License.txt, included with the software, for details. 16 | 17 | error('No mex-file for this architecture. See Matlab help and convert.m in ./linuxCsource or ./winCsource for help.') 18 | -------------------------------------------------------------------------------- /mc/linuxCsource/ars.h: -------------------------------------------------------------------------------- 1 | /* ARS.H - Interface to Adaptive Rejection Sampling procedure. */ 2 | 3 | 4 | /* Copyright (c) 1995-2003 by Carl Edward Rasmussen and Radford M. Neal 5 | * 6 | * Permission is granted for anyone to copy, use, modify, or distribute this 7 | * program and accompanying programs and documents for any purpose, provided 8 | * this copyright notice is retained and prominently displayed, along with 9 | * a note saying that the original programs are available from Radford Neal's 10 | * web page, and note is made of any changes made to the programs. The 11 | * programs and documents are distributed without any warranty, express or 12 | * implied. As the programs were written for research purposes only, they have 13 | * not been tested to the degree that would be advisable in any important 14 | * application. All use of these programs is entirely at the user's own risk. 15 | */ 16 | 17 | double ars(double, double, double (*)(double, double *, void *), void *); 18 | -------------------------------------------------------------------------------- /mc/linuxCsource/binsgeq.c: -------------------------------------------------------------------------------- 1 | /* binsgeq 2 | * 3 | * binary search of a sorted (in ascending order) double array <*vec> 4 | * of length for a first element which is greater than or equal 5 | * to a key . If no greater element is found, returns . 6 | */ 7 | 8 | 9 | /* Copyright (c) 1998-2004 Aki Vehtari 10 | * 11 | *This software is distributed under the GNU General Public 12 | *License (version 3 or later); please refer to the file 13 | *License.txt, included with the software, for details. 14 | * 15 | */ 16 | 17 | double binsgeq(double *vec, int len, double item) 18 | { 19 | int low=0, high=len-1, mid; 20 | if (item<=vec[0]) { 21 | return 1.0; 22 | } 23 | while ((high-low) > 1) { 24 | mid=(high+low)/2; 25 | if (item>vec[mid]) 26 | low = mid; 27 | else 28 | high = mid; 29 | } 30 | return high+1.0; 31 | } 32 | -------------------------------------------------------------------------------- /mc/linuxCsource/binsgeq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998-2004 Aki Vehtari 2 | * 3 | *This software is distributed under the GNU General Public 4 | *License (version 3 or later); please refer to the file 5 | *License.txt, included with the software, for details. 6 | * 7 | */ 8 | 9 | double binsgeq(double *, int, double); 10 | -------------------------------------------------------------------------------- /mc/linuxCsource/convert_for_win: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | mkdir ../winCsource 4 | cp *.c ../winCsource 5 | cp *.h ../winCsource 6 | cd ../winCsource 7 | 8 | baddies=`grep -l '_(' *.c` 9 | 10 | echo "$baddies" 11 | for i in $baddies;do 12 | ed -s $i << EOF_INPUT 13 | 1,\$s/_(/(/g 14 | w 15 | q 16 | EOF_INPUT 17 | done 18 | -------------------------------------------------------------------------------- /mc/mc_install.m: -------------------------------------------------------------------------------- 1 | function mc_install 2 | 3 | 4 | if ispc % A windows version of Matlab 5 | mex -O -output bbmean winCSource\bbmean.c 6 | mex -O -output resampres winCsource\resampres.c winCsource\binsgeq.c 7 | mex -O -output resampsim winCsource\resampsim.c winCsource\binsgeq.c 8 | mex -O -output resampstr winCsource\resampstr.c winCsource\binsgeq.c 9 | mex -O -output resampdet winCsource\resampdet.c winCsource\binsgeq.c 10 | else 11 | mex -O -output bbmean linuxCsource/bbmean.c 12 | mex -O -output resampres linuxCsource/resampres.c linuxCsource/binsgeq.c 13 | mex -O -output resampsim linuxCsource/resampsim.c linuxCsource/binsgeq.c 14 | mex -O -output resampstr linuxCsource/resampstr.c linuxCsource/binsgeq.c 15 | mex -O -output resampdet linuxCsource/resampdet.c linuxCsource/binsgeq.c 16 | end 17 | -------------------------------------------------------------------------------- /mc/metrop2_opt.m: -------------------------------------------------------------------------------- 1 | function opt = metrop2_opt(opt) 2 | %METROP2_OPT Default options for Metropolis sampling. 3 | % 4 | % Default options for METROP 5 | % 6 | % opt=metrop2_opt; 7 | % return default options 8 | % opt=metrop2_opt(metropopt); 9 | % fill empty options with default values 10 | % 11 | % The options and defaults are 12 | % display (0) 13 | % 1 to display the energy values and rejection threshold at 14 | % each step of the Markov chain 15 | % 2 to display also position vectors at each step 16 | % nsamples (1) 17 | % the number of samples retained from the Markov chain 18 | % nomit (0) 19 | % the number of samples omitted from the start of the chain 20 | % stddev (0.9) 21 | % the variance of the proposal distribution; default 1. 22 | % 23 | % See also 24 | % METROP2 25 | 26 | % Copyright (c) 1998-2000 Aki Vehtari 27 | 28 | % This software is distributed under the GNU General Public 29 | % License (version 3 or later); please refer to the file 30 | % License.txt, included with the software, for details. 31 | if nargin < 1 32 | opt=[]; 33 | end 34 | 35 | if ~isfield(opt,'display') 36 | opt.display=0; 37 | end 38 | if ~isfield(opt,'nsamples') | opt.nsamples < 1 39 | opt.nsamples=1; 40 | end 41 | if ~isfield(opt,'nomit') | opt.nomit < 0 42 | opt.nomit=0; 43 | end 44 | if ~isfield(opt,'stddev') | opt.stddev < 0 45 | opt.stddev=0.1; 46 | end 47 | -------------------------------------------------------------------------------- /mc/private/nchooseks.m: -------------------------------------------------------------------------------- 1 | function c = nchooseks(N,K) 2 | %NCHOOSEKS Multinomial coefficient 3 | % 4 | % C = NCHOOSEKS(N,K) where N is a non-negative integer and K is a vector 5 | % of k non-negative integers returns N!/(K(1)!...K(k))!) 6 | % This is the number of combinations of N things grouped in k groups with 7 | % sizes in vector K. SUM(K) must be be N. 8 | % When a coefficient is greater than 10^15, a warning will be produced 9 | % indicating possible inexact results. In such cases, the result is good 10 | % to 15 digits. 11 | % 12 | % See also NCHOOSEK 13 | 14 | % Copyright (c) 2004 Aki Vehtari 15 | 16 | % This software is distributed under the GNU General Public 17 | % License (version 3 or later); please refer to the file 18 | % License.txt, included with the software, for details. 19 | 20 | if any(K < 0) || any(K ~= round(K)) || min(size(K)) ~=1 21 | error('The second input has to be a vector of non-negative integers'); 22 | end 23 | 24 | [m, n] = size(N); 25 | if m ~= 1 && n ~= 1 26 | error('The first argument has to be a non-negative integer'); 27 | end 28 | 29 | if sum(K) ~= N, error('SUM(K) must be equal to N'); end 30 | 31 | nums=1:N; 32 | ii=1; 33 | for i=1:numel(K) 34 | for j=1:K(i) 35 | nums(ii)=ii/j; 36 | ii=ii+1; 37 | end 38 | end 39 | c=round(prod(nums)); 40 | 41 | if c > 1e+015 42 | warning('MATLAB:nchoosek:LargeCoefficient',['Result may not be ' ... 43 | 'exact. Coefficient is greater than 10^15,\n and ' ... 44 | 'is only good to 15 digits.']); 45 | end 46 | -------------------------------------------------------------------------------- /mc/randpick.m: -------------------------------------------------------------------------------- 1 | function r = randpick(x) 2 | % RANDPICK - Pick element from x randomly 3 | % If x is matrix, pick row from x randomly. 4 | 5 | % Author: Aki Vehtari 6 | % Last modified: 2004-09-07 11:25:23 EEST 7 | 8 | % This software is distributed under the GNU General Public 9 | % License (version 3 or later); please refer to the file 10 | % License.txt, included with the software, for details. 11 | 12 | if any(size(x)==1) 13 | r=x(floor(rand.*length(x)+1)); 14 | else 15 | r=x(floor(rand.*size(x,1)+1),:); 16 | end 17 | -------------------------------------------------------------------------------- /mc/resampres.m: -------------------------------------------------------------------------------- 1 | function s = resampres(p,m,n); 2 | %RESAMPRES Residual resampling 3 | % 4 | % Description: 5 | % S = RESAMPRES(P) returns a new set of indices according to 6 | % the probabilities P. P is array of probabilities, which are 7 | % not necessarily normalized, though they must be non-negative, 8 | % and not all zero. The size of S is the size of P. 9 | % 10 | % S = RESAMPRES(P,M,N) return M by N matrix. 11 | % 12 | % S = RESAMPRES(P,M) returns M by M matrix. 13 | % 14 | % Note that stratified and deterministic resampling have smaller 15 | % variance. 16 | % 17 | % Residual resampling retains k_j=floor(n*p_j) copies of index j, 18 | % where n is length of P and p is normalized probabilities. 19 | % Additionally n_r=n-k_1-...-k_n indices are sampled with 20 | % probabilities proportional to n*p_j-k_j. See, e.g., Liu, J. S., 21 | % Monte Carlo Strategies in Scientific Computing, Springer, 2001, 22 | % p. 72. 23 | % 24 | % See also RESAMPSIM, RESAMPSTR, RESAMPDET 25 | % 26 | % Copyright (c) 2003-2004 Aki Vehtari 27 | 28 | % This software is distributed under the GNU General Public 29 | % License (version 3 or later); please refer to the file 30 | % License.txt, included with the software, for details. 31 | 32 | if nargin<2 33 | [m,n] = size(p); 34 | elseif nargin==2 35 | n = m; 36 | end 37 | nin=m.*n; 38 | p=p(:); 39 | pn=p./sum(p).*nin; 40 | fpn=floor(pn); 41 | s=zeros(m,n); 42 | k=0; 43 | for i=1:numel(pn) 44 | if pn(i)>=1 45 | a=fpn(i); 46 | pn(i)=pn(i)-a; 47 | s(k+[1:a])=i; 48 | k=k+a; 49 | end 50 | end 51 | pc=cumsum(pn./(nin-k)); 52 | pc(end)=1; 53 | s((k+1):nin)=binsgeq(pc,rand(1,nin-k)); 54 | -------------------------------------------------------------------------------- /mc/resampsim.m: -------------------------------------------------------------------------------- 1 | function s = resampsim(p,m,n) 2 | %RESAMPSIM Simple random resampling 3 | % 4 | % Description: 5 | % S = RESAMPSIM(P) returns a new set of indices according to 6 | % the probabilities P. P is array of probabilities, which are 7 | % not necessarily normalized, though they must be non-negative, 8 | % and not all zero. The size of S is the size of P. 9 | % 10 | % S = RESAMPSIM(P,M,N) returns M by N matrix. 11 | % 12 | % S = RESAMPSIM(P,M) returns M by M matrix. 13 | % 14 | % Note that residual, stratified and deterministic resampling all 15 | % have smaller variance. 16 | % 17 | % Simple random resampling samples indices randomly according 18 | % to the probabilities P. See, e.g., Liu, J. S., Monte Carlo 19 | % Strategies in Scientific Computing, Springer, 2001, p. 72. 20 | % 21 | % See also RESAMPRES, RESAMPSTR, RESAMPDET 22 | % 23 | % Copyright (c) 2003-2004 Aki Vehtari 24 | 25 | % This software is distributed under the GNU General Public 26 | % License (version 3 or later); please refer to the file 27 | % License.txt, included with the software, for details. 28 | 29 | if nargin<2 30 | [m,n] = size(p); 31 | elseif nargin==2 32 | n = m; 33 | end 34 | pc=cumsum(p(:)); 35 | pc=pc./pc(end); 36 | s=binsgeq(pc,rand([m,n])); 37 | -------------------------------------------------------------------------------- /mc/resampwor.m: -------------------------------------------------------------------------------- 1 | function s = resampwor(p,m,n) 2 | %RESAMWOR Random resampling without replacement 3 | % 4 | % Description: 5 | % S = RESAMWOR(P) returns a new set of indices according to the 6 | % probabilities P without replacemnt. P is array of probabilities, 7 | % which are not necessarily normalized, though they must be 8 | % non-negative, and not all zero. The size of S is the size of P. 9 | % 10 | % S = RESAMWOR(P,M,N) returns M by N matrix. 11 | % 12 | % S = RESAMWOR(P,M) returns M by M matrix. 13 | % 14 | % See also RESAMPSIM, RESAMPRES, RESAMPSTR, RESAMPDET 15 | % 16 | % Copyright (c) 2003-2004 Aki Vehtari 17 | 18 | % This software is distributed under the GNU General Public 19 | % License (version 3 or later); please refer to the file 20 | % License.txt, included with the software, for details. 21 | 22 | if nargin<2 23 | [m,n] = size(p); 24 | elseif nargin==2 25 | n = m; 26 | end 27 | if m*n>numel(p) 28 | error('In resampling without replacment M*N has to be smaller than numel(P)') 29 | end 30 | r=rand([m,n]); 31 | s=zeros([m,n]); 32 | for i=1:m*n 33 | pc=cumsum(p(:)); 34 | pc=pc./pc(end); 35 | s(i)=binsgeq(pc,r(i)); 36 | p(s(i))=0; 37 | end 38 | -------------------------------------------------------------------------------- /mc/sls1mm_opt.m: -------------------------------------------------------------------------------- 1 | function opt = sls1mm_opt(opt) 2 | %SLS1MM_OPT Default options for Slice Sampling 3 | % 4 | % Default options for SLS1MM 5 | % 6 | % opt = sls1mm_opt; 7 | % return default options 8 | % opt = sls1mm_opt(opt); 9 | % fill empty options with default values 10 | % 11 | % The options and defaults are (default value) 12 | % maxiter (50) 13 | % maximum number of iterations for the shrinkage procedure, in case 14 | % this is exceeded the other parameters might not be properly assigned 15 | % mmlimits ([0; 1]) 16 | % absolute limits for the slice (minmax) 17 | % 18 | % See also 19 | % SLS1MM 20 | 21 | % Copyright (c) 2003-2004 Toni Auranen 22 | % Copyright (c) 2004 Aki Vehtari 23 | 24 | % This software is distributed under the GNU General Public 25 | % License (version 3 or later); please refer to the file 26 | % License.txt, included with the software, for details. 27 | 28 | if nargin < 1 29 | opt=[]; 30 | end 31 | 32 | if ~isfield(opt,'maxiter') 33 | opt.maxiter = 50; 34 | end 35 | if ~isfield(opt,'mmlimits') 36 | opt.mmlimits = [0; 1]; 37 | end 38 | -------------------------------------------------------------------------------- /mc/take_nth.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/mc/take_nth.m -------------------------------------------------------------------------------- /mc/thin.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/mc/thin.m -------------------------------------------------------------------------------- /mc/winCsource/ars.h: -------------------------------------------------------------------------------- 1 | /* ARS.H - Interface to Adaptive Rejection Sampling procedure. */ 2 | 3 | 4 | /* Copyright (c) 1995-2003 by Carl Edward Rasmussen and Radford M. Neal 5 | * 6 | * Permission is granted for anyone to copy, use, modify, or distribute this 7 | * program and accompanying programs and documents for any purpose, provided 8 | * this copyright notice is retained and prominently displayed, along with 9 | * a note saying that the original programs are available from Radford Neal's 10 | * web page, and note is made of any changes made to the programs. The 11 | * programs and documents are distributed without any warranty, express or 12 | * implied. As the programs were written for research purposes only, they have 13 | * not been tested to the degree that would be advisable in any important 14 | * application. All use of these programs is entirely at the user's own risk. 15 | */ 16 | 17 | double ars(double, double, double (*)(double, double *, void *), void *); 18 | -------------------------------------------------------------------------------- /mc/winCsource/binsgeq.c: -------------------------------------------------------------------------------- 1 | /* binsgeq 2 | * 3 | * binary search of a sorted (in ascending order) double array <*vec> 4 | * of length for a first element which is greater than or equal 5 | * to a key . If no greater element is found, returns . 6 | */ 7 | 8 | 9 | /* Copyright (c) 1998-2004 Aki Vehtari 10 | * 11 | *This software is distributed under the GNU General Public 12 | *License (version 3 or later); please refer to the file 13 | *License.txt, included with the software, for details. 14 | * 15 | */ 16 | 17 | double binsgeq(double *vec, int len, double item) 18 | { 19 | int low=0, high=len-1, mid; 20 | if (item<=vec[0]) { 21 | return 1.0; 22 | } 23 | while ((high-low) > 1) { 24 | mid=(high+low)/2; 25 | if (item>vec[mid]) 26 | low = mid; 27 | else 28 | high = mid; 29 | } 30 | return high+1.0; 31 | } 32 | -------------------------------------------------------------------------------- /mc/winCsource/binsgeq.h: -------------------------------------------------------------------------------- 1 | /* Copyright (c) 1998-2004 Aki Vehtari 2 | * 3 | *This software is distributed under the GNU General Public 4 | *License (version 3 or later); please refer to the file 5 | *License.txt, included with the software, for details. 6 | * 7 | */ 8 | 9 | double binsgeq(double *, int, double); 10 | -------------------------------------------------------------------------------- /misc/Contents.m: -------------------------------------------------------------------------------- 1 | % MISCELLANEOUS FUNCTIONS (in the misc-folder) 2 | % 3 | % ADDLOGS - Add numbers represented by their logarithms. 4 | % BINSGEQ - Binary search of sorted vector 5 | % CVIT - Create itr and itst indeces for k-fold-cv 6 | % DENORMDATA - De-normalize normalized data 7 | % HMEAN - Harmonic mean 8 | % LOGIT - Logit transformation 9 | % LOGITINV - Inverse of the logit transformation 10 | % NORMDATA - Normalize input to zero mean and unit variance 11 | % SET_PIC - Set the inducing inputs and blocks for two dimensional input data 12 | % SETRANDSTREAM - Set random stream 13 | % SOFTMAX2 - Softmax transfer function 14 | % STR2FUN - Compatibility wrapper to str2func 15 | % SUMLOGS - Sum of vector where numbers are represented by their logarithms. 16 | % VIOLINPLOT - Plot a violinplot 17 | % WMEAN - Weighted mean 18 | % WPRCTILE - Prctiles from weighted data 19 | % 20 | % Colormaps 21 | % MAPCOLOR - Returns a colormap ranging from blue through gray to red 22 | % MAPCOLOR2 - Create a blue-gray-red colormap 23 | % 24 | % Mapping helper 25 | % M2KML - Converts GP prediction results to a KML file 26 | -------------------------------------------------------------------------------- /misc/addlogs.m: -------------------------------------------------------------------------------- 1 | function c=addlogs(a,b) 2 | %ADDLOGS Add numbers represented by their logarithms. 3 | % 4 | % Description 5 | % C=ADDLOGS(A,B) computes C=log(exp(A)+exp(B)) in such a fashion 6 | % that it works even when A and B have large magnitude. 7 | % 8 | % Copyright (c) 2003 Aki Vehtari 9 | 10 | % This software is distributed under the GNU General Public 11 | % License (version 3 or later); please refer to the file 12 | % License.txt, included with the software, for details. 13 | 14 | if a>b 15 | c = a + log(1+exp(b-a)); 16 | else 17 | c = b + log(1+exp(a-b)); 18 | end 19 | -------------------------------------------------------------------------------- /misc/binsgeq.m: -------------------------------------------------------------------------------- 1 | function s=binsgeq(pc,p) 2 | %BINSGEQ Binary search of sorted vector 3 | % 4 | % Description: 5 | % S=BINSGEQ(PC,P) Binary search of a sorted (in ascending order) 6 | % vector PC for a first element which is greater than or equal to 7 | % a key P. If no greater element is found, returns LENGTH(PC). 8 | % The size of S is the size of P. 9 | % 10 | % Copyright (c) 2004 Aki Vehtari 11 | 12 | % This software is distributed under the GNU General Public 13 | % License (version 3 or later); please refer to the file 14 | % License.txt, included with the software, for details. 15 | 16 | % This is fast only in Matlab 6.5 and later with JIT accelerator 17 | n=numel(pc); 18 | [pm,pn]=size(p); 19 | s=zeros(pm,pn); 20 | for i=1:(pm*pn) 21 | pi=p(i); 22 | if pi<=pc(1) 23 | s(i)=1; 24 | else 25 | low=1; 26 | high=n; 27 | while (high-low)>1 28 | mid=floor((high+low)/2); 29 | if pi>pc(mid) 30 | low=mid; 31 | else 32 | high=mid; 33 | end 34 | end 35 | s(i)=high; 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /misc/cvit.m: -------------------------------------------------------------------------------- 1 | function [itr, itst] = cvit(n, k, rsubstream) 2 | %CVIT Create itr and itst indeces for k-fold-cv 3 | % 4 | % Description 5 | % [ITR,ITST]=CVIT(N,K) returns 1xK cell arrays ITR and ITST 6 | % holding cross-validation indeces for train and test sets 7 | % respectively. K-fold division is balanced with all sets having 8 | % floor(N/K) or ceil(N/K) elements. 9 | % 10 | % [ITR,ITST]=CVIT(N,K,RS) with integer RS>0 also makes random 11 | % permutation, using substream RS. This way different 12 | % permutations can be produced with different RS values, but 13 | % same permutation is obtained when called again with same RS. 14 | % Function restores the previous random stream before exiting. 15 | % 16 | % Copyright (c) 2010 Aki Vehtari 17 | 18 | % This software is distributed under the GNU General Public 19 | % License (version 3 or later); please refer to the file 20 | % License.txt, included with the software, for details. 21 | 22 | if nargin<3 23 | rsubstream=0; 24 | end 25 | if nargin < 2 26 | k=10; 27 | end 28 | a=k-rem(n,k); 29 | b=floor(n/k); 30 | for cvi=1:a 31 | itst{cvi}=[[1:b]+(cvi-1)*b]; 32 | itr{cvi}=setdiff(1:n,itst{cvi}); 33 | end 34 | for cvi=(a+1):k 35 | itst{cvi}=[(a*b)+[1:(b+1)]+(cvi-a-1)*(b+1)]; 36 | itr{cvi}=setdiff(1:n,itst{cvi}); 37 | end 38 | 39 | if rsubstream>0 40 | prevstream=setrandstream(rsubstream, 'mrg32k3a'); 41 | 42 | rii=randperm(n); 43 | for cvi=1:k 44 | itst{cvi}=rii(itst{cvi}); 45 | itr{cvi}=rii(itr{cvi}); 46 | end 47 | 48 | setrandstream(prevstream); 49 | end 50 | -------------------------------------------------------------------------------- /misc/denormdata.m: -------------------------------------------------------------------------------- 1 | function [x] = denormdata(xn,xmean,xstd) 2 | %DENORMDATA De-normalize normalized data 3 | % 4 | % Description 5 | % X = DENORMDATA(XN,XMEAN,XSTD) de-normalize XN using 6 | % precomputed XMEAN and XSTD. 7 | % 8 | % See also NORMDATA 9 | % 10 | % Copyright (c) 2010 Aki Vehtari 11 | 12 | % This software is distributed under the GNU General Public 13 | % License (version 3 or later); please refer to the file 14 | % License.txt, included with the software, for details. 15 | 16 | if nargin<3 17 | error('Too few arguments') 18 | end 19 | x=bsxfun(@plus,bsxfun(@times,xn,xstd),xmean); 20 | -------------------------------------------------------------------------------- /misc/gpstuff_version.m: -------------------------------------------------------------------------------- 1 | function version = gpstuff_version(str) 2 | % Return version of currently used gpstuff 3 | % 4 | % gpstuff_version() returns string including release number and release 5 | % date 6 | % 7 | % gpstuff_version('date') returns the release date (string) 8 | % 9 | % gpstuff_version('release') returns the release number (double) 10 | % 11 | % Copyright (c) 2013 Ville Tolvanen 12 | 13 | 14 | if nargin==0 15 | version='4.2_2013-06-14'; 16 | elseif isequal(str, 'date') 17 | version='2013-06-14'; 18 | elseif isequal(str, 'release') 19 | version=4.2; 20 | end 21 | 22 | 23 | 24 | end 25 | 26 | -------------------------------------------------------------------------------- /misc/hmean.m: -------------------------------------------------------------------------------- 1 | function y = hmean(x) 2 | % HMEAN 1/mean(1/input) 3 | % 4 | % Description: 5 | % Y = HMEAN(X) evaluates y=1./mean(1./x) 6 | % 7 | % Copyright (c) 1998 Aki Vehtari 8 | 9 | % This software is distributed under the GNU General Public 10 | % License (version 3 or later); please refer to the file 11 | % License.txt, included with the software, for details. 12 | 13 | y=1./mean(1./x); 14 | -------------------------------------------------------------------------------- /misc/logit.m: -------------------------------------------------------------------------------- 1 | function v = logit(u) 2 | %LOGIT Logit transformation 3 | % 4 | % Description 5 | % V = LOGIT(U) computes the logit transformation of U 6 | % 7 | % V = LOG(U./(1-U)) 8 | % 9 | % See also LOGITINV 10 | % 11 | % Copyright (c) 2011 Aki Vehtari 12 | 13 | % This software is distributed under the GNU General Public 14 | % License (version 3 or later); please refer to the file 15 | % License.txt, included with the software, for details. 16 | 17 | warning off MATLAB:divideByZero 18 | v=reallog(u./(1-u)); 19 | warning on MATLAB:divideByZero 20 | -------------------------------------------------------------------------------- /misc/logitinv.m: -------------------------------------------------------------------------------- 1 | function u = logitinv(v) 2 | %LOGITINV Inverse of the logit transformation 3 | % 4 | % Description 5 | % U = LOGITINV(V) computes the inverse of the logit 6 | % transformation of U 7 | % 8 | % U = 1./(1 + EXP(-V)) 9 | % 10 | % See also LOGIT 11 | % 12 | % Copyright (c) 2011 Aki Vehtari 13 | 14 | % This software is distributed under the GNU General Public 15 | % License (version 3 or later); please refer to the file 16 | % License.txt, included with the software, for details. 17 | 18 | maxcut = -log(eps); 19 | mincut = -log(1/realmin - 1); 20 | u = 1 ./ (1 + exp(-max(min(v,maxcut),mincut))); 21 | -------------------------------------------------------------------------------- /misc/normdata.m: -------------------------------------------------------------------------------- 1 | function [xn, xmean, xstd] = normdata(x,xmean,xstd) 2 | %NORMDATA Normalize input to zero mean and unit variance 3 | % 4 | % Description 5 | % [XN, XMEAN, XSTD] = NORMDATA(X) normalizes X to zero mean and 6 | % unit variance. Returns normalized XN, mean of X XMEAN and 7 | % standard deviance of X XSTD. 8 | % 9 | % XN = NORMDATA(X,XMEAN,XSTD) normalizes X using precomputed 10 | % XMEAN and XSTD. 11 | % 12 | % See also DENORMDATA 13 | % 14 | % Copyright (c) 2010 Aki Vehtari 15 | 16 | % This software is distributed under the GNU General Public 17 | % License (version 3 or later); please refer to the file 18 | % License.txt, included with the software, for details. 19 | 20 | if nargin<=1 21 | xmean=nanmean(x); 22 | xstd=nanstd(x); 23 | end 24 | xn=bsxfun(@rdivide,bsxfun(@minus,x,xmean),xstd); 25 | -------------------------------------------------------------------------------- /misc/softmax2.m: -------------------------------------------------------------------------------- 1 | function a = softmax2(n) 2 | %SOFTMAX2 Softmax transfer function 3 | % 4 | % Description 5 | % A = SOFTMAX2(N) takes a matrix N of network outputs and 6 | % transfers it through a sotmax function to get A. 7 | % 8 | % Code: 9 | % temp = exp(n); 10 | % a = temp./(sum(temp, 2)*ones(1,size(n,2))); 11 | % 12 | % See also 13 | % MLP2, MLP2PAK, MLP2UNPAK, MLP2ERR, MLP2BKP, MLP2GRAD 14 | % 15 | % Copyright (c) 1999 Aki Vehtari 16 | 17 | % This software is distributed under the GNU General Public 18 | % License (version 3 or later); please refer to the file 19 | % License.txt, included with the software, for details. 20 | 21 | temp = exp(n); 22 | a = temp./(sum(temp, 2)*ones(1,size(n,2))); 23 | -------------------------------------------------------------------------------- /misc/str2fun.m: -------------------------------------------------------------------------------- 1 | function f = str2fun(f) 2 | % STR2FUN - Compatibility wrapper to str2func 3 | % 4 | % Description 5 | % the code of function: 6 | % 7 | % if exist('str2func') 8 | % f=str2func(f); 9 | % end 10 | % 11 | % Copyright (c) 1998-2004 Aki Vehtari 12 | 13 | % This software is distributed under the GNU General Public 14 | % License (version 3 or later); please refer to the file 15 | % License.txt, included with the software, for details. 16 | 17 | if exist('str2func') 18 | f=str2func(f); 19 | end 20 | -------------------------------------------------------------------------------- /misc/sumlogs.m: -------------------------------------------------------------------------------- 1 | function y = sumlogs(x,dim) 2 | %SUMLOGS Sum of elements where numbers are represented by their logarithms. 3 | % 4 | % Description 5 | % C=SUMLOGS(A) computes C=log(sum(exp(A))) in such a fashion 6 | % that it works even when elements have large magnitude. 7 | % 8 | % C=SUMLOGS(A,DIM) sums along the dimension DIM. 9 | % 10 | % See also SUM 11 | % 12 | % Copyright (c) 2013 Aki Vehtari 13 | 14 | % This software is distributed under the GNU General Public 15 | % License (version 3 or later); please refer to the file 16 | % License.txt, included with the software, for details. 17 | 18 | if nargin<2 19 | dim=find(size(x)>1,1); 20 | end 21 | maxx=max(x(:)); 22 | y=maxx+log(sum(exp(x-maxx),dim)); 23 | -------------------------------------------------------------------------------- /misc/wmean.m: -------------------------------------------------------------------------------- 1 | function y = wmean(x, w) 2 | %WMEAN Weighted average or mean value. 3 | % 4 | % Description 5 | % WMEAN(X,W) is the weighted mean value of the elements in X 6 | % (along first dimension) given weights W. 7 | % 8 | % See also wprctile 9 | % 10 | % Copyright (c) 2000-2013 Aki Vehtari 11 | 12 | % This software is distributed under the GNU General Public 13 | % License (version 3 or later); please refer to the file 14 | % License.txt, included with the software, for details. 15 | 16 | y=sum(bsxfun(@times,x,w),1); 17 | -------------------------------------------------------------------------------- /misc/wprctile.m: -------------------------------------------------------------------------------- 1 | function y = wprctile(x, p, w) 2 | %WPRCTILE Percentiles of a weighted sample. 3 | % 4 | % Description 5 | % Y = PRCTILE(X, P, W) returns percentiles of the values in X 6 | % (along the first dimension). P is a scalar or a vector of percent 7 | % values. W is a vector of unnormalized weights for samples. Length 8 | % of W has to be same as length of X. X need to be a a vector. Y is 9 | % the same size as P, and Y(i) contains the P(i)-th percentile. 10 | % 11 | % Example 12 | % y = prctile(x,50,w); % the median of x given sample weights w 13 | % 14 | % See also wmean, prctile 15 | % 16 | % Copyright (c) 2000-2013 Aki Vehtari 17 | 18 | % This software is distributed under the GNU General Public 19 | % License (version 3 or later); please refer to the file 20 | % License.txt, included with the software, for details. 21 | 22 | x=sort(x,1); 23 | p=p./100; 24 | y=zeros(length(p),size(x,2)); 25 | ww=cumsum(w);ww=ww./ww(end); 26 | for j=1:length(p) 27 | wi=min(find(ww>=p(j))); 28 | if wi==1 29 | y(j,:)=x(1,:); 30 | else 31 | w1=ww(wi-1);x1=x(wi-1,:); 32 | y(j,:)=x1+(x(wi,:)-x1).*(p(j)-w1)./(ww(wi)-w1); 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /optim/Contents.m: -------------------------------------------------------------------------------- 1 | % OPTIMIZATION FUNCTIONS (in the optim-folder) 2 | % 3 | % BSEARCH - Finds the minimum of a combinatorial function using backward search 4 | % BSEARCH_OPT - Default options for backward search 5 | % FSEARCH - Finds the minimum of a combinatorial function using forward search 6 | % FSEARCH_OPT - Default options for forward search 7 | % SCGES - Scaled conjugate gradient optimization with early stopping 8 | % SCGES_OPT - Default options for scaled conjugate gradient optimization 9 | % SCGES - Scaled conjugate gradient optimization with early stopping (new options structure). 10 | % SCG2 - Scaled conjugate gradient optimization 11 | % SCG2_OPT - Default options for scaled conjugate gradient optimization (scg2) (new options structure). 12 | % FMINSCG - Scaled conjugate gradient optimization 13 | % FMINLBFGS - (Limited memory) Quasi Newton 14 | % Broyden-Fletcher-Goldfarb-Shanno (BFGS) 15 | -------------------------------------------------------------------------------- /optim/bsearch_opt.m: -------------------------------------------------------------------------------- 1 | function opt = bsearch_opt(opt) 2 | %BSEARCH_OPT Default options for backward search 3 | % 4 | % Default options for BSEARCH 5 | % 6 | % opt=bsearch_options; 7 | % return default otions 8 | % opt=bsearch_options(opt); 9 | % fill empty options with default values 10 | % 11 | % The options and defaults are 12 | % display (0) 13 | % 0 off 14 | % 1 on 15 | % 2 more 16 | % nsel(1) 17 | % minimum number of columns, Inf means all 18 | % stop (0) 19 | % stop if value does not increase 20 | % stopvalue (-Inf) 21 | % stop if the current best value smaller than stopvalue 22 | 23 | % Copyright (c) Aki Vehtari (2004-2007) 24 | 25 | % This software is distributed under the GNU General Public 26 | % License (version 3 or later); please refer to the file 27 | % License.txt, included with the software, for details. 28 | 29 | 30 | if nargin < 1 31 | opt=[]; 32 | end 33 | 34 | if ~isfield(opt,'display') 35 | opt.display=0; 36 | end 37 | if ~isfield(opt,'nsel') 38 | opt.nsel=1; 39 | end 40 | if ~isfield(opt,'stop') 41 | opt.stop=0; 42 | end 43 | if ~isfield(opt,'stopvalue') 44 | opt.stopvalue=-Inf; 45 | end 46 | -------------------------------------------------------------------------------- /optim/fsearch_opt.m: -------------------------------------------------------------------------------- 1 | function opt = fsearch_opt(opt) 2 | %FSEARCH_OPT Default options for forward search 3 | % 4 | % Default options for FSEARCH 5 | % 6 | % opt=fsearch_options; 7 | % return default otions 8 | % opt=fsearch_options(opt); 9 | % fill empty options with default values 10 | % 11 | % The options and defaults are 12 | % display (0) 13 | % 0 off 14 | % 1 on 15 | % 2 more 16 | % nsel(Inf) 17 | % maximum number of columns, Inf means all 18 | % stop (0) 19 | % stop if the value does not increase 20 | % stopvalue (-Inf) 21 | % stop if the current best value smaller than stopvalue 22 | % 23 | % Copyright (c) Aki Vehtari (2004-2007) 24 | 25 | % This software is distributed under the GNU General Public 26 | % License (version 3 or later); please refer to the file 27 | % License.txt, included with the software, for details. 28 | 29 | if nargin < 1 30 | opt=[]; 31 | end 32 | 33 | if ~isfield(opt,'display') 34 | opt.display=0; 35 | end 36 | if ~isfield(opt,'nsel') 37 | opt.nsel=Inf; 38 | end 39 | nsel = max(1,opt.nsel); 40 | if ~isfield(opt,'stop') 41 | opt.stop=0; 42 | end 43 | if ~isfield(opt,'stopvalue') 44 | opt.stopvalue=-Inf; 45 | end 46 | -------------------------------------------------------------------------------- /optim/scg2_opt.m: -------------------------------------------------------------------------------- 1 | function opt = scg2_opt(opt) 2 | %SCG2_OPT Default options for scaled conjugate gradient optimization 3 | % 4 | % Description 5 | % OPT=SCG2_OPT returns default options for SCG2 6 | % OPT=SCG2_OPT(OPT); fills empty options with default values 7 | % 8 | % The options and defaults are 9 | % display (0) 10 | % 0 to not display anything 11 | % 1 to display just diagnostic messages 12 | % 2 positive integer to show also the function values and 13 | % validation values every iteration 14 | % checkgrad (0) 15 | % 1 to check the user defined gradient function 16 | % maxiter (1000) 17 | % maximum number of iterations 18 | % tolfun (1e-6) 19 | % termination tolerance on the function value 20 | % tolx (1e-6) 21 | % termination tolerance on X 22 | % 23 | % See also 24 | % SCG2 25 | 26 | % Copyright (c) Aki Vehtari (1998-2010) 27 | 28 | % This software is distributed under the GNU General Public 29 | % License (version 3 or later); please refer to the file 30 | % License.txt, included with the software, for details. 31 | 32 | if nargin < 1 33 | opt=[]; 34 | end 35 | 36 | if ~isfield(opt,'display') 37 | opt.display=0; 38 | end 39 | if ~isfield(opt,'checkgrad') 40 | opt.checkgrad=0; 41 | end 42 | if ~isfield(opt,'maxiter') | opt.maxiter < 1 43 | opt.maxiter=100; 44 | end 45 | if ~isfield(opt,'tolfun') | opt.tolfun < 0 46 | opt.tolfun=1e-6; 47 | end 48 | if ~isfield(opt,'tolx') | opt.tolx < 0 49 | opt.tolx=1e-6; 50 | end 51 | -------------------------------------------------------------------------------- /optim/scges_opt.m: -------------------------------------------------------------------------------- 1 | function opt = scges_opt(opt) 2 | %SCGES_OPT Default options for scaled conjugate gradient optimization 3 | % 4 | % Description 5 | % OPT=SCGES_OPT returns default options for SCGES 6 | % OPT=SCGES_OPT(OPT); fills empty options with default values 7 | % 8 | % The options and defaults are 9 | % display (0) 10 | % 0 to not display anything 11 | % 1 to display just diagnostic messages 12 | % 2 positive integer to show also the function values and 13 | % validation values every iteration 14 | % checkgrad (0) 15 | % 1 to check the user defined gradient function 16 | % maxiter (1000) 17 | % maximum number of iterations 18 | % tolfun (1e-6) 19 | % termination tolerance on the function value 20 | % tolx (1e-6) 21 | % termination tolerance on X 22 | % 23 | % See also 24 | % SCGES 25 | 26 | % Copyright (c) Aki Vehtari (1998-2010) 27 | 28 | % This software is distributed under the GNU General Public 29 | % License (version 3 or later); please refer to the file 30 | % License.txt, included with the software, for details. 31 | 32 | if nargin < 1 33 | opt=[]; 34 | end 35 | 36 | if ~isfield(opt,'display') 37 | opt.display=0; 38 | end 39 | if ~isfield(opt,'checkgrad') 40 | opt.checkgrad=0; 41 | end 42 | if ~isfield(opt,'maxiter') | opt.maxiter < 1 43 | opt.maxiter=100; 44 | end 45 | if ~isfield(opt,'tolfun') | opt.tolfun < 0 46 | opt.tolfun=1e-6; 47 | end 48 | if ~isfield(opt,'tolx') | opt.tolx < 0 49 | opt.tolx=1e-6; 50 | end 51 | if ~isfield(opt,'maxfail') 52 | opt.maxfail=20; 53 | end 54 | -------------------------------------------------------------------------------- /startup.m: -------------------------------------------------------------------------------- 1 | % If Matlab is started in GPstuff root directory, this startup.m 2 | % adds subfolders automatically to the path 3 | F = mfilename; 4 | S = which(F); 5 | if exist('OCTAVE_VERSION', 'builtin') 6 | subfolders={'diag' 'dist' 'gp' 'mc' 'misc' 'optim' 'tests', 'octave_compat', 'inputparser'}; 7 | else 8 | subfolders={'diag' 'dist' 'gp' 'mc' 'misc' 'optim' 'tests'}; 9 | end 10 | for sf=subfolders 11 | addpath(strrep(S,[F '.m'],sf{:})) 12 | end 13 | 14 | 15 | % Alternatively copy following lines to startup.m in MATLAB startup folder 16 | % and edit gpstuffroot to point where you have installed the GPstuff 17 | %gpstuffroot='/...' 18 | %addpath([gpstuffroot 'diag']) 19 | %addpath([gpstuffroot 'dist']) 20 | %addpath([gpstuffroot 'gp']) 21 | %addpath([gpstuffroot 'mc']) 22 | %addpath([gpstuffroot 'misc']) 23 | %addpath([gpstuffroot 'optim']) 24 | %addpath([gpstuffroot 'tests']) 25 | 26 | % If using Octave version of GPstuff, also add the following 27 | %addpath([gpstuffroot 'inputparser']) 28 | %addpath([gpstuffroot 'octave_compat']) -------------------------------------------------------------------------------- /tests/Readme.txt: -------------------------------------------------------------------------------- 1 | This directory contains unit test for GPstuff. The tests can be run using 2 | the built-in unit test framewoork (Matlab 2013b or greater) or using the 3 | xUnit package by Steve Eddins. 4 | 5 | Test structure in every test is basically the same: Run demo, save values 6 | from demo, compare those saved test values to previously saved "correct" 7 | values. Users can run these tests to determine if some calculations within 8 | demos don't give correct answers. 9 | 10 | Tests are named test_.m (e.g. test_binomial.m is a corresponding 11 | test for demo_binomial1.m) and they can include multiple test cases each. 12 | Individual tests can be run with command "runtests ". 13 | Function runtestset can be used to run all the tests or a predetermined set 14 | of tests. 15 | 16 | When a test is run, the results of the demo are saved into the folder 17 | testValues. The saved components include figures, selected workspace 18 | variables and the log file of the command line output. Folder realValues 19 | contain similar precomputed files for each demo. 20 | 21 | For more information to the MATLAB unit testing framework, see Matlab 22 | documentation. 23 | 24 | For more information to the xUnit Test Framework package, visit 25 | http://www.mathworks.com/matlabcentral/fx_files/22846/11/content/matlab_xunit/doc/xunit_product_page.html 26 | 27 | Real values from revision 990. 28 | -------------------------------------------------------------------------------- /tests/realValues/bayesoptimization1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/bayesoptimization1.mat -------------------------------------------------------------------------------- /tests/realValues/bayesoptimization2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/bayesoptimization2.mat -------------------------------------------------------------------------------- /tests/realValues/bayesoptimization3.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/bayesoptimization3.mat -------------------------------------------------------------------------------- /tests/realValues/binomial1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial1.mat -------------------------------------------------------------------------------- /tests/realValues/binomial1.txt: -------------------------------------------------------------------------------- 1 | TolFun reached. Func-count 37. Final f(x)=169.569. Elapsed time 1.02 2 | 3 | gp hyperparameters: 4 | 5 | -0.7902 -1.0035 6 | 7 | Demo completed in 0.088 minutes 8 | -------------------------------------------------------------------------------- /tests/realValues/binomial1_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial1_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/binomial1_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial1_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/binomial1_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial1_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/binomial2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial2.mat -------------------------------------------------------------------------------- /tests/realValues/binomial2.txt: -------------------------------------------------------------------------------- 1 | Laplace+grid approximation IA-grid: finding the mode 2 | IA-grid: computing Hessian using multiplication 3 | IA-grid: evaluating density in a grid 4 | IA-grid: evaluated density at 30 points 5 | Elapsed time 2s 6 | EP+grid approximation IA-grid: finding the mode 7 | IA-grid: computing Hessian using multiplication 8 | IA-grid: evaluating density in a grid 9 | IA-grid: evaluated density at 30 points 10 | Elapsed time 1.03 seconds 11 | IA-grid: Total elapsed time 1.23 seconds 12 | Elapsed time 5s 13 | MCMC approximation Elapsed time 194s 14 | 15 | gp hyperparameters: 16 | 17 | 4.3811 2.3256 18 | 19 | Demo completed in 3.367 minutes 20 | -------------------------------------------------------------------------------- /tests/realValues/binomial2_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial2_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/binomial_apc.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial_apc.mat -------------------------------------------------------------------------------- /tests/realValues/binomial_apc_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial_apc_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/binomial_apc_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/binomial_apc_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/classific.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/classific.mat -------------------------------------------------------------------------------- /tests/realValues/classific.txt: -------------------------------------------------------------------------------- 1 | Probit model with Laplace integration over the latent values and 2 | MAP estimate for the parameters 3 | TolFun reached. Func-count 27. Final f(x)=81.5289. Elapsed time 1.10 4 | Probit model with EP integration over the latent values and 5 | MAP estimate for the parameters 6 | TolFun reached. Func-count 7. Final f(x)=81.748. Elapsed time 0.30 7 | Probit model with MCMC integration over the latent values and 8 | the parameters 9 | Using SSLS sampler for hyperparameters and ESLS for latent values 10 | cycle etr lslsn 11 | 20 -943.088 2.0e+00 12 | 40 -933.602 7.0e+00 13 | 60 -975.302 7.0e+00 14 | 80 -978.888 6.0e+00 15 | 100 -1009.051 1.1e+01 16 | 120 -1048.534 7.0e+00 17 | 140 -1027.652 6.0e+00 18 | 160 -1001.384 6.0e+00 19 | 180 -1016.275 2.0e+00 20 | 200 -1090.211 4.0e+00 21 | 220 -1088.827 0.0e+00 22 | Compare MCMC, Laplace and EP results for two latent variables 23 | 24 | gp hyperparameters: 25 | 26 | 3.2607 -0.7237 0.0613 27 | 28 | Demo completed in 0.966 minutes 29 | -------------------------------------------------------------------------------- /tests/realValues/classific_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/classific_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/classific_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/classific_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/classific_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/classific_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/classific_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/classific_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/classific_fig5.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/classific_fig5.fig -------------------------------------------------------------------------------- /tests/realValues/classific_fig6.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/classific_fig6.fig -------------------------------------------------------------------------------- /tests/realValues/classific_fig7.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/classific_fig7.fig -------------------------------------------------------------------------------- /tests/realValues/derivativeobs.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivativeobs.mat -------------------------------------------------------------------------------- /tests/realValues/derivativeobs.txt: -------------------------------------------------------------------------------- 1 | GP model without derivative obs 2 | Checking gradient ... 3 | 4 | analytic diffs delta 5 | 6 | 2.2001 2.2001 0.0000 7 | -1.0624 -1.0624 -0.0000 8 | 9 | TolFun reached. Func-count 17. Final f(x)=5.67863. Elapsed time 0.12 10 | GP model with derivative obs 11 | Checking gradient ... 12 | 13 | analytic diffs delta 14 | 15 | 3.6684 3.6684 0.0000 16 | -10.3567 -10.3567 -0.0000 17 | 1.1596 1.1596 0.0000 18 | 19 | TolX reached. Func-count 19. Final f(x)=3.15085. Elapsed time 0.17 20 | 21 | gp hyperparameters: 22 | 23 | -1.6957 -0.3805 -4.1351 24 | 25 | Demo completed in 0.012 minutes 26 | -------------------------------------------------------------------------------- /tests/realValues/derivativeobs_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivativeobs_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives.mat -------------------------------------------------------------------------------- /tests/realValues/derivatives.txt: -------------------------------------------------------------------------------- 1 | TolFun reached. Func-count 28. Final f(x)=8.83586. Elapsed time 0.29 2 | TolFun reached. Func-count 31. Final f(x)=5.26377. Elapsed time 0.20 3 | TolFun reached. Func-count 25. Final f(x)=8.76508. Elapsed time 0.15 4 | TolFun reached. Func-count 55. Final f(x)=9.8007. Elapsed time 1.07 5 | TolFun reached. Func-count 26. Final f(x)=9.30243. Elapsed time 0.51 6 | TolFun reached. Func-count 19. Final f(x)=27.0383. Elapsed time 0.50 7 | TolFun reached. Func-count 19. Final f(x)=28.9647. Elapsed time 0.60 8 | TolX reached. Func-count 43. Final f(x)=57.4604. Elapsed time 4.95 9 | TolFun reached. Func-count 51. Final f(x)=13.8857. Elapsed time 0.29 10 | TolX reached. Func-count 28. Final f(x)= 2.899. Elapsed time 0.28 11 | TolFun reached. Func-count 27. Final f(x)=7.30701. Elapsed time 0.19 12 | TolFun reached. Func-count 30. Final f(x)=-14.7792. Elapsed time 0.40 13 | TolFun reached. Func-count 19. Final f(x)=8.95452. Elapsed time 0.13 14 | TolFun reached. Func-count 29. Final f(x)=11.6177. Elapsed time 0.94 15 | 16 | gp hyperparameters: 17 | 18 | 0.2063 0.5772 -1.1356 1.2508 -5.3190 19 | 20 | Demo completed in 0.228 minutes 21 | -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig5.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig5.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig6.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig6.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig7.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig7.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig8.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig8.fig -------------------------------------------------------------------------------- /tests/realValues/derivatives_fig9.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/derivatives_fig9.fig -------------------------------------------------------------------------------- /tests/realValues/epinf.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/epinf.mat -------------------------------------------------------------------------------- /tests/realValues/epinf.txt: -------------------------------------------------------------------------------- 1 | Optimise the input-dependent model 2 | Iteration Func-count f(x) Lambda 3 | 0 1 783.75 4 | 1 3 783.714 10 5 | 2 5 783.705 5 6 | 3 7 783.705 2.5 7 | 4 8 783.705 10 8 | 5 10 783.703 10 9 | 6 12 783.703 5 10 | 7 13 783.703 20 11 | TolFun reached. Func-count 13. Final f(x)=783.703. Elapsed time 4600.79 12 | mlpd input-dependent: -0.99 13 | Optimise the normal gaussian model 14 | Iteration Func-count f(x) Lambda 15 | 0 1 2984.2 16 | 1 3 1408.89 10 17 | 2 5 937.085 5 18 | 3 7 837.594 2.5 19 | 4 9 828.249 1.25 20 | 5 11 827.869 0.625 21 | 6 13 827.834 0.312 22 | 7 15 827.818 0.156 23 | 8 17 827.811 0.0781 24 | 9 19 827.796 0.0391 25 | 10 21 827.795 0.0195 26 | 11 23 827.795 0.00977 27 | 12 25 827.795 0.00488 28 | TolFun reached. Func-count 25. Final f(x)=827.795. Elapsed time 1.47 29 | mlpd gaussian: -1.12 30 | 31 | gp hyperparameters: 32 | 33 | 0.1823 -2.4816 -0.3657 -1.3494 1.0286 -0.2708 34 | 35 | Demo completed in 76.727 minutes 36 | -------------------------------------------------------------------------------- /tests/realValues/epinf_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/epinf_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/epinf_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/epinf_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/hierprior.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/hierprior.mat -------------------------------------------------------------------------------- /tests/realValues/hierprior_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/hierprior_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/hurdle.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/hurdle.mat -------------------------------------------------------------------------------- /tests/realValues/hurdle_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/hurdle_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/improvemarginals.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/improvemarginals.mat -------------------------------------------------------------------------------- /tests/realValues/improvemarginals.txt: -------------------------------------------------------------------------------- 1 | Time elapsed for marginal corrections with EP-FACT: 0.2 s and for predictions 0.1 s 2 | Time elapsed for marginal corrections with LA-CM2: 0.2 s and for predictions 0.1 s 3 | Time elapsed for marginal corrections with LA-FACT: 0.1 s and for predictions 0.1 s 4 | 5 | gp hyperparameters: 6 | 7 | 2.3026 -0.1054 -0.1054 8 | 9 | Demo completed in 0.029 minutes 10 | -------------------------------------------------------------------------------- /tests/realValues/improvemarginals_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/improvemarginals_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/improvemarginals_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/improvemarginals_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/kalman1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/kalman1.mat -------------------------------------------------------------------------------- /tests/realValues/kalman1.txt: -------------------------------------------------------------------------------- 1 | TolFun reached. Func-count 27. Final f(x)=-10.5562. Elapsed time 0.16 2 | TolFun reached. Func-count 27. Final f(x)=-10.5562. Elapsed time 1.36 3 | 4 | Parameter | FULL | KALMAN 5 | ----------------------------------- 6 | magnSigma2 | 0.0944 | 0.0944 7 | lengthScale | 0.7018 | 0.7018 8 | sigma2 | 0.0083 | 0.0083 9 | 10 | gp hyperparameters: 11 | 12 | -2.3606 -0.3541 -4.7891 13 | 14 | Demo completed in 0.036 minutes 15 | -------------------------------------------------------------------------------- /tests/realValues/kalman1_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/kalman1_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/kalman1_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/kalman1_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/kalman2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/kalman2.mat -------------------------------------------------------------------------------- /tests/realValues/kalman2_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/kalman2_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/kalman2_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/kalman2_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/kalman2_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/kalman2_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/lgcp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/lgcp.mat -------------------------------------------------------------------------------- /tests/realValues/lgcp.txt: -------------------------------------------------------------------------------- 1 | Coal disaster data with EP integration over the latent values 2 | Redwood data with Laplace integration over the latent 3 | values and MAP estimate for the parameters 4 | Demo completed in 0.094 minutes 5 | -------------------------------------------------------------------------------- /tests/realValues/lgcp_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/lgcp_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/lgcp_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/lgcp_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/loopred.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/loopred.mat -------------------------------------------------------------------------------- /tests/realValues/loopred_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/loopred_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/loopred_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/loopred_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/memorysave.txt: -------------------------------------------------------------------------------- 1 | Classification (EP), Neuralnetwork covariance function without and with memory saving (optimization and prediction) 2 | Elapsed time is 6.419354 seconds. 3 | Elapsed time is 6.433990 seconds. 4 | Classification (Laplace), Squared-Exponential covariance function without and with memory saving (optimization and prediction) 5 | Elapsed time is 1.118030 seconds. 6 | Elapsed time is 1.522736 seconds. 7 | Regression, FIC GP, Matern-3/2 covariance function, without and with memory saving (optimization and prediction) 8 | Elapsed time is 0.295367 seconds. 9 | Elapsed time is 0.314384 seconds. 10 | Regression, VAR GP, Squared-Exponential covariance function, without and with memory saving (optimization and prediction) 11 | Elapsed time is 2.041667 seconds. 12 | Elapsed time is 1.953337 seconds. 13 | Spatial process (Laplace), FIC GP, PPCS3 covariance function, without and with memory saving (optimization and prediction) 14 | Elapsed time is 0.911109 seconds. 15 | Elapsed time is 1.163756 seconds. 16 | Spatial process (EP), FIC GP, Squared-Exponential covariance function, without and with memory saving (optimization and prediction) 17 | Elapsed time is 11.673574 seconds. 18 | Elapsed time is 11.344609 seconds. 19 | Spatial process (Laplace), FIC GP, Neuralnetwork covariance function, without and with memory saving (optimization and prediction) 20 | Elapsed time is 0.872615 seconds. 21 | Elapsed time is 1.700451 seconds. 22 | 23 | gp hyperparameters: 24 | 25 | 0.2956 1.5729 -2.9479 4.1251 26 | 27 | Demo completed in 0.806 minutes 28 | -------------------------------------------------------------------------------- /tests/realValues/modelassesment1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/modelassesment1.mat -------------------------------------------------------------------------------- /tests/realValues/modelassesment2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/modelassesment2.mat -------------------------------------------------------------------------------- /tests/realValues/monotonic2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/monotonic2.mat -------------------------------------------------------------------------------- /tests/realValues/monotonic2_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/monotonic2_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/multiclass.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multiclass.mat -------------------------------------------------------------------------------- /tests/realValues/multiclass_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multiclass_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/multiclass_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multiclass_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/multiclass_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multiclass_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/multiclass_nested_ep.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multiclass_nested_ep.mat -------------------------------------------------------------------------------- /tests/realValues/multiclass_nested_ep.txt: -------------------------------------------------------------------------------- 1 | Optimize the hyperparameters 2 | Iteration Func-count Grad-count f(x) Step-size 3 | 0 1 1 145.286 4 | 1 2 2 106.602 0.0541548 5 | 2 5 5 102.985 0.120757 6 | 3 8 8 98.2436 0.0807225 7 | 4 10 10 98.0724 0.254374 8 | 5 11 11 98.0559 1 9 | 6 12 12 98.0407 1 10 | 7 14 14 98.0398 0.216519 11 | Optimizer Results 12 | Algorithm Used: Broyden-Fletcher-Goldfarb-Shanno (BFGS) 13 | Exit message : Change in x was smaller than the specified tolerance TolX. 14 | Iterations : 8 15 | Function Count : 15 16 | Minimum found : 98.0398 17 | Intern Time : 0.010704 seconds 18 | Total Time : 60.4646 seconds 19 | 20 | Optimized magnitude sigma^2: 13.1109 21 | Optimized lengthscales: 0.58525 0.64233 4.8782 4.3622 22 | The percentage of misclassified points: 0.1525 23 | Demo completed in 1.082 minutes 24 | -------------------------------------------------------------------------------- /tests/realValues/multiclass_nested_ep_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multiclass_nested_ep_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/multinom.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multinom.mat -------------------------------------------------------------------------------- /tests/realValues/multinom_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multinom_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/multinom_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multinom_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/multinom_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multinom_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/multivariategp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multivariategp.mat -------------------------------------------------------------------------------- /tests/realValues/multivariategp_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multivariategp_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/multivariategp_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/multivariategp_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/neuralnetcov.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/neuralnetcov.mat -------------------------------------------------------------------------------- /tests/realValues/neuralnetcov.txt: -------------------------------------------------------------------------------- 1 | TolFun reached. Func-count 34. Final f(x)=-49.0877. Elapsed time 0.81 2 | TolFun reached. Func-count 33. Final f(x)=-92.1279. Elapsed time 1.22 3 | TolFun reached. Func-count 48. Final f(x)=-123.011. Elapsed time 0.36 4 | TolFun reached. Func-count 25. Final f(x)=-126.821. Elapsed time 0.27 5 | 6 | gp hyperparameters: 7 | 8 | -3.6553 -0.9891 -5.8739 9 | 10 | Demo completed in 0.072 minutes 11 | -------------------------------------------------------------------------------- /tests/realValues/neuralnetcov_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/neuralnetcov_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/neuralnetcov_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/neuralnetcov_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/neuralnetcov_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/neuralnetcov_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/neuralnetcov_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/neuralnetcov_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/periodic.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/periodic.mat -------------------------------------------------------------------------------- /tests/realValues/periodic_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/periodic_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/periodic_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/periodic_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/periodic_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/periodic_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/periodic_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/periodic_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/quantilegp.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/quantilegp.mat -------------------------------------------------------------------------------- /tests/realValues/quantilegp_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/quantilegp_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression1.mat -------------------------------------------------------------------------------- /tests/realValues/regression1.txt: -------------------------------------------------------------------------------- 1 | GP with Gaussian noise model 2 | 3 | gpcf = 4 | 5 | type: 'gpcf_sexp' 6 | lengthScale: [1.1000 1.2000] 7 | magnSigma2: 0.0400 8 | p: [1x1 struct] 9 | fh: [1x1 struct] 10 | 11 | 12 | K = 13 | 14 | 0.0400 0.0187 0.0019 15 | 0.0187 0.0400 0.0187 16 | 0.0019 0.0187 0.0400 17 | 18 | 19 | C = 20 | 21 | 0.0800 0.0187 0.0019 22 | 0.0187 0.0800 0.0187 23 | 0.0019 0.0187 0.0800 24 | 25 | MAP estimate for the parameters 26 | TolFun reached. Func-count 33. Final f(x)=41.4902. Elapsed time 0.65 27 | 'log(sexp.magnSigma2)' 28 | 'log(sexp.lengthScale x 2)' 29 | 'log(gaussian.sigma2)' 30 | 31 | 3.5984 0.8838 0.8323 0.0428 32 | 33 | Grid integration over the parameters 34 | IA-grid: finding the mode 35 | IA-grid: computing Hessian using multiplication 36 | IA-grid: evaluating density in a grid 37 | IA-grid: evaluated density at 341 points 38 | Elapsed time 11.44 seconds 39 | IA-grid: Total elapsed time 19.63 seconds 40 | MCMC integration over the parameters 41 | Using SLS sampler for hyperparameters 42 | cycle etr slsrej 43 | 20 44.827 sls 44 | 40 42.705 sls 45 | 60 42.124 sls 46 | 80 44.214 sls 47 | 100 42.967 sls 48 | 120 43.217 sls 49 | 140 41.865 sls 50 | 160 44.764 sls 51 | 180 42.241 sls 52 | 200 41.686 sls 53 | 220 42.984 sls 54 | Done 55 | 56 | gp hyperparameters: 57 | 58 | 1.2805 -0.1235 -0.1836 -3.1521 59 | 60 | Demo completed in 1.078 minutes 61 | -------------------------------------------------------------------------------- /tests/realValues/regression1_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression1_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression1_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression1_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/regression1_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression1_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/regression1_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression1_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive1.mat -------------------------------------------------------------------------------- /tests/realValues/regression_additive1_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive1_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive1_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive1_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive1_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive1_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive1_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive1_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive1_fig5.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive1_fig5.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive2.mat -------------------------------------------------------------------------------- /tests/realValues/regression_additive2.txt: -------------------------------------------------------------------------------- 1 | Constant + linear covariance function 2 | TolFun reached. Func-count 31. Final f(x)=103.189. Elapsed time 0.44 3 | Constant + squared exponential covariance function 4 | (w.r.t. the first input dimension) + linear (w.r.t. 5 | the second input dimension) 6 | TolFun reached. Func-count 33. Final f(x)=54.0344. Elapsed time 0.82 7 | Additive squared exponential covariance function 8 | TolFun reached. Func-count 35. Final f(x)=26.9207. Elapsed time 0.76 9 | Squared exponential covariance function 10 | TolFun reached. Func-count 29. Final f(x)=30.6121. Elapsed time 0.46 11 | Additive neural network covariance function 12 | TolFun reached. Func-count 33. Final f(x)=24.4157. Elapsed time 1.09 13 | Neural network covariance function 14 | TolFun reached. Func-count 54. Final f(x)=24.2467. Elapsed time 1.23 15 | 16 | gp hyperparameters: 17 | 18 | -3.1648 1.4213 0.5037 -2.9099 19 | 20 | Demo completed in 0.273 minutes 21 | -------------------------------------------------------------------------------- /tests/realValues/regression_additive2_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive2_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive2_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive2_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive2_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive2_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive2_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive2_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive2_fig5.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive2_fig5.fig -------------------------------------------------------------------------------- /tests/realValues/regression_additive2_fig6.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_additive2_fig6.fig -------------------------------------------------------------------------------- /tests/realValues/regression_hier.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_hier.mat -------------------------------------------------------------------------------- /tests/realValues/regression_hier_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_hier_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression_hier_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_hier_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/regression_meanf.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_meanf.mat -------------------------------------------------------------------------------- /tests/realValues/regression_meanf.txt: -------------------------------------------------------------------------------- 1 | Checking gradient ... 2 | 3 | analytic diffs delta 4 | 5 | -6.7439 -6.7439 0.0000 6 | 2.1897 2.1897 -0.0000 7 | -2.3321 -2.3321 -0.0000 8 | 9 | TolFun reached. Func-count 19. Final f(x)=16.4578. Elapsed time 0.19 10 | 11 | gp hyperparameters: 12 | 13 | 1.6749 -0.3565 -1.4619 14 | 15 | Demo completed in 0.009 minutes 16 | -------------------------------------------------------------------------------- /tests/realValues/regression_meanf_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_meanf_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression_ppcs.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_ppcs.mat -------------------------------------------------------------------------------- /tests/realValues/regression_ppcs.txt: -------------------------------------------------------------------------------- 1 | Iteration Func-count f(x) Lambda 2 | 0 1 15150 3 | 1 3 14366.9 10 4 | 2 5 14366.9 5 5 | 3 6 14366.9 20 6 | 4 7 14366.9 80 7 | 5 8 13860.1 320 8 | 6 10 13859.9 320 9 | 7 12 13449.3 160 10 | 8 14 13274.3 160 11 | 9 16 13257.4 80 12 | 10 18 13254 40 13 | 11 20 13253.7 20 14 | 12 22 13253.6 10 15 | 13 24 13253.4 5 16 | 14 26 13253.4 2.5 17 | 15 28 13253.4 1.25 18 | TolX reached. Func-count 28. Final f(x)=13253.4. Elapsed time 3338.85 19 | Proportion of non-zeros is 0.0475 20 | 21 | gp hyperparameters: 22 | 23 | 2.7497 1.1142 1.4814 1.3157 24 | 25 | Demo completed in 55.722 minutes 26 | -------------------------------------------------------------------------------- /tests/realValues/regression_ppcs_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_ppcs_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression_ppcs_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_ppcs_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/regression_ppcs_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_ppcs_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/regression_robust.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust.mat -------------------------------------------------------------------------------- /tests/realValues/regression_robust_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression_robust_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/regression_robust_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/regression_robust_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/regression_robust_fig5.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust_fig5.fig -------------------------------------------------------------------------------- /tests/realValues/regression_robust_fig6.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust_fig6.fig -------------------------------------------------------------------------------- /tests/realValues/regression_robust_fig7.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust_fig7.fig -------------------------------------------------------------------------------- /tests/realValues/regression_robust_fig8.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_robust_fig8.fig -------------------------------------------------------------------------------- /tests/realValues/regression_sparse1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_sparse1.mat -------------------------------------------------------------------------------- /tests/realValues/regression_sparse1_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_sparse1_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/regression_sparse1_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_sparse1_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/regression_sparse1_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_sparse1_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/regression_sparse1_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_sparse1_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/regression_sparse1_fig5.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_sparse1_fig5.fig -------------------------------------------------------------------------------- /tests/realValues/regression_sparse2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_sparse2.mat -------------------------------------------------------------------------------- /tests/realValues/regression_sparse2.txt: -------------------------------------------------------------------------------- 1 | Full GP 2 | TolFun reached. Func-count 35. Final f(x)=51.3654. Elapsed time 0.31 3 | FIC GP 4 | TolX reached. Func-count 14. Final f(x)=57.5109. Elapsed time 0.18 5 | VAR GP 6 | TolFun reached. Func-count 68. Final f(x)=65.8332. Elapsed time 0.87 7 | DTC GP 8 | TolX reached. Func-count 14. Final f(x)=48.4277. Elapsed time 0.17 9 | 10 | gp hyperparameters: 11 | 12 | 1.6935 -0.6707 -2.9350 13 | 14 | Demo completed in 0.034 minutes 15 | -------------------------------------------------------------------------------- /tests/realValues/regression_sparse2_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/regression_sparse2_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/spatial1.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial1.mat -------------------------------------------------------------------------------- /tests/realValues/spatial1_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial1_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/spatial1_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial1_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/spatial1_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial1_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/spatial1_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial1_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/spatial1_fig5.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial1_fig5.fig -------------------------------------------------------------------------------- /tests/realValues/spatial1_fig6.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial1_fig6.fig -------------------------------------------------------------------------------- /tests/realValues/spatial1_fig7.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial1_fig7.fig -------------------------------------------------------------------------------- /tests/realValues/spatial2.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial2.mat -------------------------------------------------------------------------------- /tests/realValues/spatial2.txt: -------------------------------------------------------------------------------- 1 | GP with negative-binomial observation model, Laplace 2 | integration over the latent values and MAP estimate 3 | for the parameters 4 | Iteration Func-count f(x) Lambda 5 | 0 1 5286.4 6 | 1 3 5286.36 10 7 | 2 4 5241.3 40 8 | 3 6 5221.46 40 9 | 4 8 5216.89 20 10 | 5 10 5216.55 10 11 | 6 12 5216.44 5 12 | 7 14 5216.44 2.5 13 | TolX reached. Func-count 14. Final f(x)=5216.44. Elapsed time 239.70 14 | Proportion of non-zeros is 0.0715 15 | GP with negative-binomial observation model, EP 16 | integration over the latent values and MAP estimate 17 | for the parameters 18 | Iteration Func-count f(x) Lambda 19 | 0 1 5216.4 20 | 1 3 5216.42 10 21 | TolX reached. Func-count 3. Final f(x)=5216.42. Elapsed time 221.78 22 | Proportion of non-zeros is 0.0715 23 | 24 | gp hyperparameters: 25 | 26 | -2.1782 2.2583 2.8991 27 | 28 | Demo completed in 8.026 minutes 29 | -------------------------------------------------------------------------------- /tests/realValues/spatial2_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial2_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/spatial2_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial2_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/spatial2_fig3.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial2_fig3.fig -------------------------------------------------------------------------------- /tests/realValues/spatial2_fig4.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial2_fig4.fig -------------------------------------------------------------------------------- /tests/realValues/spatial2_fig5.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial2_fig5.fig -------------------------------------------------------------------------------- /tests/realValues/spatial2_fig6.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/spatial2_fig6.fig -------------------------------------------------------------------------------- /tests/realValues/survival_aft.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/survival_aft.mat -------------------------------------------------------------------------------- /tests/realValues/survival_aft_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/survival_aft_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/survival_coxph.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/survival_coxph.mat -------------------------------------------------------------------------------- /tests/realValues/survival_coxph.txt: -------------------------------------------------------------------------------- 1 | Iteration Func-count f(x) Lambda 2 | 0 1 592.79 3 | 1 3 586.41 21.6 4 | 2 5 585.087 21.6 5 | 3 7 572.396 10.8 6 | 4 9 569.02 5.41 7 | 5 11 568.097 2.71 8 | 6 13 567.164 1.35 9 | 7 15 567.04 0.676 10 | 8 17 566.904 0.338 11 | 9 19 566.673 0.169 12 | 10 21 566.665 0.0846 13 | TolFun reached. Func-count 21. Final f(x)=566.665. Elapsed time 58.25 14 | 15 | ans = 16 | 17 | -5.9203e+03 18 | 19 | Evaluating the CV utility. The inference method is MAP. 20 | The CV-fold number: 1/10 21 | The CV-fold number: 2/10 22 | The CV-fold number: 3/10 23 | The CV-fold number: 4/10 24 | The CV-fold number: 5/10 25 | The CV-fold number: 6/10 26 | The CV-fold number: 7/10 27 | The CV-fold number: 8/10 28 | The CV-fold number: 9/10 29 | The CV-fold number: 10/10 30 | 31 | ans = 32 | 33 | -546.5010 34 | 35 | 36 | gp hyperparameters: 37 | 38 | -0.6744 -0.3888 -0.6922 -1.1005 -1.3187 -1.5066 0.4186 0.9045 -0.9993 0.4694 39 | 40 | Demo completed in 15.805 minutes 41 | -------------------------------------------------------------------------------- /tests/realValues/survival_coxph_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/survival_coxph_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/svi_classific.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/svi_classific.mat -------------------------------------------------------------------------------- /tests/realValues/svi_classific_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/svi_classific_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/svi_regression.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/svi_regression.mat -------------------------------------------------------------------------------- /tests/realValues/svi_regression.txt: -------------------------------------------------------------------------------- 1 | Assign inducing inputs by clustering 2 | iter=1/150, e=-806.238, mlpd=-0.00329, rmse=0.08678, de=Inf 3 | iter=11/150, e=1628.618, mlpd=1.341, rmse=0.01701, de=0.53808 4 | iter=21/150, e=1638.118, mlpd=1.352, rmse=0.01603, de=0.92957 5 | iter=31/150, e=1644.276, mlpd=1.354, rmse=0.01486, de=0.00041356 6 | iter=41/150, e=1648.648, mlpd=1.357, rmse=0.01436, de=0.6143 7 | iter=51/150, e=1650.748, mlpd=1.353, rmse=0.01441, de=0.011609 8 | iter=61/150, e=1653.303, mlpd=1.357, rmse=0.01386, de=0.69366 9 | iter=71/150, e=1654.098, mlpd=1.356, rmse=0.01392, de=0.73379 10 | iter=81/150, e=1655.407, mlpd=1.362, rmse=0.01336, de=0.15758 11 | iter=91/150, e=1656.587, mlpd=1.362, rmse=0.01348, de=0.83295 12 | iter=101/150, e=1657.672, mlpd=1.362, rmse=0.01369, de=0.55494 13 | iter=111/150, e=1658.012, mlpd=1.359, rmse=0.01341, de=0.028293 14 | iter=121/150, e=1659.574, mlpd=1.362, rmse=0.0132, de=0.37814 15 | iter=131/150, e=1660.190, mlpd=1.361, rmse=0.01289, de=0.43749 16 | iter=141/150, e=1660.848, mlpd=1.361, rmse=0.01271, de=0.026303 17 | Iteration limit 150 reached while optimising the parameters 18 | Final values: 19 | e=1660.428, mlpd=1.362, rmse=0.01325 20 | [Warning: MATLAB has disabled some advanced graphics rendering features by switching to software 21 | OpenGL. For more information, click here.] 22 | Demo completed in 1.108 minutes 23 | -------------------------------------------------------------------------------- /tests/realValues/svi_regression_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/svi_regression_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/svi_regression_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/svi_regression_fig2.fig -------------------------------------------------------------------------------- /tests/realValues/zinegbin.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/zinegbin.mat -------------------------------------------------------------------------------- /tests/realValues/zinegbin.txt: -------------------------------------------------------------------------------- 1 | Iteration Func-count Grad-count f(x) Step-size 2 | 0 1 1 2964.84 3 | 1 2 2 2908.76 0.0146046 4 | 2 4 4 2900.33 0.1 5 | 3 5 5 2885.72 1 6 | 4 7 7 2864.1 0.295668 7 | 5 8 8 2848.64 1 8 | 6 9 9 2842.71 1 9 | 7 10 10 2842.05 1 10 | 8 12 12 2841.84 0.266463 11 | 9 14 14 2841.81 0.143598 12 | 10 15 15 2841.77 1 13 | 11 16 16 2841.71 1 14 | 12 17 17 2841.7 1 15 | 13 18 18 2841.69 1 16 | 14 19 19 2841.69 1 17 | Optimizer Results 18 | Algorithm Used: Broyden-Fletcher-Goldfarb-Shanno (BFGS) 19 | Exit message : Change in x was smaller than the specified tolerance TolX. 20 | Iterations : 15 21 | Function Count : 20 22 | Minimum found : 2841.6901 23 | Intern Time : 0.017685 seconds 24 | Total Time : 102.8869 seconds 25 | 26 | gp hyperparameters: 27 | 28 | 4.0478 1.3173 -2.6332 1.4244 29 | 30 | Demo completed in 1.745 minutes 31 | -------------------------------------------------------------------------------- /tests/realValues/zinegbin_fig1.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/zinegbin_fig1.fig -------------------------------------------------------------------------------- /tests/realValues/zinegbin_fig2.fig: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gpstuff-dev/gpstuff/114937ec0a201306489a66cbba38283e722fb998/tests/realValues/zinegbin_fig2.fig --------------------------------------------------------------------------------