@@ -460,23 +460,23 @@ <h1>Run benchmark from a script</h1>
460460< div class ="line-block ">
461461< div class ="line "> < br /> </ div >
462462</ div >
463- < div class ="highlight-Python notranslate "> < div class ="highlight "> < pre > < span > </ span > < span class ="kn "> from</ span > < span class ="nn "> pathlib</ span > < span class ="kn "> import</ span > < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.Path " title ="pathlib.Path " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class "> < span class ="n "> Path</ span > </ a >
463+ < div class ="highlight-Python notranslate "> < div class ="highlight "> < pre > < span > </ span > < span class ="kn "> from</ span > < span class ="nn "> pathlib</ span > < span class ="kn "> import</ span > < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.Path " title ="pathlib.Path " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class "> < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.Path " title =" pathlib.Path " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class " > < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.Path " title =" pathlib.Path " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class " > < span class ="n "> Path</ span > </ a > </ a > </ a >
464464< span class ="kn "> import</ span > < span class ="nn "> matplotlib.pyplot</ span > < span class ="k "> as</ span > < span class ="nn "> plt</ span >
465- < span class ="kn "> from</ span > < span class ="nn "> benchopt</ span > < span class ="kn "> import</ span > < a href ="../user_guide/generated/benchopt.run_benchmark.html#benchopt.run_benchmark " title ="benchopt.run_benchmark " class ="sphx-glr-backref-module-benchopt sphx-glr-backref-type-py-function "> < span class ="n "> run_benchmark</ span > </ a >
465+ < span class ="kn "> from</ span > < span class ="nn "> benchopt</ span > < span class ="kn "> import</ span > < a href ="../user_guide/generated/benchopt.run_benchmark.html#benchopt.run_benchmark " title ="benchopt.run_benchmark " class ="sphx-glr-backref-module-benchopt sphx-glr-backref-type-py-function "> < a href =" ../user_guide/generated/benchopt.run_benchmark.html#benchopt.run_benchmark " title =" benchopt.run_benchmark " class =" sphx-glr-backref-module-benchopt sphx-glr-backref-type-py-function " > < a href =" ../user_guide/generated/benchopt.run_benchmark.html#benchopt.run_benchmark " title =" benchopt.run_benchmark " class =" sphx-glr-backref-module-benchopt sphx-glr-backref-type-py-function " > < span class ="n "> run_benchmark</ span > </ a > </ a > </ a >
466466< span class ="kn "> from</ span > < span class ="nn "> benchopt.benchmark</ span > < span class ="kn "> import</ span > < span class ="n "> Benchmark</ span >
467- < span class ="kn "> from</ span > < span class ="nn "> benchopt.plotting</ span > < span class ="kn "> import</ span > < a href ="../user_guide/generated/benchopt.plotting.plot_benchmark.html#benchopt.plotting.plot_benchmark " title ="benchopt.plotting.plot_benchmark " class ="sphx-glr-backref-module-benchopt-plotting sphx-glr-backref-type-py-function "> < span class ="n "> plot_benchmark</ span > </ a > < span class ="p "> ,</ span > < span class ="n "> PLOT_KINDS</ span >
467+ < span class ="kn "> from</ span > < span class ="nn "> benchopt.plotting</ span > < span class ="kn "> import</ span > < a href ="../user_guide/generated/benchopt.plotting.plot_benchmark.html#benchopt.plotting.plot_benchmark " title ="benchopt.plotting.plot_benchmark " class ="sphx-glr-backref-module-benchopt-plotting sphx-glr-backref-type-py-function "> < a href =" ../user_guide/generated/benchopt.plotting.plot_benchmark.html#benchopt.plotting.plot_benchmark " title =" benchopt.plotting.plot_benchmark " class =" sphx-glr-backref-module-benchopt-plotting sphx-glr-backref-type-py-function " > < a href =" ../user_guide/generated/benchopt.plotting.plot_benchmark.html#benchopt.plotting.plot_benchmark " title =" benchopt.plotting.plot_benchmark " class =" sphx-glr-backref-module-benchopt-plotting sphx-glr-backref-type-py-function " > < span class ="n "> plot_benchmark</ span > </ a > </ a > </ a > < span class ="p "> ,</ span > < span class ="n "> PLOT_KINDS</ span >
468468< span class ="kn "> from</ span > < span class ="nn "> benchopt.plotting.plot_objective_curve</ span > < span class ="kn "> import</ span > < span class ="n "> reset_solver_styles_idx</ span >
469469
470470
471- < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> BENCHMARK_PATH</ span > </ a > < span class ="o "> =</ span > < span class ="p "> (</ span >
472- < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.Path " title ="pathlib.Path " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class "> < span class ="n "> Path</ span > </ a > < span class ="p "> ()</ span > < span class ="o "> .</ span > < span class ="n "> resolve</ span > < span class ="p "> ()</ span > < span class ="o "> .</ span > < span class ="n "> parent</ span > < span class ="o "> /</ span > < span class ="s1 "> 'benchmarks'</ span > < span class ="o "> /</ span > < span class ="s1 "> 'benchmark_logreg_l2'</ span >
471+ < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title =" pathlib.PosixPath " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance " > < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title =" pathlib.PosixPath " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance " > < span class ="n "> BENCHMARK_PATH</ span > </ a > </ a > </ a > < span class ="o "> =</ span > < span class ="p "> (</ span >
472+ < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.Path " title ="pathlib.Path " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class "> < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.Path " title =" pathlib.Path " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class " > < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.Path " title =" pathlib.Path " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class " > < span class ="n "> Path</ span > </ a > </ a > </ a > < span class ="p "> ()</ span > < span class ="o "> .</ span > < span class ="n "> resolve</ span > < span class ="p "> ()</ span > < span class ="o "> .</ span > < span class ="n "> parent</ span > < span class ="o "> /</ span > < span class ="s1 "> 'benchmarks'</ span > < span class ="o "> /</ span > < span class ="s1 "> 'benchmark_logreg_l2'</ span >
473473< span class ="p "> )</ span >
474474
475475
476476< span class ="k "> try</ span > < span class ="p "> :</ span >
477477
478- < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> save_file</ span > </ a > < span class ="o "> =</ span > < a href ="../user_guide/generated/benchopt.run_benchmark.html#benchopt.run_benchmark " title ="benchopt.run_benchmark " class ="sphx-glr-backref-module-benchopt sphx-glr-backref-type-py-function "> < span class ="n "> run_benchmark</ span > </ a > < span class ="p "> (</ span >
479- < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> BENCHMARK_PATH</ span > </ a > < span class ="p "> ,</ span >
478+ < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> save_file</ span > </ a > </ a > </ a > < span class ="o "> =</ span > < a href ="../user_guide/generated/benchopt.run_benchmark.html#benchopt.run_benchmark " title ="benchopt.run_benchmark " class ="sphx-glr-backref-module-benchopt sphx-glr-backref-type-py-function "> < a href ="../user_guide/generated/benchopt.run_benchmark.html#benchopt.run_benchmark " title ="benchopt.run_benchmark " class ="sphx-glr-backref-module-benchopt sphx-glr-backref-type-py-function "> < a href ="../user_guide/generated/benchopt.run_benchmark.html#benchopt.run_benchmark " title ="benchopt.run_benchmark " class ="sphx-glr-backref-module-benchopt sphx-glr-backref-type-py-function "> < span class ="n "> run_benchmark</ span > </ a > </ a > </ a > < span class ="p "> (</ span >
479+ < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title =" pathlib.PosixPath " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance " > < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title =" pathlib.PosixPath " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance " > < span class ="n "> BENCHMARK_PATH</ span > </ a > </ a > </ a > < span class ="p "> ,</ span >
480480 < span class ="n "> solver_names</ span > < span class ="o "> =</ span > < span class ="p "> [</ span > < span class ="s1 "> 'sklearn[liblinear]'</ span > < span class ="p "> ,</ span > < span class ="s1 "> 'sklearn[newton-cg]'</ span > < span class ="p "> ,</ span > < span class ="s1 "> 'lightning'</ span > < span class ="p "> ],</ span >
481481 < span class ="n "> dataset_names</ span > < span class ="o "> =</ span > < span class ="p "> [</ span > < span class ="s2 "> "Simulated[n_features=500,n_samples=200]"</ span > < span class ="p "> ],</ span >
482482 < span class ="n "> objective_filters</ span > < span class ="o "> =</ span > < span class ="p "> [</ span > < span class ="s1 "> 'L2 Logistic Regression[lmbd=1.0]'</ span > < span class ="p "> ],</ span >
@@ -489,15 +489,15 @@ <h1>Run benchmark from a script</h1>
489489 < span class ="s2 "> "This example can only work when Logreg-l2 benchmark is cloned in a "</ span >
490490 < span class ="s2 "> "`benchmarks` folder. Please run:</ span > < span class ="se "> \n</ span > < span class ="s2 "> "</ span >
491491 < span class ="s2 "> "$ git clone https://github.com/benchopt/benchmark_logreg_l2 "</ span >
492- < span class ="sa "> f</ span > < span class ="s2 "> "</ span > < span class ="si "> {</ span > < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve " title ="pathlib.Path.resolve " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-method "> < span class ="n "> BENCHMARK_PATH</ span > < span class ="o "> .</ span > < span class ="n "> resolve</ span > </ a > < span class ="p "> ()</ span > < span class ="si "> }</ span > < span class ="s2 "> "</ span >
492+ < span class ="sa "> f</ span > < span class ="s2 "> "</ span > < span class ="si "> {</ span > < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve " title ="pathlib.Path.resolve " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-method "> < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve " title =" pathlib.Path.resolve " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-method " > < a href =" https://docs.python.org/3/library/pathlib.html#pathlib.Path.resolve " title =" pathlib.Path.resolve " class =" sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-method " > < span class ="n "> BENCHMARK_PATH</ span > < span class ="o "> .</ span > < span class ="n "> resolve</ span > </ a > </ a > </ a > < span class ="p "> ()</ span > < span class ="si "> }</ span > < span class ="s2 "> "</ span >
493493 < span class ="p "> )</ span >
494494
495495
496- < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> kinds</ span > </ a > < span class ="o "> =</ span > < span class ="nb "> list</ span > < span class ="p "> (</ span > < span class ="n "> PLOT_KINDS</ span > < span class ="o "> .</ span > < span class ="n "> keys</ span > < span class ="p "> ())</ span >
496+ < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href =" https://docs.python.org/3/library/stdtypes.html#list " title =" builtins.list " class =" sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance " > < a href =" https://docs.python.org/3/library/stdtypes.html#list " title =" builtins.list " class =" sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance " > < span class ="n "> kinds</ span > </ a > </ a > </ a > < span class ="o "> =</ span > < span class ="nb "> list</ span > < span class ="p "> (</ span > < span class ="n "> PLOT_KINDS</ span > < span class ="o "> .</ span > < span class ="n "> keys</ span > < span class ="p "> ())</ span >
497497< span class ="n "> reset_solver_styles_idx</ span > < span class ="p "> ()</ span >
498- < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> figs</ span > </ a > < span class ="o "> =</ span > < a href ="../user_guide/generated/benchopt.plotting.plot_benchmark.html#benchopt.plotting.plot_benchmark " title ="benchopt.plotting.plot_benchmark " class ="sphx-glr-backref-module-benchopt-plotting sphx-glr-backref-type-py-function "> < span class ="n "> plot_benchmark</ span > </ a > < span class ="p "> (</ span > < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> save_file</ span > </ a > < span class ="p "> ,</ span > < span class ="n "> benchmark</ span > < span class ="o "> =</ span > < span class ="n "> Benchmark</ span > < span class ="p "> (</ span > < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> BENCHMARK_PATH</ span > </ a > < span class ="p "> ),</ span >
499- < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> kinds</ span > </ a > < span class ="o "> =</ span > < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> kinds</ span > </ a > < span class ="p "> ,</ span > < span class ="n "> html</ span > < span class ="o "> =</ span > < span class ="kc "> False</ span > < span class ="p "> )</ span >
500- < a href ="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show " title ="matplotlib.pyplot.show " class ="sphx-glr-backref-module-matplotlib-pyplot sphx-glr-backref-type-py-function "> < span class ="n "> plt</ span > < span class ="o "> .</ span > < span class ="n "> show</ span > </ a > < span class ="p "> ()</ span >
498+ < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> figs</ span > </ a > </ a > </ a > < span class ="o "> =</ span > < a href ="../user_guide/generated/benchopt.plotting.plot_benchmark.html#benchopt.plotting.plot_benchmark " title ="benchopt.plotting.plot_benchmark " class ="sphx-glr-backref-module-benchopt-plotting sphx-glr-backref-type-py-function "> < a href ="../user_guide/generated/benchopt.plotting.plot_benchmark.html#benchopt.plotting.plot_benchmark " title ="benchopt.plotting.plot_benchmark " class ="sphx-glr-backref-module-benchopt-plotting sphx-glr-backref-type-py-function "> < a href ="../user_guide/generated/benchopt.plotting.plot_benchmark.html#benchopt.plotting.plot_benchmark " title ="benchopt.plotting.plot_benchmark " class ="sphx-glr-backref-module-benchopt-plotting sphx-glr-backref-type-py-function "> < span class ="n "> plot_benchmark</ span > </ a > </ a > </ a > < span class ="p "> (</ span > < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> save_file</ span > </ a > </ a > </ a > < span class ="p "> ,</ span > < span class ="n "> benchmark</ span > < span class ="o "> =</ span > < span class ="n "> Benchmark</ span > < span class ="p "> (</ span > < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/pathlib.html#pathlib.PosixPath " title ="pathlib.PosixPath " class ="sphx-glr-backref-module-pathlib sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> BENCHMARK_PATH</ span > </ a > </ a > </ a > < span class ="p "> ),</ span >
499+ < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> kinds</ span > </ a > </ a > </ a > < span class ="o "> =</ span > < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < a href ="https://docs.python.org/3/library/stdtypes.html#list " title ="builtins.list " class ="sphx-glr-backref-module-builtins sphx-glr-backref-type-py-class sphx-glr-backref-instance "> < span class ="n "> kinds</ span > </ a > </ a > </ a > < span class ="p "> ,</ span > < span class ="n "> html</ span > < span class ="o "> =</ span > < span class ="kc "> False</ span > < span class ="p "> )</ span >
500+ < a href ="https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show " title ="matplotlib.pyplot.show " class ="sphx-glr-backref-module-matplotlib-pyplot sphx-glr-backref-type-py-function "> < a href =" https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show " title =" matplotlib.pyplot.show " class =" sphx-glr-backref-module-matplotlib-pyplot sphx-glr-backref-type-py-function " > < a href =" https://matplotlib.org/stable/api/_as_gen/matplotlib.pyplot.show.html#matplotlib.pyplot.show " title =" matplotlib.pyplot.show " class =" sphx-glr-backref-module-matplotlib-pyplot sphx-glr-backref-type-py-function " > < span class ="n "> plt</ span > < span class ="o "> .</ span > < span class ="n "> show</ span > </ a > </ a > </ a > < span class ="p "> ()</ span >
501501</ pre > </ div >
502502</ div >
503503< p class ="sphx-glr-timing "> < strong > Total running time of the script:</ strong > (0 minutes 17.513 seconds)</ p >
0 commit comments