Skip to content

Instantly share code, notes, and snippets.

@lakshay-arora
Created November 4, 2019 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lakshay-arora/122e325d70f2f8efe30bcf0194f461d2 to your computer and use it in GitHub Desktop.
Save lakshay-arora/122e325d70f2f8efe30bcf0194f461d2 to your computer and use it in GitHub Desktop.
# create a sample data without the labels
sample_data_test = spark.createDataFrame([
(3.0, 'Z', 'S10', 40),
(1.0, 'X', 'E10', 20),
(4.0, 'A', 'S20', 10),
(3.0, 'A', 'S10', 20),
(4.0, 'X', 'D10', 30),
(1.0, 'Z', 'E10', 20),
(4.0, 'A', 'S10', 30),
], ['feature_1', 'feature_2', 'feature_3', 'feature_4'])
# transform the data using the pipeline
sample_data_test = model.transform(sample_data_test)
# see the prediction on the test data
sample_data_test.select('features', 'rawPrediction', 'probability', 'prediction').show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment