Latent variable models in Java.
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
.
Just include this in your pom.xml
:
<dependency>
<groupId>net.digital-alexandria</groupId>
<artifactId>lvm4j</artifactId>
<version>0.2</version>
</dependency>
You can also build the jar
and then include it in your package.
-
Download the latest releast
-
Then build the package:
mvn clean package -P standalone
-
This gives you a
lvm4j-standalone.jar
that can be added to your project (make sure to call this correctly).
For usage check out javadocs
or the tutorial below.
GaussianMixtureModel gmm = Lvm4j.gaussianMixture(iris);
GaussianMixtureComponents comps = gmm.fit(2);
FactorAnalysis fa = Lvm4j.factorAnalysis(iris);
INDArray Z = fa.run(2);
PCA pca = Lvm4j.pca(iris);
INDArray Z = pca.run(4);
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);
Simon Dirmeier [email protected]