Open dweindl opened 8 months ago
maybe tolerances in test_pyjulia_pipeline need to be adapted.
test_pyjulia_pipeline
https://github.com/ICB-DCM/pyPESTO/actions/runs/7472405078/job/20334519310
____________________________ test_pyjulia_pipeline _____________________________ def test_pyjulia_pipeline(): """Test that a pipeline with julia objective works.""" # just make sure display function works rng = np.random.default_rng(42) assert display_source_ipython( # noqa: S101 f"{os.path.dirname(__file__)}/../../doc/example/model_julia/LR.jl" ) # define objective obj = JuliaObjective( module="LR", source_file=f"{os.path.dirname(__file__)}/../../" f"doc/example/model_julia/LR.jl", fun="fun", grad="grad", ) n_p = obj.get("n_p") # call consistency x = rng.normal(size=n_p) assert obj.get_fval(x) == obj.get_fval(x) # noqa: S101 assert (obj.get_grad(x) == obj.get_grad(x)).all() # noqa: S101 # define problem lb, ub = [-5.0] * n_p, [5.0] * n_p # create 10 random starting points within the bounds x_guesses = rng.uniform(lb, ub, size=(10, n_p)) problem = Problem(obj, lb=lb, ub=ub, x_guesses=x_guesses) # optimize result = optimize.minimize(problem, engine=SingleCoreEngine(), n_starts=10) # use parallelization result2 = optimize.minimize( problem, engine=MultiProcessEngine(), n_starts=10 ) # check results match assert np.allclose( # noqa: S101 result.optimize_result[0].x, result2.optimize_result[0].x ) # optimal point won't be true parameter x_true = obj.get("p_true") assert not np.allclose(x_true, result.optimize_result[0].x) # noqa: S101 # check with analytical value p_opt = obj.get("p_opt") > assert np.allclose(result.optimize_result[0].x, p_opt) # noqa: S101 E assert False E + where False = <function allclose at 0x7f94f5366d30>(array([ 0.67469106, 0.85365126, -0.27880515, -0.09968592, 0.60157911,\n 0.2020777 , 0.00129849, -0.11284351]), array([ 0.67469117, 0.85365118, -0.27880519, -0.09968595, 0.60157918,\n 0.20207782, 0.00129851, -0.11284341])) E + where <function allclose at 0x7f94f5366d30> = np.allclose E + and array([ 0.67469106, 0.85365126, -0.27880515, -0.09968592, 0.60157911,\n 0.2020777 , 0.00129849, -0.11284351]) = {'id': '7', 'x': array([ 0.67469106, 0.85365126, -0.27880515, -0.09968592, 0.60157911,\n 0.2020777 , 0.001298...B options={'disp': False, 'maxfun': 1000}>", 'free_indices': array([0, 1, 2, 3, 4, 5, 6, 7]), 'inner_parameters': None}.x test/julia/test_pyjulia.py:62: AssertionError
maybe tolerances in
test_pyjulia_pipeline
need to be adapted.https://github.com/ICB-DCM/pyPESTO/actions/runs/7472405078/job/20334519310