mirror of
https://github.com/hanzo-ml/kserve.git
synced 2026-10-30 20:53:49 +00:00
* Fix python linter Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Format e2e tests Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Format hack, docs Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Add py-fmt target Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Update python lint workflow Signed-off-by: Sivanantham Chinnaiyan <[email protected]> * Rebase master Signed-off-by: Sivanantham Chinnaiyan <[email protected]> --------- Signed-off-by: Sivanantham Chinnaiyan <[email protected]>
18 lines
610 B
Python
18 lines
610 B
Python
from pyspark.sql import SparkSession
|
|
from pyspark.ml import Pipeline
|
|
from pyspark.ml.classification import DecisionTreeClassifier
|
|
from pyspark.ml.feature import RFormula
|
|
from pyspark2pmml import PMMLBuilder
|
|
|
|
spark = SparkSession.builder.appName("SparkByExamples.com").getOrCreate()
|
|
df = spark.read.csv("Iris.csv", header=True, inferSchema=True)
|
|
|
|
formula = RFormula(formula="Species ~ .")
|
|
classifier = DecisionTreeClassifier()
|
|
pipeline = Pipeline(stages=[formula, classifier])
|
|
pipelineModel = pipeline.fit(df)
|
|
|
|
pmmlBuilder = PMMLBuilder(spark, df, pipelineModel)
|
|
|
|
pmmlBuilder.buildFile("DecisionTreeIris.pmml")
|