项目作者: AidanRocke

项目描述 :
Analytic approximations of the min and max operators
高级语言: Jupyter Notebook
项目地址: git://github.com/AidanRocke/analytic_min-max_operators.git
创建时间: 2020-02-12T14:09:20Z
项目社区:https://github.com/AidanRocke/analytic_min-max_operators

开源协议:

下载


analytic_min-max_operators

Within the context of optimisation, analytic approximations of the min and max operators
are very useful. I found a few proposed solutions on the MathOverflow
and after analysing their numerical stability decided to formulate my own variant inspired
by the infinity norm.

To improve numerical stability my method does the following:

  1. Standardises random vectors: https://www.britannica.com/topic/standardized-random-variable
  2. Maps vectors from R^n to R+^n, which is necessary for methods inspired by the infinity norm to work.
  1. function analytic_min_max(X::Array{Float64, 1},N::Int64,case::Int64)
  2. """
  3. An analytic approximation to the min and max operators
  4. Inputs:
  5. X: a vector from R^n where n is unknown
  6. N: an integer such that the approximation
  7. improves with increasing N.
  8. case: If case == 1 apply analytic_min(), otherwise
  9. apply analytic_max() if case == 2
  10. Output:
  11. An approximation to min(X) if case == 1, and max(X) if
  12. case == 2
  13. """
  14. if (case != 1)*(case != 2)
  15. return print("Error: case isn't well defined")
  16. else
  17. ## q is the degree of the approximation:
  18. q = N*(-1)^case
  19. mu, sigma = mean(X), std(X)
  20. ## rescale vector so it has zero mean and unit variance:
  21. Z_score = (X.-mu)./sigma
  22. exp_sum = sum(exp.(Z_score*q))
  23. log_ = log(exp_sum)/q
  24. return (log_*sigma)+mu
  25. end
  26. end

Discussion:

It took me about an hour to come up with my solution so I doubt this method is either original or state-of-the-art.
If you know of a more robust method, feel free to join the discussion on the MathOverflow.

Relevant articles:

  1. analytic approximations of the min and max operators
  2. Differentiable approximations to the min and max operators