Sha256: fb938f2a716c918788a4a6c9e06783ebbc9915c7950135c349b7897a4d0a3985

Contents?: true

Size: 1.23 KB

Versions: 1

Compression:

Stored size: 1.23 KB

Contents

#pragma once
#include "LDA.h"

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

		// numByTopic indicates numByLevel in HLDAModel.
		// Zs indicates level in HLDAModel.
		std::vector<int32_t> path;

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

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

	struct HLDAArgs : public LDAArgs
	{
		Float gamma = 0.1;

		HLDAArgs()
		{
			k = 2;
		}
	};

	class IHLDAModel : public ILDAModel
	{
	public:
		using DefaultDocType = DocumentHLDA<TermWeight::one>;
		static IHLDAModel* create(TermWeight _weight, const HLDAArgs& args,
			bool scalarRng = false);

		virtual Float getGamma() const = 0;
		virtual size_t getLiveK() const = 0;
		virtual size_t getLevelDepth() const = 0;
		virtual bool isLiveTopic(Tid tid) const = 0;
		virtual size_t getNumDocsOfTopic(Tid tid) const = 0;
		virtual size_t getLevelOfTopic(Tid tid) const = 0;
		virtual size_t getParentTopicId(Tid tid) const = 0;
		virtual std::vector<uint32_t> getChildTopicId(Tid tid) const = 0;
	};
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tomoto-0.4.1 vendor/tomotopy/src/TopicModel/HLDA.h