Skip to content

Commit a5d8827

Browse files
jwscookjuliohm
andauthored
Swap out Optim.jl NelderMead.jl (#155)
* add Neldermead, rm Optim, add TableTransforms to test proj * use neldermead 0.4.0, make sure initial step is valid * reduce nelder mead xtol_rel * Apply suggestions from code review Co-authored-by: Júlio Hoffimann <[email protected]> * set neldermead intial step to 1 std(α₀) is guaranteed to have a norm of 1, so we can set the nelder mead initial step size to 1 for all cases. * make neldermead step size 1/2 * Update src/transforms/projectionpursuit.jl Co-authored-by: Júlio Hoffimann <[email protected]>
1 parent 222d30b commit a5d8827

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ AbstractTrees = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
88
CategoricalArrays = "324d7699-5711-5eae-9e2f-1d82baa6b597"
99
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
1010
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
11-
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
11+
NelderMead = "2f6b4ddb-b4ff-44c0-b59b-2ab99302f970"
1212
PrettyTables = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d"
1313
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1414
ScientificTypes = "321657f4-b219-11e9-178b-2701a2544e81"
@@ -22,7 +22,7 @@ TransformsBase = "28dd2a49-a57a-4bfb-84ca-1a49db9b96b8"
2222
AbstractTrees = "0.4"
2323
CategoricalArrays = "0.10"
2424
Distributions = "0.25"
25-
Optim = "1.7"
25+
NelderMead = "0.4.0"
2626
PrettyTables = "1.3, 2"
2727
ScientificTypes = "2.3, 3.0"
2828
StatsBase = "0.33"

src/TableTransforms.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ using PrettyTables
1616
using AbstractTrees
1717
using CategoricalArrays
1818
using Random
19-
using Optim: optimize, minimizer
19+
using NelderMead: optimise
2020

2121
import Distributions: ContinuousUnivariateDistribution
2222
import Distributions: quantile, cdf

src/transforms/projectionpursuit.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,7 @@ end
111111

112112
function neldermead(transform, Z, α₀)
113113
f(α) = -pindex(transform, Z, α ./ norm(α))
114-
op = optimize(f, α₀)
115-
minimizer(op)
114+
optimise(f, α₀, 1/2, xtol_rel=10eps()) |> first
116115
end
117116

118117
function alphamax(transform, Z)
@@ -197,4 +196,4 @@ function revertfeat(::ProjectionPursuit, newtable, fcache)
197196

198197
𝒯 = (; zip(names, eachcol(Z))...)
199198
newtable = 𝒯 |> Tables.materializer(newtable)
200-
end
199+
end

0 commit comments

Comments
 (0)