blob: 5c9f7f10dc882edfcf43ba877c81fc4b3fad7b79 [file] [log] [blame]
package org.template.textclassification
import io.prediction.controller.PPreparator
import io.prediction.controller.Params
import org.apache.spark.SparkContext
// 1. Initialize Preparator parameters. Recall that for our data
// representation we are only required to input the n-gram window
// components.
case class PreparatorParams(
nMin: Int,
nMax: Int,
inverseIdfMin : Double,
inverseIdfMax : Double
) extends Params
// 2. Initialize your Preparator class.
class Preparator(pp: PreparatorParams) extends PPreparator[TrainingData, PreparedData] {
// Prepare your training data.
def prepare(sc : SparkContext, td: TrainingData): PreparedData = {
new PreparedData(td, pp.nMin, pp.nMax, pp.inverseIdfMin, pp. inverseIdfMax)
}
}