Hi Chiwan,

when you use the single element predict operation, you always have to
implement the `getModel` method. There you have access to the resulting
parameters and even to the instance to which the `PredictOperation`
belongs. Within in this `getModel` method you can initialize all the
information you need for the `predict` operation.

You can take a look at the `StandardScalerTransformOperation` [1] where the
mean and the std are set in the `getModel` method.

Cheers,
Till

[1]
https://github.com/apache/flink/blob/master/flink-staging/flink-ml/src/main/scala/org/apache/flink/ml/preprocessing/StandardScaler.scala#L197

On Sun, Jun 28, 2015 at 1:49 PM, Chiwan Park <chiwanp...@apache.org> wrote:

> Hi, I’m implementing k-nearest-neighbors classification based flink-ml
> structure.
>
> In recent commit (7a7a2940 [1]), the pipeline is restructured by dividing
> predict operation
> into case of a single element and case of data set. In case of data set,
> parameter map is
> given as a method parameter but in case of a single element there is no
> method to access
> parameter map.
>
> But in k-nearest-neighbors classification, we need to know k in predict
> method to select top
> k values.
>
> How can I solve this problem?
>
> Regards,
> Chiwan Park
>
> [1]
> https://github.com/apache/flink/commit/7a7a294033ef99c596e59f670e2e4ae9262f5c5f
>
>

Reply via email to