FAQs
Crystallisability and solvate prediction scripts not working in 2024.2 release
Solution
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.
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)