Search in sources :

Example 1 with Segment

use of org.dmg.pmml.mining.Segment in project jpmml-sparkml by jpmml.

the class ModelConverter method getLastModel.

protected org.dmg.pmml.Model getLastModel(org.dmg.pmml.Model model) {
    if (model instanceof MiningModel) {
        MiningModel miningModel = (MiningModel) model;
        Segmentation segmentation = miningModel.getSegmentation();
        MultipleModelMethod multipleModelMethod = segmentation.getMultipleModelMethod();
        switch(multipleModelMethod) {
            case MODEL_CHAIN:
                List<Segment> segments = segmentation.getSegments();
                if (segments.size() > 0) {
                    Segment lastSegment = segments.get(segments.size() - 1);
                    return lastSegment.getModel();
                }
                break;
            default:
                break;
        }
    }
    return model;
}
Also used : MiningModel(org.dmg.pmml.mining.MiningModel) Segmentation(org.dmg.pmml.mining.Segmentation) MultipleModelMethod(org.dmg.pmml.mining.Segmentation.MultipleModelMethod) Segment(org.dmg.pmml.mining.Segment)

Aggregations

MiningModel (org.dmg.pmml.mining.MiningModel)1 Segment (org.dmg.pmml.mining.Segment)1 Segmentation (org.dmg.pmml.mining.Segmentation)1 MultipleModelMethod (org.dmg.pmml.mining.Segmentation.MultipleModelMethod)1