Public 型 | Public メソッド
クラス テンプレート mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >

AdaBoost を用いた識別器(マルチクラス対応) [詳細]

#include <machine_learning.h>

Public 型

typedef __WEAK_CLASSIFIER__ weak_classifier_type
 Boosting する弱識別器のクラス
typedef feature feature_type
 学習に用いる特徴量を扱うクラス
typedef feature_type::value_type value_type
 MISTのコンテナ内に格納するデータ型.mist::array< data > の data と同じ
typedef feature_type::size_type size_type
 符号なしの整数を表す型.コンテナ内の要素数や,各要素を指定するときなどに利用し,内部的には size_t 型と同じ
typedef
feature_type::difference_type 
difference_type
 符号付きの整数を表す型.コンテナ内の要素数や,各要素を指定するときなどに利用し,内部的には ptrdiff_t 型と同じ

Public メソッド

 classifier ()
 デフォルトのコンストラクタ
 classifier (const classifier &cls)
 コピーコンストラクタ
classifieroperator= (const classifier &other)
 他の識別器と同じパラメータの識別器となるようにデータをコピーする
const std::vector
< weak_classifier_type > & 
weak_classifiers () const
 分類に使用する弱識別器のリストを取得する
std::vector
< weak_classifier_type > & 
weak_classifiers ()
 分類に使用する弱識別器のリストを取得する
const std::vector< std::string > & categories () const
 分類に使用するカテゴリのリストを取得する
std::vector< std::string > & categories ()
 分類に使用するカテゴリのリストを取得する
const std::vector< std::vector
< bool > > & 
code_word () const
 分類に使用する Code Word のリストを取得する
std::vector< std::vector< bool > > & code_word ()
 分類に使用する Code Word のリストを取得する
const std::vector< double > & alpha () const
 分類に使用する係数のリストを取得する
std::vector< double > & alpha ()
 分類に使用する係数のリストを取得する
const std::vector< double > & beta () const
 分類に使用する係数のリストを取得する
std::vector< double > & beta ()
 分類に使用する係数のリストを取得する
template<template< typename, typename > class FEATURE_LIST, class Allocator >
bool learn (FEATURE_LIST< feature_type, Allocator > &features, size_type number_of_iterations)
 教師データを用いて最適な弱識別器を構築する
template<class FEATURE >
const std::string operator() (const FEATURE &f) const
 学習済みの識別器を用いて特徴量を分類する
template<class FEATURE >
const std::string evaluate (const FEATURE &f) const
 学習済みの識別器を用いて特徴量を分類する
template<class FEATURE >
void compute_category_ranks (const FEATURE &f, std::vector< pair< double, std::string > > &ranks) const
 学習済みの識別器を用いて特徴量を分類し、各カテゴリの重みを列挙する
template<template< typename, typename > class FEATURE_LIST, class Allocator >
double error_rate (const FEATURE_LIST< feature_type, Allocator > &features) const
 学習済みの識別器の分類誤差を計算する
bool save (const std::string &filename) const
 学習済みの識別器のパラメータをファイルに保存する
bool load (const std::string &filename)
 学習済みの識別器のパラメータをファイルから読み込む

説明

template<typename __WEAK_CLASSIFIER__ = threshold_classifier>
class mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >

AdaBoost を用いた識別器(マルチクラス対応)

関数

template<typename __WEAK_CLASSIFIER__ = threshold_classifier>
template<class FEATURE >
void mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >::compute_category_ranks ( const FEATURE &  f,
std::vector< pair< double, std::string > > &  ranks 
) const
inline

学習済みの識別器を用いて特徴量を分類し、各カテゴリの重みを列挙する

引数
[in]f… 分類する特徴量
[out]ranks… 各クラスに割り振られた重みのリスト
template<typename __WEAK_CLASSIFIER__ = threshold_classifier>
template<template< typename, typename > class FEATURE_LIST, class Allocator >
double mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >::error_rate ( const FEATURE_LIST< feature_type, Allocator > &  features) const
inline

学習済みの識別器の分類誤差を計算する

引数
[in]features… 分類する特徴量のリスト
戻り値
分類誤差

参照先 mist::machine_learning::feature::category, と mist::machine_learning::feature::valid.

template<typename __WEAK_CLASSIFIER__ = threshold_classifier>
template<class FEATURE >
const std::string mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >::evaluate ( const FEATURE &  f) const
inline

学習済みの識別器を用いて特徴量を分類する

引数
[in]f… 分類する特徴量
戻り値
分類結果(学習の際に指定したカテゴリ名)
template<typename __WEAK_CLASSIFIER__ = threshold_classifier>
template<template< typename, typename > class FEATURE_LIST, class Allocator >
bool mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >::learn ( FEATURE_LIST< feature_type, Allocator > &  features,
size_type  number_of_iterations 
)
inline

教師データを用いて最適な弱識別器を構築する

指定した number_of_iterations 回 Boosting を実行する.分類誤差が 0 となった場合は途中で終了する.

引数
[in]features… 学習に用いる教師データ
[in]number_of_iterations… 学習を実行する最大ステップ数

参照先 __NUMBER_OF_INNER_LOOPS__, mist::machine_learning::feature::category, mist::uniform::random::real1(), mist::machine_learning::feature::valid, と mist::machine_learning::feature::weight.

template<typename __WEAK_CLASSIFIER__ = threshold_classifier>
bool mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >::load ( const std::string &  filename)
inline

学習済みの識別器のパラメータをファイルから読み込む

注意
save と load はペアで使用してください.
引数
[in]filename… パラメータを保存してあるファイル名
戻り値
読込に成功したかどうか
template<typename __WEAK_CLASSIFIER__ = threshold_classifier>
template<class FEATURE >
const std::string mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >::operator() ( const FEATURE &  f) const
inline

学習済みの識別器を用いて特徴量を分類する

引数
[in]f… 分類する特徴量
戻り値
分類結果(学習の際に指定したカテゴリ名)
template<typename __WEAK_CLASSIFIER__ = threshold_classifier>
bool mist::machine_learning::adaboost::classifier< __WEAK_CLASSIFIER__ >::save ( const std::string &  filename) const
inline

学習済みの識別器のパラメータをファイルに保存する

注意
save と load はペアで使用してください.
引数
[in]filename… パラメータを保存するファイル名
戻り値
保存に成功したかどうか

このクラスの説明は次のファイルから生成されました:

Generated on Wed Nov 12 2014 19:44:29 for MIST by doxygen 1.8.1.2