I have built a logistic regression model using spark ml pipelines and saved it. I am trying to apply the pipeline on new set of records and receiving an error. My pipeline has vector assembler, standard scaler and logistic regression model in it.
I tried pipeline.transform and received the below error
AttributeError: 'Pipeline' object has no attribute 'transform'
Below is the code
from pyspark.ml import Pipeline
pipelineModel = Pipeline.load("/user/userid/lr_pipe")
scored_temp = pipelineModel.transform(combined_data_imputed_final)
Here is how I saved my pipeline
from pyspark.ml.classification import LogisticRegression
vector = VectorAssembler(inputCols=final_features, outputCol="final_features")
scaler = StandardScaler(inputCol="final_features", outputCol="final_scaled_features")
lr = LogisticRegression(labelCol="label", featuresCol="final_scaled_features", maxIter=30)
stages = [vector,scaler,lr]
pipe = Pipeline(stages=stages)
lrModel = pipe.fit(train_transformed_data_1).transform(train_transformed_data_1)
pipe.save("lr_pipe")
I am expecting it to complete all the pipeline steps and score the records.