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



##########
File path: 
flink-ml-api/src/main/java/org/apache/flink/ml/api/core/PipelineModel.java
##########
@@ -0,0 +1,86 @@
+/*
+ * 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.api.pipeline;
+
+import org.apache.flink.annotation.PublicEvolving;
+import org.apache.flink.annotation.VisibleForTesting;
+import org.apache.flink.ml.api.core.AlgoOperator;
+import org.apache.flink.ml.api.core.Model;
+import org.apache.flink.ml.api.core.Stage;
+import org.apache.flink.ml.api.misc.param.Params;
+import org.apache.flink.table.api.Table;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * A PipelineModel acts as a Model. It consists of an ordered list of stages, 
each of which could be
+ * a Model, Transformer or AlgoOperator.
+ */
+@PublicEvolving
+public final class PipelineModel implements Model<PipelineModel> {
+    private static final long serialVersionUID = 6184950154217411318L;
+    private final List<Stage<?>> stages;
+    private final Params params = new Params();
+
+    public PipelineModel(List<Stage<?>> stages) {
+        this.stages = stages;
+    }
+
+    /**
+     * Applies all stages in this PipelineModel on the input tables in order. 
The output of one
+     * stage is used as the input of the next stage (if any). The output of 
the last stage is
+     * returned as the result of this method.
+     *
+     * @param inputs a list of tables
+     * @return a list of tables
+     */
+    @Override
+    public Table[] transform(Table... inputs) {
+        for (Stage<?> stage : stages) {
+            inputs = ((AlgoOperator<?>) stage).transform(inputs);
+        }
+        return inputs;
+    }
+
+    @Override
+    public void save(String path) throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    public static PipelineModel load(String path) throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Params getParams() {
+        return params;
+    }
+
+    /**
+     * Returns a list of all stages in this PipelineModel in order. The list 
is immutable.
+     *
+     * @return an immutable list of transformers.
+     */
+    @VisibleForTesting
+    public List<Stage<?>> getStages() {

Review comment:
       Yes. It is changed to package private now.




-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to