Skip to content

Commit c394be6

Browse files
committed
Scala doc commenting on ModelPredictionPipe class
1 parent 1e569e1 commit c394be6

File tree

1 file changed

+19
-6
lines changed
  • dynaml-core/src/main/scala-2.11/io/github/mandar2812/dynaml/modelpipe

1 file changed

+19
-6
lines changed

dynaml-core/src/main/scala-2.11/io/github/mandar2812/dynaml/modelpipe/ModelPipe.scala

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import io.github.mandar2812.dynaml.models.Model
44
import io.github.mandar2812.dynaml.pipes.DataPipe
55

66
/**
7-
* Top level trait for Pipes involving ML models.
7+
* Top level trait for Pipes returning ML models.
88
*/
99
trait ModelPipe[-Source, T, Q, R, +M <: Model[T, Q, R]]
1010
extends DataPipe[Source, M] {
@@ -15,9 +15,20 @@ trait ModelPipe[-Source, T, Q, R, +M <: Model[T, Q, R]]
1515
}
1616

1717
/**
18-
* A pipeline which encapsulates a DynaML [[Model]]
18+
* A pipeline which encapsulates a DynaML [[Model.predict()]] functionality.
19+
*
20+
* @tparam T The training data type accepted by the encapsulated model
21+
* @tparam P The type of unprocessed input to the pipe
22+
* @tparam Q The type of input features the model accepts
23+
* @tparam R The type of output returned by [[Model.predict()]]
24+
* @tparam S The type of the processed output.
25+
*
26+
* @param m The underlying model
27+
* @param pre Pre-processing [[DataPipe]]
28+
* @param po Post-processing [[DataPipe]]
29+
*
1930
* */
20-
class ModelPredictionPipe[T, P, Q, R, S, M <: Model[T, Q, R]](
31+
class ModelPredictionPipe[T, -P, Q, R, +S, M <: Model[T, Q, R]](
2132
pre: DataPipe[P, Q], m: M, po: DataPipe[R, S])
2233
extends DataPipe[P, S] {
2334

@@ -27,12 +38,14 @@ class ModelPredictionPipe[T, P, Q, R, S, M <: Model[T, Q, R]](
2738

2839
val postprocess: DataPipe[R, S] = po
2940

30-
protected val netFlow: DataPipe[P, S] = preprocess > DataPipe((x: Q) => baseModel.predict(x)) > postprocess
41+
protected val netFlow: DataPipe[P, S] =
42+
preprocess > DataPipe((x: Q) => baseModel.predict(x)) > postprocess
3143

3244
override def run(data: P) = netFlow(data)
3345
}
3446

3547
object ModelPredictionPipe {
36-
def apply[T, P, Q, R, S, M <: Model[T, Q, R]](pre: DataPipe[P, Q], m: M, po: DataPipe[R, S]) =
48+
def apply[T, P, Q, R, S, M <: Model[T, Q, R]](
49+
pre: DataPipe[P, Q], m: M, po: DataPipe[R, S]) =
3750
new ModelPredictionPipe[T, P, Q, R, S, M](pre, m, po)
38-
}
51+
}

0 commit comments

Comments
 (0)