bstellato / mlopt Goto Github PK
View Code? Open in Web Editor NEWThe Machine Learning Optimizer
License: Apache License 2.0
The Machine Learning Optimizer
License: Apache License 2.0
Make sure the logger and tqdm bars behave nicely together (same output stream)
KKT matrix can be factored only if the problem is a QP (is_qp()
in cvxpy) and if the parameters do not enter in the matrices P
and A
. This was complicated with cvxpy < 1.1.
cvxpy 1.1 makes it easy to check these conditions on the reformulated parametric program.
Must happen after #4
sorry I do not know how to fix it((((
I made:
pip install mlopt (in python36)
I also tried to build package on my laptop, tried on windows and ubuntu etc, always I get the same error, it hapends with import mlopt
ImportError Traceback (most recent call last)
C:\anaconda3\envs\mlopt36\lib\site-packages\scikits\umfpack_umfpack.py in swig_import_helper()
17 try:
---> 18 fp, pathname, description = imp.find_module('__umfpack', [dirname(file)])
19 except ImportError:
C:\anaconda3\envs\mlopt36\lib\imp.py in find_module(name, path)
296 else:
--> 297 raise ImportError(_ERR_MSG.format(name), name=name)
298
ImportError: No module named '__umfpack'
During handling of the above exception, another exception occurred:
ModuleNotFoundError Traceback (most recent call last)
in
11
12 #from mlopt.sampling import uniform_sphere_sample
---> 13 import mlopt
14 import pandas as pd
15 import cvxpy as cp
C:\anaconda3\envs\mlopt36\lib\site-packages\mlopt_init_.py in
----> 1 from mlopt.optimizer import Optimizer
2 from mlopt.settings import PYTORCH, OPTIMAL_TREE, XGBOOST
3 from mlopt.learners import installed_learners
4
5
C:\anaconda3\envs\mlopt36\lib\site-packages\mlopt\optimizer.py in
1 import pandas as pd
----> 2 from mlopt.problem import Problem
3 import mlopt.settings as stg
4 from mlopt.learners import LEARNER_MAP, installed_learners
5 from mlopt.sampling import Sampler
C:\anaconda3\envs\mlopt36\lib\site-packages\mlopt\problem.py in
4 from mlopt.strategy import Strategy
5 import mlopt.settings as stg
----> 6 from mlopt.kkt import KKTSolver
7 import mlopt.utils as u
8 import mlopt.error as e
C:\anaconda3\envs\mlopt36\lib\site-packages\mlopt\kkt.py in
13 from scipy.sparse.linalg import spsolve
14 from scipy.sparse.linalg import factorized
---> 15 from scikits.umfpack import UmfpackWarning
16 import time
17 import warnings
C:\anaconda3\envs\mlopt36\lib\site-packages\scikits\umfpack_init_.py in
10 from future import division, print_function, absolute_import
11
---> 12 from .umfpack import *
13 from .interface import *
14
C:\anaconda3\envs\mlopt36\lib\site-packages\scikits\umfpack\umfpack.py in
128 import scipy.sparse as sp
129
--> 130 from . import _umfpack as _um
131
132 assumeSortedIndices = False
C:\anaconda3\envs\mlopt36\lib\site-packages\scikits\umfpack_umfpack.py in
26 fp.close()
27 return _mod
---> 28 __umfpack = swig_import_helper()
29 del swig_import_helper
30 else:
C:\anaconda3\envs\mlopt36\lib\site-packages\scikits\umfpack_umfpack.py in swig_import_helper()
18 fp, pathname, description = imp.find_module('__umfpack', [dirname(file)])
19 except ImportError:
---> 20 import __umfpack
21 return __umfpack
22 if fp is not None:
ModuleNotFoundError: No module named '__umfpack'
Need better linear system solver that can be pickled for parallel execution (coming...)
Update to DPP format when the CVXPY parametric QP interface is ready.
Need to update intermediate chains extraction. The intermediate problem becomes data[s.PARAM_PROB]
in cvxpy 1.1. To solve it you need to call
P, q, A, l, u = problem.apply_parameters()
to get the low-level problem representation. Then it is easy to check which constraints are tight or not.
Use a framework like Optuna instead of GridSearch.
Integration with PyTorch Lightning
Implement strategies with an abstract class. Each strategy will define useful information to help solving the problem and hopefully making it convex. Examples are (combinations of):
The object-oriented interface will deal with how to:
In order to do so, we need to inject the Strategy in the reduction chain (possible after the ParamProg
).
Dear authors,
first of all, I would like to congratulate you for the awesome scientific contributions associated with both papers: "The voice of optimization" and "Online Mixed-Integer Optimization in Milliseconds" 😀
I open this issue because, in my opinion, the following points will be very useful to increase the readability and the impact of both publications, in particular, of the paper "The voice of optimization":
Create a minimum work example that reproduces the offline and online steps of the approach proposed in "The voice of optimization". I had a look at the examples folder and I only see examples devoted to the paper "Online Mixed-Integer Optimization in Milliseconds".
Data sets with the exact values of the parameters involved in the creation of the training instances of the different optimization problems (transportation, portfolio, facility location and hybrid vehicle control optimization) are desired. In addition, it would be fantastic to have the main scripts which run the proposed approach on the test examples of these problems, as well as the output results.
Please do not hesitate to contact me, if further info is needed.
Thank you very much in advance, and congrats again for the excellent work 😊
Best regards,
Asunción Jiménez-Cordero
_RemoteTraceback Traceback (most recent call last)
_RemoteTraceback:
"""
Traceback (most recent call last):
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\joblib\externals\loky\process_executor.py", line 404, in _process_worker
call_item = call_queue.get(block=True, timeout=timeout)
File "D:\ProgramData\Anaconda3\envs\Python36\lib\multiprocessing\queues.py", line 113, in get
return _ForkingPickler.loads(res)
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in load_backward_compatible
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\mlopt-0.0.2-py3.6.egg\mlopt_init.py", line 1, in
from mlopt.optimizer import Optimizer
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\mlopt-0.0.2-py3.6.egg\mlopt\optimizer.py", line 4, in
from mlopt.learners import LEARNER_MAP, installed_learners
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in load_backward_compatible
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\mlopt-0.0.2-py3.6.egg\mlopt\learners_init.py", line 1, in
from mlopt.learners.pytorch.pytorch import PytorchNeuralNet
File "", line 971, in _find_and_load
File "", line 955, in _find_and_load_unlocked
File "", line 656, in _load_unlocked
File "", line 626, in _load_backward_compatible
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\mlopt-0.0.2-py3.6.egg\mlopt\learners\pytorch\pytorch.py", line 3, in
from optuna.integration import PyTorchLightningPruningCallback
File "", line 1020, in handle_fromlist
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\optuna\integration_init.py", line 91, in getattr
module = self.get_module(self.class_to_module[name])
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\optuna\integration_init.py", line 103, in get_module
return importlib.import_module("." + module_name, self.name)
File "D:\ProgramData\Anaconda3\envs\Python36\lib\importlib_init.py", line 126, in import_module
return bootstrap.gcd_import(name[level:], package, level)
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\optuna\integration\pytorch_lightning.py", line 7, in
from pytorch_lightning import LightningModule
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\pytorch_lightning_init.py", line 56, in
from pytorch_lightning.core import LightningDataModule, LightningModule
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\pytorch_lightning\core_init.py", line 2, in
from pytorch_lightning.core.datamodule import LightningDataModule
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\pytorch_lightning\core\datamodule.py", line 21, in
import torch
File "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\torch_init.py", line 124, in
raise err
OSError: [WinError 1455] 页面文件太小,无法完成操作。 Error loading "D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\torch\lib\caffe2_detectron_ops_gpu.dll" or one of its dependencies.
"""
The above exception was the direct cause of the following exception:
BrokenProcessPool Traceback (most recent call last)
in
6
7 # Train solver
----> 8 m.train(theta_train, learner=mlopt.PYTORCH)
D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\mlopt-0.0.2-py3.6.egg\mlopt\optimizer.py in train(self, X, sampling_fn, parallel, learner, filter_strategies, **learner_options)
319 self.get_samples(X, sampling_fn,
320 parallel=parallel,
--> 321 filter_strategies=filter_strategies)
322
323 # Define learner
D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\mlopt-0.0.2-py3.6.egg\mlopt\optimizer.py in get_samples(self, X, sampling_fn, parallel, filter_strategies)
224 message="Compute " +
225 "tight constraints " +
--> 226 "for training set")
227
228 stg.logger.info("Checking for infeasible points")
D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\mlopt-0.0.2-py3.6.egg\mlopt\problem.py in solve_parametric(self, theta, batch_size, parallel, message)
380 results = Parallel(n_jobs=n_jobs, batch_size=batch_size)(
381 delayed(self.populate_and_solve)(theta.iloc[i])
--> 382 for i in tqdm(range(n))
383 )
384
D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\joblib\parallel.py in call(self, iterable)
1040
1041 with self._backend.retrieval_context():
-> 1042 self.retrieve()
1043 # Make sure that we get a last message telling us we are done
1044 elapsed_time = time.time() - self._start_time
D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\joblib\parallel.py in retrieve(self)
919 try:
920 if getattr(self._backend, 'supports_timeout', False):
--> 921 self._output.extend(job.get(timeout=self.timeout))
922 else:
923 self._output.extend(job.get())
D:\ProgramData\Anaconda3\envs\Python36\lib\site-packages\joblib_parallel_backends.py in wrap_future_result(future, timeout)
538 AsyncResults.get from multiprocessing."""
539 try:
--> 540 return future.result(timeout=timeout)
541 except CfTimeoutError:
542 raise TimeoutError()
D:\ProgramData\Anaconda3\envs\Python36\lib\concurrent\futures_base.py in result(self, timeout)
430 raise CancelledError()
431 elif self._state == FINISHED:
--> 432 return self.__get_result()
433 else:
434 raise TimeoutError()
D:\ProgramData\Anaconda3\envs\Python36\lib\concurrent\futures_base.py in __get_result(self)
382 def __get_result(self):
383 if self._exception:
--> 384 raise self._exception
385 else:
386 return self._result
BrokenProcessPool: A task has failed to un-serialize. Please ensure that the arguments of the function are all picklable.
Traceback (most recent call last):
File "/media/frank/easystore/Code/P2S/mlopt/test.py", line 2, in <module>
from mlopt.sampling import uniform_sphere_sample
File "/media/frank/easystore/Code/P2S/mlopt/mlopt/__init__.py", line 1, in <module>
from mlopt.optimizer import Optimizer
File "/media/frank/easystore/Code/P2S/mlopt/mlopt/optimizer.py", line 4, in <module>
from mlopt.learners import LEARNER_MAP, installed_learners
File "/media/frank/easystore/Code/P2S/mlopt/mlopt/learners/__init__.py", line 1, in <module>
from mlopt.learners.pytorch.pytorch import PytorchNeuralNet
File "/media/frank/easystore/Code/P2S/mlopt/mlopt/learners/pytorch/pytorch.py", line 2, in <module>
import mlopt.learners.pytorch.settings as pts
AttributeError: module 'mlopt' has no attribute 'learners'
Process finished with exit code 1
I learn that the advantage of this algorithm lies in the millimeter-level result output. In the meanwhile, reinforcement learning is also a hot research area in the field of control. I was wondering if this algorithm has a higher execution speed advantage over the reinforcement learning algorithm? Or is it closer to global optimal in terms of optimization? Looking forward to your reply, thank you very much!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.