Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

specifying the error of the function #1

Open
amlwwalker opened this issue Aug 10, 2021 · 0 comments
Open

specifying the error of the function #1

amlwwalker opened this issue Aug 10, 2021 · 0 comments

Comments

@amlwwalker
Copy link

Hi, I have a function to fit such as

func (b Model) Find(dst, params []float64) {
	n := len(b.Data)
	fittedCurve := make([]float64, n)
	invtrig := 0.0

	for i := 0; i < n; i++ {
		invtrig = math.Asinh(math.Sinh(params[2]) * math.Exp(params[0]*float64(i + 1)*2*math.Pi))
		fittedCurve[i] = (1 / (params[0] * params[1])) * (params[2] - invtrig)
		dst[i] = b.Data[i] - fittedCurve[i]
	}
}

However I am not sure if I am constructing the dst value correctly for a least squares algorithm. I cant tell whether I need to do something like dst[i] = math.Sqrt(math.Pow(dst[i])) each loop. Or is the least squares part of the error handled by the algorithm itself?

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant