ParaMonte MATLAB 3.0.0
Parallel Monte Carlo and Machine Learning Library
See the latest version documentation.
FileContentsChainDRAM Class Reference

This is the base class for generating objects that contain the contents of a chain file generated by a sampler of superclass pm.sampling.Paradram.
More...

Inheritance diagram for FileContentsChainDRAM:
Collaboration diagram for FileContentsChainDRAM:

Public Member Functions

function FileContentsChainDRAM (in file, in silent, in sep, in format)
 Return a scalar object of class pm.sampling.FileContentsChainDRAM.
More...
 

Detailed Description

This is the base class for generating objects that contain the contents of a chain file generated by a sampler of superclass pm.sampling.Paradram.

This class is meant to be primarily internally used by the ParaMonte MATLAB library samplers.
This class merely adds a number of visualizations to its superclass which are specific to the pm.sampling.Paradram sampler.

Note
See also the documentation of the class constructor pm.sampling.FileContentsChainDRAM::FileContentsChainDRAM.
See also the documentation of the superclass pm.sampling.FileContentsChainMCMC.
See below for information on the attributes (properties).
See below for information on the class methods.


Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

Definition at line 28 of file FileContentsChainDRAM.m.

Constructor & Destructor Documentation

◆ FileContentsChainDRAM()

function FileContentsChainDRAM::FileContentsChainDRAM ( in  file,
in  silent,
in  sep,
in  format 
)

Return a scalar object of class pm.sampling.FileContentsChainDRAM.

This is the constructor of the class pm.sampling.FileContentsChainDRAM.

Parameters
[in]file: The input scalar MATLAB string containing the path or web address to an external file.
[in]silent: See the corresponding argument of the superclass constructor pm.sampling.FileContentsChainMCMC::FileContentsChainMCMC.
(optional. The default is set by the superclass constructor pm.sampling.FileContentsChainMCMC::FileContentsChainMCMC.)
[in]sep: See the corresponding argument of the superclass constructor pm.sampling.FileContentsChainMCMC::FileContentsChainMCMC.
(optional. The default is set by the superclass constructor pm.sampling.FileContentsChainMCMC::FileContentsChainMCMC.)
[in]format: The input scalar MATLAB string containing the reading format of the Markov chain:
  1. If format is set to "compact", the Markov chain will be read in compact (weighted) format.
    This format is fast and potentially highly memory-efficient.
    Beware that this format does not necessarily generate a compact chain when the specified chain file is already written in verbose format.
  2. If format is set to "verbose", the Markov chain will be read in verbose (unweighted or unrolled) format.
    While the chain in this format is the actual Markov chain, reading the chain in this format can be highly inefficient as it can use too much memory for high-dimensional density functions.
(optional, default = "compact".)
Returns
self : The output scalar object of class pm.sampling.FileContentsChainDRAM.


Possible calling interfaces

contents = pm.sampling.FileContentsChainDRAM(file)
contents = pm.sampling.FileContentsChainDRAM(file, [])
contents = pm.sampling.FileContentsChainDRAM(file, silent)
contents = pm.sampling.FileContentsChainDRAM(file, [], sep)
contents = pm.sampling.FileContentsChainDRAM(file, silent, sep)


Example usage

1close all
2clear all
3cd(fileparts(mfilename('fullpath'))); % Change working directory to source code directory.
4addpath('../../../'); % Add the ParaMonte library root directory to the search path.
5
6fname = "regression_powerlaw_process_1_chain.txt";
7path = "regression_powerlaw_data_paradram/out/" + fname;
8url = "https://raw.githubusercontent.com/cdslaborg/paramontex/fbeca6745684c798ff28c1bf57cfae0c190db478/MATLAB/mlx/";
9chain = pm.sampling.FileContentsChainDRAM(websave(fname, url + path));
10
11for visfield = string(fields(chain.vis))'
12
13 disp("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
14
15 plottypes = [];
16 if contains(lower(visfield), "adaptation")
17 varname = "proposalAdaptation";
18 plottypes = ["line", "scatter"];
19 elseif contains(lower(visfield), "burnin")
20 varname = "burninLocation";
21 plottypes = ["line"];
22 elseif contains(lower(visfield), "mean")
23 varname = "meanAcceptanceRate";
24 plottypes = ["line"];
25 end
26
27 if ~isempty(plottypes)
28 for plottype = plottypes
29 chain.vis.(visfield).(plottype).make();
30 chain.vis.(visfield).(plottype).savefig(join(["FileContentsChainDRAM", varname, plottype], ".") + ".png", "-m3");
31 end
32 else
33 for plottype = string(fields(chain.vis.(visfield)))'
34 chain.vis.(visfield).(plottype).make("figure", {"visible", "off"});
35 figname = join(["FileContentsChainDRAM", visfield, plottype], ".");
36 if strcmpi(visfield, "cascade")
37 figname = figname + "." + string(1 : numel(chain.vis.(visfield).(plottype).window));
38 end
39 disp("figname")
40 disp( figname )
41 chain.vis.(visfield).(plottype).savefig(figname + ".png", "-m3");
42 end
43 end
44
45 disp("%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%")
46
47end
function root()
Return a scalar MATLAB string containing the root directory of the ParaMonte library package.
function savefig(in varargin)
Export figures in a publication-quality format.

Visualization of the example output






































































































































Final Remarks


If you believe this algorithm or its documentation can be improved, we appreciate your contribution and help to edit this page's documentation and source file on GitHub.
For details on the naming abbreviations, see this page.
For details on the naming conventions, see this page.
This software is distributed under the MIT license with additional terms outlined below.

  1. If you use any parts or concepts from this library to any extent, please acknowledge the usage by citing the relevant publications of the ParaMonte library.
  2. If you regenerate any parts/ideas from this library in a programming environment other than those currently supported by this ParaMonte library (i.e., other than C, C++, Fortran, MATLAB, Python, R), please also ask the end users to cite this original ParaMonte library.

This software is available to the public under a highly permissive license.
Help us justify its continued development and maintenance by acknowledging its benefit to society, distributing it, and contributing to it.

Author:
Fatemeh Bagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.
Amir Shahmoradi, May 16 2016, 9:03 AM, Oden Institute for Computational Engineering and Sciences (ICES), UT Austin

The documentation for this class was generated from the following file: