2%> This is the base
class for generating objects
3%> that contain the contents of a sample/chain file
4%> generated by a ParaMonte sampler.<br>
5%> This
class is meant to be primarily internally
6%> used by the ParaMonte MATLAB library samplers.<br>
9%> See the documentation of the
class constructor.<br>
12%> See below
for information on the attributes (properties).<br>
15%> See below
for information on the methods.<br>
20%> \AmirShahmoradi, 3:31 PM Friday, November 8, 2024, Dallas, TX<br>
21%> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
24 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 properties(Access =
public)
30 %> The scalar MATLAB integer representing the number of
31 %> dimensions of the domain of the objective function sampled.<br>
32 %> This integer is also the number of columns in the file that
33 %> correspond that contain the sampled states from the domain
34 %> of the mathematical objective function.<br>
40 %> The scalar MATLAB integer representing the column
41 %>
index of the dataframe component ``df`` that contains
42 %> the natural logarithm of the objective function values
43 %> corresponding to the sampled states next to
this column,
44 %> such that the following relationship holds.<br>
50 %> While
this column
index can be readily inferred by exploring
51 %> the contents of the dataframe component,
this column
index is also
52 %> computed and explicitly offered to conveniently slice the values of
53 %> the sampled states and their corresponding log-function values.<br>
59 %> The scalar MATLAB
object containing the set of
60 %> computed properties of the contents of the file.<br>
61 %> This component is populated by the subclasses automatically.<br>
62 %> It can also be manually constructed by calling the ``Hidden``
class method
69 %> The scalar MATLAB ``
struct`` containing the set of
70 %> predefined visualizations
for the output data.<br>
71 %> This component is populated by the subclasses automatically.<br>
72 %> It can also be manually constructed by calling the ``Hidden``
class method
77 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
83 %> The ``Hidden`` scalar MATLAB
string representing
84 %> the column
name of the dataframe component ``df`` that
85 %> contains the natural logarithm of the objective function
86 %> values corresponding to the sampled states next to
this column.<br>
89 %> This is an internal ``Hidden``
class attribute
90 %> that is inaccessible to the end users.<br>
92 slfcname =
"sampleLogFunc";
95 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
97 methods(Access =
public)
99 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
102 %> Return a scalar
object of
class [pm.sampling.FileContentsSample](@ref
FileContentsSample).<br>
105 %> This is the constructor of the
class [pm.sampling.FileContentsSample](@ref
FileContentsSample).<br>
107 %> \param[in] file : The input scalar MATLAB
string containing the path to an external file.<br>
108 %> \param[in] silent : See the corresponding argument of [pm.sampling.FileContentsRestart](@ref
FileContentsRestart)
class.<br>
109 %> (**optional**. The
default is set by [pm.sampling.FileContentsRestart](@ref
FileContentsRestart).)
110 %> \param[in] sep : The input scalar MATLAB
string containing the field separator used in the file.<br>
111 %> (**optional**,
default = ``
","``)
114 %> ``self`` : The output scalar
object of
class [pm.sampling.FileContentsSample](@ref
FileContentsSample).<br>
120 %> contents = pm.sampling.FileContentsSample(file, [])
121 %> contents = pm.sampling.FileContentsSample(file, silent)
122 %> contents = pm.sampling.FileContentsSample(file, [], [])
123 %> contents = pm.sampling.FileContentsSample(file, [], sep)
124 %> contents = pm.sampling.FileContentsSample(file, silent, [])
125 %> contents = pm.sampling.FileContentsSample(file, silent, sep)
130 %> See the documentations of the subclasses of
this class for example usage.<br>
135 %> \JoshuaOsborne, May 21 2024, 3:36 AM, University of Texas at Arlington<br>
136 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
137 %> \AmirShahmoradi, May 16 2016, 9:03 AM, Oden Institute
for Computational Engineering and Sciences (ICES), UT Austin<br>
147 self = self@pm.io.FileContentsTabular(file, silent, sep);
149 for icol = 1 : self.ncol
150 if strcmpi(self.df.Properties.VariableNames{icol}, self.slfcname)
156 self.ndim = self.ncol - self.slfc;
157 if self.nrow <= self.ndim
158 warning ( newline ...
159 + "There are insufficient number of states in the specified file:" + newline ...
161 + pm.io.
tab() + self.file + newline ...
163 + "for computing the covariance/correlation matrices. Skipping..." + newline ...
170 %%%%
statistics (actual computations are all done in the ``setstats`` method and respective subclasses).
176 %%%% visualization (actual visualization setup are all done in ``setvis`` method and the respective subclasses).
183 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
189 methods(Access = public, Hidden)
191 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
195 %> and store the results in the respective fields of the ``stats`` attribute of the parent
object.<br>
199 %> It is **inaccessible** to the end users of the library.<br>
202 %>
which is **implicitly** passed to this dynamic method (not by the user).<br>
204 %> \interface{setstats}
207 %> contents = pm.sampling.FileContentsSample();
209 %> contents.setstats();
216 %> \AmirShahmoradi, 2:11 PM Friday, November 8, 2024, Dallas, TX<br>
217 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
218 function setstats(self)
220 self.stats =
struct();
222 self.checkpoint(
"adding the stats components...",
false);
225 %%%% Add chain cormat.
228 self.checkpoint(
"computing the sample correlation matrix...",
false);
229 self.stats.cor = pm.stats.Cor(self.df(:, self.slfc + 1 : end));
233 %%%% Add chain covmat.
236 self.checkpoint(
"computing the sample covariance matrix...",
false);
237 self.stats.cov = pm.stats.Cov(self.df(:, self.slfc + 1 : end));
244 self.checkpoint(
"computing the sample autocorrelation...",
false);
245 self.stats.acf = pm.stats.AutoCorr(self.df(:, self.slfc : end));
248 self.stats.max =
struct(
"val", [],
"loc", []);
249 self.stats.min =
struct(
"val", [],
"loc", []);
252 %%%% The `{:,:}` slice is essential in MATLAB ~2020a.
255 [self.stats.max.val, self.stats.max.loc] = max(self.df{:,:});
256 [self.stats.min.val, self.stats.min.loc] = min(self.df{:,:});
257 self.stats.avg = mean(self.df{:,:});
258 self.stats.std = std(self.df{:,:});
261 %%%% Add the ACF stats information.
264 self.stats.acf = pm.stats.AutoCorr(@()self.df);
267 %%%% Add the correlation/covariance matrix information.
270 self.stats.cor = pm.stats.Cor(@()self.df);
271 self.stats.cov = pm.stats.Cov(@()self.df);
277 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
281 %> and store the results in the respective fields of the ``stats`` attribute of the parent
object.<br>
284 %> This is a dynamic ``Hidden`` method of
class [pm.sampling.FileContentsSample](@ref
FileContentsSample).<br>
285 %> It is **inaccessible** to the end users of the library.<br>
287 %> \param[in] self : The input parent
object of
class [pm.sampling.FileContentsSample](@ref
FileContentsSample)
288 %>
which is **implicitly** passed to
this dynamic method (not by the user).<br>
290 %> \interface{setvis}
293 %> contents = pm.sampling.FileContentsSample();
295 %> contents.setvis();
302 %> \AmirShahmoradi, 2:12 PM Friday, November 8, 2024, Dallas, TX<br>
303 %> \FatemehBagheri, May 20 2024, 1:25 PM, NASA Goddard Space Flight Center (GSFC), Washington, D.C.<br>
304 function setvis(self)
308 self.checkpoint(
"adding the visualization components...",
false);
311 cols = self.slfc + [1 : self.ndim];
312 silent_kws = {
"silent", self.silent};
314 self.vis.cascade =
struct();
316 self.vis.cascade.line = pm.vis.CascadeLine(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
317 self.vis.cascade.scatter = pm.vis.CascadeScatter(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
318 self.vis.cascade.lineScatter = pm.vis.CascadeLineScatter(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
320 self.vis.cascade.line3 = pm.vis.CascadeLine3(@()self.df,
"coly", cols,
"colz", colf,
"colc", colf, silent_kws{:});
321 self.vis.cascade.scatter3 = pm.vis.CascadeScatter3(@()self.df,
"coly", cols,
"colz", colf,
"colc", colf, silent_kws{:});
322 self.vis.cascade.lineScatter3 = pm.vis.CascadeLineScatter3(@()self.df,
"coly", cols,
"colz", colf,
"colc", colf, silent_kws{:});
324 self.vis.cascade.histfit = pm.vis.CascadeHistfit(@()self.df,
"colx", cols, silent_kws{:});
325 self.vis.cascade.histogram = pm.vis.CascadeHistogram(@()self.df,
"colx", cols, silent_kws{:});
326 self.vis.cascade.histogram2 = pm.vis.CascadeHistogram2(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
328 self.vis.cascade.contour = pm.vis.CascadeContour(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
329 self.vis.cascade.contourf = pm.vis.CascadeContourf(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
330 self.vis.cascade.contour3 = pm.vis.CascadeContour3(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
332 self.vis.plot =
struct();
334 self.vis.plot.line = pm.vis.PlotLine(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
335 self.vis.plot.scatter = pm.vis.PlotScatter(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
336 self.vis.plot.lineScatter = pm.vis.PlotLineScatter(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
338 self.vis.plot.line3 = pm.vis.PlotLine3(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
339 self.vis.plot.scatter3 = pm.vis.PlotScatter3(@()self.df,
"coly", cols,
"colz", colf,
"colc", colf, silent_kws{:});
340 self.vis.plot.lineScatter3 = pm.vis.PlotLineScatter3(@()self.df,
"coly", cols,
"colz", colf,
"colc", colf, silent_kws{:});
342 self.vis.plot.histfit = pm.vis.PlotHistfit(@()self.df,
"colx", cols, silent_kws{:});
343 self.vis.plot.histogram = pm.vis.PlotHistogram(@()self.df,
"colx", cols, silent_kws{:});
344 self.vis.plot.histogram2 = pm.vis.PlotHistogram2(@()self.df,
"colx", colf,
"coly", cols, silent_kws{:});
346 self.vis.plot.contour = pm.vis.PlotContour(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
347 self.vis.plot.contourf = pm.vis.PlotContourf(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
348 self.vis.plot.contour3 = pm.vis.PlotContour3(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
350 self.vis.tile =
struct();
352 self.vis.tile.line = pm.vis.TileLine(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
353 self.vis.tile.scatter = pm.vis.TileScatter(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
354 self.vis.tile.lineScatter = pm.vis.TileLineScatter(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
356 self.vis.tile.line3 = pm.vis.TileLine3(@()self.df,
"coly", cols,
"colc", colf, silent_kws{:});
357 self.vis.tile.scatter3 = pm.vis.TileScatter3(@()self.df,
"coly", cols,
"colz", colf,
"colc", colf, silent_kws{:});
358 self.vis.tile.lineScatter3 = pm.vis.TileLineScatter3(@()self.df,
"coly", cols,
"colz", colf,
"colc", colf, silent_kws{:});
360 self.vis.tile.histfit = pm.vis.TileHistfit(@()self.df,
"colx", cols, silent_kws{:});
361 self.vis.tile.histogram = pm.vis.TileHistogram(@()self.df,
"colx", cols, silent_kws{:});
362 self.vis.tile.histogram2 = pm.vis.TileHistogram2(@()self.df,
"colx", colf,
"coly", cols, silent_kws{:});
364 self.vis.tile.contour = pm.vis.TileContour(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
365 self.vis.tile.contourf = pm.vis.TileContourf(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
366 self.vis.tile.contour3 = pm.vis.TileContour3(@()self.df,
"colx", cols,
"coly", colf, silent_kws{:});
368 self.vis.triplex.lshc2 = pm.vis.Triplex ( pm.vis.SubplotLineScatter(@()self.df,
"colx", cols,
"coly", cols,
"colc", colf,
"colorbar", {
"enabled",
false}) ...
369 , pm.vis.SubplotHistogram(@()self.df,
"colx", cols) ...
370 , pm.vis.SubplotContour(@()self.df,
"colx", cols,
"coly", cols,
"colorbar", {
"enabled",
false}) ...
374 self.vis.triplex.lshcf = pm.vis.Triplex ( pm.vis.SubplotLineScatter(@()self.df,
"colx", cols,
"coly", cols,
"colc", colf,
"colorbar", {
"enabled",
false}) ...
375 , pm.vis.SubplotHistogram(@()self.df,
"colx", cols) ...
376 , pm.vis.SubplotContourf(@()self.df,
"colx", cols,
"coly", cols,
"colorbar", {
"enabled",
false}) ...
380 self.vis.triplex.lshc3 = pm.vis.Triplex ( pm.vis.SubplotLineScatter(@()self.df,
"colx", cols,
"coly", cols,
"colc", colf,
"colorbar", {
"enabled",
false}) ...
381 , pm.vis.SubplotHistogram(@()self.df,
"colx", cols) ...
382 , pm.vis.SubplotContour3(@()self.df,
"colx", cols,
"coly", cols,
"colorbar", {
"enabled",
false}) ...
387 % self.vis.triplex.layout.tiling.position = [.1, .1, nan, nan];
388 % self.vis.triplex.layout.cbarh.position = [];
389 % self.vis.triplex.layout.cbarv.position = [];
390 % self.vis.triplex.layout.tiling.tile.width = [];
397 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
401 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function name(in vendor)
Return the MPI library name as used in naming the ParaMonte MATLAB shared library directories.
function index(in array)
Given array(1 : n), return the array index indx(1 : n) such that array(indx) is in ascending order.
This is the base class for generating objects that contain the contents of a restart file generated b...
This is the base class for generating objects that contain the contents of a sample/chain file genera...
function setvis(in self)
Compute the statistics of the parent object of class pm.sampling.FileContentsSample and store the res...
function setstats(in self)
Compute the statistics of the parent object of class pm.sampling.FileContentsSample and store the res...
function FileContentsSample(in file, in silent, in sep)
Return a scalar object of class pm.sampling.FileContentsSample.
This is the base class for generating objects that contain the tabular contents of a given file.
function statistics()
Return a scalar MATLAB logical that is true if and only if the current installation of MATLAB contain...
function tab()
Return a scalar MATLAB string containing 4 blank characters equivalent to a tab character.
function which(in vendor)
Return the a MATLAB string containing the path to the first mpiexec executable binary found in system...