Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-24747

Make spark.ml.util.Instrumentation class more flexible

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 2.3.1
    • 2.4.0
    • ML
    • None

    Description

      The Instrumentation class (which is an internal private class) is some what limited by it's current APIs. The class requires an estimator and dataset be passed to the constructor which limits how it can be used. Furthermore, the current APIs make it hard to intercept failures and record anything related to those failures.

      The following changes could make the instrumentation class easier to work with. All these changes are for private APIs and should not be visible to users.

      // New no-argument constructor:
      Instrumentation()
      
      // New api to log previous constructor arguments.
      logTrainingContext(estimator: Estimator[_], dataset: Dataset[_])
      
      logFailure(e: Throwable): Unit
      
      // Log success with no arguments
      logSuccess(): Unit
      
      // Log result model explicitly instead of passing to logSuccess
      logModel(model: Model[_]): Unit
      
      // On Companion object
      Instrumentation.instrumented[T](body: (Instrumentation => T)): T
      
      // The above API will allow us to write instrumented methods more clearly and handle logging success and failure automatically:
      def someMethod(...): T = instrumented { instr =>
        instr.logNamedValue(name, value)
        // more code here
        instr.logModel(model)
      }
      
      

      Attachments

        Issue Links

          Activity

            People

              bago.amirbekian Bago Amirbekian
              bago.amirbekian Bago Amirbekian
              Xiangrui Meng Xiangrui Meng
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: