if (entry.column() >= numColumns) numColumns = entry.column() + 1; if (entry.row() >= numRows) numRows = entry.row() + 1; if (entry.value() == 0d) continue; Double occurance = rowCountMap.get(entry.row()); double rowDelta = (countRowOccurrances) ? 1 : entry.value(); rowCountMap.put(entry.row(), (occurance == null) ? rowDelta : occurance + rowDelta); occurance = colCountMap.get(entry.column()); double columnDelta = (countColumnOccurrances) ? 1 : entry.value(); colCountMap.put(entry.column(), (occurance == null) ? columnDelta : occurance + columnDelta); matrixSum += entry.value();
Double rowSum = rowSums.get(entry.row()); rowSums.put(entry.row(), (rowSum == null) ? entry.value() : rowSum + entry.value()); if (entry.row() >= numRows) numRows = entry.row() + 1; if (entry.column() >= numColumns) numColumns = entry.column() + 1; Double rowSumDouble = rowSums.get(entry.row()); double rowSum = (rowSumDouble == null) ? 0 : rowSumDouble; double probability = entry.value() / rowSum; rowEntropy[entry.row()] += probability * log2(probability);
Double rowSum = rowSums.get(entry.row()); rowSums.put(entry.row(), (rowSum == null) ? entry.value() : rowSum + entry.value()); if (entry.row() >= numRows) numRows = entry.row() + 1; if (entry.column() >= numColumns) numColumns = entry.column() + 1; Double rowSumDouble = rowSums.get(entry.row()); double rowSum = (rowSumDouble == null) ? 0 : rowSumDouble; double probability = entry.value() / rowSum; rowEntropy[entry.row()] += probability * log2(probability);
if (entry.column() >= numColumns) numColumns = entry.column() + 1; if (entry.row() >= numRows) numRows = entry.row() + 1; if (entry.value() == 0d) continue; Double occurance = rowCountMap.get(entry.row()); double rowDelta = (countRowOccurrances) ? 1 : entry.value(); rowCountMap.put(entry.row(), (occurance == null) ? rowDelta : occurance + rowDelta); occurance = colCountMap.get(entry.column()); double columnDelta = (countColumnOccurrances) ? 1 : entry.value(); colCountMap.put(entry.column(), (occurance == null) ? columnDelta : occurance + columnDelta); matrixSum += entry.value();