You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/Core/curvaturetools.jl
+64-1Lines changed: 64 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -141,7 +141,11 @@ end
141
141
142
142
Approximates the signed curvature of a function given evenly spaced samples.
143
143
144
-
Uses [`d_dx`](@ref) and [`d2_dx2`](@ref) to approximate the first two derivatives.
144
+
# Possible `method`s
145
+
- `:finite_differences`: Approximates first and second derivative with 3rd order finite differences. See [`d_dx`](@ref) and [`d2_dx2`](@ref).
146
+
- `:splines`: Curvature of a third order spline. See [`d_dx_and_d2_dx2_spline`](@ref).
147
+
- `:circles`: Inverse radius of a circle through rolling three points. See [`circle_curvature`](@ref).
148
+
- `:breakpoints`: WARNING does not compute a value that approximates the curvature of a continuous function. Computes the inverse least-squares error of `f.(eachindex(y); z)` and `y` for all `z in eachindex(y)` where `f(x; z) = a + b(min(x, z) - z) + c(max(x, z) - z)`. Useful if `y` looks like two lines. See [`breakpoint_curvature`](@ref).
@@ -153,6 +157,8 @@ function curvature(y::AbstractVector{<:Real}; method=:finite_differences, kwargs
153
157
return@. dy2_dx2 / (1+ dy_dx^2)^1.5
154
158
elseif method ==:circles
155
159
returncircle_curvature(y; h=1)
160
+
elseif method ==:breakpoints
161
+
returnbreakpoint_curvature(y)
156
162
else
157
163
throw(ArgumentError("method $method not implemented"))
158
164
end
@@ -166,6 +172,13 @@ Approximates the signed curvature of a function, scaled to the unit box ``[0,1]^
166
172
Assumes the function is 1 at 0 and (after x dimension is scaled) 0 at 1.
167
173
168
174
See [`curvature`](@ref).
175
+
176
+
177
+
# Possible `method`s
178
+
- `:finite_differences`: Approximates first and second derivative with 3rd order finite differences. See [`d_dx`](@ref) and [`d2_dx2`](@ref).
179
+
- `:splines`: Curvature of a third order spline. See [`d_dx_and_d2_dx2_spline`](@ref).
180
+
- `:circles`: Inverse radius of a circle through rolling three points. See [`circle_curvature`](@ref).
181
+
- `:breakpoints`: WARNING does not compute a value that approximates the curvature of a continuous function. Computes the inverse least-squares error of `f.(eachindex(y); z)` and `y` for all `z in eachindex(y)` where `f(x; z) = a + b(min(x, z) - z) + c(max(x, z) - z)`. Useful if `y` looks like two lines. See [`breakpoint_curvature`](@ref).
Copy file name to clipboardExpand all lines: src/Core/rankdetection.jl
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@ Selects the rank that maximizes the standard curvature of the Relative Error (as
7
7
8
8
# Keywords
9
9
- `online_rank_estimation`: `false`. Set to `true` to stop testing larger ranks after the first peak in curvature
10
-
- `curvature_method`: `:splines`. Can also pick `:finite_differences` (faster but less accurate) or `circles` (fastest and smallest memory but more sensitive to results from `factorize`)
10
+
- `curvature_method`: `:splines`. Can also pick `:finite_differences` (faster but less accurate) or `circles` (fastest and smallest memory but more sensitive to results from `factorize`). Set to `:breakpoints` to pick the rank `R` that minimizes least-squares error in the model `f(r) = a + b(min(r, R) - R) + c(max(r, R) - R)` and the errors.
11
11
- `model`: `Tucker1`. Only rank detection with `Tucker1` and `CPDecomposition` is currently implemented
12
12
- `max_rank`: `max_possible_rank(Y, model)`. Test ranks from `1` up to `max_rank`. Defaults to largest possible rank under the model
13
13
- `rank`: `nothing`. If a rank is passed, rank detection is ignored and `factorize(Y; kwargs...)` is called
0 commit comments