df = spark.createDataFrame([(1, 0, 3)], ["a", "b", "c"])
vecAssembler = VectorAssembler(inputCols=[
"a", "b", "c"], outputCol="features")
vecAssembler.transform(df).head().features
vecAssembler.setParams(outputCol="freqs").transform(df).head().freqs
params = {vecAssembler.inputCols: [
"b", "a"], vecAssembler.outputCol: "vector"}
vecAssembler.transform(df, params).head().vector
vectorAssemblerPath = temp_path + "/vector-assembler"
vecAssembler.save(vectorAssemblerPath)
loadedAssembler = VectorAssembler.load(vectorAssemblerPath)
loadedAssembler.transform(df).head().freqs == vecAssembler.transform(
df).head().freqs