View Source Evision.ML.TrainData (Evision v0.1.8)

Link to this section Summary

cv.ml

Creates training data from in-memory arrays.

Creates training data from in-memory arrays.

Positional Arguments
  • vi: int

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Returns the vector of class labels

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Returns vector of symbolic names captured in loadFromCSV()

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Positional Arguments

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Extract from matrix rows/cols specified by passed indexes.

Extract from 1D vector elements specified by passed indexes.

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Returns matrix of test samples

Python prototype (for reference):

Returns the vector of normalized categorical responses

Returns the vector of responses

Python prototype (for reference):

Returns matrix of train samples

Python prototype (for reference):

Positional Arguments

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Python prototype (for reference):

Splits the training data into the training and test parts

Splits the training data into the training and test parts

Splits the training data into the training and test parts

Splits the training data into the training and test parts

Python prototype (for reference):

Functions

Raising version of getCatMap/1.

Raising version of getCatOfs/1.

Raising version of getLayout/1.

Raising version of getMissing/1.

Raising version of getNAllVars/1.

Raising version of getNames/2.

Raising version of getNSamples/1.

Raising version of getNVars/1.

Raising version of getResponses/1.

Raising version of getSamples/1.

Raising version of getVarIdx/1.

Raising version of getVarType/1.

Link to this section cv.ml

Link to this function

create(samples, layout, responses)

View Source

Creates training data from in-memory arrays.

Positional Arguments
  • samples: Evision.Mat.

    matrix of samples. It should have CV_32F type.

  • layout: int.

    see ml::SampleTypes.

  • responses: Evision.Mat.

    matrix of responses. If the responses are scalar, they should be stored as a single row or as a single column. The matrix should have type CV_32F or CV_32S (in the former case the responses are considered as ordered by default; in the latter case - as categorical)

Keyword Arguments
  • varIdx: Evision.Mat.

    vector specifying which variables to use for training. It can be an integer vector (CV_32S) containing 0-based variable indices or byte vector (CV_8U) containing a mask of active variables.

  • sampleIdx: Evision.Mat.

    vector specifying which samples to use for training. It can be an integer vector (CV_32S) containing 0-based sample indices or byte vector (CV_8U) containing a mask of training samples.

  • sampleWeights: Evision.Mat.

    optional vector with weights for each sample. It should have CV_32F type.

  • varType: Evision.Mat.

    optional vector of type CV_8U and size <number_of_variables_in_samples> + <number_of_variables_in_responses>, containing types of each input and output variable. See ml::VariableTypes.

Python prototype (for reference):

create(samples, layout, responses[, varIdx[, sampleIdx[, sampleWeights[, varType]]]]) -> retval
Link to this function

create(samples, layout, responses, opts)

View Source

Creates training data from in-memory arrays.

Positional Arguments
  • samples: Evision.Mat.

    matrix of samples. It should have CV_32F type.

  • layout: int.

    see ml::SampleTypes.

  • responses: Evision.Mat.

    matrix of responses. If the responses are scalar, they should be stored as a single row or as a single column. The matrix should have type CV_32F or CV_32S (in the former case the responses are considered as ordered by default; in the latter case - as categorical)

Keyword Arguments
  • varIdx: Evision.Mat.

    vector specifying which variables to use for training. It can be an integer vector (CV_32S) containing 0-based variable indices or byte vector (CV_8U) containing a mask of active variables.

  • sampleIdx: Evision.Mat.

    vector specifying which samples to use for training. It can be an integer vector (CV_32S) containing 0-based sample indices or byte vector (CV_8U) containing a mask of training samples.

  • sampleWeights: Evision.Mat.

    optional vector with weights for each sample. It should have CV_32F type.

  • varType: Evision.Mat.

    optional vector of type CV_8U and size <number_of_variables_in_samples> + <number_of_variables_in_responses>, containing types of each input and output variable. See ml::VariableTypes.

Python prototype (for reference):

create(samples, layout, responses[, varIdx[, sampleIdx[, sampleWeights[, varType]]]]) -> retval
Positional Arguments
  • vi: int

Python prototype (for reference):

getCatCount(vi) -> retval

Python prototype (for reference):

getCatMap() -> retval

Python prototype (for reference):

getCatOfs() -> retval

Returns the vector of class labels

The function returns vector of unique labels occurred in the responses.

Python prototype (for reference):

getClassLabels() -> retval
Link to this function

getDefaultSubstValues(self)

View Source

Python prototype (for reference):

getDefaultSubstValues() -> retval

Python prototype (for reference):

getLayout() -> retval

Python prototype (for reference):

getMissing() -> retval

Python prototype (for reference):

getNAllVars() -> retval

Returns vector of symbolic names captured in loadFromCSV()

Positional Arguments
  • names: [String]

Python prototype (for reference):

getNames(names) -> None
Link to this function

getNormCatResponses(self)

View Source

Python prototype (for reference):

getNormCatResponses() -> retval

Python prototype (for reference):

getNSamples() -> retval

Python prototype (for reference):

getNTestSamples() -> retval

Python prototype (for reference):

getNTrainSamples() -> retval

Python prototype (for reference):

getNVars() -> retval

Python prototype (for reference):

getResponses() -> retval

Python prototype (for reference):

getResponseType() -> retval
Link to this function

getSample(self, varIdx, sidx, buf)

View Source
Positional Arguments

Python prototype (for reference):

getSample(varIdx, sidx, buf) -> None

Python prototype (for reference):

getSamples() -> retval

Python prototype (for reference):

getSampleWeights() -> retval
Link to this function

getSubMatrix(matrix, idx, layout)

View Source

Extract from matrix rows/cols specified by passed indexes.

Positional Arguments
  • matrix: Evision.Mat.

    input matrix (supported types: CV_32S, CV_32F, CV_64F)

  • idx: Evision.Mat.

    1D index vector

  • layout: int.

    specifies to extract rows (cv::ml::ROW_SAMPLES) or to extract columns (cv::ml::COL_SAMPLES)

Python prototype (for reference):

getSubMatrix(matrix, idx, layout) -> retval

Extract from 1D vector elements specified by passed indexes.

Positional Arguments

Python prototype (for reference):

getSubVector(vec, idx) -> retval
Link to this function

getTestNormCatResponses(self)

View Source

Python prototype (for reference):

getTestNormCatResponses() -> retval

Python prototype (for reference):

getTestResponses() -> retval

Python prototype (for reference):

getTestSampleIdx() -> retval

Returns matrix of test samples

Python prototype (for reference):

getTestSamples() -> retval
Link to this function

getTestSampleWeights(self)

View Source

Python prototype (for reference):

getTestSampleWeights() -> retval
Link to this function

getTrainNormCatResponses(self)

View Source

Returns the vector of normalized categorical responses

The function returns vector of responses. Each response is integer from 0 to <number of classes>-1. The actual label value can be retrieved then from the class label vector, see TrainData::getClassLabels.

Python prototype (for reference):

getTrainNormCatResponses() -> retval

Returns the vector of responses

The function returns ordered or the original categorical responses. Usually it's used in regression algorithms.

Python prototype (for reference):

getTrainResponses() -> retval

Python prototype (for reference):

getTrainSampleIdx() -> retval

Returns matrix of train samples

Keyword Arguments
  • layout: int.

    The requested layout. If it's different from the initial one, the matrix is transposed. See ml::SampleTypes.

  • compressSamples: bool.

    if true, the function returns only the training samples (specified by sampleIdx)

  • compressVars: bool.

    if true, the function returns the shorter training samples, containing only the active variables.

In current implementation the function tries to avoid physical data copying and returns the matrix stored inside TrainData (unless the transposition or compression is needed).

Python prototype (for reference):

getTrainSamples([, layout[, compressSamples[, compressVars]]]) -> retval
Link to this function

getTrainSampleWeights(self)

View Source

Python prototype (for reference):

getTrainSampleWeights() -> retval
Link to this function

getValues(self, vi, sidx, values)

View Source
Positional Arguments

Python prototype (for reference):

getValues(vi, sidx, values) -> None

Python prototype (for reference):

getVarIdx() -> retval

Python prototype (for reference):

getVarSymbolFlags() -> retval

Python prototype (for reference):

getVarType() -> retval
Link to this function

setTrainTestSplit(self, count)

View Source

Splits the training data into the training and test parts

Positional Arguments
  • count: int
Keyword Arguments
  • shuffle: bool.

@sa TrainData::setTrainTestSplitRatio

Python prototype (for reference):

setTrainTestSplit(count[, shuffle]) -> None
Link to this function

setTrainTestSplit(self, count, opts)

View Source

Splits the training data into the training and test parts

Positional Arguments
  • count: int
Keyword Arguments
  • shuffle: bool.

@sa TrainData::setTrainTestSplitRatio

Python prototype (for reference):

setTrainTestSplit(count[, shuffle]) -> None
Link to this function

setTrainTestSplitRatio(self, ratio)

View Source

Splits the training data into the training and test parts

Positional Arguments
  • ratio: double
Keyword Arguments
  • shuffle: bool.

The function selects a subset of specified relative size and then returns it as the training set. If the function is not called, all the data is used for training. Please, note that for each of TrainData::getTrain* there is corresponding TrainData::getTest*, so that the test subset can be retrieved and processed as well. @sa TrainData::setTrainTestSplit

Python prototype (for reference):

setTrainTestSplitRatio(ratio[, shuffle]) -> None
Link to this function

setTrainTestSplitRatio(self, ratio, opts)

View Source

Splits the training data into the training and test parts

Positional Arguments
  • ratio: double
Keyword Arguments
  • shuffle: bool.

The function selects a subset of specified relative size and then returns it as the training set. If the function is not called, all the data is used for training. Please, note that for each of TrainData::getTrain* there is corresponding TrainData::getTest*, so that the test subset can be retrieved and processed as well. @sa TrainData::setTrainTestSplit

Python prototype (for reference):

setTrainTestSplitRatio(ratio[, shuffle]) -> None

Python prototype (for reference):

shuffleTrainTest() -> None

Link to this section Functions

Link to this function

create!(samples, layout, responses)

View Source

Raising version of create/3.

Link to this function

create!(samples, layout, responses, opts)

View Source

Raising version of create/4.

Raising version of getCatCount/2.

Raising version of getCatMap/1.

Raising version of getCatOfs/1.

Raising version of getClassLabels/1.

Link to this function

getDefaultSubstValues!(self)

View Source

Raising version of getDefaultSubstValues/1.

Raising version of getLayout/1.

Raising version of getMissing/1.

Raising version of getNAllVars/1.

Raising version of getNames/2.

Link to this function

getNormCatResponses!(self)

View Source

Raising version of getNormCatResponses/1.

Raising version of getNSamples/1.

Raising version of getNTestSamples/1.

Raising version of getNTrainSamples/1.

Raising version of getNVars/1.

Raising version of getResponses/1.

Raising version of getResponseType/1.

Link to this function

getSample!(self, varIdx, sidx, buf)

View Source

Raising version of getSample/4.

Raising version of getSamples/1.

Raising version of getSampleWeights/1.

Link to this function

getSubMatrix!(matrix, idx, layout)

View Source

Raising version of getSubMatrix/3.

Raising version of getSubVector/2.

Link to this function

getTestNormCatResponses!(self)

View Source

Raising version of getTestNormCatResponses/1.

Raising version of getTestResponses/1.

Raising version of getTestSampleIdx/1.

Raising version of getTestSamples/1.

Link to this function

getTestSampleWeights!(self)

View Source

Raising version of getTestSampleWeights/1.

Link to this function

getTrainNormCatResponses!(self)

View Source

Raising version of getTrainNormCatResponses/1.

Link to this function

getTrainResponses!(self)

View Source

Raising version of getTrainResponses/1.

Link to this function

getTrainSampleIdx!(self)

View Source

Raising version of getTrainSampleIdx/1.

Raising version of getTrainSamples/1.

Link to this function

getTrainSampleWeights!(self)

View Source

Raising version of getTrainSampleWeights/1.

Link to this function

getValues!(self, vi, sidx, values)

View Source

Raising version of getValues/4.

Raising version of getVarIdx/1.

Link to this function

getVarSymbolFlags!(self)

View Source

Raising version of getVarSymbolFlags/1.

Raising version of getVarType/1.

Link to this function

setTrainTestSplit!(self, count)

View Source

Raising version of setTrainTestSplit/2.

Link to this function

setTrainTestSplit!(self, count, opts)

View Source

Raising version of setTrainTestSplit/3.

Link to this function

setTrainTestSplitRatio!(self, ratio)

View Source

Raising version of setTrainTestSplitRatio/2.

Link to this function

setTrainTestSplitRatio!(self, ratio, opts)

View Source

Raising version of setTrainTestSplitRatio/3.

Raising version of shuffleTrainTest/1.