     Flow.HTML.template("td.#{tdClasses}")(tooltipDiv)
 
 renderMultinomialConfusionMatrix = (title, cm) ->
-  cm.columns.push({'name':'Recall', 'type':'long', 'format': '%.2f', 'description': 'Recall'})
+  cm.columns.push({'name':'Precision', 'type':'long', 'format': '%.2f', 'description': 'Precision'})
   errorColumnIndex = cm.columns.length - 3 # last three cols are Error, Rate Recall
-  recallValues = []
+  precisionValues = []
   cm.rowcount += 1 # We will have new row with Precision values
   totalRowIndex = cm.rowcount - 2 # Last two rows will be Totals and Precision
   for column, i in cm.data
       if i < errorColumnIndex
-          column.push(calcPrecision(cm, i, errorColumnIndex)) # calculate precision for each feature and add it as last row for each column
+          column.push(calcRecall(cm, i, errorColumnIndex)) # calculate recall for each feature and add it as last column for each row
       if i < totalRowIndex
-          recallValues.push(calcRecall(cm, i, totalRowIndex)) # calculate recall for each feature, will be added as new column
-  cm.data.push(recallValues) # add recall values as new (last) column
+          precisionValues.push(calcPrecision(cm, i, totalRowIndex)) # calculate precision for each feature and add it as last row for each column
+  cm.data.push(precisionValues) # add recall values as new (last) column
 
   [table, tbody, tr, normal, bold] = Flow.HTML.template 'table.flow-confusion-matrix', 'tbody', 'tr', 'td', 'td.strong'
   tooltip = (tooltipText) ->

calcRecall = (cm, index, firstInvalidIndex) ->
    tp = cm.data[index][index]
    fn = 0
    for value, i in cm.data[index]
        if i >= firstInvalidIndex
            break
        if i != index
            fn += value
    result = tp / (tp + fn)
    return parseFloat(result).toFixed(2).replace(/\.0+$/, '.0')

calcPrecision = (cm, index, firstInvalidIndex) ->
    tp = cm.data[index][index]
    fp = 0
    for column, i in cm.data # iterate over all columns
        if i >= firstInvalidIndex # do not count Error, Rate and Recall columns
            break
        if i != index # if not on diagonal
            fp += column[index] # pick value at index from each column; sum of row
    result = tp / (tp + fp)
    return parseFloat(result).toFixed(2).replace(/\.0+$/, '.0')


  headers = map cm.columns, (column, i) -> bold column.description
  headers.unshift normal ' ' # NW corner cell
  rows = [tr headers]
  precisionColumnIndex = cm.columns.length - 1
  recallRowIndex = cm.rowcount - 1
  for rowIndex in [0 ... cm.rowcount]
    cells = for column, i in cm.data
      tooltipText = "Actual: #{cm.columns[rowIndex].description}&#013;&#010;Predicted: #{cm.columns[i].description}"
