I'm interested in extracting the trained weights of Spark Multi-Layer Perceptron (MLP) model: https://spark.apache.org/docs/latest/ml-classification-regression.html#multilayer-perceptron-classifier
Does anyone know how to do that?
I'm interested in extracting the trained weights of Spark Multi-Layer Perceptron (MLP) model: https://spark.apache.org/docs/latest/ml-classification-regression.html#multilayer-perceptron-classifier
Does anyone know how to do that?
You can call model.weights
. Python example: (should be almost identical in Scala)
mlp = MultilayerPerceptronClassifier(layers=[2, 2, 2], seed=123)
model = mlp.fit(df)
>>> print(model.weights)
DenseVector([-41.4189, 10.0329, 13.2597, -15.7512, -11.4471, -7.5988, -57.9849, 59.6254, -27.15, 27.9458, 8.7534, -9.349])
For more details, you can refer to the example in the API docs.