Sha256: cdc2daac4e7405baa012d6baf0e7e8f86285070d5ff5e2729a95804c7616f17d

Contents?: true

Size: 1.54 KB

Versions: 3

Compression:

Stored size: 1.54 KB

Contents

#pragma once
#include "LDA.h"

namespace tomoto
{
    template<TermWeight _tw>
	struct DocumentPA : public DocumentLDA<_tw>
	{
		using BaseDocument = DocumentLDA<_tw>;
		using DocumentLDA<_tw>::DocumentLDA;
		using WeightType = typename DocumentLDA<_tw>::WeightType;

		tvector<Tid> Z2s;
		Eigen::Matrix<WeightType, -1, -1> numByTopic1_2;

		template<typename _TopicModel> void update(WeightType* ptr, const _TopicModel& mdl);

		DECLARE_SERIALIZER_WITH_VERSION(0);
		DECLARE_SERIALIZER_WITH_VERSION(1);
	};

	struct PAArgs : public LDAArgs
	{
		size_t k2 = 1;
		std::vector<Float> subalpha = { 0.1 };
	};
    
    class IPAModel : public ILDAModel
	{
	public:
		using DefaultDocType = DocumentPA<TermWeight::one>;
		static IPAModel* create(TermWeight _weight, const PAArgs& args,
			bool scalarRng = false);

		virtual size_t getDirichletEstIteration() const = 0;
		virtual void setDirichletEstIteration(size_t iter) = 0;
		virtual size_t getK2() const = 0;
		virtual Float getSubAlpha(Tid k1, Tid k2) const = 0;
		virtual std::vector<Float> getSubAlpha(Tid k1) const = 0;
		virtual std::vector<Float> getSubTopicBySuperTopic(Tid k, bool normalize = true) const = 0;
		virtual std::vector<std::pair<Tid, Float>> getSubTopicBySuperTopicSorted(Tid k, size_t topN) const = 0;

		virtual std::vector<Float> getSubTopicsByDoc(const DocumentBase* doc, bool normalize = true) const = 0;
		virtual std::vector<std::pair<Tid, Float>> getSubTopicsByDocSorted(const DocumentBase* doc, size_t topN) const = 0;

		virtual std::vector<uint64_t> getCountBySuperTopic() const = 0;
	};
}

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tomoto-0.5.1 vendor/tomotopy/src/TopicModel/PA.h
tomoto-0.5.0 vendor/tomotopy/src/TopicModel/PA.h
tomoto-0.4.1 vendor/tomotopy/src/TopicModel/PA.h