🤖 AIによる機械翻訳(非公式) — これは OpenCV 5.0.0 公式リファレンス(英語)を AI (Claude) で自動翻訳したものです。訳に誤りを含む場合があります。正確な情報は 公式英語版(原文) を参照してください。
Package org.opencv.ml
クラス StatModel
- java.lang.Object
-
- org.opencv.core.Algorithm
-
- org.opencv.ml.StatModel
-
- 既知の直接サブクラス:
ANN_MLP,DTrees,EM,KNearest,LogisticRegression,NormalBayesClassifier,SVM,SVMSGD
public class StatModel extends Algorithm
Base class for statistical models in OpenCV ML.
-
-
フィールドの要約
フィールド Modifier and Type Field Description static intCOMPRESSED_INPUTstatic intPREPROCESSED_INPUTstatic intRAW_OUTPUTstatic intUPDATE_MODEL
-
コンストラクタの要約
コンストラクタ Modifier Constructor Description protectedStatModel​(long addr)
-
メソッドの要約
すべてのメソッド 静的メソッド インスタンスメソッド 具象メソッド Modifier and Type Method Description static StatModel__fromPtr__​(long addr)floatcalcError​(TrainData data, boolean test, Mat resp)Computes error on the training or test datasetbooleanempty()Returns true if the Algorithm is empty (e.g.intgetVarCount()Returns the number of variables in training samplesbooleanisClassifier()Returns true if the model is classifierbooleanisTrained()Returns true if the model is trainedfloatpredict​(Mat samples)Predicts response(s) for the provided sample(s)floatpredict​(Mat samples, Mat results)Predicts response(s) for the provided sample(s)floatpredict​(Mat samples, Mat results, int flags)Predicts response(s) for the provided sample(s)booleantrain​(Mat samples, int layout, Mat responses)Trains the statistical modelbooleantrain​(TrainData trainData)Trains the statistical modelbooleantrain​(TrainData trainData, int flags)Trains the statistical model-
クラス org.opencv.core.Algorithm から継承されたメソッド
clear, getDefaultName, getNativeObjAddr, save
-
-
-
-
メソッドの詳細
-
__fromPtr__
public static StatModel __fromPtr__​(long addr)
-
getVarCount
public int getVarCount()
Returns the number of variables in training samples- 戻り値:
- 自動生成
-
empty
public boolean empty()
Description copied from class:AlgorithmReturns true if the Algorithm is empty (e.g. in the very beginning or after unsuccessful read
-
isTrained
public boolean isTrained()
Returns true if the model is trained- 戻り値:
- 自動生成
-
isClassifier
public boolean isClassifier()
Returns true if the model is classifier- 戻り値:
- 自動生成
-
train
public boolean train​(TrainData trainData, int flags)
Trains the statistical model- 引数:
trainData- TrainData::loadFromCSV でファイルから読み込むか、TrainData::create で作成できる訓練データ。flags- モデルに依存する省略可能なフラグ。一部のモデルは、完全に上書きするのではなく、新しい訓練サンプルで更新できる(NormalBayesClassifier や ANN_MLP など)。- 戻り値:
- 自動生成
-
train
public boolean train​(TrainData trainData)
Trains the statistical model- 引数:
trainData- TrainData::loadFromCSV でファイルから読み込むか、TrainData::create で作成できる訓練データ。完全に上書きするのではなく、新しい訓練サンプル(NormalBayesClassifier や ANN_MLP など)。- 戻り値:
- 自動生成
-
train
public boolean train​(Mat samples, int layout, Mat responses)
Trains the statistical model- 引数:
samples- 訓練サンプルlayout- ml::SampleTypes を参照。responses- 訓練サンプルに対応する応答のベクトル。- 戻り値:
- 自動生成
-
calcError
public float calcError​(TrainData data, boolean test, Mat resp)
Computes error on the training or test dataset- 引数:
data- 訓練データtest- true の場合、誤差はデータのテストサブセットに対して計算され、そうでない場合は訓練サブセットに対して計算される。すでに訓練済みの分類器を評価するために完全に異なるデータセットを読み込んだ場合は、おそらく TrainData::setTrainTestSplitRatio でテストサブセットをまったく設定せずに test=false を指定し、新しいセット全体に対して誤差を計算したいと考えるだろう。そう、これは少し紛らわしい。resp- 省略可能な出力レスポンス。このメソッドは誤差の計算に StatModel::predict を使用する。回帰モデルでは誤差は RMS として計算され、分類器では誤分類されたサンプルの割合(0%-100%)として計算される。- 戻り値:
- 自動生成
-
predict
public float predict​(Mat samples, Mat results, int flags)
Predicts response(s) for the provided sample(s)- 引数:
samples- 入力サンプル。浮動小数点型の行列。results- 省略可能な結果の出力行列。flags- モデルに依存する省略可能なフラグ。cv::ml::StatModel::Flags を参照。- 戻り値:
- 自動生成
-
predict
public float predict​(Mat samples, Mat results)
Predicts response(s) for the provided sample(s)- 引数:
samples- 入力サンプル。浮動小数点型の行列。results- 省略可能な結果の出力行列。- 戻り値:
- 自動生成
-
predict
public float predict​(Mat samples)
Predicts response(s) for the provided sample(s)- 引数:
samples- 入力サンプル。浮動小数点型の行列。- 戻り値:
- 自動生成
-
-