【发布时间】:2021-04-18 23:59:00
【问题描述】:
我有兴趣提取 Spark 多层感知器 (MLP) 模型的训练权重:https://spark.apache.org/docs/latest/ml-classification-regression.html#multilayer-perceptron-classifier
有人知道怎么做吗?
【问题讨论】:
标签: apache-spark apache-spark-mllib
我有兴趣提取 Spark 多层感知器 (MLP) 模型的训练权重:https://spark.apache.org/docs/latest/ml-classification-regression.html#multilayer-perceptron-classifier
有人知道怎么做吗?
【问题讨论】:
标签: apache-spark apache-spark-mllib
您可以拨打model.weights。 Python 示例:(在 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])
更多细节可以参考API docs中的例子。
【讨论】: