org.opencv.ml
public class CvStatModel extends java.lang.Object
Base class for statistical models in ML.
class CvStatModel
// C++ code:
public:
/ * CvStatModel(); * /
/ * CvStatModel(const Mat& train_data...); * /
virtual ~CvStatModel();
virtual void clear()=0;
/ * virtual bool train(const Mat& train_data, [int tflag,]..., const
Mat& responses,...,
[const Mat& var_idx,]..., [const Mat& sample_idx,]...
[const Mat& var_type,]..., [const Mat& missing_mask,]
/ * virtual float predict(const Mat& sample...) const=0; * /
virtual void save(const char* filename, const char* name=0)=0;
virtual void load(const char* filename, const char* name=0)=0;
virtual void write(CvFileStorage* storage, const char* name)=0;
virtual void read(CvFileStorage* storage, CvFileNode* node)=0;
};
In this declaration, some methods are commented off. These are methods for which there is no unified API (with the exception of the default constructor). However, there are many similarities in the syntax and semantics that are briefly described below in this section, as if they are part of the base class.
Modifier and Type | Method and Description |
---|---|
void |
load(java.lang.String filename)
Loads the model from a file.
|
void |
load(java.lang.String filename,
java.lang.String name)
Loads the model from a file.
|
void |
save(java.lang.String filename)
Saves the model to a file.
|
void |
save(java.lang.String filename,
java.lang.String name)
Saves the model to a file.
|
public void load(java.lang.String filename)
Loads the model from a file.
The method load
loads the complete model state with the
specified name (or default model-dependent name) from the specified XML or
YAML file. The previous model state is cleared by "CvStatModel.clear".
filename
- a filenamepublic void load(java.lang.String filename, java.lang.String name)
Loads the model from a file.
The method load
loads the complete model state with the
specified name (or default model-dependent name) from the specified XML or
YAML file. The previous model state is cleared by "CvStatModel.clear".
filename
- a filenamename
- a namepublic void save(java.lang.String filename)
Saves the model to a file.
The method save
saves the complete model state to the specified
XML or YAML file with the specified name or default name (which depends on a
particular class). *Data persistence* functionality from CxCore
is used.
filename
- a filenamepublic void save(java.lang.String filename, java.lang.String name)
Saves the model to a file.
The method save
saves the complete model state to the specified
XML or YAML file with the specified name or default name (which depends on a
particular class). *Data persistence* functionality from CxCore
is used.
filename
- a filenamename
- a name