Package org.dmg.pmml

Examples of org.dmg.pmml.PMML


    assertEquals(MiningFunctionType.CLASSIFICATION, treeModel.getFunctionName());
  }

  @Test
  public void testExtensionValue() {
    PMML model = buildDummyModel();
    assertNull(PMMLUtils.getExtensionValue(model, "foo"));
    PMMLUtils.addExtension(model, "foo", "bar");
    assertEquals("bar", PMMLUtils.getExtensionValue(model, "foo"));
  }
View Full Code Here


    assertEquals("bar", PMMLUtils.getExtensionValue(model, "foo"));
  }

  @Test
  public void testExtensionContent() {
    PMML model = buildDummyModel();
    assertNull(PMMLUtils.getExtensionContent(model, "foo"));
    PMMLUtils.addExtensionContent(model, "foo", Arrays.asList("bar", "baz"));
    assertEquals(Arrays.<Object>asList("bar", "baz"), PMMLUtils.getExtensionContent(model, "foo"));
    PMMLUtils.addExtensionContent(model, "foo", Collections.emptyList());
    assertEquals(Arrays.<Object>asList("bar", "baz"), PMMLUtils.getExtensionContent(model, "foo"));
View Full Code Here

    assertTrue(PMMLUtils.parseArray(Collections.singletonList("")).isEmpty());
  }

  @Test
  public void testToString() throws Exception {
    PMML model = buildDummyModel();
    model.getHeader().setTimestamp(null);
    assertEquals("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" +
                 "<PMML version=\"4.2.1\" xmlns=\"http://www.dmg.org/PMML-4_2\">\n" +
                 "    <Header>\n" +
                 "        <Application name=\"Oryx\"/>\n" +
                 "    </Header>\n" +
View Full Code Here

                 PMMLUtils.toString(model));
  }

  @Test
  public void testFromString() throws Exception {
    PMML model = buildDummyModel();
    PMML model2 = PMMLUtils.fromString(PMMLUtils.toString(model));
    assertEquals(model.getHeader().getApplication().getName(),
                 model2.getHeader().getApplication().getName());
    assertEquals(model.getModels().get(0).getFunctionName(),
                 model2.getModels().get(0).getFunctionName());
  }
View Full Code Here

    fs.delete(candidatesPath, true);

    // Push PMML model onto model queue, if it exists
    Path bestModelPath = new Path(finalPath, MODEL_FILE_NAME);
    if (fs.exists(bestModelPath)) {
      PMML bestModel;
      try (InputStream in = new GZIPInputStream(fs.open(bestModelPath), 1 << 16)) {
        bestModel = PMMLUtils.read(in);
      }
      modelUpdateQueue.send("MODEL", PMMLUtils.toString(bestModel));
      publishAdditionalModelData(
View Full Code Here

      Double eval = null;
      if (trainDataSize <= 0) {
        log.info("No train data to build a model");
      } else {
        PMML model = buildModel(sparkContext, allTrainData, hyperParameters, candidatePath);
        if (model == null) {
          log.info("Unable to build a model");
        } else {
          Path modelPath = new Path(candidatePath, MODEL_FILE_NAME);
          log.info("Writing model to {}", modelPath);
View Full Code Here

  static
  public ModelEvaluator<?> unmarshal(InputStream is) throws SAXException, JAXBException {
    Source source = ImportFilter.apply(new InputSource(is));

    PMML pmml = JAXBUtil.unmarshalPMML(source);

    PMMLManager pmmlManager = new PMMLManager(pmml);

    return (ModelEvaluator<?>)pmmlManager.getModelManager(ModelEvaluatorFactory.getInstance());
  }
View Full Code Here

    return (ModelEvaluator<?>)pmmlManager.getModelManager(ModelEvaluatorFactory.getInstance());
  }

  static
  public void marshal(ModelEvaluator<?> evaluator, OutputStream os) throws JAXBException {
    PMML pmml = evaluator.getPMML();

    Result result = new StreamResult(os);

    JAXBUtil.marshalPMML(pmml, result);
  }
View Full Code Here

TOP

Related Classes of org.dmg.pmml.PMML

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.