TrainData class
Class encapsulating training data. https://docs.opencv.org/4.x/dc/d32/classcv_1_1ml_1_1TrainData.html
- Inheritance
- Available extensions
Constructors
- TrainData.create(Mat samples, int layout, Mat responses, {Mat? varIdx, Mat? sampleIdx, Mat? sampleWeights, Mat? varType})
-
Creates training data from in-memory arrays.
factory
- TrainData.fromPointer(TrainDataPtr ptr, [bool attach = true])
-
factory
- TrainData.loadFromCSV(String filename, int headerLineCount, {int responseStartIdx = -1, int responseEndIdx = -1, String varTypeSpec = '', String delimiter = ',', String missch = '?'})
-
Reads the dataset from a .csv file.
factory
Properties
- catMap → Mat
-
no setter
- catOfs → Mat
-
no setter
- classLabels → Mat
-
no setter
- defaultSubstValues → Mat
-
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- isDisposed → bool
-
Whether this object has been disposed.
no setterinherited
- layout → int
-
no setter
- missing → Mat
-
no setter
- nAllVars → int
-
no setter
-
names
→ List<
String> -
The symbolic values of the categorical variables captured by TrainData.loadFromCSV.
no setter
- normCatResponses → Mat
-
no setter
- nSamples → int
-
no setter
- nTestSamples → int
-
no setter
- nTrainSamples → int
-
no setter
- nVars → int
-
no setter
-
props
→ List<
Object?> -
no setterinherited
-
ptr
↔ Pointer<
TrainData> -
getter/setter pairinherited
- ref → TrainData
-
A view of the native memory behind ptr, not a copy.
no setteroverride
- responses → Mat
-
no setter
- responseType → int
-
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- samples → Mat
-
no setter
- sampleWeights → Mat
-
no setter
- testNormCatResponses → Mat
-
no setter
- testResponses → Mat
-
no setter
- testSampleIdx → Mat
-
no setter
- testSamples → Mat
-
no setter
- testSampleWeights → Mat
-
no setter
- trainNormCatResponses → Mat
-
no setter
- trainResponses → Mat
-
no setter
- trainSampleIdx → Mat
-
no setter
- trainSampleWeights → Mat
-
no setter
- varIdx → Mat
-
no setter
- varSymbolFlags → Mat
-
no setter
- varType → Mat
-
no setter
Methods
-
dispose(
) → void -
Releases the underlying native resources. Idempotent: calling it more
than once is safe, but the object must not be used after dispose.
inherited
-
freeNative(
) → void -
Frees the native resources owned by this object. Subclasses implement the
concrete free logic here; callers must use dispose instead.
override
-
getCatCount(
int vi) → int -
Number of categories of the categorical variable
vi. -
getTrainSamples(
{int layout = ROW_SAMPLE, bool compressSamples = true, bool compressVars = true}) → Mat - Returns matrix of train samples.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
setTrainTestSplit(
int count, {bool shuffle = true}) → void - Splits the training data into the training and test parts.
-
setTrainTestSplitRatio(
double ratio, {bool shuffle = true}) → void -
Splits the training data into the training and test parts by
ratio. -
shuffleTrainTest(
) → void -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- finalizer → NativeFinalizer
-
final
- missingValue → double
-
The value OpenCV uses to mark a missing measurement.
no setter
Static Methods
-
getSubMatrix(
Mat matrix, Mat idx, int layout) → Mat -
Extracts from
matrixthe rows (ROW_SAMPLE) or columns (COL_SAMPLE) specified byidx. -
getSubVector(
Mat vec, Mat idx) → Mat -
Extracts from 1D
vecthe elements specified byidx. -
singleChar(
String value, String name) → int -
The code unit of a single-character
value, for the Ccharparameters.