/** * Read and return a PMML model. * * @param stream the <code>InputStream</code> to read from * @return a PMML model * @throws Exception if there is a problem while reading from the stream */ public static PMMLModel getPMMLModel(InputStream stream) throws Exception { return getPMMLModel(stream, null); }
/** * Serialize a <code>PMMLModel</code> object that encapsulates a PMML model * * @param model the <code>PMMLModel</code> to serialize * @param filename the name of the file to save to * @throws Exception if something goes wrong during serialization */ public static void serializePMMLModel(PMMLModel model, String filename) throws Exception { serializePMMLModel(model, new File(filename)); }
stream.close(); doc.getDocumentElement().normalize(); if (!isPMML(doc)) { throw new IllegalArgumentException( "[PMMLFactory] Source is not a PMML file!!"); Instances dataDictionary = getDataDictionaryAsInstances(doc); TransformationDictionary transDict = getTransformationDictionary(doc, dataDictionary); ModelType modelType = getModelType(doc); if (modelType == ModelType.UNKNOWN_MODEL) { throw new Exception("Unsupported PMML model type"); Element model = getModelElement(doc, modelType); PMMLModel theModel = getModelInstance(doc, modelType, model, dataDictionary, ms); if (log != null) {
stream.close(); doc.getDocumentElement().normalize(); if (!isPMML(doc)) { throw new IllegalArgumentException( "[PMMLFactory] Source is not a PMML file!!"); Instances dataDictionary = getDataDictionaryAsInstances(doc); TransformationDictionary transDict = getTransformationDictionary(doc, dataDictionary); ModelType modelType = getModelType(doc); if (modelType == ModelType.UNKNOWN_MODEL) { throw new Exception("Unsupported PMML model type"); Element model = getModelElement(doc, modelType); PMMLModel theModel = getModelInstance(doc, modelType, model, dataDictionary, ms); if (log != null) {
/** * Read and return a PMML model. * * @param file a <code>File</code> to read from * @return a PMML model * @throws Exception if there is a problem while reading the file */ public static PMMLModel getPMMLModel(File file) throws Exception { return getPMMLModel(file, null); }
/** * Serialize a <code>PMMLModel</code> object that encapsulates a PMML model * * @param model the <code>PMMLModel</code> to serialize * @param filename the name of the file to save to * @throws Exception if something goes wrong during serialization */ public static void serializePMMLModel(PMMLModel model, String filename) throws Exception { serializePMMLModel(model, new File(filename)); }
/** * Read and return a PMML model. * * @param filename the name of the file to read from * @return a PMML model * @throws Exception if there is a problem while reading the file */ public static PMMLModel getPMMLModel(String filename) throws Exception { return getPMMLModel(filename, null); }
/** * Serialize a <code>PMMLModel</code> object that encapsulates a PMML model * * @param model the <code>PMMLModel</code> to serialize * @param file the <code>File</code> to save to * @throws Exception if something goes wrong during serialization */ public static void serializePMMLModel(PMMLModel model, File file) throws Exception { serializePMMLModel(model, new BufferedOutputStream(new FileOutputStream( file))); }
/** * Read and return a PMML model. * * @param filename the name of the file to read from * @return a PMML model * @throws Exception if there is a problem while reading the file */ public static PMMLModel getPMMLModel(String filename) throws Exception { return getPMMLModel(filename, null); }
/** * Serialize a <code>PMMLModel</code> object that encapsulates a PMML model * * @param model the <code>PMMLModel</code> to serialize * @param file the <code>File</code> to save to * @throws Exception if something goes wrong during serialization */ public static void serializePMMLModel(PMMLModel model, File file) throws Exception { serializePMMLModel(model, new BufferedOutputStream(new FileOutputStream( file))); }
/** * Read and return a PMML model. * * @param file a <code>File</code> to read from * @return a PMML model * @throws Exception if there is a problem while reading the file */ public static PMMLModel getPMMLModel(File file) throws Exception { return getPMMLModel(file, null); }
/** * Read and return a PMML model. * * @param stream the <code>InputStream</code> to read from * @return a PMML model * @throws Exception if there is a problem while reading from the stream */ public static PMMLModel getPMMLModel(InputStream stream) throws Exception { return getPMMLModel(stream, null); }
/** * Read and return a PMML model. * * @param filename the name of the file to read from * @param log the logging object to use (or null if none is to be used) * @return a PMML model * @throws Exception if there is a problem while reading the file */ public static PMMLModel getPMMLModel(String filename, Logger log) throws Exception { return getPMMLModel(new File(filename), log); }
/** * Read and return a PMML model. * * @param filename the name of the file to read from * @param log the logging object to use (or null if none is to be used) * @return a PMML model * @throws Exception if there is a problem while reading the file */ public static PMMLModel getPMMLModel(String filename, Logger log) throws Exception { return getPMMLModel(new File(filename), log); }
/** * Read and return a PMML model. * * @param file a <code>File</code> to read from * @param log the logging object to use (or null if none is to be used) * @return a PMML model * @throws Exception if there is a problem while reading the file */ public static PMMLModel getPMMLModel(File file, Logger log) throws Exception { return getPMMLModel(new BufferedInputStream(new FileInputStream(file)), log); }
/** * Read and return a PMML model. * * @param file a <code>File</code> to read from * @param log the logging object to use (or null if none is to be used) * @return a PMML model * @throws Exception if there is a problem while reading the file */ public static PMMLModel getPMMLModel(File file, Logger log) throws Exception { return getPMMLModel(new BufferedInputStream(new FileInputStream(file)), log); }
public PMMLClassifier getClassifier(String name) { PMMLClassifier regression = null; try { PMMLModel model = PMMLFactory.getPMMLModel(new BufferedInputStream( ClassLoader.getSystemResourceAsStream("weka/classifiers/pmml/data/" + name))); regression = (PMMLClassifier) model; } catch (Exception ex) { ex.printStackTrace(); } return regression; }
public PMMLClassifier getClassifier(String name) { PMMLClassifier regression = null; try { PMMLModel model = PMMLFactory.getPMMLModel(new BufferedInputStream( ClassLoader.getSystemResourceAsStream("weka/classifiers/pmml/data/" + name))); regression = (PMMLClassifier) model; } catch (Exception ex) { ex.printStackTrace(); } return regression; }
} catch (IOException e) { try { this.setClassifier((Classifier) PMMLFactory.getPMMLModel(location, null));
getPMMLModel(pmmlFile, null);