def getBlockOfCols(nT,*args): mnT = MergedNumericTable() for idx in range(args[0],args[1]): doubleBlock = BlockDescriptor_Float64() nT.getBlockOfColumnValues(idx, 0, nT.getNumberOfRows(), readOnly, doubleBlock) mnT.releaseBlockOfColumnValues(doubleBlock) return mnT
def getArrayFromNT(table, nrows=0): bd = BlockDescriptor_Float64() if nrows == 0: nrows = table.getNumberOfRows() table.getBlockOfRows(0, nrows, readOnly, bd) npa = bd.getArray() table.releaseBlockOfRows(bd) return npa
def getArrayFromNT(self, nT): doubleBlock = BlockDescriptor_Float64() firstRow = 0 lastRow = nT.getNumberOfRows() firstCol = 0 lastCol = nT.getNumberOfColumns() nT.getBlockOfRows(firstRow, lastRow, readOnly, doubleBlock) getArray = doubleBlock.getArray() return getArray
def _computeMulticlassQualityMetrics(self, nclasses): # Alg object for quality metrics computation quality_alg = multiclass_quality.Batch(nclasses) # Get access to the input parameter input = quality_alg.getInputDataCollection().getInput( multiclass_quality.confusionMatrix) # Pass ground truth and predictions as input input.set(multiclass_confusion_matrix.groundTruthLabels, self._truth) input.set(multiclass_confusion_matrix.predictedLabels, self._predictions) # Compute confusion matrix confusion = quality_alg.compute().getResult(multiclass_quality.confusionMatrix) # Retrieve quality metrics from the confusion matrix metrics = confusion.get(multiclass_confusion_matrix.multiClassMetrics) # Convert the metrics into a Python namedtuple and return it block = BlockDescriptor_Float64() metrics.getBlockOfRows(0, 1, readOnly, block) x = block.getArray().flatten() self._metrics = MultiClassMetrics(*x) metrics.releaseBlockOfRows(block)
def getArrayFromNT(nT, *args): doubleBlock = BlockDescriptor_Float64() if not args: firstRow = 0 lastRow = nT.getNumberOfRows() firstCol = 0 lastCol = nT.getNumberOfColumns() else: if args[0] == "head": firstRow = 0 lastRow = 5 firstCol = 0 lastCol = 5 if args[0] == "tail": firstRow = nT.getNumberOfRows() - 5 lastRow = nT.getNumberOfRows() firstCol = 0 lastCol = 5 nT.getBlockOfRows(firstRow, lastRow, readOnly, doubleBlock) getArray = doubleBlock.getArray() return getArray