Open mindis opened 5 years ago
@mindis
You should be able to access the raw RDD
of models, we should loosen the permissions on the RandomEffectModel
. I'll make a PR and reference this issue.
Thanks, that solved the issue!
Maybe related, I was getting same "Access to protected" error when trying to instantiate GameDatum for scoring part in the code below.
import org.apache.spark.sql.Row
val data_prep = df.rdd.map{case Row(id: Int, response: Double, grouping:Int, fixed:org.apache.spark.ml.linalg.SparseVector, rand:org.apache.spark.ml.linalg.SparseVector)
=>
val breeze_fixed = fixed match{
case sv:org.apache.spark.ml.linalg.SparseVector => new breeze.linalg.SparseVector[Double](sv.indices, sv.values, sv.size)
}
val breeze_rand = rand match{
case sv:org.apache.spark.ml.linalg.SparseVector => new breeze.linalg.SparseVector[Double](sv.indices, sv.values, sv.size)
}
(id.toLong, new com.linkedin.photon.ml.data.GameDatum(
response = 1.0,
offsetOpt = None,
weightOpt = None,
featureShardContainer = Map("fixed" -> breeze_fixed, "rand" -> breeze_rand),
idTagToValueMap = Map("grouping" -> "grouping")
)
)
}
To make it work I had to modify to GameDatum.scala
file
to remove protected[ml]
in line 38 protected[ml] class GameDatum
thanks
Hi
I'm trying to replicate code in lme4-photon-sleep.zip in https://github.com/linkedin/photon-ml/issues/374 using Apache Toree notebook (directly accessing PhotonML API) Spark version 2.3.4 with scala 2.11.8 and latest Photon version jar.
I get error when trying to save random effects from model in the following step
Is this something related to my environment or changes in Photon ML API?
If related to Photon ML how can I see/save random effects without using ModelProcessingUtils.saveGameModelToHDFS?
Problem with ModelProcessingUtils.saveGameModelToHDFS is that it requires inputIndexMaps that is generated by AvroReader that I'd like to avoid as my data is in csv.
thanks