guillermo-navas-palencia / optbinning

Optimal binning: monotonic binning with constraints. Support batch & stream optimal binning. Scorecard modelling and counterfactual explanations.
http://gnpalencia.org/optbinning/
Apache License 2.0
435 stars 98 forks source link

RuntimeError: CHECK failed: target + size == res: #218

Closed DariaMishina closed 1 year ago

DariaMishina commented 1 year ago

Hi! Try to reproduce example from tutorial http://gnpalencia.org/optbinning/tutorials/tutorial_binary.html#Basic and faced with the same issue as described in issue #208 at the moment of optb.fit(x, y) optbinning Version: 0.17.1 macos Ventura 13.0.1 solver="cp" full text of error [libprotobuf FATAL google/protobuf/message_lite.cc:352] CHECK failed: target + size == res:

RuntimeError Traceback (most recent call last) /var/folders/70/85v3_kq55lvgwqht3b7b7jr00000gn/T/ipykernel_75315/3994782521.py in ----> 1 optb.fit(x, y)

~/opt/anaconda3/lib/python3.9/site-packages/optbinning/binning/binning.py in fit(self, x, y, sample_weight, check_input) 554 Fitted optimal binning. 555 """ --> 556 return self._fit(x, y, sample_weight, check_input) 557 558 def fit_transform(self, x, y, sample_weight=None, metric="woe",

~/opt/anaconda3/lib/python3.9/site-packages/optbinning/binning/binning.py in _fit(self, x, y, sample_weight, check_input) 826 827 # Optimization --> 828 self._fit_optimizer(splits, n_nonevent, n_event) 829 830 # Post-processing

~/opt/anaconda3/lib/python3.9/site-packages/optbinning/binning/binning.py in _fit_optimizer(self, splits, n_nonevent, n_event) 1022 logger.info("Optimizer: solve...") 1023 -> 1024 status, solution = optimizer.solve() 1025 1026 self._solution = solution

~/opt/anaconda3/lib/python3.9/site-packages/optbinning/binning/cp.py in solve(self) 263 self.solver_.parameters.max_time_in_seconds = self.timelimit 264 --> 265 status = self.solver.Solve(self._model) 266 statusname = self.solver.StatusName(status) 267

~/opt/anaconda3/lib/python3.9/site-packages/ortools/sat/python/cp_model.py in Solve(self, model, solution_callback) 2197 2198 self.__solution = cp_model_pb2.CpSolverResponse.FromString( -> 2199 swig_helper.SolveWrapper.SerializedSolve( 2200 model.Proto().SerializeToString(), solve_wrapper)) 2201

RuntimeError: CHECK failed: target + size == res:

guillermo-navas-palencia commented 1 year ago

Hi Daria.

AFAIK, this is an OR-Tools issue with macOS (> 12). All unit tests passed with macOS-12 link, so it might be an issue with macOS-13. On the other hand, OR-Tools wheels are not available for macOS 13: https://pypi.org/project/ortools/#files.

I would suggest:

DariaMishina commented 1 year ago

Hi! Thank you so much for your help. You are right, issue with macos-13, in linux/colabe everything is fine) Solver unfortunately didnt help. Regarding ortools - will have a look (didnt know anything about it).