From 0eab203c3d2e8ef98ba651b407f162ea8ca45492 Mon Sep 17 00:00:00 2001 From: ozan Date: Sun, 13 Sep 2020 22:48:42 +0900 Subject: [PATCH] update docs and prepare for 0.5.0 release --- README.md | 6 +++--- build.sbt | 2 +- docs/conf.py | 2 +- docs/gmmguide.rst | 3 ++- docs/rlsguide.rst | 2 ++ examples/src/main/python/streaming/gmm_rate_source.py | 2 +- .../src/main/python/streaming/rls_rate_source_ols.py | 1 + .../artan/examples/streaming/GMMRateSource.scala | 1 + .../artan/examples/streaming/RLSRateSourceOLS.scala | 1 + python/artan/mixture/mixture_params.py | 9 +++++++++ setup.py | 2 +- 11 files changed, 23 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index bf0dce7..5567589 100644 --- a/README.md +++ b/README.md @@ -35,17 +35,17 @@ Artan requires Scala 2.12, Spark 3.0+ and Python 3,6+ This project has been published to the Maven Central Repository. When submitting jobs on your cluster, you can use `spark-submit` with `--packages` parameter to download all required dependencies including python packages. - spark-submit --packages='com.github.ozancicek:artan_2.12:0.4.2' + spark-submit --packages='com.github.ozancicek:artan_2.12:0.5.0' For SBT: - libraryDependencies += "com.github.ozancicek" %% "artan" % "0.4.2" + libraryDependencies += "com.github.ozancicek" %% "artan" % "0.5.0" For python: pip install artan -Note that pip will only install the python dependencies. To submit pyspark jobs, `--packages='com.github.ozancicek:artan_2.12:0.4.2'` argument should be specified in order to download necessary jars. +Note that pip will only install the python dependencies. To submit pyspark jobs, `--packages='com.github.ozancicek:artan_2.12:0.5.0'` argument should be specified in order to download necessary jars. ## Docs and Examples diff --git a/build.sbt b/build.sbt index 7c55cd5..654798e 100644 --- a/build.sbt +++ b/build.sbt @@ -20,7 +20,7 @@ val longDesc = """Online latent state estimation with Apache Spark. lazy val settings = Seq( scalaVersion := scalaVer, - version := "0.4.2", + version := "0.5.0", organization := "com.github.ozancicek", organizationName := "ozancicek", sparkVersion := sparkVer, diff --git a/docs/conf.py b/docs/conf.py index afb8881..9cc5344 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -21,7 +21,7 @@ author = 'Ozan Cicekci' # The full version, including alpha/beta/rc tags -release = '0.4.2' +release = '0.5.0' rst_epilog = f""" .. |artan_version| replace:: {release} """ diff --git a/docs/gmmguide.rst b/docs/gmmguide.rst index 71c08a8..fb1bdea 100644 --- a/docs/gmmguide.rst +++ b/docs/gmmguide.rst @@ -79,6 +79,7 @@ consecutive numbers with timestamps. These consecutive numbers are binned to sim // Set initial values and hyperparams. val gmm = new MultivariateGaussianMixture() + .setMixtureCount(3) .setInitialWeights(Array(0.33, 0.33, 0.33)) .setStateKeyCol("stateKey") .setInitialMeans(Array(Array(3.0, 5.0), Array(6.0, 6.0), Array(7.0, 1.0))) @@ -207,7 +208,7 @@ consecutive numbers with timestamps. These consecutive numbers are binned to sim eye = [1.0, 0.0, 0.0, 1.0] gmm = MultivariateGaussianMixture()\ .setMixtureCount(3)\ - .setInitialWeights([0.0, 0.0, 0.0])\ + .setInitialWeights([0.33, 0.33, 0.33])\ .setStateKeyCol("stateKey")\ .setInitialMeans([[3.0, 5.0], [6.0, 6.0], [7.0, 1.0]])\ .setInitialCovariances([eye, eye, eye])\ diff --git a/docs/rlsguide.rst b/docs/rlsguide.rst index 1785a95..b8e2357 100644 --- a/docs/rlsguide.rst +++ b/docs/rlsguide.rst @@ -75,6 +75,7 @@ identifying different models and their incremented index. val filter = new RecursiveLeastSquaresFilter() .setStateKeyCol("stateKey") + .setFeatureSize(3) .setInitialEstimate(new DenseVector(Array(0.0, 0.0, 0.0))) .setRegularizationMatrixFactor(10E6) .setForgettingFactor(0.99) @@ -185,6 +186,7 @@ identifying different models and their incremented index. rls = RecursiveLeastSquaresFilter()\ .setStateKeyCol("stateKey")\ + .setFeatureSize(3)\ .setInitialEstimate(Vectors.dense([0.0, 0.0, 0.0]))\ .setRegularizationMatrixFactor(10E6)\ .setForgettingFactor(0.99) diff --git a/examples/src/main/python/streaming/gmm_rate_source.py b/examples/src/main/python/streaming/gmm_rate_source.py index 9b2c450..9dd893b 100644 --- a/examples/src/main/python/streaming/gmm_rate_source.py +++ b/examples/src/main/python/streaming/gmm_rate_source.py @@ -70,7 +70,7 @@ initial_covs = [eye, eye, eye] gmm = MultivariateGaussianMixture()\ .setMixtureCount(3)\ - .setInitialWeights([0.0, 0.0, 0.0])\ + .setInitialWeights([0.33, 0.33, 0.33])\ .setStateKeyCol("stateKey")\ .setInitialMeans(initial_means)\ .setInitialCovariances(initial_covs)\ diff --git a/examples/src/main/python/streaming/rls_rate_source_ols.py b/examples/src/main/python/streaming/rls_rate_source_ols.py index 024c806..607d540 100644 --- a/examples/src/main/python/streaming/rls_rate_source_ols.py +++ b/examples/src/main/python/streaming/rls_rate_source_ols.py @@ -89,6 +89,7 @@ rls = RecursiveLeastSquaresFilter()\ .setStateKeyCol("stateKey")\ + .setFeatureSize(3)\ .setInitialEstimate(Vectors.dense([0.0, 0.0, 0.0]))\ .setRegularizationMatrixFactor(10E6)\ .setForgettingFactor(0.99) diff --git a/examples/src/main/scala/com/github/ozancicek/artan/examples/streaming/GMMRateSource.scala b/examples/src/main/scala/com/github/ozancicek/artan/examples/streaming/GMMRateSource.scala index 8fec48b..f9a0fdd 100644 --- a/examples/src/main/scala/com/github/ozancicek/artan/examples/streaming/GMMRateSource.scala +++ b/examples/src/main/scala/com/github/ozancicek/artan/examples/streaming/GMMRateSource.scala @@ -61,6 +61,7 @@ object GMMRateSource { val mixture = when(weight < 0.2, dist1).when(weight < 0.5, dist2).otherwise(dist3) val gmm = new MultivariateGaussianMixture() + .setMixtureCount(3) .setInitialWeights(Array(0.33, 0.33, 0.33)) .setStateKeyCol("stateKey") .setInitialMeans(Array(Array(3.0, 5.0), Array(6.0, 6.0), Array(7.0, 1.0))) diff --git a/examples/src/main/scala/com/github/ozancicek/artan/examples/streaming/RLSRateSourceOLS.scala b/examples/src/main/scala/com/github/ozancicek/artan/examples/streaming/RLSRateSourceOLS.scala index 60c190c..3dda29d 100644 --- a/examples/src/main/scala/com/github/ozancicek/artan/examples/streaming/RLSRateSourceOLS.scala +++ b/examples/src/main/scala/com/github/ozancicek/artan/examples/streaming/RLSRateSourceOLS.scala @@ -67,6 +67,7 @@ object RLSRateSourceOLS { val filter = new RecursiveLeastSquaresFilter() .setStateKeyCol("stateKey") + .setFeatureSize(3) .setInitialEstimate(new DenseVector(Array(0.0, 0.0, 0.0))) .setRegularizationMatrixFactor(10E6) .setForgettingFactor(0.99) diff --git a/python/artan/mixture/mixture_params.py b/python/artan/mixture/mixture_params.py index e9be85d..8fff4b3 100644 --- a/python/artan/mixture/mixture_params.py +++ b/python/artan/mixture/mixture_params.py @@ -343,6 +343,15 @@ class MixtureParams(HasSampleCol, HasStepSize, HasStepSizeCol, HasInitialWeights HasMinibatchSizeCol, HasUpdateHoldoutCol, HasBatchTrainEnabled, HasBatchTrainMaxIter, HasBatchTrainTol, HasMixtureCount): + def setMixtureCount(self, value): + """ + Sets the number of components in the finite mixture + + :param value: Int + :return: MixtureTransformer + """ + return self._set(mixtureCount=value) + def setSampleCol(self, value): """ Sets the sample column for the mixture model inputs. Depending on the mixture distribution, sample type should diff --git a/setup.py b/setup.py index 8a1cd57..e120a72 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ from setuptools import setup -VERSION = "0.4.2" +VERSION = "0.5.0" with open("README.md") as f: long_description = f.read()