Skip to content

specifying the error of the function #1

@amlwwalker

Description

@amlwwalker

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions