lindong28 commented on a change in pull request #28:
URL: https://github.com/apache/flink-ml/pull/28#discussion_r747324700



##########
File path: 
flink-ml-lib/src/main/java/org/apache/flink/ml/classification/BaseLinearClassifier.java
##########
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.ml.classification;
+
+import org.apache.flink.ml.api.core.Estimator;
+import org.apache.flink.ml.operator.batch.linear.BaseLinearModelTrainBatchOp;
+import org.apache.flink.ml.operator.common.LinearModelType;
+import org.apache.flink.ml.param.Param;
+import org.apache.flink.ml.params.linear.LinearTrainParams;
+import org.apache.flink.ml.util.ParamUtils;
+import org.apache.flink.ml.util.ReadWriteUtils;
+import org.apache.flink.table.api.Table;
+
+import java.io.IOException;
+import java.util.Map;
+
+/** Base class for {@link Estimator} implementation of linear classifiers. */
+public class BaseLinearClassifier<
+                E extends BaseLinearClassifier<E, M>, M extends 
BaseLinearClassifierModel<M>>
+        implements Estimator<E, M>, LinearTrainParams<E> {
+
+    Map<Param<?>, Object> paramMap;
+
+    LinearModelType modelType;
+
+    public BaseLinearClassifier(LinearModelType modelType, Map<Param<?>, 
Object> paramMap) {
+        this.modelType = modelType;
+        this.paramMap = paramMap;
+        ParamUtils.initializeMapWithDefaultValues(this.paramMap, this);
+    }
+
+    @Override
+    public Map<Param<?>, Object> getParamMap() {
+        return paramMap;
+    }
+
+    @Override
+    public void save(String path) throws IOException {
+        // TODO: save model data
+        ReadWriteUtils.saveMetadata(this, path);
+    }
+
+    public static BaseLinearClassifier load(String path) throws IOException {
+        // TODO: load model data
+        return ReadWriteUtils.loadStageParam(path);
+    }
+
+    @Override
+    public M fit(Table... inputs) {
+        new BaseLinearClassifier<>(modelType, getParamMap());

Review comment:
       This seems like an Flink ML infra class. Can you explain why this is 
useful?
   
   Alternatively, it may be simpler to implement logistic regression without 
those infra classes before FFA. We can discuss the motivation for these classes 
later.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to