O'Reilly logo

Learning Salesforce Einstein by Mohith Shrivastava

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Algorithm

The Algorithm class consists of two main methods: Train() and Predict().

The pio train command runs the Train method that is responsible for training a predictive model and the Predict method is responsible for predicting a model. Consider the following diagram:

The sample Java code for the pio train method would look as follows:

     @Override     public Model train(SparkContext sc, PreparedData preparedData) {       TrainingData data = preparedData.getTrainingData();       // user stuff       JavaPairRDD<String, Integer> userIndexRDD =        data.getUsers().map(new Function<Tuple2<String, User>, String>()       {         @Override public String call(Tuple2<String, User> idUser) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required