Skip to content

Commit f56d6cc

Browse files
committed
Remove unused biquadratic exponential functions
1 parent cfae382 commit f56d6cc

File tree

2 files changed

+0
-62
lines changed

2 files changed

+0
-62
lines changed

src/Utilities.jl

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -177,59 +177,4 @@
177177
return ll
178178
end
179179

180-
## --- Biquadratic distribution (like bilinear, with quadratic sides)
181-
182-
183-
struct BiquadraticExponential{T<:Real}
184-
A::T
185-
μ::T
186-
σ::T
187-
shp::T
188-
skw::T
189-
end
190-
function BiquadraticExponential(p::AbstractVector)
191-
@assert length(p) == 5
192-
@assert all(x->x>0, Iterators.drop(p,1))
193-
BiquadraticExponential(p...)
194-
end
195-
196-
function biquadratic_exponential(x::Number, p::AbstractVector{<:Number})
197-
@assert length(p) == 5
198-
_, μ, σ, shp, skw = (abs(x) for x in p)
199-
xs = (x - μ)/σ # X scaled by mean and variance
200-
v = 1/2 - atan(xs)/3.141592653589793 # Sigmoid (positive on LHS)
201-
return exp(first(p) -0.5*(shp*skw*xs*v - shp/skw*xs*(1-v))^2)
202-
end
203-
function biquadratic_exponential(x::AbstractVector, p::AbstractVector{<:Number})
204-
@assert length(p) == 5
205-
_, μ, σ, shp, skw = (abs(x) for x in p)
206-
result = Array{float(eltype(x))}(undef,size(x))
207-
@inbounds for i eachindex(x)
208-
xs = (x[i] - μ)/σ # X scaled by mean and variance
209-
v = 1/2 - atan(xs)/3.141592653589793 # Sigmoid (positive on LHS)
210-
result[i] = exp(first(p) -0.5*(shp*skw*xs*v - shp/skw*xs*(1-v))^2)
211-
end
212-
return result
213-
end
214-
215-
function biquadratic_exponential_ll(x::Number, p::AbstractVector{<:Number})
216-
xs = (x - p[2])/abs(p[3]) # X scaled by mean and variance
217-
v = 1/2 - atan(xs)/3.141592653589793 # Sigmoid (positive on LHS)
218-
shp = abs(p[4])
219-
skw = abs(p[5])
220-
return -(shp*skw*xs*v - shp/skw*xs*(1-v))^2
221-
end
222-
function biquadratic_exponential_ll(x::AbstractVector, ages::AbstractVector{BiquadraticExponential{T}}) where T
223-
ll = zero(T)
224-
@inbounds for i eachindex(x,ages)
225-
pᵢ = ages[i]
226-
xs = (x[i]-pᵢ.μ)/(pᵢ.σ) # X scaled by mean and variance
227-
v = 1/2 - atan(xs)/3.141592653589793 # Sigmoid (positive on LHS)
228-
shp = pᵢ.shp
229-
skw = pᵢ.skw
230-
ll -= (shp*skw*xs*v - shp/skw*xs*(1-v))^2
231-
end
232-
return ll
233-
end
234-
235180
## --- End of File

test/testUtilities.jl

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,6 @@
1717
@test location(d * 2) == 66.00606672179812 * 2
1818
@test scale(d * 2) == 0.17739474265630253 * 2
1919

20-
## --- Alternatively: biquadratic exponential
21-
22-
@test Chron.biquadratic_exponential(66.02, [-5.9345103368858085, 66.00606672179812, 0.17739474265630253, 70.57882331291309, 0.6017142541555505]) 1.3384991282229901e-5
23-
@test Chron.biquadratic_exponential([66.02, 66.08, 66.15], [-5.9345103368858085, 66.00606672179812, 0.17739474265630253, 70.57882331291309, 0.6017142541555505]) [1.3384991282229901e-5, 5.441899612287734e-128, 0.0]
24-
@test Chron.biquadratic_exponential_ll(66.02, [-5.9345103368858085, 66.00606672179812, 0.17739474265630253, 70.57882331291309, 0.6017142541555505]) -10.573732390830594
25-
26-
2720
## --- Other utility functions for log likelihoods
2821

2922
@test Chron.strat_ll([0.0, 0.0], [Normal(0,1), Normal(0,1)]) 0

0 commit comments

Comments
 (0)