Open xiaoerhei opened 6 years ago
It looks like Tuple 22 problem.
Thanks for the reply. Yes, indeed. It is the tuple 22 problem. If needed, you can close this issue, I am working to get around this 22 limit problem. Thanks
Fixing this issue: modify the "data" related code as below:
val data = mutable.MutableList [Query] () data += query val df = data.toDF()
Hi developer,
Thanks for the pio template.
I am facing an build error if I tried more input features like 23 raw input features. the error log shows as below: could you help me out? thanks
[INFO] [Engine$] Using command '/home/zhangyongxing/apache-predictionio-0.12.0-incubating/PredictionIO-0.12.0-incubating/sbt/sbt' at /home/zhangyongxing/apache-predictionio-0.12.0-incubating/templates/predictionio-template-boston-house-prices to build. [INFO] [Engine$] If the path above is incorrect, this process will fail. [INFO] [Engine$] Uber JAR disabled. Making sure lib/pio-assembly-0.12.0-incubating.jar is absent. [INFO] [Engine$] Going to run: /home/zhangyongxing/apache-predictionio-0.12.0-incubating/PredictionIO-0.12.0-incubating/sbt/sbt package assemblyPackageDependency in /home/zhangyongxing/apache-predictionio-0.12.0-incubating/templates/predictionio-template-boston-house-prices [ERROR] [Engine$] [error] /home/zhangyongxing/apache-predictionio-0.12.0-incubating/templates/predictionio-template-boston-house-prices/src/main/scala/org/jpioug/template/bhp/Algorithm.scala:49: object is not a member of package scala
[ERROR] [Engine$] [error] val data = Seq((
[ERROR] [Engine$] [error] ^
[ERROR] [Engine$] [error] one error found
[ERROR] [Engine$] [error] (compile:compileIncremental) Compilation failed
[ERROR] [Engine$] [error] Total time: 4 s, completed Nov 29, 2017 10:04:10 PM
[ERROR] [Engine$] Return code of build command: /home/zhangyongxing/apache-predictionio-0.12.0-incubating/PredictionIO-0.12.0-incubating/sbt/sbt package assemblyPackageDependency is 1. Aborting.
And my code as below,just modify the src/main/scala/org/jpioug/template/bhp/Algorithm.scala:
package org.jpioug.template.bhp
import org.apache.predictionio.controller.{P2LAlgorithm, Params} import org.apache.spark.SparkContext import org.apache.spark.ml.PipelineModel import org.apache.spark.sql.SparkSession import org.jpioug.template.python.{Engine, PreparedData}
case class AlgorithmParams(name: String) extends Params
case class Query(AGE: Double, B: Double, CHAS: Double, CRIM: Double, DIS: Double, INDUS: Double, LSTAT: Double, NOX: Double, PTRATIO: Double, RAD: Double, RM: Double, TAX: Double, ZN: Double, index_14: Double, index_15: Double, index_16: Double, index_17: Double, index_18: Double, index_19: Double, index_20: Double, index_21: Double, index_22: Double, index_23: Double )
case class PredictedResult(label: Double) extends Serializable
class Algorithm(val ap: AlgorithmParams) extends P2LAlgorithm[PreparedData, PipelineModel, Query, PredictedResult] {
def train(sc: SparkContext, data: PreparedData): PipelineModel = { Engine.modelRef.get() }
def predict(model: PipelineModel, query: Query): PredictedResult = { val spark = SparkSession .builder .getOrCreate() import spark.implicits._ val data = Seq(( query.AGE, query.B, query.CHAS, query.CRIM, query.DIS, query.INDUS, query.LSTAT, query.NOX, query.PTRATIO, query.RAD, query.RM, query.TAX, query.ZN, query.index_14, query.index_15, query.index_16, query.index_17, query.index_18, query.index_19, query.index_20, query.index_21, query.index_22, query.index_23 )) val df = spark.createDataset(data).toDF("AGE", "B", "CHAS", "CRIM", "DIS", "INDUS", "LSTAT", "NOX", "PTRATIO", "RAD", "RM", "TAX", "ZN", "index_14", "index_15", "index_16", "index_17", "index_18", "index_19", "index_20", "index_21", "index_22", "index_23" ) val labelDf = model.transform(df) PredictedResult(labelDf.select("prediction").first().getAs(0)) } }
Thanks