Learn R Programming

nnR (version 0.1.0)

Tay: The Tay function

Description

The Tay function

Usage

Tay(f, n, q, eps)

Value

a neural network that approximates the function f. For now only \(sin\), \(cos\), and \(e^x\) are available.

Arguments

f

the function to be Taylor approximated, for now "exp", "sin" and "cos". NOTE use the quotation marks when using this argument.

n

The number of Taylor iterations. Accuracy as well as computation time increases as \(n\) increases

q

a real number in \((2,\infty)\). Accuracy as well as computation time increases as \(q\) gets closer to \(2\) increases

eps

a real number in \((0,\infty)\). ccuracy as well as computation time increases as \(\varepsilon\) gets closer to \(0\) increases

Examples

Run this code
Tay("sin", 2, 2.3, 0.3) |> inst(ReLU, 1.5) # May take some time, please only click once
Tay("cos", 2, 2.3, 0.3) |> inst(ReLU, 1) # May take some time, please only click once
Tay("exp", 4, 2.3, 0.3) |> inst(ReLU, 1.5) # May take some time, please only click once


Run the code above in your browser using DataLab