Questions tagged [function-approximation]

A function that implements an approximation solution for a problem. In general, the function approximation problem asks us to select a function among a well-defined class that closely matches ("approximates") a target function in a task-specific way

In computer science, they are many times that we can not compute something with full accuracy, because it's infinite. For example, in order to compute the value of cosine(π), we perform some approximation.

The function that would perform the computation of cosine(π) approximately is a function that uses approximation.

This tag should be used for problems that have to do with functions that implement an approximation solution for a problem.

Sometimes, these functions receive an ε parameter, which controls the approximation. Usually, ε, is called an approximation factor.

64 questions
8
votes
1 answer

Fast approximate algorithm for RGB/LAB conversion?

I am working on a data visualization tool using OpenGL, and the LAB color space is the most comprehensible color space for visualization of the data I'm dealing with (3 axes of data are mapped to the 3 axes of the color space). Is there a fast (e.g.…
6
votes
1 answer

How to compute sincos fast on a x64 CPU?

This is a question addresed to users, experienced in SSE/AVX instruction family, and those of them, who are familiar with its performance analysis. I saw a lot of different implementations and approaches, ranging from older for SSE2 to newer ones.…
xakepp35
  • 2,878
  • 7
  • 26
  • 54
6
votes
1 answer

Approximating log2(float) by separating significand and exponent

Problem I am trying to implement a fast float = log2(float). I wrote a simple C program to compare my results with log2 and I get a small error that I can't find a source for. Background I am taking the approach of identifying the floating point…
n-west
  • 118
  • 5
4
votes
1 answer

Java- Looking for advice on calculating the min/max for a function or the derivative in step intervals

Looking for advice on a math problem that has turned into a Java nightmare. I scanned the web and could not find a solution. I have looked at similar programs and unfortunately couldn't find help. Summary of the problem: I am looking to implement a…
Axion004
  • 943
  • 1
  • 11
  • 37
4
votes
1 answer

In Q-learning with function approximation, is it possible to avoid hand-crafting features?

I have little background knowledge of Machine Learning, so please forgive me if my question seems silly. Based on what I've read, the best model-free reinforcement learning algorithm to this date is Q-Learning, where each state,action pair in the…
3
votes
1 answer

Plotting Legendre Polynomials - Getting different results for own method

I'm trying to plot the legendre polynomials, defined as: P0(x) = 1 P1(x) = x Pn+1(x) = ((2n+1)/(n+1)) * x * Pn(x) - (n / (n+1)) * Pn-1(x) I've done it the easy slow way, and I've done it the direct, a little more complicated way. Both result in a…
3
votes
2 answers

How do you update the weights in function approximation with reinforcement learning?

My SARSA with gradient-descent keep escalating the weights exponentially. At Episode 4 step 17 the value is already nan Exception: Qa is nan e.g: 6) Qa: Qa = -2.00890180632e+303 7) NEXT Qa: Next Qa with west = -2.28577776413e+303 8)…
2
votes
1 answer

R: approxfun() only returns first observation of y

EDIT: The solution is simple. As Miff points out, I'm using values of x that are too low. I suppose I might leave the question up for the next person who makes this mistake. I'm attempting to use the approxfun() to approximates a function for a…
KjetilH
  • 47
  • 4
2
votes
2 answers

Is such a normalization right for wiggly curves?

I am training a neural network (in C++, without any additional library), to learn a random wiggly function: f(x)=0.2+0.4x2+0.3sin(15x)+0.05cos(50x) Plotted in Python as: lim = 500 for i in range(lim): x.append(i) p = 2*3.14*i/lim …
2
votes
1 answer

A very quick method to approximate np.random.dirichlet with large dimension

I'd like to evaluate np.random.dirichlet with large dimension as quickly as possible. More precisely, I'd like a function approximating the below by at least 10 times faster. Empirically, I observed that small-dimension-version of this function…
2
votes
1 answer

Newtonraphson code in R leads to different results

I need to approximate the parameters of a sample from Birnbaum-Saunders distr. here is my code: x =c(6.7508, 1.9345, 4.9612, 22.0232, 0.2665, 66.7933, 5.5582, 60.2324, 72.5214, 1.4188, 4.6318, 61.8093, 11.3845, 1.1587, 22.8475, 8.3223, 2.6085,…
2
votes
1 answer

MATLAB's newrb for designing radial basis networks does not behave in accordance to the documentation. Why?

I'm trying to approximate various signals using radial basis networks. In particular, I make use of MATLAB's newrb. My problem is that this function seems to behave incorrectly if I follow the description of newrb. As I understand it, it makes sense…
Maryks
  • 73
  • 7
2
votes
1 answer

Solving GridWorld using Q-Learning and function approximation

I'm studying the simple GridWorld (3x4, as described in Russell & Norvig Ch. 21.2) problem; I've solved it using Q-Learning and a QTable, and now I'd like to use a function approximator instead of a matrix. I'm using MATLAB and have tried both…
1
vote
1 answer

Using Python to find best square approximation of Piecewise Functions?

Given a parabola, $f(x)=10(x-1)^2-1,x\in \Omega =[1,2]$, find the best approximation in the space of all linear functions. The Python code is as follows: import sympy as sym import numpy as np import matplotlib.pyplot as plt from mpmath import…
1
vote
1 answer

How to find the true Q-value and overestimation bias in actor critic

I am trying to plot the overestimation bias of the critics in DDPG and TD3 models. So essentially there is a critic_target and a critic network. I want to understand how does one go about finding the overestimation bias of the critic with the true Q…
1
2 3 4 5