Introduction: A few days ago, I got a model called xyz.model. We got it from a client and I had no idea how to open it. And after searching a lot, I couldn't find out an useful answer though. That's why this article. What is the object? a .model model object is created on saving xgboost model from R, using xgboost::save() method. That is how it is created. Now as you may guess, using a R model in python we will have a problem. And you are right. In general the standard xgboost library will not be able to load according to this github thread . What is the issue? Actually it is impossible to load a model from a buffer (e.g. bytestring) in Python, due to a bug where ctypes is used incorrectly to get a const char* pointer: >> > bst . load_model ( b'123' ) TypeError : underlying buffer is not writable Here's a short example of what it is basically trying to do: >> > b = b'123' >> > ( ctypes . c_char * 3 ). from_buf...
I write about machine learning models, python programming, web scraping, statistical tests and other coding or data science related things I find interesting. Read, learn and grow with me!