Repository: systemml
Updated Branches:
  refs/heads/master 9a8421d4c -> bd1946a3d


[MINOR] Allow users to set explain level of mllearn algorithms


Project: http://git-wip-us.apache.org/repos/asf/systemml/repo
Commit: http://git-wip-us.apache.org/repos/asf/systemml/commit/bd1946a3
Tree: http://git-wip-us.apache.org/repos/asf/systemml/tree/bd1946a3
Diff: http://git-wip-us.apache.org/repos/asf/systemml/diff/bd1946a3

Branch: refs/heads/master
Commit: bd1946a3d91f3661fc6572bbc6c9500a59992044
Parents: 9a8421d
Author: Niketan Pansare <npan...@us.ibm.com>
Authored: Tue Aug 29 14:37:19 2017 -0700
Committer: Niketan Pansare <npan...@us.ibm.com>
Committed: Tue Aug 29 14:37:19 2017 -0700

----------------------------------------------------------------------
 src/main/python/systemml/mllearn/estimators.py         | 13 +++++++++++++
 .../apache/sysml/api/ml/BaseSystemMLClassifier.scala   |  8 ++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/systemml/blob/bd1946a3/src/main/python/systemml/mllearn/estimators.py
----------------------------------------------------------------------
diff --git a/src/main/python/systemml/mllearn/estimators.py 
b/src/main/python/systemml/mllearn/estimators.py
index 44c6125..7443968 100644
--- a/src/main/python/systemml/mllearn/estimators.py
+++ b/src/main/python/systemml/mllearn/estimators.py
@@ -99,6 +99,19 @@ class BaseSystemMLEstimator(Estimator):
         """
         self.estimator.setExplain(explain)
         return self
+    
+    def setExplainLevel(self, explainLevel):
+        """
+        Set explain level. Mainly intended for developers.
+        
+        Parameters
+        ----------
+        explainLevel: string
+            Can be one of "hops", "runtime", "recompile_hops", 
"recompile_runtime"
+            or in the above in upper case.
+        """
+        self.estimator.setExplainLevel(explainLevel)
+        return self
             
     def setStatistics(self, statistics):
         """

http://git-wip-us.apache.org/repos/asf/systemml/blob/bd1946a3/src/main/scala/org/apache/sysml/api/ml/BaseSystemMLClassifier.scala
----------------------------------------------------------------------
diff --git 
a/src/main/scala/org/apache/sysml/api/ml/BaseSystemMLClassifier.scala 
b/src/main/scala/org/apache/sysml/api/ml/BaseSystemMLClassifier.scala
index 8b4817f..f42acb5 100644
--- a/src/main/scala/org/apache/sysml/api/ml/BaseSystemMLClassifier.scala
+++ b/src/main/scala/org/apache/sysml/api/ml/BaseSystemMLClassifier.scala
@@ -108,23 +108,27 @@ trait BaseSystemMLEstimatorOrModel {
   var enableGPU:Boolean = false
   var forceGPU:Boolean = false
   var explain:Boolean = false
+  var explainLevel:String = "runtime"
   var statistics:Boolean = false
   var statisticsMaxHeavyHitters:Int = 10
   val config:HashMap[String, String] = new HashMap[String, String]()
   def setGPU(enableGPU1:Boolean):BaseSystemMLEstimatorOrModel = { enableGPU = 
enableGPU1; this}
   def setForceGPU(enableGPU1:Boolean):BaseSystemMLEstimatorOrModel = { 
forceGPU = enableGPU1; this}
   def setExplain(explain1:Boolean):BaseSystemMLEstimatorOrModel = { explain = 
explain1; this}
+  def setExplainLevel(explainLevel1:String):BaseSystemMLEstimatorOrModel = { 
explainLevel = explainLevel1; this  }
   def setStatistics(statistics1:Boolean):BaseSystemMLEstimatorOrModel = { 
statistics = statistics1; this}
   def 
setStatisticsMaxHeavyHitters(statisticsMaxHeavyHitters1:Int):BaseSystemMLEstimatorOrModel
 = { statisticsMaxHeavyHitters = statisticsMaxHeavyHitters1; this}
   def setConfigProperty(key:String, value:String):BaseSystemMLEstimatorOrModel 
= { config.put(key, value); this}
   def updateML(ml:MLContext):Unit = {
     ml.setGPU(enableGPU); ml.setForceGPU(forceGPU);
-    ml.setExplain(explain); ml.setStatistics(statistics); 
ml.setStatisticsMaxHeavyHitters(statisticsMaxHeavyHitters); 
+    ml.setExplain(explain); ml.setExplainLevel(explainLevel);
+    ml.setStatistics(statistics); 
ml.setStatisticsMaxHeavyHitters(statisticsMaxHeavyHitters); 
     config.map(x => ml.setConfigProperty(x._1, x._2))
   }
   def 
copyProperties(other:BaseSystemMLEstimatorOrModel):BaseSystemMLEstimatorOrModel 
= {
     other.setGPU(enableGPU); other.setForceGPU(forceGPU);
-    other.setExplain(explain); other.setStatistics(statistics); 
other.setStatisticsMaxHeavyHitters(statisticsMaxHeavyHitters);
+    other.setExplain(explain); other.setExplainLevel(explainLevel);
+    other.setStatistics(statistics); 
other.setStatisticsMaxHeavyHitters(statisticsMaxHeavyHitters);
     config.map(x => other.setConfigProperty(x._1, x._2))
     return other
   }

Reply via email to