类 BandwidthWeight

继承关系

基类

类文档

class BandwidthWeight : public gwm::Weight

Class for calculating weight with a bandwidth. Users can specific bandwidth size, bandwidth type and kernel function type.

There are two types of bandwidth: adaptive and fixed. If use an adaptive bandwidth, the value of bandwidth size \(b\) must be integer, representing the distance to \(b\)-th nearest point. If use a fixed bandwidth, the value of bandwidth size is a distance.

There are five types of kernels: Gaussian, Exponential, Bisquare, Tricube and Boxcar. Each type of kernel representing a kernel function. Users need only set the kernel type to let the instance call for the kernel function.

公有类型

enum KernelFunctionType

Type of kernel function.

Values:

enumerator Gaussian
enumerator Exponential
enumerator Bisquare
enumerator Tricube
enumerator Boxcar
typedef arma::vec (*KernelFunction)(arma::vec, double)

公有方法

inline BandwidthWeight()

Construct a new BandwidthWeight object.

inline BandwidthWeight(double size, bool adaptive, KernelFunctionType kernel)

Construct a new BandwidthWeight object.

参数
  • size – Bandwidth size.

  • adaptive – Whether use an adaptive bandwidth.

  • kernel – Type of kernel function.

inline BandwidthWeight(const BandwidthWeight &bandwidthWeight)

Construct a new BandwidthWeight object.

参数

bandwidthWeight – Reference to the object for copying.

inline BandwidthWeight(const BandwidthWeight *bandwidthWeight)

Construct a new BandwidthWeight object.

参数

bandwidthWeight – Pointer to the object for copying.

inline virtual Weight *clone() override

Clone this object.

返回

Newly created pointer.

virtual arma::vec weight(arma::vec dist) override

Calculate weight vector from a distance vector.

参数

dist – According distance vector.

返回

Weight vector.

inline double bandwidth() const

Get the BandwidthWeight::mBandwidth object.

返回

Bandwidth size.

inline void setBandwidth(double bandwidth)

Set the BandwidthWeight::mBandwidth object.

参数

bandwidth – Bandwidth size.

inline bool adaptive() const

Get the BandwidthWeight::mAdaptive object.

返回

true if use an adaptive bandwidth.

返回

false if use an fixed bandwidth.

inline void setAdaptive(bool adaptive)

Set the BandwidthWeight::mAdaptive object.

参数

bandwidth – Whether use an adaptive bandwidth.

inline KernelFunctionType kernel() const

Get the BandwidthWeight::mKernel object.

返回

Type of kernel function.

inline void setKernel(const KernelFunctionType &kernel)

Set the BandwidthWeight::mBandwidth object.

参数

bandwidth – Type of kernel function.

公有静态方法

static inline arma::vec GaussianKernelFunction(arma::vec dist, double bw)

Gaussian kernel function.

参数
  • distDistance vector.

  • bw – Bandwidth size. The unit is equal to that of distance vector.

返回

Weight value.

static inline arma::vec ExponentialKernelFunction(arma::vec dist, double bw)

Exponential kernel function.

参数
  • distDistance vector.

  • bw – Bandwidth size. The unit is equal to that of distance vector.

返回

Weight value.

static inline arma::vec BisquareKernelFunction(arma::vec dist, double bw)

Bisquare kernel function.

参数
  • distDistance vector.

  • bw – Bandwidth size. The unit is equal to that of distance vector.

返回

Weight value.

static inline arma::vec TricubeKernelFunction(arma::vec dist, double bw)

Tricube kernel function.

参数
  • distDistance vector.

  • bw – Bandwidth size. The unit is equal to that of distance vector.

返回

Weight value.

static inline arma::vec BoxcarKernelFunction(arma::vec dist, double bw)

Boxcar kernel function.

参数
  • distDistance vector.

  • bw – Bandwidth size. The unit is equal to that of distance vector.

返回

Weight value.

公有静态属性

static std::unordered_map<KernelFunctionType, std::string> KernelFunctionTypeNameMapper
static std::unordered_map<bool, std::string> BandwidthTypeNameMapper
static KernelFunction Kernel[]