View Source Evision.ML.Boost (Evision v0.2.9)

Summary

Types

t()

Type that represents an ML.Boost struct.

Functions

Computes error on the training or test dataset

Computes error on the training or test dataset

Clears the algorithm state

create

getMaxCategories

getMinSampleCount

getRegressionAccuracy

getTruncatePrunedTree

getUseSurrogates

Returns the number of variables in training samples

getWeightTrimRate

Returns true if the model is classifier

Returns true if the model is trained

Loads and creates a serialized Boost from a file

Loads and creates a serialized Boost from a file

Predicts response(s) for the provided sample(s)

Predicts response(s) for the provided sample(s)

Reads algorithm parameters from a file storage

setMaxCategories

setMinSampleCount

setRegressionAccuracy

setTruncatePrunedTree

setUse1SERule

setUseSurrogates

setWeightTrimRate

Trains the statistical model

Trains the statistical model

Trains the statistical model

Stores algorithm parameters in a file storage

Types

@type t() :: %Evision.ML.Boost{ref: reference()}

Type that represents an ML.Boost struct.

  • ref. reference()

    The underlying erlang resource variable.

Functions

@spec calcError(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

calcError(self, data, test)

View Source
@spec calcError(t(), Evision.ML.TrainData.t(), boolean()) ::
  {number(), Evision.Mat.t()} | {:error, String.t()}

Computes error on the training or test dataset

Positional Arguments
  • self: Evision.ML.Boost.t()

  • data: Evision.ML.TrainData.t().

    the training data

  • test: bool.

    if true, the error is computed over the test subset of the data, otherwise it's computed over the training subset of the data. Please note that if you loaded a completely different dataset to evaluate already trained classifier, you will probably want not to set the test subset at all with TrainData::setTrainTestSplitRatio and specify test=false, so that the error is computed for the whole new set. Yes, this sounds a bit confusing.

Return
  • retval: float

  • resp: Evision.Mat.t().

    the optional output responses.

The method uses StatModel::predict to compute the error. For regression models the error is computed as RMS, for classifiers - as a percent of missclassified samples (0%-100%).

Python prototype (for reference only):

calcError(data, test[, resp]) -> retval, resp
Link to this function

calcError(self, data, test, opts)

View Source
@spec calcError(
  t(),
  Evision.ML.TrainData.t(),
  boolean(),
  [{atom(), term()}, ...] | nil
) ::
  {number(), Evision.Mat.t()} | {:error, String.t()}

Computes error on the training or test dataset

Positional Arguments
  • self: Evision.ML.Boost.t()

  • data: Evision.ML.TrainData.t().

    the training data

  • test: bool.

    if true, the error is computed over the test subset of the data, otherwise it's computed over the training subset of the data. Please note that if you loaded a completely different dataset to evaluate already trained classifier, you will probably want not to set the test subset at all with TrainData::setTrainTestSplitRatio and specify test=false, so that the error is computed for the whole new set. Yes, this sounds a bit confusing.

Return
  • retval: float

  • resp: Evision.Mat.t().

    the optional output responses.

The method uses StatModel::predict to compute the error. For regression models the error is computed as RMS, for classifiers - as a percent of missclassified samples (0%-100%).

Python prototype (for reference only):

calcError(data, test[, resp]) -> retval, resp
@spec clear(Keyword.t()) :: any() | {:error, String.t()}
@spec clear(t()) :: t() | {:error, String.t()}

Clears the algorithm state

Positional Arguments
  • self: Evision.ML.Boost.t()

Python prototype (for reference only):

clear() -> None
@spec create() :: t() | {:error, String.t()}

create

Return
  • retval: Evision.ML.Boost.t()

Creates the empty model. Use StatModel::train to train the model, Algorithm::load\<Boost>(filename) to load the pre-trained model.

Python prototype (for reference only):

create() -> retval
@spec create(Keyword.t()) :: any() | {:error, String.t()}
@spec empty(Keyword.t()) :: any() | {:error, String.t()}
@spec empty(t()) :: boolean() | {:error, String.t()}

empty

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: bool

Python prototype (for reference only):

empty() -> retval
Link to this function

getBoostType(named_args)

View Source
@spec getBoostType(Keyword.t()) :: any() | {:error, String.t()}
@spec getBoostType(t()) :: integer() | {:error, String.t()}

getBoostType

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: integer()

@see setBoostType/2

Python prototype (for reference only):

getBoostType() -> retval
@spec getCVFolds(Keyword.t()) :: any() | {:error, String.t()}
@spec getCVFolds(t()) :: integer() | {:error, String.t()}

getCVFolds

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: integer()

@see setCVFolds/2

Python prototype (for reference only):

getCVFolds() -> retval
Link to this function

getDefaultName(named_args)

View Source
@spec getDefaultName(Keyword.t()) :: any() | {:error, String.t()}
@spec getDefaultName(t()) :: binary() | {:error, String.t()}

getDefaultName

Positional Arguments
  • self: Evision.ML.Boost.t()
Return

Returns the algorithm string identifier. This string is used as top level xml/yml node tag when the object is saved to a file or string.

Python prototype (for reference only):

getDefaultName() -> retval
Link to this function

getMaxCategories(named_args)

View Source
@spec getMaxCategories(Keyword.t()) :: any() | {:error, String.t()}
@spec getMaxCategories(t()) :: integer() | {:error, String.t()}

getMaxCategories

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: integer()

@see setMaxCategories/2

Python prototype (for reference only):

getMaxCategories() -> retval
@spec getMaxDepth(Keyword.t()) :: any() | {:error, String.t()}
@spec getMaxDepth(t()) :: integer() | {:error, String.t()}

getMaxDepth

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: integer()

@see setMaxDepth/2

Python prototype (for reference only):

getMaxDepth() -> retval
Link to this function

getMinSampleCount(named_args)

View Source
@spec getMinSampleCount(Keyword.t()) :: any() | {:error, String.t()}
@spec getMinSampleCount(t()) :: integer() | {:error, String.t()}

getMinSampleCount

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: integer()

@see setMinSampleCount/2

Python prototype (for reference only):

getMinSampleCount() -> retval
@spec getPriors(Keyword.t()) :: any() | {:error, String.t()}
@spec getPriors(t()) :: Evision.Mat.t() | {:error, String.t()}

getPriors

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: Evision.Mat.t()

@see setPriors/2

Python prototype (for reference only):

getPriors() -> retval
Link to this function

getRegressionAccuracy(named_args)

View Source
@spec getRegressionAccuracy(Keyword.t()) :: any() | {:error, String.t()}
@spec getRegressionAccuracy(t()) :: number() | {:error, String.t()}

getRegressionAccuracy

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: float

@see setRegressionAccuracy/2

Python prototype (for reference only):

getRegressionAccuracy() -> retval
Link to this function

getTruncatePrunedTree(named_args)

View Source
@spec getTruncatePrunedTree(Keyword.t()) :: any() | {:error, String.t()}
@spec getTruncatePrunedTree(t()) :: boolean() | {:error, String.t()}

getTruncatePrunedTree

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: bool

@see setTruncatePrunedTree/2

Python prototype (for reference only):

getTruncatePrunedTree() -> retval
Link to this function

getUse1SERule(named_args)

View Source
@spec getUse1SERule(Keyword.t()) :: any() | {:error, String.t()}
@spec getUse1SERule(t()) :: boolean() | {:error, String.t()}

getUse1SERule

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: bool

@see setUse1SERule/2

Python prototype (for reference only):

getUse1SERule() -> retval
Link to this function

getUseSurrogates(named_args)

View Source
@spec getUseSurrogates(Keyword.t()) :: any() | {:error, String.t()}
@spec getUseSurrogates(t()) :: boolean() | {:error, String.t()}

getUseSurrogates

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: bool

@see setUseSurrogates/2

Python prototype (for reference only):

getUseSurrogates() -> retval
@spec getVarCount(Keyword.t()) :: any() | {:error, String.t()}
@spec getVarCount(t()) :: integer() | {:error, String.t()}

Returns the number of variables in training samples

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: integer()

Python prototype (for reference only):

getVarCount() -> retval
Link to this function

getWeakCount(named_args)

View Source
@spec getWeakCount(Keyword.t()) :: any() | {:error, String.t()}
@spec getWeakCount(t()) :: integer() | {:error, String.t()}

getWeakCount

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: integer()

@see setWeakCount/2

Python prototype (for reference only):

getWeakCount() -> retval
Link to this function

getWeightTrimRate(named_args)

View Source
@spec getWeightTrimRate(Keyword.t()) :: any() | {:error, String.t()}
@spec getWeightTrimRate(t()) :: number() | {:error, String.t()}

getWeightTrimRate

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: double

@see setWeightTrimRate/2

Python prototype (for reference only):

getWeightTrimRate() -> retval
Link to this function

isClassifier(named_args)

View Source
@spec isClassifier(Keyword.t()) :: any() | {:error, String.t()}
@spec isClassifier(t()) :: boolean() | {:error, String.t()}

Returns true if the model is classifier

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: bool

Python prototype (for reference only):

isClassifier() -> retval
@spec isTrained(Keyword.t()) :: any() | {:error, String.t()}
@spec isTrained(t()) :: boolean() | {:error, String.t()}

Returns true if the model is trained

Positional Arguments
  • self: Evision.ML.Boost.t()
Return
  • retval: bool

Python prototype (for reference only):

isTrained() -> retval
@spec load(Keyword.t()) :: any() | {:error, String.t()}
@spec load(binary()) :: t() | {:error, String.t()}

Loads and creates a serialized Boost from a file

Positional Arguments
  • filepath: String.

    path to serialized Boost

Keyword Arguments
  • nodeName: String.

    name of node containing the classifier

Return
  • retval: Evision.ML.Boost.t()

Use Boost::save to serialize and store an RTree to disk. Load the Boost from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier

Python prototype (for reference only):

load(filepath[, nodeName]) -> retval
@spec load(binary(), [{:nodeName, term()}] | nil) :: t() | {:error, String.t()}

Loads and creates a serialized Boost from a file

Positional Arguments
  • filepath: String.

    path to serialized Boost

Keyword Arguments
  • nodeName: String.

    name of node containing the classifier

Return
  • retval: Evision.ML.Boost.t()

Use Boost::save to serialize and store an RTree to disk. Load the Boost from this file again, by calling this function with the path to the file. Optionally specify the node for the file containing the classifier

Python prototype (for reference only):

load(filepath[, nodeName]) -> retval
@spec predict(Keyword.t()) :: any() | {:error, String.t()}
@spec predict(t(), Evision.Mat.maybe_mat_in()) ::
  {number(), Evision.Mat.t()} | {:error, String.t()}

Predicts response(s) for the provided sample(s)

Positional Arguments
  • self: Evision.ML.Boost.t()

  • samples: Evision.Mat.

    The input samples, floating-point matrix

Keyword Arguments
  • flags: integer().

    The optional flags, model-dependent. See cv::ml::StatModel::Flags.

Return
  • retval: float

  • results: Evision.Mat.t().

    The optional output matrix of results.

Python prototype (for reference only):

predict(samples[, results[, flags]]) -> retval, results
Link to this function

predict(self, samples, opts)

View Source
@spec predict(t(), Evision.Mat.maybe_mat_in(), [{:flags, term()}] | nil) ::
  {number(), Evision.Mat.t()} | {:error, String.t()}

Predicts response(s) for the provided sample(s)

Positional Arguments
  • self: Evision.ML.Boost.t()

  • samples: Evision.Mat.

    The input samples, floating-point matrix

Keyword Arguments
  • flags: integer().

    The optional flags, model-dependent. See cv::ml::StatModel::Flags.

Return
  • retval: float

  • results: Evision.Mat.t().

    The optional output matrix of results.

Python prototype (for reference only):

predict(samples[, results[, flags]]) -> retval, results
@spec read(Keyword.t()) :: any() | {:error, String.t()}
@spec read(t(), Evision.FileNode.t()) :: t() | {:error, String.t()}

Reads algorithm parameters from a file storage

Positional Arguments

Python prototype (for reference only):

read(fn) -> None
@spec save(Keyword.t()) :: any() | {:error, String.t()}
@spec save(t(), binary()) :: t() | {:error, String.t()}

save

Positional Arguments
  • self: Evision.ML.Boost.t()
  • filename: String

Saves the algorithm to a file. In order to make this method work, the derived class must implement Algorithm::write(FileStorage& fs).

Python prototype (for reference only):

save(filename) -> None
Link to this function

setBoostType(named_args)

View Source
@spec setBoostType(Keyword.t()) :: any() | {:error, String.t()}
@spec setBoostType(t(), integer()) :: t() | {:error, String.t()}

setBoostType

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: integer()

@see getBoostType/1

Python prototype (for reference only):

setBoostType(val) -> None
@spec setCVFolds(Keyword.t()) :: any() | {:error, String.t()}
@spec setCVFolds(t(), integer()) :: t() | {:error, String.t()}

setCVFolds

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: integer()

@see getCVFolds/1

Python prototype (for reference only):

setCVFolds(val) -> None
Link to this function

setMaxCategories(named_args)

View Source
@spec setMaxCategories(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMaxCategories(self, val)

View Source
@spec setMaxCategories(t(), integer()) :: t() | {:error, String.t()}

setMaxCategories

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: integer()

@see getMaxCategories/1

Python prototype (for reference only):

setMaxCategories(val) -> None
@spec setMaxDepth(Keyword.t()) :: any() | {:error, String.t()}
@spec setMaxDepth(t(), integer()) :: t() | {:error, String.t()}

setMaxDepth

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: integer()

@see getMaxDepth/1

Python prototype (for reference only):

setMaxDepth(val) -> None
Link to this function

setMinSampleCount(named_args)

View Source
@spec setMinSampleCount(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setMinSampleCount(self, val)

View Source
@spec setMinSampleCount(t(), integer()) :: t() | {:error, String.t()}

setMinSampleCount

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: integer()

@see getMinSampleCount/1

Python prototype (for reference only):

setMinSampleCount(val) -> None
@spec setPriors(Keyword.t()) :: any() | {:error, String.t()}
@spec setPriors(t(), Evision.Mat.maybe_mat_in()) :: t() | {:error, String.t()}

setPriors

Positional Arguments

@see getPriors/1

Python prototype (for reference only):

setPriors(val) -> None
Link to this function

setRegressionAccuracy(named_args)

View Source
@spec setRegressionAccuracy(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setRegressionAccuracy(self, val)

View Source
@spec setRegressionAccuracy(t(), number()) :: t() | {:error, String.t()}

setRegressionAccuracy

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: float

@see getRegressionAccuracy/1

Python prototype (for reference only):

setRegressionAccuracy(val) -> None
Link to this function

setTruncatePrunedTree(named_args)

View Source
@spec setTruncatePrunedTree(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setTruncatePrunedTree(self, val)

View Source
@spec setTruncatePrunedTree(t(), boolean()) :: t() | {:error, String.t()}

setTruncatePrunedTree

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: bool

@see getTruncatePrunedTree/1

Python prototype (for reference only):

setTruncatePrunedTree(val) -> None
Link to this function

setUse1SERule(named_args)

View Source
@spec setUse1SERule(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setUse1SERule(self, val)

View Source
@spec setUse1SERule(t(), boolean()) :: t() | {:error, String.t()}

setUse1SERule

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: bool

@see getUse1SERule/1

Python prototype (for reference only):

setUse1SERule(val) -> None
Link to this function

setUseSurrogates(named_args)

View Source
@spec setUseSurrogates(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setUseSurrogates(self, val)

View Source
@spec setUseSurrogates(t(), boolean()) :: t() | {:error, String.t()}

setUseSurrogates

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: bool

@see getUseSurrogates/1

Python prototype (for reference only):

setUseSurrogates(val) -> None
Link to this function

setWeakCount(named_args)

View Source
@spec setWeakCount(Keyword.t()) :: any() | {:error, String.t()}
@spec setWeakCount(t(), integer()) :: t() | {:error, String.t()}

setWeakCount

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: integer()

@see getWeakCount/1

Python prototype (for reference only):

setWeakCount(val) -> None
Link to this function

setWeightTrimRate(named_args)

View Source
@spec setWeightTrimRate(Keyword.t()) :: any() | {:error, String.t()}
Link to this function

setWeightTrimRate(self, val)

View Source
@spec setWeightTrimRate(t(), number()) :: t() | {:error, String.t()}

setWeightTrimRate

Positional Arguments
  • self: Evision.ML.Boost.t()
  • val: double

@see getWeightTrimRate/1

Python prototype (for reference only):

setWeightTrimRate(val) -> None
@spec train(Keyword.t()) :: any() | {:error, String.t()}
@spec train(t(), Evision.ML.TrainData.t()) :: boolean() | {:error, String.t()}

Trains the statistical model

Positional Arguments
  • self: Evision.ML.Boost.t()

  • trainData: Evision.ML.TrainData.t().

    training data that can be loaded from file using TrainData::loadFromCSV or created with TrainData::create.

Keyword Arguments
  • flags: integer().

    optional flags, depending on the model. Some of the models can be updated with the new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP).

Return
  • retval: bool

Python prototype (for reference only):

train(trainData[, flags]) -> retval
Link to this function

train(self, trainData, opts)

View Source
@spec train(t(), Evision.ML.TrainData.t(), [{:flags, term()}] | nil) ::
  boolean() | {:error, String.t()}

Trains the statistical model

Positional Arguments
  • self: Evision.ML.Boost.t()

  • trainData: Evision.ML.TrainData.t().

    training data that can be loaded from file using TrainData::loadFromCSV or created with TrainData::create.

Keyword Arguments
  • flags: integer().

    optional flags, depending on the model. Some of the models can be updated with the new training samples, not completely overwritten (such as NormalBayesClassifier or ANN_MLP).

Return
  • retval: bool

Python prototype (for reference only):

train(trainData[, flags]) -> retval
Link to this function

train(self, samples, layout, responses)

View Source
@spec train(t(), Evision.Mat.maybe_mat_in(), integer(), Evision.Mat.maybe_mat_in()) ::
  boolean() | {:error, String.t()}

Trains the statistical model

Positional Arguments
  • self: Evision.ML.Boost.t()

  • samples: Evision.Mat.

    training samples

  • layout: integer().

    See ml::SampleTypes.

  • responses: Evision.Mat.

    vector of responses associated with the training samples.

Return
  • retval: bool

Python prototype (for reference only):

train(samples, layout, responses) -> retval
@spec write(Keyword.t()) :: any() | {:error, String.t()}
@spec write(t(), Evision.FileStorage.t()) :: t() | {:error, String.t()}

Stores algorithm parameters in a file storage

Positional Arguments

Python prototype (for reference only):

write(fs) -> None
@spec write(t(), Evision.FileStorage.t(), binary()) :: t() | {:error, String.t()}

write

Positional Arguments

Has overloading in C++

Python prototype (for reference only):

write(fs, name) -> None