Skip to content

Latest commit

 

History

History
89 lines (59 loc) · 2.9 KB

README.md

File metadata and controls

89 lines (59 loc) · 2.9 KB

lvm4j

Project Status Build Status codecov Codacy Badge Maven Javadocs

Latent variable models in Java.

Introduction

Latent variable models (LVMs) are well-established statistical models where some of the variables are not observed. lvm4j implements popular LVMs in the Java programming language. For the sake of simplicity I refer to every model as latent if it consists of two disjoint sets of variables, one that is observed and one that is hidden (e.g. we don't have data or they are just not observable at all).

With new versions I will try to cover more latent variable models in lvm4j.

Installation

Maven

Just include this in your pom.xml:

<dependency>
    <groupId>net.digital-alexandria</groupId>
    <artifactId>lvm4j</artifactId>
    <version>0.2</version>
</dependency>

Install the package manually

You can also build the jar and then include it in your package.

  1. Download the latest releast

  2. Then build the package:

       mvn clean package -P standalone
  3. This gives you a lvm4j-standalone.jar that can be added to your project (make sure to call this correctly).

Usage

For usage check out javadocs or the tutorial below.

Mixture models

GaussianMixtureModel gmm = Lvm4j.gaussianMixture(iris);
GaussianMixtureComponents comps = gmm.fit(2);

Dimensionality reduction

FactorAnalysis fa = Lvm4j.factorAnalysis(iris);
INDArray Z = fa.run(2);

PCA pca = Lvm4j.pca(iris);
INDArray Z = pca.run(4);

Markov models

HMM hmm = Lvm4j.hmm(new char[]{'A', 'B', 'C'}, new char[]{'X', 'Y', 'Z'}, 1)

Map<String, String> m = new HashMap<String, String>()
{{
    put("A", "ABCABC");
    put("B", "ABCABC");
}};
hmm.train(m, m);
Map<String, String> preds = hmm.predict(m);

Author

Simon Dirmeier [email protected]