Class BandwidthWeight

Inheritance Relationships

Base Type

Class Documentation

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.

Public Types

enum KernelFunctionType

Type of kernel function.

Values:

enumerator Gaussian

Gaussian kernel BandwidthWeight::GaussianKernelFunction()

enumerator Exponential

Exponential kernel BandwidthWeight::ExponentialKernelFunction()

enumerator Bisquare

Bisquare kernel BandwidthWeight::BisquareKernelFunction()

enumerator Tricube

Tricube kernel BandwidthWeight::TricubeKernelFunction()

enumerator Boxcar

Boxcar kernel BandwidthWeight::BoxcarKernelFunction()

typedef arma::vec (*KernelFunction)(arma::vec, double)

Kernel functions.

Public Functions

inline BandwidthWeight()

Construct a new BandwidthWeight object.

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

Construct a new BandwidthWeight object. Bandwidth size Whether use an adaptive bandwidth Type of kernel function.

inline BandwidthWeight(const BandwidthWeight &bandwidthWeight)

Copy construct a new BandwidthWeight object. Reference to the object for copying.

inline BandwidthWeight(const BandwidthWeight *bandwidthWeight)

Copy construct a new BandwidthWeight object from a pointer. Pointer to the object for copying.

inline virtual Weight *clone() const override

Clone this object. Newly created pointer.

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

Calculate weight vector from a distance vector. According distance vector Weight vector.

inline double bandwidth() const

Get the bandwidth size. Bandwidth size.

inline void setBandwidth(double bandwidth)

Set the bandwidth size. Bandwidth size.

inline bool adaptive() const

Get whether it is adaptive bandwidth. Yes No.

inline void setAdaptive(bool adaptive)

Set whether it is adaptive bandwidth. Whether it is adaptive bandwidth.

inline KernelFunctionType kernel() const

Get the type of kernel function. Type of kernel function.

inline void setKernel(const KernelFunctionType &kernel)

Set the type of kernel function. Type of kernel function.

Public Static Functions

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

Gaussian kernel function. Distance vector Bandwidth size (its unit is equal to that of distance vector) Weight value.

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

Exponential kernel function. Distance vector Bandwidth size (its unit is equal to that of distance vector) Weight value.

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

Bisquare kernel function. Distance vector Bandwidth size (its unit is equal to that of distance vector) Weight value.

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

Tricube kernel function. Distance vector Bandwidth size (its unit is equal to that of distance vector) Weight value.

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

Boxcar kernel function. Distance vector Bandwidth size (its unit is equal to that of distance vector) Weight value.

Public Static Attributes

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