Created
November 5, 2020 15:30
-
-
Save Ben-Epstein/917a050f976c4670c475ab63349e121d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pyspark.ml.feature import VectorAssembler | |
from pyspark.ml.classification import DecisionTreeClassifier | |
from pyspark.ml import Pipeline | |
va = VectorAssembler(inputCols=cols[:-1], outputCol='features') # Define feature vector | |
dt = DecisionTreeClassifier() # Define model | |
pipeline = Pipeline(stages=[va, dt]) # Chain steps together into a full pipeline | |
train, test = df.randomSplit([0.8,0.2]) | |
model = pipeline.fit(train) | |
print(model) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment