Skip to content

Commit

Permalink
Version 1.4.3 begun!
Browse files Browse the repository at this point in the history
 - Added feature in ParallelPipe to access individual pipes
 - Added scaling function for CoRegGPPrior
  • Loading branch information
mandar2812 committed May 9, 2017
1 parent be23f41 commit c7a8c92
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ packageDescription := "DynaML is a scala library/repl for implementing and worki
"which can be extended easily to implement advanced models for small and large scale applications.\n\n"+
"But the library can also be used as an educational/research tool for data analysis."

val mainVersion = "v1.4.2"
val mainVersion = "v1.4.3-beta.1"

val dataDirectory = settingKey[File]("The directory holding the data files for running example scripts")

Expand Down
8 changes: 4 additions & 4 deletions copy-docs.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/bash

cp -R dynaml-core/target/scala-2.11/api/* docs/api_docs/v1.4.2/dynaml-core/
cp -R dynaml-pipes/target/scala-2.11/api/* docs/api_docs/v1.4.2/dynaml-pipes/
cp -R dynaml-examples/target/scala-2.11/api/* docs/api_docs/v1.4.2/dynaml-examples/
cp -R target/scala-2.11/api/* docs/api_docs/v1.4.2/dynaml-repl/
cp -R dynaml-core/target/scala-2.11/api/* docs/api_docs/v1.4.3/dynaml-core/
cp -R dynaml-pipes/target/scala-2.11/api/* docs/api_docs/v1.4.3/dynaml-pipes/
cp -R dynaml-examples/target/scala-2.11/api/* docs/api_docs/v1.4.3/dynaml-examples/
cp -R target/scala-2.11/api/* docs/api_docs/v1.4.3/dynaml-repl/
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import io.github.mandar2812.dynaml.modelpipe.GPRegressionPipe2
import io.github.mandar2812.dynaml.models.gp.AbstractGPRegressionModel

import scala.reflect.ClassTag
import io.github.mandar2812.dynaml.pipes.{DataPipe, MetaPipe}
import io.github.mandar2812.dynaml.pipes.{DataPipe, MetaPipe, ParallelPipe}
import io.github.mandar2812.dynaml.probability.{MatrixNormalRV, MultGaussianPRV}

/**
Expand Down Expand Up @@ -213,6 +213,7 @@ abstract class CoRegGPPrior[I: ClassTag, J: ClassTag, MeanFuncParams](
noiseCovarianceI: LocalScalarKernel[I], noiseCovarianceJ: LocalScalarKernel[J]) extends
GaussianProcessPrior[(I,J), MeanFuncParams](covarianceI:*covarianceJ, noiseCovarianceI:*noiseCovarianceJ) {

self =>

def priorDistribution[U <: Seq[I], V <: Seq[J]](d1: U, d2: V): MatrixNormalRV = {

Expand All @@ -224,6 +225,26 @@ abstract class CoRegGPPrior[I: ClassTag, J: ClassTag, MeanFuncParams](
MatrixNormalRV(m, u, v)
}

/**
* Define a prior over the process which is a scaled version of the base GP.
*
* z ~ GP(m(.), K(.,.))
*
* y = g(x)&times;z
*
* y ~ GP(g(x)&times;m(x), g(x)K(x,x')g(x'))
**/
def *(scalingFunc: ParallelPipe[I, Double, J, Double]) =
CoRegGPPrior(
ScaledKernel[I](self.covarianceI, scalingFunc._1),
ScaledKernel[J](self.covarianceJ, scalingFunc._2),
ScaledKernel[I](self.noiseCovarianceI, scalingFunc._1),
ScaledKernel[J](self.noiseCovarianceJ, scalingFunc._2))(
MetaPipe((p: MeanFuncParams) => (x: (I, J)) => {
self.meanFunctionPipe(p)(x)*scalingFunc._1(x._1)*scalingFunc._2(x._2)
}),
self._meanFuncParams
)
}

object CoRegGPPrior {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,21 @@ object DataPipe {
trait ParallelPipe[-Source1, +Result1, -Source2, +Result2]
extends DataPipe[(Source1, Source2), (Result1, Result2)] {

val _1: DataPipe[Source1, Result1]
val _2: DataPipe[Source2, Result2]

}

object ParallelPipe {
def apply[S1, D1, S2, D2](func1: (S1) => D1, func2: (S2) => D2):
ParallelPipe[S1, D1, S2, D2] = {
new ParallelPipe[S1, D1, S2, D2] {

def run(data: (S1, S2)) = (func1(data._1), func2(data._2))

override val _1 = DataPipe(func1)

override val _2 = DataPipe(func2)
}
}
}
Expand Down

0 comments on commit c7a8c92

Please sign in to comment.