       createVector 'scoring_time', TNumber, [ prediction.scoring_time ]
     ]
 
+    createDataframe frameLabel, vectors, (sequence 1), null,
+      description: frameLabel
+      origin: origin
+
+  inspectBinomialPrediction = (prediction) -> ->
+    { frame, model } = prediction
+
+    vectors = [
+      createFactor 'key', TString, [ model.name ]
+      createFactor 'frame', TString, [ frame.name ]
+      createFactor 'model_category', TString, [ prediction.model_category ]
+      createVector 'AUC', TNumber, [ prediction.AUC ]
+      createVector 'Gini', TNumber, [ prediction.Gini ]
+      createVector 'mse', TNumber, [ prediction.mse ]
+      createVector 'duration_in_ms', TNumber, [ prediction.duration_in_ms ]
+      createVector 'scoring_time', TNumber, [ prediction.scoring_time ]
+    ]
+
     createDataframe 'Prediction', vectors, (sequence 1), null,
       description: "Prediction output for model '#{model.name}' on frame '#{frame.name}'"
       origin: "getPrediction #{stringify model.name}, #{stringify frame.name}"
+
+  inspectBinomialConfusionMatrices2 = (frameLabel, prediction) -> ->
+    origin = "getModel #{stringify prediction.model.name}"
+    vectors = [
+      createList 'CM', prediction.confusion_matrices, formatConfusionMatrix
+      createVector 'TPR', TNumber, map prediction.confusion_matrices, computeTruePositiveRate
+      createVector 'FPR', TNumber, map prediction.confusion_matrices, computeFalsePositiveRate
+    ]
+    createDataframe frameLabel, vectors, (sequence prediction.confusion_matrices.length), null,
+      description: frameLabel
+      origin: origin
+      plot: "plot inspect '#{frameLabel}', #{origin}"
+
 
   inspectBinomialConfusionMatrices = (opts, predictions) -> ->
     vectors = [

      description: "Prediction output for model '#{model.name}' on frame '#{frame.name}'"
      origin: "getPrediction #{stringify model.name}, #{stringify frame.name}"

  inspectBinomialPrediction = (prediction) -> ->
    { frame, model } = prediction

    vectors = [

      'Cluster means': inspectKmeansModelClusterMeans model

  extendDeepLearningModel = (model) ->

    origin = "getModel #{stringify model.key.name}"

    inspections = {}
    inspections.parameters = inspectModelParameters model

    if model.output.model_category is 'Binomial'
      tables = [ model.output.modelSummary, model.output.scoringHistory ]
      tables.forEach (table) ->
        inspections[ table.name ] = ->
          convertTableToFrame table,
            description: table.name 
            origin: origin

      if prediction1 = model.output.trainMetrics
        prediction1.thresholdsAndMetricScores.name = 'Training ' + prediction1.thresholdsAndMetricScores.name
        prediction1.maxCriteriaAndMetricScores.name = 'Training ' + prediction1.maxCriteriaAndMetricScores.name

        inspections[ 'Training Metrics' ] = inspectBinomialPrediction2 'Training Metrics', prediction1

        inspections[ prediction1.thresholdsAndMetricScores.name ] = -> 
          convertTableToFrame prediction1.thresholdsAndMetricScores,
            description: prediction1.thresholdsAndMetricScores.name
            origin: origin
            plot: "plot inspect '#{prediction1.thresholdsAndMetricScores.name}', #{origin}"

        inspections[ prediction1.maxCriteriaAndMetricScores.name ] = -> 
          convertTableToFrame prediction1.maxCriteriaAndMetricScores,
          description: prediction1.maxCriteriaAndMetricScores.name
          origin: origin
          plot: "plot inspect '#{prediction1.maxCriteriaAndMetricScores.name}', #{origin}"

        inspections[ 'Training Confusion Matrices' ] = inspectBinomialConfusionMatrices2 'Training Confusion Matrices', prediction1

      if prediction2 = model.output.validMetrics
        prediction2.thresholdsAndMetricScores.name = 'Validation ' + prediction2.thresholdsAndMetricScores.name
        prediction2.maxCriteriaAndMetricScores.name = 'Validation ' + prediction2.maxCriteriaAndMetricScores.name

        inspections[ 'Validation Metrics' ] = inspectBinomialPrediction2 'Validation Metrics', prediction2
        inspections[ prediction2.thresholdsAndMetricScores.name ] = -> 
          convertTableToFrame prediction2.thresholdsAndMetricScores,
          description: prediction2.thresholdsAndMetricScores.name
          origin: origin
          plot: "plot inspect '#{prediction2.thresholdsAndMetricScores.name}', #{origin}"

        inspections[ prediction2.maxCriteriaAndMetricScores.name ] = -> 
        convertTableToFrame prediction2.maxCriteriaAndMetricScores,
          description: prediction2.maxCriteriaAndMetricScores.name
          origin: origin
          plot: "plot inspect '#{prediction2.maxCriteriaAndMetricScores.name}', #{origin}"

        inspections[ 'Validation Confusion Matrices' ] = inspectBinomialConfusionMatrices2 'Validation Confusion Matrices', prediction2

    inspect_ model, inspections
  
  extendGBMModel = (model) ->
    inspect_ model,
