The Mercury scripts in the CSD Python API -> Predictors menu (crystallisability_prediction.py
and solubility_prediction.py
) do not work in the 2024.2 release owing to a bug. This has been fixed in the 2024.3 release.
If you are unable to upgrade then as a workaround, you can edit the file CCDC\ccdc-software\csd-python-api\miniconda\Lib\site-packages\xgboost\compat.py
. Add the following code at line 91 and make sure that there are two blank lines before and after it.
class XGBoostLabelEncoder(LabelEncoder):
"""Label encoder with JSON serialization methods."""
def to_json(self) -> Dict:
"""Returns a JSON compatible dictionary"""
meta = {}
for k, v in self.__dict__.items():
if isinstance(v, np.ndarray):
meta[k] = v.tolist()
else:
meta[k] = v
return meta
def from_json(self, doc: Dict) -> None:
# pylint: disable=attribute-defined-outside-init
"""Load the encoder back from a JSON compatible dict."""
meta = {}
for k, v in doc.items():
if k == "classes_":
self.classes_ = np.array(v)
continue
meta[k] = v
self.__dict__.update(meta)
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article