Package: iOpt
iOpt is an open source framework for automatic selection of parameter values both for mathematical models of complex industrial processes and for AI and ML methods used in industry. The framework is distributed under the 3-Clause BSD license.Key features of the frameworkAutomatic selection of parameter values both for mathematical models and for AI and ML methods used in industry.Intelligent control of the process of choosing the optimal parameters for industrial applications.Integration with external artificial intelligence and machine learning libraries or frameworks as well as applied models.Automation of the preliminary analysis of the models under study, e.g., by identifying different types of model dependencies on different groups of parameters.Visualization of the process of choosing optimal parameters.InstallationAutomatic installationThe simplest way to installiOptis usingpip:pip install iOptManual installationOn Unix-like systems:git clone https://github.com/aimclub/iOpt
cd iOpt
pip install virtualenv
virtualenv ioptenv
source ioptenv/bin/activate
python setup.py installOn Windows:git clone https://github.com/aimclub/iOpt
cd iOpt
pip install virtualenv
virtualenv ioptenv
ioptenv\Scripts\activate.bat
python setup.py installDockerDownload the image:docker pull aimclub/iopt:latestUsing the iOpt image:docker run -it aimclub/iopt:latestHow to UseUsing the iOpt framework to minimize the Rastrigin test function.fromproblems.rastriginimportRastriginfromiOpt.solverimportSolverfromiOpt.solver_parametrsimportSolverParametersfromiOpt.output_system.listeners.static_paintersimportStaticPainterNDListenerfromiOpt.output_system.listeners.console_outputersimportConsoleOutputListenerfromsubprocessimportPopen,PIPE,STDOUTif__name__=="__main__":"""Minimization of the Rastrigin test function with visualization"""# Create a test taskproblem=Rastrigin(2)# Setup a solver optionsparams=SolverParameters(r=2.5,eps=0.01,iters_limit=300,refine_solution=True)# Create the solversolver=Solver(problem,parameters=params)# Print results to console while solvingcfol=ConsoleOutputListener(mode='full')solver.add_listener(cfol)# 3D visualization at the end of the solutionspl=StaticPainterNDListener("rastrigin.png","output",vars_indxs=[0,1],mode="surface",calc="interpolation")solver.add_listener(spl)# Run problem solutionsol=solver.solve()ExamplesLet’s demonstrate the use of the iOpt framework when tuning the hyperparameters of one of the machine learning methods. In the support vector machine (SVC), we find the optimal hyperparameters (the regularization parameterC, the kernel coefficientgamma) in the problem of breast cancer classification (detailed description of the data).importnumpyasnpfromsklearn.utilsimportshufflefromsklearn.datasetsimportload_breast_cancerfromiOpt.output_system.listeners.static_paintersimportStaticPainterNDListenerfromiOpt.output_system.listeners.animate_paintersimportAnimatePainterNDListenerfromiOpt.output_system.listeners.console_outputersimportConsoleOutputListenerfromiOpt.solverimportSolverfromiOpt.solver_parametrsimportSolverParametersfromexamples.Machine_learning.SVC._2D.ProblemsimportSVC_2ddefload_breast_cancer_data():dataset=load_breast_cancer()x_raw,y_raw=dataset['data'],dataset['target']inputs,outputs=shuffle(x_raw,y_raw^1,random_state=42)returninputs,outputsif__name__=="__main__":x,y=load_breast_cancer_data()regularization_value_bound={'low':1,'up':6}kernel_coefficient_bound={'low':-7,'up':-3}problem=SVC_2d.SVC_2D(x,y,regularization_value_bound,kernel_coefficient_bound)method_params=SolverParameters(r=np.double(3.0),iters_limit=100)solver=Solver(problem,parameters=method_params)apl=AnimatePainterNDListener("svc2d_anim.png","output",vars_indxs=[0,1],to_paint_obj_func=False)solver.add_listener(apl)spl=StaticPainterNDListener("svc2d_stat.png","output",vars_indxs=[0,1],mode="surface",calc="interpolation")solver.add_listener(spl)cfol=ConsoleOutputListener(mode='full')solver.add_listener(cfol)solver_info=solver.solve()Project StructureThe latest stable release of iOpt is in themainbranch. The repository includes the following directories:TheiOptdirectory contains the framework core in the form of Python classes.Theexamplesdirectory contains examples of using the framework for both test and applied problems.Unit tests are located in thetestdirectory.Documentation source files are located in thedocsdirectory.DocumentationA detailed description of the iOpt framework API is available atRead the Docs.Supported byThe study is supported by theResearch Center Strong Artificial Intelligence in IndustryofITMO Universityas part of the plan of the center's program: Framework of intelligent heuristic optimization methods.