How to use the nyoka.reconstruct.pmml_to_pipeline_pp.generate_pipeline function in nyoka

To help you get started, we’ve selected a few nyoka examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nyoka-pmml / nyoka / nyoka / reconstruct / pmml_to_pipeline_model.py View on Github external
else:
                sk_model_obj = get_ensemble_model(pmml)
        elif pmml.NaiveBayesModel:
            pmml_modelobj = pmml.NaiveBayesModel[0]
            sk_model_obj = get_naivebayes_model(pmml)
        elif pmml.NearestNeighborModel:
            pmml_modelobj = pmml.NearestNeighborModel[0]
            sk_model_obj = get_knn_model(pmml)
        elif pmml.DeepNetwork:
            return GenerateKerasModel(pmml)
        else:
            raise NotImplementedError("Not Implemented")
        if output == "modelOnly":
            return sk_model_obj
        elif output == "preProcessingPipelineWithModel":
            pipe = reconstructPeprocessingPipeline.generate_pipeline(pmml,pmml_modelobj)
            if pipe:
                pipe.steps.append(("model", sk_model_obj))
                return pipe
            else:
                return sk_model_obj
        elif output == "asDictionary":
            return {"preProcessingPipeline" : reconstructPeprocessingPipeline.generate_pipeline(pmml,pmml_modelobj), "model" : sk_model_obj}
        else:
            raise ValueError("Invalid Arguments")
    except Exception as err:
        print("Error Occurred while reconstructing, details are : {} ".format(str(err)))
        print(str(traceback.format_exc()))
github nyoka-pmml / nyoka / nyoka / reconstruct / pmml_to_pipeline_model.py View on Github external
sk_model_obj = get_knn_model(pmml)
        elif pmml.DeepNetwork:
            return GenerateKerasModel(pmml)
        else:
            raise NotImplementedError("Not Implemented")
        if output == "modelOnly":
            return sk_model_obj
        elif output == "preProcessingPipelineWithModel":
            pipe = reconstructPeprocessingPipeline.generate_pipeline(pmml,pmml_modelobj)
            if pipe:
                pipe.steps.append(("model", sk_model_obj))
                return pipe
            else:
                return sk_model_obj
        elif output == "asDictionary":
            return {"preProcessingPipeline" : reconstructPeprocessingPipeline.generate_pipeline(pmml,pmml_modelobj), "model" : sk_model_obj}
        else:
            raise ValueError("Invalid Arguments")
    except Exception as err:
        print("Error Occurred while reconstructing, details are : {} ".format(str(err)))
        print(str(traceback.format_exc()))