If you use a new command in the "CC2" folder, please read this new document.
This toolkit consists of C++ classes for Gaussian process regression(GPR) and Bayesian scaling analysis(BSA) and the application codes for the finite-size scaling analysis. The BSA is a new method of statistical inference in the scaling analysis of critical phenomena. It is based on Bayesian statistics, most specifically, the GPR. The BSA assumes only the smoothness of a scaling function, and it does not need a form. Thus, it may be more effective than conventional approaches in the scaling analyses of critical phenomena. We find the detail of BSA in the paper (Kenji Harada, Physical Review E 84 (2011) 056704).
Because the BSA is a new technique, this toolkit is the reference code, but this toolkit is alpha version. Your comment and suggestion are welcome. In particular, there are only C++ codes. I hope the other language codes as python, fortran, c, or perl, etc.. Your contribution is welcome.
You could see the demonstrations of BSA from this page. The second case in the demonstration corresponds to the inference process of present application code.
I hope that the BSA helps your study.
July 2013, Kenji Harada (@KenjiHarada)
Graduate school of informatics, Kyoto University
E-mail: harada@acs.i.kyoto-u.ac.jp
URL: https://www-np.acs.i.kyoto-u.ac.jp/~harada/index_en.html
Note: please use the latest version which fixes the bugs.
Firstly, we needs to install the GSL library for the class GPR::Regression. After that, we needs to change variables in Makefile: GSL_DIR and BLAS_LIB in CC folder.
To compile and test, we can use "make" command as follows.
% cd CC % make % make test
To see the result of finite-size scaling of Binder ratio of Ising model, one can use "gnuplot" as follows.
% gnuplot gnuplot> plot "test.op" u 1:2:3 i 0 w e gnuplot> plot "test_mc.op" u 1:2:3 i 0 w e gnuplot> plot "test_c.op" u 1:2:3 i 0 w e gnuplot> plot "test_c_mc.op" u 1:2:3 i 0 w e
Usage: ./bfss [data_file] [three physical parameter sets] (option)[three hyper parameter sets] Usage: ./bfss_mc [data_file] [three physical parameter sets] (option)[three hyper parameter sets] Usage: ./bfss_c [data_file] [five physical parameter sets] (option)[three hyper parameter sets] Usage: ./bfss_c_mc [data_file] [five physical parameter sets] (option)[three hyper parameter sets]
The command "bfss" finds the best finite-size scaling parameters. The command "bfss_mc" calculates the confidential intervals of parameters by Monte Carlo sampling. The command "bfss_c" finds the best finite-size scaling parameters with correction to scaling. The command "bfss_c_mc" calculates the confidential intervals of parameters by Monte Carlo sampling for the case of correction to scaling.
If [data_file] is '-', data are loaded from STDIN. A parameter set is a pair of mask and initial value of parameter.
If mask = 0(1), the parameter is fixed (unfixed).
Usually, it is better that a hyper parameter starts from 1, because all data are renormalized. If you do not give hyper parameter sets, the default values are 1.
Example. % ./bfss Test/Ising-square-Binder.dat 1 0.42 1 0.9 1 0.1 1 1 1 1 1 1 > test.op 2>test.log % ./bfss_mc Test/Ising-square-Binder.dat 1 0.42 1 0.9 1 0.1 1 1 1 1 1 1 > test_mc.op 2>test_mc.log % ./bfss_c Sample/sample-c.dat 1 0.28 1 0.9 0 0 1 1 1 2 1 1 1 1 1 1 > test_c.op 2>test_c.log % ./bfss_c_mc Sample/sample-c.dat 1 0.28 1 0.9 0 0 1 1 1 2 1 1 1 1 1 1 > test_c_mc.op 2>test_c_mc.log
This code can be applied to a scaling analysis which has the same form of the finite-size scaling law.
The format of data file is as follows.
# L T A Error_of_A 128 4.200000e-01 6.271240e-02 1.336090e-03
A line has to be ended with the newline character. Comment lines starts with the character '#'. A null line is ignored. Other lines contain four values. The value of \( L \) is in the first column of data file. The value of \( T \) is in the second column. The value of \( A \) is in the third column. The value of \( \delta A \) is in the fourth column. If a line is not correctly formatted, it will be skipped.
The value of best parameters and the confidential intervals are written in header as comments. The remain consists of three groups. These three groups are separated two null lines.
The first group is the scaling result with unnormalized variables as \begin{equation} X = (T - T_c ) L^{c_1}, Y = A / L^{c_2}, E = \delta A/ L^{c_2}. \end{equation} In all groups, the best parameters are used. In the case of commands "bfss_mc" and "bfss_c_mc", the average of parameters are used. The line of output contains a list of \( X, Y, E, L, T, A, \mbox{and}\ \delta A.\)
The second one consists of 100 points of the inferred scaling function with unnormalized variables. The line contains a list of \( X, \mu(X), \sqrt{\sigma^2(X)} \).
The third one is the scaling result with normalized variables as \begin{equation} X = (T - T_c ) (L/L_m)^{c_1} / R_X,\ Y = (A / (L/L_m)^{c_2} - Y_0)/R_Y,\ E = \delta A/ (L/L_m)^{c_2}/R_Y. \end{equation} The line contains a list of \( X, Y, E, L, T, A, \mbox{and}\ \delta A.\)
The first group is the scaling result with unnormalized variables as \begin{equation} X = (T - T_c ) L^{c_1}, Y = A / L^{c_2} / ( 1 + a L^{-w}), E = \delta A/ L^{c_2} / ( 1 + a L^{-w}). \end{equation} The third one is the scaling result with normalized variables as \begin{eqnarray} X &=& (T - T_c ) (L/L_m)^{c_1} / R_X,\\ Y &=& (A / (L/L_m)^{c_2} \times [( 1 + a L_m^{-w}) / ( 1 + a L^{-w})] - Y_0)/R_Y,\\ E &=& \delta A/ (L/L_m)^{c_2} \times [( 1 + a L_m^{-w}) / ( 1 + a L^{-w})] /R_Y. \end{eqnarray}