ml_TrainData_create
import { ml_TrainData_create } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Creates training data from in-memory arrays.
ml_TrainData_create(samples: Mat, layout: number, responses: Mat, varIdx: Mat, sampleIdx: Mat, sampleWeights: Mat, varType: Mat): ml_TrainData | null;5 available overloads
ml_TrainData_create(samples: Mat, layout: number, responses: Mat): ml_TrainData | null;ml_TrainData_create(samples: Mat, layout: number, responses: Mat, varIdx: Mat): ml_TrainData | null;ml_TrainData_create(samples: Mat, layout: number, responses: Mat, varIdx: Mat, sampleIdx: Mat): ml_TrainData | null;ml_TrainData_create(samples: Mat, layout: number, responses: Mat, varIdx: Mat, sampleIdx: Mat, sampleWeights: Mat): ml_TrainData | null;ml_TrainData_create(samples: Mat, layout: number, responses: Mat, varIdx: Mat, sampleIdx: Mat, sampleWeights: Mat, varType: Mat): ml_TrainData | null;samplesmatrix of samples. It should have CV_32F type.
layoutsee ml::SampleTypes.
responsesmatrix 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)
varIdxvector 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.
sampleIdxvector 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.
sampleWeightsoptional vector with weights for each sample. It should have CV_32F type.
varTypeoptional 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.
The ml_TrainData | null result.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.