pythonjavaapache-flinksvmflinkml

Can I extract the Linear SVC model coefficient and intercept in Apache Flink ML?


I have trained a Linear SVC model using Flink ML library. I wish to extract the SVM hyperplane so I can use the rules in Pattern Matching API of Flink CEP. This is possible when using the sklearn library in python but is there a way to extract the classifier rules in flink-ml?


Solution

  • Yes you can extract the hyperplane parameter from the model data fitted by a LinearSVC Estimator. Here are the example code snippets to get model data using Python API [1] and Java API [2] respectively. Hope it helps!

    [1] https://github.com/apache/flink-ml/blob/master/flink-ml-python/pyflink/ml/classification/tests/test_linearsvc.py#L124

    [2] https://github.com/apache/flink-ml/blob/master/flink-ml-lib/src/test/java/org/apache/flink/ml/classification/LinearSVCTest.java#L243