Skip to content

Commit

Permalink
Optim.jl is not THAT good
Browse files Browse the repository at this point in the history
  • Loading branch information
jvo203 committed Jul 30, 2024
1 parent 3cfff1f commit 3fedfa0
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions Julia/HDS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,7 @@ function rbf_cost_function(params::Vector{Float64}, centres::Vector{Float32}, ta
#return plot(predictions, label="Predictions", xlabel="Pixel", ylabel="Intensity", legend=:topleft)

# the cost is the sum of the squared differences between the predictions and the targets
rmse = sqrt(sum((predictions .- targets) .^ 2) / length(targets))

return rmse
return sqrt(sum((predictions .- targets) .^ 2))
end

function rbf_forward(params::Vector{Float64}, centres::Vector{Float32}, targets::Vector{Float32})
Expand Down Expand Up @@ -106,7 +104,7 @@ println("#params: ", length(params))
@time rbf_cost_function(params, centres, row)

# optimize the parameters with Optim
#result = optimize(x -> rbf_cost_function(x, centres, row), params, Optim.Options(iterations=100, show_trace=true))
#result = optimize(x -> rbf_cost_function(x, centres, row), params, Optim.Options(iterations=1000000, show_trace=true))
#result = optimize(x -> rbf_cost_function(x, centres, row), params, LBFGS(), Optim.Options(iterations=1000, show_trace=true))
result = optimize(x -> rbf_cost_function(x, centres, row), params, SimulatedAnnealing(), Optim.Options(iterations=1000000, show_trace=true))
println(result)
Expand Down

0 comments on commit 3fedfa0

Please sign in to comment.