🤖 AIによる機械翻訳(非公式) — これは OpenCV 4.13.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
Package org.opencv.ml
クラス TrainData
- java.lang.Object
-
- org.opencv.ml.TrainData
public class TrainData extends java.lang.Object訓練データをカプセル化するクラス。このクラスは訓練データのインターフェースのみを規定し、実装は規定しないことに注意。_ml_ モジュールのすべての統計モデルクラスは Ptr<TrainData> をパラメータとして受け取る。言い換えれば、TrainData から派生した独自のクラスを作成し、そのインスタンスへのスマートポインタを StatModel::train に渡すことができる。参照: REF: ml_intro_data
-
-
フィールドの要約
フィールド Modifier and Type Field Description protected longnativeObj
-
コンストラクタの要約
コンストラクタ Modifier Constructor Description protectedTrainData​(long addr)
-
メソッドの要約
すべてのメソッド 静的メソッド インスタンスメソッド 具象メソッド Modifier and Type Method Description static TrainData__fromPtr__​(long addr)static TrainDatacreate​(Mat samples, int layout, Mat responses)Creates training data from in-memory arrays.static TrainDatacreate​(Mat samples, int layout, Mat responses, Mat varIdx)Creates training data from in-memory arrays.static TrainDatacreate​(Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx)Creates training data from in-memory arrays.static TrainDatacreate​(Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx, Mat sampleWeights)Creates training data from in-memory arrays.static TrainDatacreate​(Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx, Mat sampleWeights, Mat varType)Creates training data from in-memory arrays.intgetCatCount​(int vi)MatgetCatMap()MatgetCatOfs()MatgetClassLabels()Returns the vector of class labels The function returns vector of unique labels occurred in the responses.MatgetDefaultSubstValues()intgetLayout()MatgetMissing()intgetNAllVars()voidgetNames​(java.util.List<java.lang.String> names)Returns vector of symbolic names captured in loadFromCSV()longgetNativeObjAddr()MatgetNormCatResponses()intgetNSamples()intgetNTestSamples()intgetNTrainSamples()intgetNVars()MatgetResponses()intgetResponseType()voidgetSample​(Mat varIdx, int sidx, float buf)MatgetSamples()MatgetSampleWeights()static MatgetSubMatrix​(Mat matrix, Mat idx, int layout)Extract from matrix rows/cols specified by passed indexes.static MatgetSubVector​(Mat vec, Mat idx)Extract from 1D vector elements specified by passed indexes.MatgetTestNormCatResponses()MatgetTestResponses()MatgetTestSampleIdx()MatgetTestSamples()Returns matrix of test samplesMatgetTestSampleWeights()MatgetTrainNormCatResponses()Returns the vector of normalized categorical responses The function returns vector of responses.MatgetTrainResponses()Returns the vector of responses The function returns ordered or the original categorical responses.MatgetTrainSampleIdx()MatgetTrainSamples()Returns matrix of train samples transposed.MatgetTrainSamples​(int layout)Returns matrix of train samplesMatgetTrainSamples​(int layout, boolean compressSamples)Returns matrix of train samplesMatgetTrainSamples​(int layout, boolean compressSamples, boolean compressVars)Returns matrix of train samplesMatgetTrainSampleWeights()voidgetValues​(int vi, Mat sidx, float values)MatgetVarIdx()MatgetVarSymbolFlags()MatgetVarType()voidsetTrainTestSplit​(int count)Splits the training data into the training and test parts SEE: TrainData::setTrainTestSplitRatiovoidsetTrainTestSplit​(int count, boolean shuffle)Splits the training data into the training and test parts SEE: TrainData::setTrainTestSplitRatiovoidsetTrainTestSplitRatio​(double ratio)Splits the training data into the training and test parts The function selects a subset of specified relative size and then returns it as the training set.voidsetTrainTestSplitRatio​(double ratio, boolean shuffle)Splits the training data into the training and test parts The function selects a subset of specified relative size and then returns it as the training set.voidshuffleTrainTest()
-
-
-
メソッドの詳細
-
getNativeObjAddr
public long getNativeObjAddr()
-
__fromPtr__
public static TrainData __fromPtr__​(long addr)
-
getLayout
public int getLayout()
-
getNTrainSamples
public int getNTrainSamples()
-
getNTestSamples
public int getNTestSamples()
-
getNSamples
public int getNSamples()
-
getNVars
public int getNVars()
-
getNAllVars
public int getNAllVars()
-
getSample
public void getSample​(Mat varIdx, int sidx, float buf)
-
getSamples
public Mat getSamples()
-
getMissing
public Mat getMissing()
-
getTrainSamples
public Mat getTrainSamples​(int layout, boolean compressSamples, boolean compressVars)
Returns matrix of train samples- 引数:
layout- 要求するレイアウト。初期のものと異なる場合、行列は転置される。ml::SampleTypes を参照。compressSamples- true の場合、関数は訓練サンプル(sampleIdx で指定)のみを返すcompressVars- true の場合、関数はアクティブな変数のみを含む、より短い訓練サンプルを返す。現在の実装では、関数は物理的なデータコピーを避けようとし、TrainData 内部に格納された行列を返す(転置や圧縮が必要な場合を除く)。- 戻り値:
- 自動生成
-
getTrainSamples
public Mat getTrainSamples​(int layout, boolean compressSamples)
Returns matrix of train samples- 引数:
layout- 要求するレイアウト。初期のものと異なる場合、行列は転置される。ml::SampleTypes を参照。compressSamples- true の場合、関数は訓練サンプル(sampleIdx で指定)のみを返す。アクティブな変数。現在の実装では、関数は物理的なデータコピーを避けようとし、TrainData 内部に格納された行列を返す(転置や圧縮が必要な場合を除く)。- 戻り値:
- 自動生成
-
getTrainSamples
public Mat getTrainSamples​(int layout)
Returns matrix of train samples- 引数:
layout- 要求するレイアウト。初期のものと異なる場合、行列は転置される。ml::SampleTypes を参照。sampleIdx) アクティブな変数。現在の実装では、関数は物理的なデータコピーを避けようとし、TrainData 内部に格納された行列を返す(転置や圧縮が必要な場合を除く)。- 戻り値:
- 自動生成
-
getTrainSamples
public Mat getTrainSamples()
Returns matrix of train samples transposed. See ml::SampleTypes. sampleIdx) 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).- 戻り値:
- 自動生成
-
getTrainResponses
public Mat getTrainResponses()
Returns the vector of responses The function returns ordered or the original categorical responses. Usually it's used in regression algorithms.- 戻り値:
- 自動生成
-
getTrainNormCatResponses
public Mat getTrainNormCatResponses()
Returns the vector of normalized categorical responses The function returns vector of responses. Each response is integer from0to `<number of classes>-1`. The actual label value can be retrieved then from the class label vector, see TrainData::getClassLabels.- 戻り値:
- 自動生成
-
getTestResponses
public Mat getTestResponses()
-
getTestNormCatResponses
public Mat getTestNormCatResponses()
-
getResponses
public Mat getResponses()
-
getNormCatResponses
public Mat getNormCatResponses()
-
getSampleWeights
public Mat getSampleWeights()
-
getTrainSampleWeights
public Mat getTrainSampleWeights()
-
getTestSampleWeights
public Mat getTestSampleWeights()
-
getVarIdx
public Mat getVarIdx()
-
getVarType
public Mat getVarType()
-
getVarSymbolFlags
public Mat getVarSymbolFlags()
-
getResponseType
public int getResponseType()
-
getTrainSampleIdx
public Mat getTrainSampleIdx()
-
getTestSampleIdx
public Mat getTestSampleIdx()
-
getValues
public void getValues​(int vi, Mat sidx, float values)
-
getDefaultSubstValues
public Mat getDefaultSubstValues()
-
getCatCount
public int getCatCount​(int vi)
-
getClassLabels
public Mat getClassLabels()
Returns the vector of class labels The function returns vector of unique labels occurred in the responses.- 戻り値:
- 自動生成
-
getCatOfs
public Mat getCatOfs()
-
getCatMap
public Mat getCatMap()
-
setTrainTestSplit
public void setTrainTestSplit​(int count, boolean shuffle)Splits the training data into the training and test parts SEE: TrainData::setTrainTestSplitRatio- 引数:
count- 自動生成shuffle- 自動生成
-
setTrainTestSplit
public void setTrainTestSplit​(int count)
Splits the training data into the training and test parts SEE: TrainData::setTrainTestSplitRatio- 引数:
count- 自動生成
-
setTrainTestSplitRatio
public void setTrainTestSplitRatio​(double ratio, boolean shuffle)Splits the training data into the training and test parts 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. SEE: TrainData::setTrainTestSplit- 引数:
ratio- 自動生成shuffle- 自動生成
-
setTrainTestSplitRatio
public void setTrainTestSplitRatio​(double ratio)
Splits the training data into the training and test parts 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. SEE: TrainData::setTrainTestSplit- 引数:
ratio- 自動生成
-
shuffleTrainTest
public void shuffleTrainTest()
-
getTestSamples
public Mat getTestSamples()
Returns matrix of test samples- 戻り値:
- 自動生成
-
getNames
public void getNames​(java.util.List<java.lang.String> names)
Returns vector of symbolic names captured in loadFromCSV()- 引数:
names- 自動生成
-
getSubVector
public static Mat getSubVector​(Mat vec, Mat idx)
Extract from 1D vector elements specified by passed indexes.- 引数:
vec- 入力ベクトル (サポートされる型: CV_32S, CV_32F, CV_64F)idx- 1次元のインデックスベクトル- 戻り値:
- 自動生成
-
getSubMatrix
public static Mat getSubMatrix​(Mat matrix, Mat idx, int layout)
Extract from matrix rows/cols specified by passed indexes.- 引数:
matrix- 入力行列 (サポートされる型: CV_32S, CV_32F, CV_64F)idx- 1次元のインデックスベクトルlayout- 行を抽出する (cv::ml::ROW_SAMPLES) か列を抽出する (cv::ml::COL_SAMPLES) かを指定する- 戻り値:
- 自動生成
-
create
public static TrainData create​(Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx, Mat sampleWeights, Mat varType)
Creates training data from in-memory arrays.- 引数:
samples- サンプルの行列。型は CV_32F でなければならない。layout- ml::SampleTypes を参照。responses- レスポンスの行列。レスポンスがスカラの場合は、単一の行または単一の列として格納する必要がある。行列の型は CV_32F または CV_32S でなければならない (前者の場合、レスポンスはデフォルトで順序付き (ordered) とみなされ、後者の場合はカテゴリ (categorical) とみなされる)varIdx- 学習に使用する変数を指定するベクトル。0始まりの変数インデックスを含む整数ベクトル (CV_32S) か、有効な変数のマスクを含むバイトベクトル (CV_8U) のいずれかを指定できる。sampleIdx- 学習に使用するサンプルを指定するベクトル。0始まりのサンプルインデックスを含む整数ベクトル (CV_32S) か、学習サンプルのマスクを含むバイトベクトル (CV_8U) のいずれかを指定できる。sampleWeights- 各サンプルの重みを含む省略可能なベクトル。型は CV_32F でなければならない。varType- 型 CV_8U でサイズが `<number_of_variables_in_samples> + <number_of_variables_in_responses>` の省略可能なベクトルで、各入力変数および出力変数の型を含む。ml::VariableTypes を参照。- 戻り値:
- 自動生成
-
create
public static TrainData create​(Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx, Mat sampleWeights)
Creates training data from in-memory arrays.- 引数:
samples- サンプルの行列。型は CV_32F でなければならない。layout- ml::SampleTypes を参照。responses- レスポンスの行列。レスポンスがスカラの場合は、単一の行または単一の列として格納する必要がある。行列の型は CV_32F または CV_32S でなければならない (前者の場合、レスポンスはデフォルトで順序付き (ordered) とみなされ、後者の場合はカテゴリ (categorical) とみなされる)varIdx- 学習に使用する変数を指定するベクトル。0始まりの変数インデックスを含む整数ベクトル (CV_32S) か、有効な変数のマスクを含むバイトベクトル (CV_8U) のいずれかを指定できる。sampleIdx- 学習に使用するサンプルを指定するベクトル。0始まりのサンプルインデックスを含む整数ベクトル (CV_32S) か、学習サンプルのマスクを含むバイトベクトル (CV_8U) のいずれかを指定できる。sampleWeights- 各サンプルの重みを含む省略可能なベクトル。型は CV_32F でなければならない。 <number_of_variables_in_responses>`, containing types of each input and output variable. See ml::VariableTypes.- 戻り値:
- 自動生成
-
create
public static TrainData create​(Mat samples, int layout, Mat responses, Mat varIdx, Mat sampleIdx)
Creates training data from in-memory arrays.- 引数:
samples- サンプルの行列。型は CV_32F でなければならない。layout- ml::SampleTypes を参照。responses- レスポンスの行列。レスポンスがスカラの場合は、単一の行または単一の列として格納する必要がある。行列の型は CV_32F または CV_32S でなければならない (前者の場合、レスポンスはデフォルトで順序付き (ordered) とみなされ、後者の場合はカテゴリ (categorical) とみなされる)varIdx- 学習に使用する変数を指定するベクトル。0始まりの変数インデックスを含む整数ベクトル (CV_32S) か、有効な変数のマスクを含むバイトベクトル (CV_8U) のいずれかを指定できる。sampleIdx- 学習に使用するサンプルを指定するベクトル。0始まりのサンプルインデックスを含む整数ベクトル (CV_32S) か、学習サンプルのマスクを含むバイトベクトル (CV_8U) のいずれかを指定できる。 <number_of_variables_in_responses>`, containing types of each input and output variable. See ml::VariableTypes.- 戻り値:
- 自動生成
-
create
public static TrainData create​(Mat samples, int layout, Mat responses, Mat varIdx)
Creates training data from in-memory arrays.- 引数:
samples- サンプルの行列。型は CV_32F でなければならない。layout- ml::SampleTypes を参照。responses- レスポンスの行列。レスポンスがスカラの場合は、単一の行または単一の列として格納する必要がある。行列の型は CV_32F または CV_32S でなければならない (前者の場合、レスポンスはデフォルトで順序付き (ordered) とみなされ、後者の場合はカテゴリ (categorical) とみなされる)varIdx- 学習に使用する変数を指定するベクトル。0始まりの変数インデックスを含む整数ベクトル (CV_32S) か、有効な変数のマスクを含むバイトベクトル (CV_8U) のいずれかを指定できる。 vector (CV_32S) containing 0-based sample indices or byte vector (CV_8U) containing a mask of training samples. <number_of_variables_in_responses>`, containing types of each input and output variable. See ml::VariableTypes.- 戻り値:
- 自動生成
-
create
public static TrainData create​(Mat samples, int layout, Mat responses)
Creates training data from in-memory arrays.- 引数:
samples- サンプルの行列。型は CV_32F でなければならない。layout- ml::SampleTypes を参照。responses- レスポンスの行列。レスポンスがスカラの場合は、単一の行または単一の列として格納する必要がある。行列の型は CV_32F または CV_32S でなければならない (前者の場合、レスポンスはデフォルトで順序付き (ordered) とみなされ、後者の場合はカテゴリ (categorical) とみなされる) (CV_32S) containing 0-based variable indices or byte vector (CV_8U) containing a mask of active variables. vector (CV_32S) containing 0-based sample indices or byte vector (CV_8U) containing a mask of training samples. <number_of_variables_in_responses>`, containing types of each input and output variable. See ml::VariableTypes.- 戻り値:
- 自動生成
-
-