You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@predictionio.apache.org by sh...@apache.org on 2017/07/25 03:38:18 UTC
[06/10] incubator-predictionio git commit: [PIO-107] Removal of
examples under examples/experimental.
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/Runner4d.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/Runner4d.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/Runner4d.java
deleted file mode 100644
index 6b224f1..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/Runner4d.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial4;
-
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.controller.java.IJavaEngineFactory;
-import org.apache.predictionio.controller.java.JavaEngine;
-import org.apache.predictionio.controller.java.JavaEngineBuilder;
-import org.apache.predictionio.controller.java.JavaEngineParams;
-import org.apache.predictionio.controller.java.JavaEngineParamsBuilder;
-import org.apache.predictionio.controller.java.LJavaFirstServing;
-import org.apache.predictionio.controller.java.JavaWorkflow;
-import org.apache.predictionio.controller.java.WorkflowParamsBuilder;
-
-import java.util.HashMap;
-
-import org.apache.predictionio.controller.IdentityPreparator;
-
-public class Runner4d {
- public static void main(String[] args) {
- if (args.length == 0) {
- System.out.println("Error: Please specify the file directory as argument");
- System.exit(1);
- }
-
- JavaEngineParams engineParams = new JavaEngineParamsBuilder()
- .dataSourceParams(new DataSourceParams(args[0], true))
- // 1 -> -1., 2 -> -.5, 3 -> 0., 4 -> .5, 5 -> 1.
- .addAlgorithmParams("featurebased", new FeatureBasedAlgorithmParams(1.0, 5.0, 3.0, 0.5))
- .addAlgorithmParams("featurebased", new FeatureBasedAlgorithmParams(4.0, 5.0, 3.0, 0.5))
- .build();
-
- JavaWorkflow.runEngine(
- (new EngineFactory()).apply(),
- engineParams,
- new WorkflowParamsBuilder().batch("Recommendation.tutorial4.Runner4d").verbose(3).build()
- );
- }
-}
-
-
-
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/Serving.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/Serving.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/Serving.java
deleted file mode 100644
index aba1611..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/Serving.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial4;
-
-import org.apache.predictionio.controller.java.LJavaServing;
-import org.apache.predictionio.controller.java.EmptyParams;
-import java.lang.Iterable;
-
-public class Serving extends LJavaServing<EmptyParams, Query, Float> {
- public Serving() {}
-
- public Float serve(Query query, Iterable<Float> predictions) {
- float sum = 0.0f;
- int count = 0;
-
- for (Float v: predictions) {
- if (!v.isNaN()) {
- sum += v;
- count += 1;
- }
- }
- return (count == 0) ? Float.NaN : sum / count;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/SingleEngineFactory.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/SingleEngineFactory.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/SingleEngineFactory.java
deleted file mode 100644
index 9c5cf06..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/SingleEngineFactory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial4;
-
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.controller.java.IJavaEngineFactory;
-import org.apache.predictionio.controller.java.JavaEngine;
-import org.apache.predictionio.controller.java.JavaEngineBuilder;
-import org.apache.predictionio.controller.java.LJavaFirstServing;
-
-public class SingleEngineFactory implements IJavaEngineFactory {
- public JavaEngine<TrainingData, EmptyParams, PreparedData, Query, Float, Object> apply() {
- return new JavaEngineBuilder<
- TrainingData, EmptyParams, PreparedData, Query, Float, Object> ()
- .dataSourceClass(DataSource.class)
- .preparatorClass(Preparator.class)
- .addAlgorithmClass("featurebased", FeatureBasedAlgorithm.class)
- .servingClass(LJavaFirstServing.apply(FeatureBasedAlgorithm.class))
- .build();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/TrainingData.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/TrainingData.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/TrainingData.java
deleted file mode 100644
index 61970cd..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/TrainingData.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial4;
-
-import java.io.Serializable;
-import java.util.List;
-import java.util.Map;
-
-public class TrainingData implements Serializable {
- public final List<Rating> ratings;
- public final List<String> genres;
- public final Map<Integer, String[]> itemInfo;
- public final Map<Integer, String[]> userInfo;
-
- public TrainingData(List<Rating> ratings, List<String> genres, Map<Integer, String[]> itemInfo,
- Map<Integer, String[]> userInfo) {
- this.ratings = ratings;
- this.genres = genres;
- this.itemInfo = itemInfo;
- this.userInfo = userInfo;
- }
-
- public TrainingData(TrainingData data) {
- ratings = data.ratings;
- genres = data.genres;
- itemInfo = data.itemInfo;
- userInfo = data.userInfo;
- }
-
- @Override
- public String toString() {
- return "TrainingData: rating.size=" + ratings.size() + " genres.size=" + genres.size()
- + " itemInfo.size=" + itemInfo.size() + " userInfo.size=" + userInfo.size();
- }
-
- public static class Rating implements Serializable {
- public int uid; // user ID
- public int iid; // item ID
- public float rating;
-
- public Rating(int uid, int iid, float rating) {
- this.uid = uid;
- this.iid = iid;
- this.rating = rating;
- }
-
- @Override
- public String toString() {
- return "(" + uid + "," + iid + "," + rating + ")";
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/jsons/algorithms.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/jsons/algorithms.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/jsons/algorithms.json
deleted file mode 100644
index cd57d8b..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/jsons/algorithms.json
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "name": "featurebased",
- "params": {
- "min": 1.0,
- "max": 5.0,
- "drift": 3.0,
- "scale": 0.5
- }
- },
- {
- "name": "featurebased",
- "params": {
- "min": 4.0,
- "max": 5.0,
- "drift": 3.0,
- "scale": 0.5
- }
- },
- {
- "name": "collaborative",
- "params": {
- "threshold": 0.2
- }
- }
-]
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/jsons/datasource.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/jsons/datasource.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/jsons/datasource.json
deleted file mode 100644
index 11a3a34..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/jsons/datasource.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "dir" : "data/ml-100k/",
- "addFakeData": true
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/multiple-algo-engine.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/multiple-algo-engine.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/multiple-algo-engine.json
deleted file mode 100644
index 2f757c2..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/multiple-algo-engine.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "id": "org.apache.predictionio.examples.java.recommendations.tutorial4.EngineFactory",
- "version": "0.9.1",
- "name": "FeatureBased Recommendations Engine",
- "engineFactory": "org.apache.predictionio.examples.java.recommendations.tutorial4.EngineFactory"
-}
-
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-algo-engine.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-algo-engine.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-algo-engine.json
deleted file mode 100644
index ceaf576..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-algo-engine.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "org.apache.predictionio.examples.java.recommendations.tutorial4.SingleEngineFactory",
- "version": "0.9.1",
- "name": "FeatureBased Recommendations Engine",
- "engineFactory": "org.apache.predictionio.examples.java.recommendations.tutorial4.SingleEngineFactory"
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-jsons/algorithms.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-jsons/algorithms.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-jsons/algorithms.json
deleted file mode 100644
index c0f2b77..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-jsons/algorithms.json
+++ /dev/null
@@ -1,11 +0,0 @@
-[
- {
- "name": "featurebased",
- "params": {
- "min": 1.0,
- "max": 5.0,
- "drift": 3.0,
- "scale": 0.5
- }
- }
-]
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-jsons/datasource.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-jsons/datasource.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-jsons/datasource.json
deleted file mode 100644
index 11a3a34..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial4/single-jsons/datasource.json
+++ /dev/null
@@ -1,4 +0,0 @@
-{
- "dir" : "data/ml-100k/",
- "addFakeData": true
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/EngineFactory.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/EngineFactory.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/EngineFactory.java
deleted file mode 100644
index ef59694..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/EngineFactory.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial5;
-
-import org.apache.predictionio.examples.java.recommendations.tutorial3.DataSource;
-import org.apache.predictionio.examples.java.recommendations.tutorial1.TrainingData;
-import org.apache.predictionio.examples.java.recommendations.tutorial1.Query;
-
-import org.apache.predictionio.controller.java.IJavaEngineFactory;
-import org.apache.predictionio.controller.java.JavaSimpleEngine;
-import org.apache.predictionio.controller.java.JavaSimpleEngineBuilder;
-
-public class EngineFactory implements IJavaEngineFactory {
- public JavaSimpleEngine<TrainingData, Object, Query, Float, Float> apply() {
- return new JavaSimpleEngineBuilder<
- TrainingData, Object, Query, Float, Float> ()
- .dataSourceClass(DataSource.class)
- .preparatorClass() // Use default Preparator
- .addAlgorithmClass("MyMahoutRecommendationAlgo", MahoutAlgorithm.class)
- .servingClass() // Use default Serving
- .build();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgoModel.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgoModel.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgoModel.java
deleted file mode 100644
index 5c87706..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgoModel.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial5;
-
-import java.io.Serializable;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamException;
-import org.apache.mahout.cf.taste.recommender.Recommender;
-import org.apache.mahout.cf.taste.impl.recommender.GenericItemBasedRecommender;
-import org.apache.mahout.cf.taste.model.DataModel;
-import org.apache.mahout.cf.taste.similarity.ItemSimilarity;
-import org.apache.mahout.cf.taste.impl.similarity.LogLikelihoodSimilarity;
-import org.apache.mahout.cf.taste.impl.similarity.TanimotoCoefficientSimilarity;
-import com.esotericsoftware.kryo.KryoSerializable;
-import com.esotericsoftware.kryo.Kryo;
-import com.esotericsoftware.kryo.io.Input;
-import com.esotericsoftware.kryo.io.Output;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MahoutAlgoModel implements Serializable, KryoSerializable {
-
- private DataModel dataModel;
- private MahoutAlgoParams params;
- private transient Recommender recommender; // declare "transient" because it's not serializable.
-
- final static Logger logger = LoggerFactory.getLogger(MahoutAlgoModel.class);
-
- public MahoutAlgoModel(DataModel dataModel, MahoutAlgoParams params) {
- this.dataModel = dataModel;
- this.params = params;
- this.recommender = buildRecommender(this.dataModel, this.params);
- }
-
- public Recommender getRecommender() {
- return this.recommender;
- }
-
- private Recommender buildRecommender(DataModel dataModel, MahoutAlgoParams params) {
- ItemSimilarity similarity;
- switch (params.itemSimilarity) {
- case MahoutAlgoParams.LOG_LIKELIHOOD:
- similarity = new LogLikelihoodSimilarity(dataModel);
- break;
- case MahoutAlgoParams.TANIMOTO_COEFFICIENT:
- similarity = new TanimotoCoefficientSimilarity(dataModel);
- break;
- default:
- logger.error("Invalid itemSimilarity: " + params.itemSimilarity +
- ". LogLikelihoodSimilarity is used.");
- similarity = new LogLikelihoodSimilarity(dataModel);
- break;
- }
- return new GenericItemBasedRecommender(
- dataModel,
- similarity
- );
- }
-
- // KryoSerializable interface
- public void write (Kryo kryo, Output output) {
- kryo.writeClassAndObject(output, this.dataModel);
- kryo.writeClassAndObject(output, this.params);
- }
-
- // KryoSerializable interface
- public void read (Kryo kryo, Input input) {
- this.dataModel = (DataModel) kryo.readClassAndObject(input);
- this.params = (MahoutAlgoParams) kryo.readClassAndObject(input);
- this.recommender = buildRecommender(this.dataModel, this.params); // recover the recommender
- }
-
- @Override
- public String toString() {
- return "Mahout Recommender";
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgoParams.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgoParams.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgoParams.java
deleted file mode 100644
index 9c95cc6..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgoParams.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial5;
-
-import org.apache.predictionio.controller.java.JavaParams;
-
-public class MahoutAlgoParams implements JavaParams {
-
- String itemSimilarity;
-
- final static String LOG_LIKELIHOOD = "LogLikelihoodSimilarity";
- final static String TANIMOTO_COEFFICIENT = "TanimotoCoefficientSimilarity";
-
- public MahoutAlgoParams(String itemSimilarity) {
- this.itemSimilarity = itemSimilarity;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgorithm.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgorithm.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgorithm.java
deleted file mode 100644
index 766ef52..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/MahoutAlgorithm.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial5;
-
-import org.apache.predictionio.controller.java.LJavaAlgorithm;
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.examples.java.recommendations.tutorial1.TrainingData;
-import org.apache.predictionio.examples.java.recommendations.tutorial1.Query;
-import org.apache.predictionio.engines.util.MahoutUtil;
-
-import org.apache.mahout.cf.taste.recommender.Recommender;
-import org.apache.mahout.cf.taste.model.DataModel;
-import org.apache.mahout.cf.taste.common.TasteException;
-import scala.Tuple4;
-import java.util.List;
-import java.util.ArrayList;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/* Simple Mahout ItemBased Algorithm integration for demonstration purpose */
-public class MahoutAlgorithm extends
- LJavaAlgorithm<EmptyParams, TrainingData, MahoutAlgoModel, Query, Float> {
-
- final static Logger logger = LoggerFactory.getLogger(MahoutAlgorithm.class);
-
- MahoutAlgoParams params;
-
- public MahoutAlgorithm(MahoutAlgoParams params) {
- this.params = params;
- }
-
- @Override
- public MahoutAlgoModel train(TrainingData data) {
- List<Tuple4<Integer, Integer, Float, Long>> ratings = new ArrayList<
- Tuple4<Integer, Integer, Float, Long>>();
- for (TrainingData.Rating r : data.ratings) {
- // no timestamp
- ratings.add(new Tuple4<Integer, Integer, Float, Long>(r.uid, r.iid, r.rating, 0L));
- }
- DataModel dataModel = MahoutUtil.jBuildDataModel(ratings);
- return new MahoutAlgoModel(dataModel, params);
- }
-
- @Override
- public Float predict(MahoutAlgoModel model, Query query) {
- float predicted;
- try {
- predicted = model.getRecommender().estimatePreference((long) query.uid, (long) query.iid);
- } catch (TasteException e) {
- predicted = Float.NaN;
- }
- return predicted;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/Runner5.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/Runner5.java b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/Runner5.java
deleted file mode 100644
index 2a8e853..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/Runner5.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.predictionio.examples.java.recommendations.tutorial5;
-
-import org.apache.predictionio.examples.java.recommendations.tutorial1.DataSourceParams;
-import org.apache.predictionio.examples.java.recommendations.tutorial3.Evaluator;
-
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.controller.java.IJavaEngineFactory;
-import org.apache.predictionio.controller.java.JavaSimpleEngine;
-import org.apache.predictionio.controller.java.JavaSimpleEngineBuilder;
-import org.apache.predictionio.controller.java.JavaEngineParams;
-import org.apache.predictionio.controller.java.JavaEngineParamsBuilder;
-import org.apache.predictionio.controller.java.JavaWorkflow;
-import org.apache.predictionio.controller.java.WorkflowParamsBuilder;
-
-import java.util.HashMap;
-
-public class Runner5 {
-
- public static void runEvaluation(String filePath) {
- JavaEngineParams engineParams = new JavaEngineParamsBuilder()
- .dataSourceParams(new DataSourceParams(filePath))
- .addAlgorithmParams("MyMahoutRecommendationAlgo",
- new MahoutAlgoParams("LogLikelihoodSimilarity"))
- .build();
-
- JavaWorkflow.runEngine(
- (new EngineFactory()).apply(),
- engineParams,
- Evaluator.class,
- new EmptyParams(),
- new WorkflowParamsBuilder().batch("MyEngine").verbose(3).build()
- );
- }
-
- public static void main(String[] args) {
- if (args.length == 0) {
- System.out.println("Error: Please specify the file path as argument");
- System.exit(1);
- }
- runEvaluation(args[0]);
- System.exit(0); // clean shutdown is needed for spark
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/manifest.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/manifest.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/manifest.json
deleted file mode 100644
index b9cdbe3..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/manifest.json
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "id": "org.apache.predictionio.examples.java.recommendations.tutorial5.EngineFactory",
- "version": "0.8.1-SNAPSHOT",
- "name": "Simple Mahout Recommendations Engine",
- "engineFactory": "org.apache.predictionio.examples.java.recommendations.tutorial5.EngineFactory"
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/params/algorithmsParams.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/params/algorithmsParams.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/params/algorithmsParams.json
deleted file mode 100644
index 7decbca..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/params/algorithmsParams.json
+++ /dev/null
@@ -1,5 +0,0 @@
-[
- { "name": "MyMahoutRecommendationAlgo",
- "params" : { "itemSimilarity" : "LogLikelihoodSimilarity" }
- }
-]
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/params/dataSourceParams.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/params/dataSourceParams.json b/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/params/dataSourceParams.json
deleted file mode 100644
index bf00f87..0000000
--- a/examples/experimental/java-local-tutorial/src/main/java/recommendations/tutorial5/params/dataSourceParams.json
+++ /dev/null
@@ -1 +0,0 @@
-{ "filePath" : "data/ml-100k/u.data" }
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/build.sbt
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/build.sbt b/examples/experimental/java-parallel-helloworld/build.sbt
deleted file mode 100644
index ea89b68..0000000
--- a/examples/experimental/java-parallel-helloworld/build.sbt
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.
- */
-
-import AssemblyKeys._
-
-assemblySettings
-
-name := "example-java-parallel-helloworld"
-
-organization := "org.sample"
-
-libraryDependencies ++= Seq(
- "org.apache.predictionio" %% "core" % "0.9.1" % "provided",
- "org.apache.spark" %% "spark-core" % "1.2.0" % "provided")
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/engine.json
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/engine.json b/examples/experimental/java-parallel-helloworld/engine.json
deleted file mode 100644
index 5ce3737..0000000
--- a/examples/experimental/java-parallel-helloworld/engine.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "id": "default",
- "description": "Parallel Hello World Engine",
- "engineFactory": "org.apache.predictionio.examples.java.parallel.EngineFactory",
- "algorithms": [
- {
- "name": "ParallelAlgorithm",
- "params": {}
- }
- ]
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/project/assembly.sbt
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/project/assembly.sbt b/examples/experimental/java-parallel-helloworld/project/assembly.sbt
deleted file mode 100644
index 54c3252..0000000
--- a/examples/experimental/java-parallel-helloworld/project/assembly.sbt
+++ /dev/null
@@ -1 +0,0 @@
-addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Algorithm.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Algorithm.java b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Algorithm.java
deleted file mode 100644
index 23635d6..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Algorithm.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- * 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.predictionio.examples.java.parallel;
-
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.controller.java.PJavaAlgorithm;
-
-import java.io.Serializable;
-import java.util.List;
-
-import org.apache.spark.api.java.JavaPairRDD;
-import org.apache.spark.api.java.function.Function;
-import org.apache.spark.api.java.function.Function2;
-import org.apache.spark.api.java.function.PairFunction;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import scala.Tuple2;
-
-public class Algorithm extends PJavaAlgorithm<
- EmptyParams, JavaPairRDD<String, Float>, Model, Query, Float> {
-
- final static Logger logger = LoggerFactory.getLogger(Algorithm.class);
-
- public static class ReadingAndCount implements Serializable {
- public float reading;
- public int count;
-
- public ReadingAndCount(float reading, int count) {
- this.reading = reading;
- this.count = count;
- }
-
- public ReadingAndCount(float reading) {
- this(reading, 1);
- }
-
- @Override
- public String toString() {
- return "(reading = " + reading + ", count = " + count + ")";
- }
- }
-
- @Override
- public Model train(JavaPairRDD<String, Float> data) {
- // take averages just like the local helloworld program
- JavaPairRDD<String, Float> averages = data.mapValues(
- new Function<Float, ReadingAndCount>() {
- @Override
- public ReadingAndCount call(Float reading) {
- return new ReadingAndCount(reading);
- }
- }).reduceByKey(
- new Function2<ReadingAndCount, ReadingAndCount, ReadingAndCount>() {
- @Override
- public ReadingAndCount call(ReadingAndCount rac1, ReadingAndCount rac2) {
- return new ReadingAndCount(rac1.reading + rac2.reading, rac1.count + rac2.count);
- }
- }).mapValues(
- new Function<ReadingAndCount, Float>() {
- @Override
- public Float call(ReadingAndCount rac) {
- return rac.reading / rac.count;
- }
- });
- return new Model(averages);
- }
-
- @Override
- public JavaPairRDD<Object, Float> batchPredict(Model model,
- JavaPairRDD<Object, Query> indexedQueries) {
- return model.temperatures.join(indexedQueries.mapToPair(
- new PairFunction<Tuple2<Object, Query>, String, Object>() {
- @Override // reverse the query tuples, then join
- public Tuple2 call(Tuple2<Object, Query> tuple) {
- return new Tuple2(tuple._2.day, tuple._1);
- }
- })).mapToPair(
- new PairFunction<Tuple2<String, Tuple2<Float, Object>>, Object, Float>() {
- @Override // map result back to predictions, dropping the day
- public Tuple2 call(Tuple2<String, Tuple2<Float, Object>> tuple) {
- return new Tuple2(tuple._2._2, tuple._2._1);
- }
- });
- }
-
- @Override
- public Float predict(Model model, Query query) {
- final String day = query.day;
- List<Float> reading = model.temperatures.lookup(day);
- if (reading.size() == 0) {
- return -10000f; // JSON does not support NaN
- }
- return reading.get(0);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/DataSource.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/DataSource.java b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/DataSource.java
deleted file mode 100644
index c2ed854..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/DataSource.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * 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.predictionio.examples.java.parallel;
-
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.controller.java.PJavaDataSource;
-
-import java.util.List;
-import java.util.ArrayList;
-
-import org.apache.spark.api.java.JavaPairRDD;
-import org.apache.spark.api.java.JavaSparkContext;
-import org.apache.spark.api.java.function.PairFunction;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import scala.Tuple2;
-import scala.Tuple3;
-
-public class DataSource extends PJavaDataSource<
- EmptyParams, Object, JavaPairRDD<String, Float>, Query, Object> {
-
- final static Logger logger = LoggerFactory.getLogger(DataSource.class);
-
- public DataSource() {
- }
-
- @Override
- public Iterable<Tuple3<Object, JavaPairRDD<String, Float>, JavaPairRDD<Query, Object>>>
- read(JavaSparkContext jsc) {
- JavaPairRDD<String, Float> readings = jsc.textFile("../data/helloworld/data.csv")
- .mapToPair(new PairFunction<String, String, Float>() {
- @Override
- public Tuple2 call(String line) {
- String[] tokens = line.split("[\t,]");
- Tuple2 reading = null;
- try {
- reading = new Tuple2(
- tokens[0],
- Float.parseFloat(tokens[1]));
- } catch (Exception e) {
- logger.error("Can't parse reading file. Caught Exception: " + e.getMessage());
- System.exit(1);
- }
- return reading;
- }
- });
-
- List<Tuple3<Object, JavaPairRDD<String, Float>, JavaPairRDD<Query, Object>>> data =
- new ArrayList<>();
-
- data.add(new Tuple3(
- null,
- readings,
- jsc.parallelizePairs(new ArrayList<Tuple2<Query, Object>>())
- ));
-
- return data;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/EngineFactory.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/EngineFactory.java b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/EngineFactory.java
deleted file mode 100644
index 2b14367..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/EngineFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * 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.predictionio.examples.java.parallel;
-
-import org.apache.predictionio.controller.java.IJavaEngineFactory;
-import org.apache.predictionio.controller.java.LJavaFirstServing;
-import org.apache.predictionio.controller.java.PJavaEngine;
-import org.apache.predictionio.controller.java.PJavaEngineBuilder;
-
-import java.util.HashMap;
-
-import org.apache.spark.api.java.JavaPairRDD;
-
-public class EngineFactory implements IJavaEngineFactory {
- public PJavaEngine<JavaPairRDD<String, Float>, Object, JavaPairRDD<String, Float>, Query, Float,
- Object> apply() {
- return new PJavaEngineBuilder<JavaPairRDD<String, Float>, Object, JavaPairRDD<String, Float>,
- Query, Float, Object> ()
- .dataSourceClass(DataSource.class)
- .preparatorClass(Preparator.class)
- .addAlgorithmClass("ParallelAlgorithm", Algorithm.class)
- .servingClass(Serving.class)
- .build();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Model.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Model.java b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Model.java
deleted file mode 100644
index ca662d0..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Model.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * 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.predictionio.examples.java.parallel;
-
-import java.io.Serializable;
-import java.lang.StringBuilder;
-import java.util.List;
-
-import org.apache.spark.api.java.JavaPairRDD;
-import scala.Tuple2;
-
-public class Model implements Serializable {
- private static int LIST_THRESHOLD = 20;
-
- public JavaPairRDD<String, Float> temperatures;
-
- public Model(JavaPairRDD<String, Float> temperatures) {
- this.temperatures = temperatures;
- }
-
- @Override
- public String toString() {
- boolean longList = temperatures.count() > LIST_THRESHOLD ? true : false;
- List<Tuple2<String, Float>> readings =
- temperatures.take(longList ? LIST_THRESHOLD : (int) temperatures.count());
- StringBuilder builder = new StringBuilder();
- builder.append("(");
- boolean first = true;
- for (Tuple2<String, Float> reading : readings) {
- if (!first) {
- builder.append(", ");
- } else {
- first = false;
- }
- builder.append(reading);
- }
- if (longList) {
- builder.append(", ...");
- }
- builder.append(")");
- return builder.toString();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Preparator.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Preparator.java b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Preparator.java
deleted file mode 100644
index 6391999..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Preparator.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.predictionio.examples.java.parallel;
-
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.controller.java.PJavaPreparator;
-
-import org.apache.spark.api.java.JavaPairRDD;
-import org.apache.spark.api.java.JavaSparkContext;
-import org.apache.spark.api.java.function.Function;
-
-public class Preparator extends
- PJavaPreparator<EmptyParams, JavaPairRDD<String, Float>, JavaPairRDD<String, Float>> {
-
- @Override
- public JavaPairRDD<String, Float> prepare(JavaSparkContext jsc,
- JavaPairRDD<String, Float> data) {
- return data.mapValues(new Function<Float, Float>() {
- @Override
- public Float call(Float temperature) {
- // let's convert it to degrees Celsius
- return (temperature - 32.0f) / 9 * 5;
- }
- });
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Query.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Query.java b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Query.java
deleted file mode 100644
index e596c2d..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Query.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * 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.predictionio.examples.java.parallel;
-
-import java.io.Serializable;
-
-public class Query implements Serializable {
- public String day;
-
- public Query(String day) {
- this.day = day;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Runner.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Runner.java b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Runner.java
deleted file mode 100644
index 53273a7..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Runner.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.predictionio.examples.java.parallel;
-
-import org.apache.predictionio.controller.IEngineFactory;
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.controller.java.IJavaEngineFactory;
-import org.apache.predictionio.controller.java.JavaEngineParams;
-import org.apache.predictionio.controller.java.JavaEngineParamsBuilder;
-import org.apache.predictionio.controller.java.JavaWorkflow;
-import org.apache.predictionio.controller.java.PJavaEngine;
-import org.apache.predictionio.controller.java.PJavaEngineBuilder;
-import org.apache.predictionio.controller.java.WorkflowParamsBuilder;
-
-import java.util.HashMap;
-
-import org.apache.spark.api.java.JavaPairRDD;
-
-public class Runner {
-
- // During development, one can build a semi-engine, only add the first few layers. In this
- // particular example, we only add until dataSource layer
- private static class HalfBakedEngineFactory implements IJavaEngineFactory {
- public PJavaEngine<JavaPairRDD<String, Float>, Object, JavaPairRDD<String, Float>,
- Query, Float, Object> apply() {
- return new PJavaEngineBuilder<
- JavaPairRDD<String, Float>, Object, JavaPairRDD<String, Float>, Query, Float, Object> ()
- .dataSourceClass(DataSource.class)
- .preparatorClass(Preparator.class)
- .addAlgorithmClass("ParallelAlgorithm", Algorithm.class)
- .servingClass(Serving.class)
- .build();
- }
- }
-
- public static void runComponents() {
- JavaEngineParams engineParams = new JavaEngineParamsBuilder()
- .addAlgorithmParams("ParallelAlgorithm", new EmptyParams())
- .servingParams(new EmptyParams())
- .build();
- JavaWorkflow.runEngine(
- (new HalfBakedEngineFactory()).apply(),
- engineParams,
- null,
- new EmptyParams(),
- new WorkflowParamsBuilder().batch("MyEngine").verbose(3).build()
- );
- }
-
- public static void main(String[] args) {
- runComponents();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Serving.java
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Serving.java b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Serving.java
deleted file mode 100644
index 40c1e7b..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/Serving.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * 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.predictionio.examples.java.parallel;
-
-import org.apache.predictionio.controller.java.EmptyParams;
-import org.apache.predictionio.controller.java.LJavaServing;
-
-public class Serving extends LJavaServing<EmptyParams, Query, Float> {
-
- public Serving() {
-
- }
-
- @Override
- public Float serve(Query query, Iterable<Float> predictions) {
- return predictions.iterator().next();
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/java-parallel-helloworld/src/main/java/parallel/build.sbt
----------------------------------------------------------------------
diff --git a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/build.sbt b/examples/experimental/java-parallel-helloworld/src/main/java/parallel/build.sbt
deleted file mode 100644
index 56dd2ba..0000000
--- a/examples/experimental/java-parallel-helloworld/src/main/java/parallel/build.sbt
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * 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.
- */
-
-import AssemblyKeys._
-
-assemblySettings
-
-name := "example-java-parallel"
-
-organization := "org.apache.predictionio.examples.java"
-
-resolvers += Resolver.sonatypeRepo("snapshots")
-
-libraryDependencies ++= Seq(
- "org.apache.predictionio" %% "core" % "0.8.0-SNAPSHOT" % "provided",
- "org.apache.predictionio" %% "data" % "0.8.0-SNAPSHOT" % "provided",
- "org.apache.spark" %% "spark-core" % "1.0.2" % "provided")
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/README.md
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/README.md b/examples/experimental/scala-cleanup-app/README.md
deleted file mode 100644
index 84b6fba..0000000
--- a/examples/experimental/scala-cleanup-app/README.md
+++ /dev/null
@@ -1,29 +0,0 @@
-<!--
-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.
--->
-
-# Removing old events from app
-
-## Documentation
-
-This shows how to remove old events from the certain app.
-
-Parameters in engine.json are appId and cutoffTime.
-All events in that appId before the cutoffTime are removed,
-including $set, $unset and $delete
-(so please adapt it for use when you want to preserve these special events).
-
-To use, edit `engine.json`, run `pio build` then `pio train`.
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/build.sbt
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/build.sbt b/examples/experimental/scala-cleanup-app/build.sbt
deleted file mode 100644
index d7ba8a6..0000000
--- a/examples/experimental/scala-cleanup-app/build.sbt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-import AssemblyKeys._
-
-assemblySettings
-
-name := "template-scala-parallel-vanilla"
-
-organization := "org.apache.predictionio"
-
-libraryDependencies ++= Seq(
- "org.apache.predictionio" %% "core" % "0.9.5" % "provided",
- "org.apache.spark" %% "spark-core" % "1.3.1" % "provided",
- "org.apache.spark" %% "spark-mllib" % "1.3.1" % "provided")
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/engine.json
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/engine.json b/examples/experimental/scala-cleanup-app/engine.json
deleted file mode 100644
index 6f7f334..0000000
--- a/examples/experimental/scala-cleanup-app/engine.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "id": "default",
- "description": "Default settings",
- "engineFactory": "org.apache.predictionio.examples.experimental.cleanupapp.VanillaEngine",
- "datasource": {
- "params" : {
- "appId": 1000000000,
- "cutoffTime": "2014-04-29T00:00:00.000Z"
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/project/assembly.sbt
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/project/assembly.sbt b/examples/experimental/scala-cleanup-app/project/assembly.sbt
deleted file mode 100644
index 54c3252..0000000
--- a/examples/experimental/scala-cleanup-app/project/assembly.sbt
+++ /dev/null
@@ -1 +0,0 @@
-addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.11.2")
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/src/main/scala/Algorithm.scala
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/src/main/scala/Algorithm.scala b/examples/experimental/scala-cleanup-app/src/main/scala/Algorithm.scala
deleted file mode 100644
index 95c69fc..0000000
--- a/examples/experimental/scala-cleanup-app/src/main/scala/Algorithm.scala
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * 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.predictionio.examples.experimental.cleanupapp
-
-import org.apache.predictionio.controller.P2LAlgorithm
-import org.apache.predictionio.controller.Params
-
-import org.apache.spark.SparkContext
-import org.apache.spark.SparkContext._
-import org.apache.spark.rdd.RDD
-
-import grizzled.slf4j.Logger
-
-//case class AlgorithmParams(mult: Int) extends Params
-
-//class Algorithm(val ap: AlgorithmParams)
-class Algorithm
- extends P2LAlgorithm[TrainingData, Model, Query, PredictedResult] {
-
- @transient lazy val logger = Logger[this.type]
-
- def train(sc: SparkContext, data: TrainingData): Model = {
- new Model
- }
-
- def predict(model: Model, query: Query): PredictedResult = {
- // Prefix the query with the model data
- PredictedResult(p = "")
- }
-}
-
-class Model extends Serializable {
- override def toString = "Model"
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/src/main/scala/DataSource.scala
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/src/main/scala/DataSource.scala b/examples/experimental/scala-cleanup-app/src/main/scala/DataSource.scala
deleted file mode 100644
index c10bd83..0000000
--- a/examples/experimental/scala-cleanup-app/src/main/scala/DataSource.scala
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * 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.predictionio.examples.experimental.cleanupapp
-
-import org.apache.predictionio.controller.PDataSource
-import org.apache.predictionio.controller.EmptyEvaluationInfo
-import org.apache.predictionio.controller.EmptyActualResult
-import org.apache.predictionio.controller.Params
-import org.apache.predictionio.data.storage.Event
-import org.apache.predictionio.data.storage.Storage
-import org.apache.predictionio.workflow.StopAfterReadInterruption
-
-import org.apache.spark.SparkContext
-import org.apache.spark.SparkContext._
-import org.apache.spark.rdd.RDD
-import com.github.nscala_time.time.Imports._
-
-import grizzled.slf4j.Logger
-
-import scala.concurrent.ExecutionContext.Implicits.global
-import scala.concurrent.{Await, Future}
-
-case class DataSourceParams(
- appId: Int,
- cutoffTime: DateTime
-) extends Params
-
-class DataSource(val dsp: DataSourceParams)
- extends PDataSource[TrainingData,
- EmptyEvaluationInfo, Query, EmptyActualResult] {
-
- @transient lazy val logger = Logger[this.type]
-
- override
- def readTraining(sc: SparkContext): TrainingData = {
- val eventsDb = Storage.getPEvents()
- val lEventsDb = Storage.getLEvents()
- logger.info(s"CleanupApp: $dsp")
-
- val countBefore = eventsDb.find(
- appId = dsp.appId
- )(sc).count
- logger.info(s"Event count before cleanup: $countBefore")
-
- val countRemove = eventsDb.find(
- appId = dsp.appId,
- untilTime = Some(dsp.cutoffTime)
- )(sc).count
- logger.info(s"Number of events to remove: $countRemove")
-
- logger.info(s"Remove events from appId ${dsp.appId}")
- val eventsToRemove: Array[String] = eventsDb.find(
- appId = dsp.appId,
- untilTime = Some(dsp.cutoffTime)
- )(sc).map { case e =>
- e.eventId.getOrElse("")
- }.collect
-
- var lastFuture: Future[Boolean] = Future[Boolean] {true}
- eventsToRemove.foreach { case eventId =>
- if (eventId != "") {
- lastFuture = lEventsDb.futureDelete(eventId, dsp.appId)
- }
- }
- // No, it's not correct to just wait for the last result.
- // This program only demonstrates how to remove old events.
- Await.result(lastFuture, scala.concurrent.duration.Duration(5, "minutes"))
- logger.info(s"Finish cleaning up events to appId ${dsp.appId}")
-
- val countAfter = eventsDb.find(
- appId = dsp.appId
- )(sc).count
- logger.info(s"Event count after cleanup: $countAfter")
-
- throw new StopAfterReadInterruption()
- }
-}
-
-class TrainingData(
-) extends Serializable {
- override def toString = ""
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/src/main/scala/Engine.scala
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/src/main/scala/Engine.scala b/examples/experimental/scala-cleanup-app/src/main/scala/Engine.scala
deleted file mode 100644
index 5a0d5a4..0000000
--- a/examples/experimental/scala-cleanup-app/src/main/scala/Engine.scala
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.predictionio.examples.experimental.cleanupapp
-
-import org.apache.predictionio.controller.IEngineFactory
-import org.apache.predictionio.controller.Engine
-import org.apache.predictionio.controller._
-
-case class Query(q: String) extends Serializable
-
-case class PredictedResult(p: String) extends Serializable
-
-object VanillaEngine extends IEngineFactory {
- def apply() = {
- new Engine(
- classOf[DataSource],
- PIdentityPreparator(classOf[DataSource]),
- Map("" -> classOf[Algorithm]),
- classOf[Serving])
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/src/main/scala/Preparator.scala
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/src/main/scala/Preparator.scala b/examples/experimental/scala-cleanup-app/src/main/scala/Preparator.scala
deleted file mode 100644
index ab8514a..0000000
--- a/examples/experimental/scala-cleanup-app/src/main/scala/Preparator.scala
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.predictionio.examples.experimental.cleanupapp
-
-import org.apache.predictionio.controller.PPreparator
-import org.apache.predictionio.data.storage.Event
-
-import org.apache.spark.SparkContext
-import org.apache.spark.SparkContext._
-import org.apache.spark.rdd.RDD
-
-/*
-class Preparator
- extends PPreparator[TrainingData, PreparedData] {
-
- def prepare(sc: SparkContext, trainingData: TrainingData): PreparedData = {
- new PreparedData(events = trainingData.events)
- }
-}
-
-class PreparedData(
- val events: RDD[Event]
-) extends Serializable
-*/
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-cleanup-app/src/main/scala/Serving.scala
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-cleanup-app/src/main/scala/Serving.scala b/examples/experimental/scala-cleanup-app/src/main/scala/Serving.scala
deleted file mode 100644
index 82620c3..0000000
--- a/examples/experimental/scala-cleanup-app/src/main/scala/Serving.scala
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * 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.predictionio.examples.experimental.cleanupapp
-
-import org.apache.predictionio.controller.LServing
-
-class Serving
- extends LServing[Query, PredictedResult] {
-
- override
- def serve(query: Query,
- predictedResults: Seq[PredictedResult]): PredictedResult = {
- predictedResults.head
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-local-friend-recommendation/.gitignore
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-local-friend-recommendation/.gitignore b/examples/experimental/scala-local-friend-recommendation/.gitignore
deleted file mode 100644
index 8fce603..0000000
--- a/examples/experimental/scala-local-friend-recommendation/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-data/
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-local-friend-recommendation/README.md
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-local-friend-recommendation/README.md b/examples/experimental/scala-local-friend-recommendation/README.md
deleted file mode 100644
index 0d9ef0f..0000000
--- a/examples/experimental/scala-local-friend-recommendation/README.md
+++ /dev/null
@@ -1,127 +0,0 @@
-<!--
-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.
--->
-
-##Our Engine
-We are creating an engine in PredictionIO for friend/item recommendation in social network settings. It learns from user profiles, item information, social interactions as well as past recommendation history and builds a model to provide suggestions on friend/item for users.
-
-#####Two algorithms are implemented:
-1. Random
-2. Keyword Similarity KNN
-
-#####Expected data:
-The dataset for KDD Cup 2012 Track 1 is required. <br />
-The KDD cup page can be found <a href="https://www.kddcup2012.org/c/kddcup2012-track1">here</a><br />
-The dataset are <a href="https://www.kddcup2012.org/c/kddcup2012-track1/data">here</a><br />
-The below files are required to put into the *data* folder.
-
-1. item.txt
-2. user_profile.txt
-3. user\_key\_word.txt
-4. user_action.txt
-5. user_sns.txt
-6. rec\_log\_train.txt
-
-#####Sampling a subset of data:
-You can sample a subset of the data with *file_random.py*
-```
-python file_random $UserSize $ItemSize
-```
-*$UserSize* and *$ItemSize* are the sample sizes of users and items respectively.
-
-Put the input files into the data folder
-
-The program runs with files:
-
-1. item.txt
-2. user_profile.txt
-3. user\_key\_word.txt
-4. user\_action.txt
-5. user\_sns.txt
-6. rec\_log\_train.txt
-
-And output files:
-
-1. mini_item.txt
-2. mini\_user\_profile.txt
-3. mini\_user_key_word.txt
-4. mini\_user_action.txt
-5. mini\_user\_sns.txt
-6. mini\_rec\_log_train.txt
-
-After sampling, please set the file path parameters in *$EngineJson* (described below) to point to the output in order to use them.
-
-#####Notice about Spark settings:
-As the data set is large, we recommend setting spark memories to be large. Please set the below two lines with the two values *$E_M* and *$D_M* in the *$SPARK_HOME/conf/spark-defaults.conf*
-
-1. spark.executor.memory *$E_M*
-2. spark.driver.memory *$D_M*
-
-We have tested "Random" and "Keyword Similarity KNN" algorithms with *$E_M* = 16g and *$D_M* = 16g.
-
-#####To run the engine, you need to Build + Train + Deploy:
-```
-$PIO_HOME/bin/pio build -v $EngineJson
-
-$PIO_HOME/bin/pio train -v $EngineJson
-
-$PIO_HOME/bin/pio deploy -v $EngineJson
-```
-
-$EngineJson is
-
-1. "random_engine.json" for "Random"
-2. "keyword_similarity_engine.json" for "Keyword Similarity KNN"
-
-Note: if the accesskey error rises when deploying, please set it to any dummy value and then the program will work.
-
-#####To query:
-```
-curl -H "Content-Type: application/json" -d '{ "user": $UserId , "item" : $ItemId}' http://localhost:8000/queries.json
-```
-
-*$UserId* and *$ItemId* are the user and item you want to query.
-
-#####Prediction provided:
-Our local algorithm provides two predicted values as below for each user-item pair queried.
-
-1. confidence (how confident the algorithm is to predict that the user will accept the item)
-2. acceptance (when the confidence is high, the algorithm will predict that the user will accept the item)
-
-#####Example *$UserId*-*$ItemId* pairs:
-While "Random" provides a uniformly distributed random result for any query,
-"Keyword Similarity KNN" may generate a zero confidence score for many queries.
-This is due to the sparsity of the keyword space in the given data that many id pairs
-do not have overlapping keywords. Below are six example pairs of *$UserId*-*$ItemId*
-in the full data set that generates positive scores.
-
-1. 1051216-1774844
-2. 1052586-1774844
-3. 1001726-1775038
-4. 1019789-1775038
-5. 1041986-1774522
-6. 1048438-1774522
-
-#####Threshold training for "Keyword Similarity KNN":
-When the confidence is higher than a threshold,
-the algorithm will predict that the user will accept the item.
-Instead of mannually setting the threshold,
-perceptron was implemented to train the threshold automatically.
-However, due to the high complexity in time and space,
-this part is commented out.
-Users can change the corresponding parts in FriendRecommendationDataSource.scala
-and eywordSimilarityAlgorithm.scala
-with comments about "training an acceptance threshold".
http://git-wip-us.apache.org/repos/asf/incubator-predictionio/blob/dec9f84c/examples/experimental/scala-local-friend-recommendation/build.sbt
----------------------------------------------------------------------
diff --git a/examples/experimental/scala-local-friend-recommendation/build.sbt b/examples/experimental/scala-local-friend-recommendation/build.sbt
deleted file mode 100644
index 63ff005..0000000
--- a/examples/experimental/scala-local-friend-recommendation/build.sbt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * 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.
- */
-
-import AssemblyKeys._
-
-assemblySettings
-
-name := "examples-friendrecommendation"
-
-organization := "org.apache.predictionio"
-
-libraryDependencies ++= Seq(
- "org.apache.predictionio" %% "core" % "0.9.1" % "provided",
- "org.apache.predictionio" %% "data" % "0.9.1" % "provided",
- "org.apache.spark" %% "spark-core" % "1.2.0" % "provided")