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

📄 serialexecutorloop.h

📁 粗糙集应用软件
💻 H
字号:
//-------------------------------------------------------------------
// Author........: Aleksander 豩rn
// Date..........:
// Description...:
// Revisions.....:
//===================================================================

#ifndef __SERIALEXECUTORLOOP_H__
#define __SERIALEXECUTORLOOP_H__

#include <copyright.h>

#include <kernel/algorithms/serialexecutor.h>

#include <kernel/structures/rules.h>

#include <kernel/utilities/rng.h>

//-------------------------------------------------------------------
// Class prototypes.
//===================================================================

class BatchClassification;
class DecisionTable;

//-------------------------------------------------------------------
// Class.........: SerialExecutorLoop
// Author........: Aleksander 豩rn
// Date..........:
// Description...: Base class for repeatedly executing two pipelines
//                 with some sort of systmatic table sampling.
// Revisions.....:
//===================================================================

class SerialExecutorLoop : public SerialExecutor {
protected:

	//- Parameters.....................................................
	int                 n_;      // Do loop n times.
	int                 seed_;   // Seed to RNG.
	int                 length_; // Length of training pipeline.
	Handle<Rules>       rules_;  // For temporary, internal use. Output from training pipeline.

protected:

  //- Methods inherited from Executor................................
	virtual Structure  *ExecuteCommands(Structure &structure, const Algorithm::Handles &algorithms, const Vector(String) &parameters, ofstream &stream) const;

  //- Methods inherited from SerialExecutor..........................
	virtual bool        SetSpecialParameters(Algorithm &algorithm, const String &parameters) const;

  //- New virtual methods............................................
	virtual bool        SplitCommands(int index, const Algorithm::Handles &algorithms, const Vector(String) &parameters, Algorithm::Handles &algorithms1, Vector(String) &parameters1, Algorithm::Handles &algorithms2, Vector(String) &parameters2) const;

	virtual bool        InitializeSamplingScheme(const DecisionTable &table, bool masked, const RNG &rng);
	virtual bool        SampleTables(int i, const RNG &rng, DecisionTable &training, DecisionTable &testing, bool masked) const = 0;

	virtual bool        SaveLogEntry(ofstream &stream, const BatchClassification &matrix) const;
	virtual bool        SaveLogStatistics(ofstream &stream, const Vector(float) &statistics, const String &name) const;


public:

	//- Local methods (should be protected)............................
	Handle<Rules>       GetRules() const {return rules_;}
	bool                SetRules(Handle<Rules> rules) {rules_ = rules; return true;}

public:

  //- Constructors/destructor........................................
  SerialExecutorLoop();
  virtual ~SerialExecutorLoop();

  //- Methods inherited from Identifier..............................
	DECLAREIDMETHODS()

  //- Methods inherited from Algorithm..............................
	virtual String      GetParameters() const;
	virtual bool        SetParameter(const String &keyword, const String &value);
	virtual bool        IsApplicable(const Structure &structure, bool warn = true) const;

	//- Local methods..................................................
	int                 GetN() const {return n_;}
	bool                SetN(int n) {n_ = n; return n > 0;}

	int                 GetSeed() const {return seed_;}
	bool                SetSeed(int seed) {seed_ = seed; return true;}

	int                 GetLength() const {return length_;}
	bool                SetLength(int length) {length_ = length; return true;}

};

#endif

⌨️ 快捷键说明

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