normalize_kernel: Normalize a kernel

View source: R/kernel-utils.R

normalize_kernelR Documentation

Normalize a kernel

Description

A normalized kernel is one that, if given a data matrix that is all 1s, will result in 1. This function applies a scalier multiple to the kernel to make it normalized, if possible. Otherwise, it optionally warns and returns the input kernel.

Usage

normalize_kernel(k, warning_enabled = TRUE)

Arguments

k

[matrix] The kernel.

warning_enabled

[logical] Whether to unable warnings, default to TRUE.

Value

The normalized kernel, a matrix.

Examples


kernel <- distance_kernel(vertical_radius = 2, horizontal_radius = 2)
kernel_norm <- normalize_kernel(kernel)
sum(kernel_norm)


pfocal documentation built on June 17, 2022, 5:07 p.m.