How to use Flinks Splitter Methods in Java

moe :

The flink documentation has an example for the usage of the Splitter methods in scala which goes like this:

// Create an Array of K TrainTestDataSets
val dataKFolded: Array[TrainTestDataSet] =  Splitter.kFoldSplit(data, 10)

In Java however I am forced to pass to further arguments for TypeInformation and ClassTag. I think for the TypeInformation the TypeInformation.of(TypeofDataset.class) is the valid input. But I cannot find out what to use for the second parameter.

LppEdd :

Given this Scala signature

def kFoldSplit[T: TypeInformation : ClassTag](
      input: DataSet[T],
      kFolds: Int,
      seed: Long = Utils.RNG.nextLong()
) : Array[TrainTestDataSet[T]]

The Java call would be

Splitter.kFoldSplit(
    data,
    10,
    99,
    TypeInformation.of(TypeofDataset.class),
    ClassTag$.MODULE$.apply(TypeofDataset.class)
)

ClassTag$ comes from

scala.reflect.ClassTag$

Horrible, but necessary.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=150288&siteId=1