|
1 | 1 | package io.github.mandar2812.dynaml.modelpipe |
2 | 2 |
|
3 | 3 | import io.github.mandar2812.dynaml.models.Model |
4 | | -import io.github.mandar2812.dynaml.pipes.DataPipe |
| 4 | +import io.github.mandar2812.dynaml.DynaMLPipe._ |
| 5 | +import io.github.mandar2812.dynaml.pipes.{DataPipe, ReversibleScaler} |
5 | 6 |
|
6 | 7 | /** |
7 | 8 | * Top level trait for Pipes returning ML models. |
@@ -45,7 +46,32 @@ class ModelPredictionPipe[T, -P, Q, R, +S, M <: Model[T, Q, R]]( |
45 | 46 | } |
46 | 47 |
|
47 | 48 | object ModelPredictionPipe { |
| 49 | + /** |
| 50 | + * Create a [[ModelPredictionPipe]] instance given |
| 51 | + * a pre-processing flow, a DynaML [[Model]] and a post-processing flow |
| 52 | + * respectively. |
| 53 | + * */ |
48 | 54 | def apply[T, P, Q, R, S, M <: Model[T, Q, R]]( |
49 | 55 | pre: DataPipe[P, Q], m: M, po: DataPipe[R, S]) = |
50 | 56 | new ModelPredictionPipe[T, P, Q, R, S, M](pre, m, po) |
| 57 | + |
| 58 | + /** |
| 59 | + * Create a [[ModelPredictionPipe]] instance |
| 60 | + * (having no pre or post processing steps) |
| 61 | + * given a DynaML [[Model]] |
| 62 | + * |
| 63 | + * */ |
| 64 | + def apply[T, Q, R, M <: Model[T, Q, R]](m: M) = |
| 65 | + new ModelPredictionPipe[T, Q, Q, R, R, M](identityPipe[Q], m, identityPipe[R]) |
| 66 | + |
| 67 | + /** |
| 68 | + * Create a [[ModelPredictionPipe]] instance |
| 69 | + * given scaling relationships for features and outputs, |
| 70 | + * along with a DynaML [[Model]] |
| 71 | + * |
| 72 | + * */ |
| 73 | + def apply[T, Q, R, M <: Model[T, Q, R]]( |
| 74 | + featuresSc: ReversibleScaler[Q], outputSc: ReversibleScaler[R], m: M) = |
| 75 | + new ModelPredictionPipe[T, Q, Q, R, R, M](featuresSc, m, outputSc.i) |
| 76 | + |
51 | 77 | } |
0 commit comments