[ 
https://issues.apache.org/jira/browse/PIO-192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16710174#comment-16710174
 ] 

ASF GitHub Bot commented on PIO-192:
------------------------------------

takezoe commented on a change in pull request #494: [PIO-192] Enhance PySpark 
support
URL: https://github.com/apache/predictionio/pull/494#discussion_r239101138
 
 

 ##########
 File path: python/pypio/pypio.py
 ##########
 @@ -0,0 +1,125 @@
+#
+# 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.
+#
+
+from __future__ import absolute_import
+
+import atexit
+import json
+import os
+import sys
+
+from pypio.data import PEventStore
+from pypio.utils import dict_to_scalamap, list_to_dict
+from pypio.workflow import CleanupFunctions
+from pyspark.sql import SparkSession
+
+
+def init(app_name=None):
 
 Review comment:
   Thanks for information!
   
   Actually, I had forgotten what `pio app new` (and `pio accessKey new`) do. 
If you have a plan to support importing event data via Web API of the event 
server, how it handle accessKey can be an important point in the design of this 
Python support.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Enhance PySpark support
> -----------------------
>
>                 Key: PIO-192
>                 URL: https://issues.apache.org/jira/browse/PIO-192
>             Project: PredictionIO
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 0.13.0
>            Reporter: Takako Shimamoto
>            Assignee: Takako Shimamoto
>            Priority: Major
>
> h3. Summary
> Enhance the pypio, which is the Python API for PIO.
> h3. Goals
> The limitations of the current Python support always force developers to have 
> access to sbt. This enhancement will get rid of the build phase.
> h3. Description
> A Python engine has nothing to need. Developers can use the pypio module with 
> jupyter notebook and Python code.
> First, import the necessary modules.
> {code:python}
> import pypio
> {code}
> Once the module in imported, the first step is to initialize the pypio module.
> {code:python}
> # not create App
> pypio.init()
> # create App (pio app new BHPApp)
> pypio.init('BHPApp')
> {code}
> Next, find data from the event store.
> {code:python}
> event_df = pypio.find_events('BHPApp')
> {code}
> And then, save the model.
> {code:python}
> # model is a PipelineModel, which is produced after a Pipeline’s fit() method 
> runs
> pipeline = Pipeline(...)
> model = pipeline.fit(train_df)
> engine_instance_id = pypio.save_model(model, ["prediction"])
> {code}
> h4. Run & Deploy
> h5. Run Jupyter
> {code:sh}
> pio-shell --with-pyspark
> {code}
> h5. Run on Spark
> {code:sh}
> pio train --main-py-file xxxx.py
> {code}
> h5. Deploy App
> {code:sh}
> pio deploy --engine-instance-id <engine_instance_id>
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to