#ifndef MIXTURE_NODE_H_ #define MIXTURE_NODE_H_ #include #include #include /** * A mixture node takes its value from one of several parents, based * on the current value of an index node, which is also a parent * @short Node for mixture models */ class MixtureNode : public DeterministicNode { std::map _map; std::vector _index; public: /** * Constructor. * @param index Vector of discrete-valued scalar nodes * @param parameters Vector of pairs. Each pair associates a * possible value of the index nodes with a parent. The mixture node * copies its value from the parent that matches the current value * of the index. */ MixtureNode(std::vector const &index, std::vector > const ¶meters); ~MixtureNode(); void forwardSample(); /** * Returns the vector of index nodes. */ std::vector const &index() const; /** * Returns true if all of the parameters of the node are discrete-valued */ bool isDiscreteValued() const; }; MixtureNode const *asMixture(Node const *node); bool isMixture(Node const *node); #endif /* MIXTURE_NODE_H_ */