bnmf-algs
alloc_model_params.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include "defs.hpp"
4 #include <vector>
5 
6 namespace bnmf_algs {
7 namespace alloc_model {
8 
25 template <typename Scalar> struct Params {
28  Scalar a;
32  Scalar b;
43 
55  Params(Scalar a, Scalar b, const std::vector<Scalar>& alpha,
56  const std::vector<Scalar>& beta)
57  : a(a), b(b), alpha(alpha), beta(beta) {}
58 
78  explicit Params(const shape<3>& tensor_shape)
79  : a(static_cast<Scalar>(1)), b(static_cast<Scalar>(10)),
80  alpha(tensor_shape[0], static_cast<Scalar>(1)),
81  beta(tensor_shape[2], static_cast<Scalar>(1)) {}
82 
83  Params() = default;
84 };
85 
96 template <typename Scalar>
97 Params<Scalar> make_bld_params(const shape<3>& tensor_shape) {
98  return Params<Scalar>(tensor_shape);
99 }
100 
116 template <typename Scalar>
118  Params<Scalar> bld_params(tensor_shape);
119  bld_params.beta =
120  std::vector<Scalar>(tensor_shape[1], static_cast<Scalar>(1));
121 
122  return std::vector<Params<Scalar>>(tensor_shape[2], bld_params);
123 }
124 
125 } // namespace alloc_model
126 } // namespace bnmf_algs
Structure to hold the parameters for the Allocation Model .
Definition: alloc_model_params.hpp:25
Eigen::array< size_t, N > shape
Shape of vectors, matrices, tensors, etc.
Definition: defs.hpp:66
std::vector< Params< Scalar > > make_EM_params(const shape< 3 > &tensor_shape)
Make default EM solver parameters.
Definition: alloc_model_params.hpp:117
Params(const shape< 3 > &tensor_shape)
Construct Params with the default distribution parameters according to the given tensor shape...
Definition: alloc_model_params.hpp:78
std::vector< Scalar > alpha
Parameter vector of Dirichlet prior for matrix of size .
Definition: alloc_model_params.hpp:37
Params< Scalar > make_bld_params(const shape< 3 > &tensor_shape)
Make default BLD solver parameters.
Definition: alloc_model_params.hpp:97
Scalar a
Shape parameter of Gamma distribution.
Definition: alloc_model_params.hpp:28
Scalar b
Rate parameter of Gamma distribution.
Definition: alloc_model_params.hpp:32
Params(Scalar a, Scalar b, const std::vector< Scalar > &alpha, const std::vector< Scalar > &beta)
Construct Params manually with the given distribution parameters.
Definition: alloc_model_params.hpp:55
std::vector< Scalar > beta
Parameter vector of Dirichlet prior for matrix of size .
Definition: alloc_model_params.hpp:42
Main namespace for bnmf-algs library.
Definition: alloc_model_funcs.hpp:12