Skip to content

Commit 80d7867

Browse files
committed
Revise documents
1 parent f3da427 commit 80d7867

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

bayesml/metatree/__init__.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
r"""
55
The stochastic data generative model is as follows:
66
7-
* :math:`\mathcal{X}` : a space of an explanatory variable (a finite set)
8-
* :math:`\boldsymbol{x}=[x_1, \ldots, x_d] \in \mathcal{X}^d` : an explanatory variable
7+
* :math:`\boldsymbol{x}=[x_1, \ldots, x_p, x_{p+1}, \ldots , x_{p+q}]` : an explanatory variable. The first :math:`p` variables are continuous. The other :math:`q` variables are categorical.
98
* :math:`\mathcal{Y}` : a space of an objective variable
109
* :math:`y \in \mathcal{Y}` : an objective variable
1110
* :math:`D_\mathrm{max} \in \mathbb{N}` : the maximum depth of trees
12-
* :math:`T` : :math:`|\mathcal{X}|`-ary regular tree whose depth is smaller than or equal to :math:`D_\mathrm{max}`, where "regular" means that all inner nodes have :math:`k` child nodes.
11+
* :math:`T` : a tree whose depth is smaller than or equal to :math:`D_\mathrm{max}`
1312
* :math:`\mathcal{T}` : a set of :math:`T`
1413
* :math:`s` : a node of a tree
1514
* :math:`\mathcal{S}` : a set of :math:`s`
1615
* :math:`\mathcal{I}(T)` : a set of inner nodes of :math:`T`
1716
* :math:`\mathcal{L}(T)` : a set of leaf nodes of :math:`T`
18-
* :math:`\boldsymbol{k}=(k_s)_{s \in \mathcal{S}}` : feature assign vector where :math:`k_s \in \{1,2,\ldots,d\}`
17+
* :math:`\boldsymbol{k}=(k_s)_{s \in \mathcal{S}}` : feature assignmet vector where :math:`k_s \in \{1, 2,\ldots,p+q\}`. If :math:`k_s \leq p`, the node :math:`s` has a threshold.
1918
* :math:`\boldsymbol{\theta}=(\theta_s)_{s \in \mathcal{S}}` : a set of parameter
20-
* :math:`s(\boldsymbol{x}) \in \mathcal{L}(T)` : a leaf node of :math:`T` corresponding to :math:`\boldsymbol{x}`
19+
* :math:`s(\boldsymbol{x}) \in \mathcal{L}(T)` : a leaf node of :math:`T` corresponding to :math:`\boldsymbol{x}`, which is determined according to :math:`\boldsymbol{k}` and the thresholds.
2120
2221
.. math::
2322
p(y | \boldsymbol{x}, \boldsymbol{\theta}, T, \boldsymbol{k})=p(y | \theta_{s(\boldsymbol{x})})

bayesml/metatree/_metatree.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ class GenModel(base.Generative):
9090
``c_dim_continuous+c_dim_categorical``, by default [2,2,...,2].
9191
The first ``c_dim_continuous`` elements represent
9292
the numbers of children of continuous features at
93-
inner nodes. The rest ``c_dim_categorial`` elements
93+
inner nodes. The other ``c_dim_categorial`` elements
9494
represent those of categorical features.
9595
If a single integer is input, it will be broadcasted.
9696
c_max_depth : int, optional
@@ -100,7 +100,7 @@ class GenModel(base.Generative):
100100
``c_dim_continuous+c_dim_categorical``.
101101
The first ``c_dim_continuous`` elements represent
102102
the maximum assignment numbers of continuous features
103-
on a path. The rest ``c_dim_categorial`` elements
103+
on a path. The other ``c_dim_categorial`` elements
104104
represent those of categorical features.
105105
By default [c_max_depth,...,c_max_depth,1,...,1].
106106
c_ranges : numpy.ndarray, optional
@@ -928,6 +928,8 @@ def _plot_2d_threshold_recursion_categorical(self,ax,node:_Node,categorical_inde
928928
def visualize_model(self,filename=None,format=None,sample_size=100,x_continuous=None,x_categorical=None):
929929
"""Visualize the stochastic data generative model and generated samples.
930930
931+
Note that values of categorical features will be shown with jitters.
932+
931933
Parameters
932934
----------
933935
filename : str, optional
@@ -1047,7 +1049,7 @@ class LearnModel(base.Posterior,base.PredictiveMixin):
10471049
``c_dim_continuous+c_dim_categorical``, by default [2,2,...,2].
10481050
The first ``c_dim_continuous`` elements represent
10491051
the numbers of children of continuous features at
1050-
inner nodes. The rest ``c_dim_categorial`` elements
1052+
inner nodes. The other ``c_dim_categorial`` elements
10511053
represent those of categorical features.
10521054
If a single integer is input, it will be broadcasted.
10531055
c_max_depth : int, optional
@@ -1057,7 +1059,7 @@ class LearnModel(base.Posterior,base.PredictiveMixin):
10571059
``c_dim_continuous+c_dim_categorical``.
10581060
The first ``c_dim_continuous`` elements represent
10591061
the maximum assignment numbers of continuous features
1060-
on a path. The rest ``c_dim_categorial`` elements
1062+
on a path. The other ``c_dim_categorial`` elements
10611063
represent those of categorical features.
10621064
By default [c_max_depth,...,c_max_depth,1,...,1].
10631065
c_ranges : numpy.ndarray, optional
@@ -2014,6 +2016,10 @@ def _copy_map_tree_recursion(self,copied_node:_Node,original_node:_Node):
20142016
def estimate_params(self,loss="0-1",visualize=True,filename=None,format=None):
20152017
"""Estimate the parameter under the given criterion.
20162018
2019+
The approximate MAP meta-tree
2020+
:math:`M_{T,\boldsymbol{k}_b} = \mathrm{argmax} p(M_{T,\boldsymbol{k}_{b'}} | \boldsymbol{x}^n, y^n)`
2021+
will be returned.
2022+
20172023
Parameters
20182024
----------
20192025
loss : str, optional

0 commit comments

Comments
 (0)