⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gis.h

📁 Amis - A maximum entropy estimator 一个最大熵模型统计工具
💻 H
字号:
////////////////////////////////////////////////////////////////////////////  Copyright (c) 2000, Yusuke Miyao///  You may distribute under the terms of the Artistic License.//////  <id>$Id: GIS.h,v 1.9 2003/05/14 06:01:53 yusuke Exp $</id>///  <collection>Maximum Entropy Estimator</collection>///  <name>GIS.h</name>///  <overview>Generalized Iterative Scaling</overview>/////////////////////////////////////////////////////////////////////////#ifndef Amis_GIS_h_#define Amis_GIS_h_#include <amis/configure.h>#include <amis/IS.h>#include <amis/ModelBase.h>#include <amis/EventSpaceInst.h>#include <amis/ModelExpect.h>#include <amis/FeatureFreqArray.h>AMIS_NAMESPACE_BEGIN///////////////////////////////////////////////////////////////////////// <classdef>/// <name>GISBase</name>/// <overview>Generalized Iterative Scaling</overview>/// <desc>/// A maximum entropy estimator based on the Generalized Iterative Scaling/// algorithm./// The implemented algorithm seems to be one without slack variables, in other words slack variables' alphas are fixed to 1 (J.K.)/// </desc>/// <body>template < class Model, class EventSpace,	   class ModelExpect = ModelExpect< FeatureFreqValue, Model, EventSpace >,	   class EmpiricalExpect = EmpiricalExpect< Model, EventSpace > >class GISBase : public IS< Model, EventSpace, ModelExpect, EmpiricalExpect > {private:  Real power;  //////////////////////////////////////////////////////////////////////public:  GISBase() : IS< Model, EventSpace, ModelExpect, EmpiricalExpect >() {    power = 0,0;  }  GISBase( Model& init_model, EventSpace& init_event )    : IS< Model, EventSpace, ModelExpect, EmpiricalExpect >( init_model, init_event ) {    power = 0.0;  }  virtual ~GISBase() {}  //////////////////////////////////////////////////////////////////////public:  void initialize() {    AMIS_DEBUG_MESSAGE( 3, "Set internal data...\n" );    power = static_cast< Real >( 1.0 ) / static_cast< Real >( event_space->maxFeatureCount() );    IS< Model, EventSpace, ModelExpect, EmpiricalExpect >::initialize();  }  /// Initialize the estimator  Real solveEquation( int i ) {    return power * ( log( empirical_expectation[ i ] / model_expectation[ i ] ) );  }};/// </body>/// </classdef>///////////////////////////////////////////////////////////////////////// <classdef>/// <name>GIS</name>/// <overview>Generalized Iterative Scaling</overview>/// <desc>/// A maximum entropy estimator based on the Generalized Iterative Scaling/// algorithm./// </desc>/// <body>template < class Feature >class GIS : public GISBase< ModelBase, EventSpaceInst< Feature > > {public:  GIS() : GISBase< ModelBase, EventSpaceInst< Feature > >() {}  GIS( ModelBase& init_model, EventSpaceInst< Feature >& init_event ) :    GISBase< ModelBase, EventSpaceInst< Feature > >( init_model, init_event ) {}  virtual ~GIS() {}  const std::string estimatorName() const {    return "GIS<" + Feature::featureTypeName() + ">";  }  /// Get the name of this class};/// </body>/// </classdef>///////////////////////////////////////////////////////////////////////// <classdef>/// <name>GISJoint</name>/// <overview>Generalized Iterative Scaling</overview>/// <desc>/// A maximum entropy estimator based on the Generalized Iterative Scaling for joint probability estimation/// </desc>/// <body>template < class Feature >class GISJoint : public GISBase< ModelBase, EventSpaceInst< Feature >,				 ModelExpect< FeatureFreqValue, ModelBase, EventSpaceInst< Feature >, true >,				 EmpiricalExpect< ModelBase, EventSpaceInst< Feature >, true > > {public:  GISJoint() : GISBase< ModelBase, EventSpaceInst< Feature >,                        ModelExpect< FeatureFreqValue, ModelBase, EventSpaceInst< Feature >, true >,                        EmpiricalExpect< ModelBase, EventSpaceInst< Feature >, true > >() {}  GISJoint( ModelBase& init_model, EventSpaceInst< Feature >& init_event ) :    GISBase< ModelBase, EventSpaceInst< Feature >,	     ModelExpect< FeatureFreqValue, ModelBase, EventSpaceInst< Feature >, true >,	     EmpiricalExpect< ModelBase, EventSpaceInst< Feature >, true > >( init_model, init_event ) {}  virtual ~GISJoint() {}  const std::string estimatorName() const {    return "GISJoint<" + Feature::featureTypeName() + ">";  }  /// Get the name of this class};/// </body>/// </classdef>AMIS_NAMESPACE_END#endif // Amis_GIS_h_// end of GIS.h

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -