optimize.py 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. # This file is not meant for public use and will be removed in SciPy v2.0.0.
  2. # Use the `scipy.optimize` namespace for importing the functions
  3. # included below.
  4. import warnings
  5. from . import _optimize
  6. __all__ = [ # noqa: F822
  7. 'Brent',
  8. 'FD_METHODS',
  9. 'Inf',
  10. 'LineSearchWarning',
  11. 'MapWrapper',
  12. 'MemoizeJac',
  13. 'OptimizeResult',
  14. 'OptimizeWarning',
  15. 'ScalarFunction',
  16. 'approx_derivative',
  17. 'approx_fhess_p',
  18. 'approx_fprime',
  19. 'argmin',
  20. 'asarray',
  21. 'asfarray',
  22. 'atleast_1d',
  23. 'bracket',
  24. 'brent',
  25. 'brute',
  26. 'check_grad',
  27. 'check_random_state',
  28. 'eye',
  29. 'fmin',
  30. 'fmin_bfgs',
  31. 'fmin_cg',
  32. 'fmin_ncg',
  33. 'fmin_powell',
  34. 'fminbound',
  35. 'golden',
  36. 'is_array_scalar',
  37. 'line_search',
  38. 'line_search_wolfe1',
  39. 'line_search_wolfe2',
  40. 'main',
  41. 'rosen',
  42. 'rosen_der',
  43. 'rosen_hess',
  44. 'rosen_hess_prod',
  45. 'shape',
  46. 'show_options',
  47. 'sqrt',
  48. 'squeeze',
  49. 'sys',
  50. 'vecnorm',
  51. 'zeros',
  52. ]
  53. def __dir__():
  54. return __all__
  55. def __getattr__(name):
  56. if name not in __all__:
  57. raise AttributeError(
  58. "scipy.optimize.optimize is deprecated and has no attribute "
  59. f"{name}. Try looking in scipy.optimize instead.")
  60. warnings.warn(f"Please use `{name}` from the `scipy.optimize` namespace, "
  61. "the `scipy.optimize.optimize` namespace is deprecated.",
  62. category=DeprecationWarning, stacklevel=2)
  63. return getattr(_optimize, name)