Sha256: b45e4b4f1f0ee19116fc88eba64cdead36f88f07c89aba46fdbbb77b3d673ed1

Contents?: true

Size: 1.21 KB

Versions: 9

Compression:

Stored size: 1.21 KB

Contents

#pragma once
#include "LDA.h"

namespace tomoto
{
    template<TermWeight _tw>
	struct DocumentSLDA : public DocumentLDA<_tw>
	{
		using BaseDocument = DocumentLDA<_tw>;
		using DocumentLDA<_tw>::DocumentLDA;
		std::vector<Float> y;

		RawDoc::MiscType makeMisc(const ITopicModel* tm) const override
		{
			RawDoc::MiscType ret = DocumentLDA<_tw>::makeMisc(tm);
			ret["y"] = y;
			return ret;
		}
		DEFINE_SERIALIZER_AFTER_BASE_WITH_VERSION(BaseDocument, 0, y);
		DEFINE_TAGGED_SERIALIZER_AFTER_BASE_WITH_VERSION(BaseDocument, 1, 0x00010001, y);
	};

	struct SLDAArgs;

	class ISLDAModel : public ILDAModel
	{
	public:
		enum class GLM
		{
			linear = 0,
			binary_logistic = 1,
		};

		using DefaultDocType = DocumentSLDA<TermWeight::one>;
		static ISLDAModel* create(TermWeight _weight, const SLDAArgs& args,
			bool scalarRng = false);

		virtual size_t getF() const = 0;
		virtual std::vector<Float> getRegressionCoef(size_t f) const = 0;
		virtual GLM getTypeOfVar(size_t f) const = 0;
		virtual std::vector<Float> estimateVars(const DocumentBase* doc) const = 0;
	};

	struct SLDAArgs : public LDAArgs
	{
		std::vector<ISLDAModel::GLM> vars;
		std::vector<Float> mu;
		std::vector<Float> nuSq;
		std::vector<Float> glmParam;
	};
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
tomoto-0.4.0 vendor/tomotopy/src/TopicModel/SLDA.h
tomoto-0.3.3 vendor/tomotopy/src/TopicModel/SLDA.h
tomoto-0.3.2 vendor/tomotopy/src/TopicModel/SLDA.h
tomoto-0.3.1 vendor/tomotopy/src/TopicModel/SLDA.h
tomoto-0.3.0 vendor/tomotopy/src/TopicModel/SLDA.h
tomoto-0.2.3 vendor/tomotopy/src/TopicModel/SLDA.h
tomoto-0.2.2 vendor/tomotopy/src/TopicModel/SLDA.h
tomoto-0.2.1 vendor/tomotopy/src/TopicModel/SLDA.h
tomoto-0.2.0 vendor/tomotopy/src/TopicModel/SLDA.h