How to use the matminer.featurizers.conversions.CompositionToOxidComposition function in matminer

To help you get started, we’ve selected a few matminer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github hackingmaterials / automatminer / automatminer / featurization / core.py View on Github external
logger.info(
                    self._log_prefix + "Compositions detected as dicts. Attempting "
                    "conversion to Composition objects..."
                )
                df[featurizer_type] = [
                    Composition.from_dict(d) for d in df[featurizer_type]
                ]

            # Convert non-oxidstate containing comps to oxidstate comps
            if self.guess_oxistates:
                logger.info(
                    self._log_prefix
                    + "Guessing oxidation states of compositions, as"
                    " they were not present in input."
                )
                cto = CompositionToOxidComposition(
                    target_col_id=featurizer_type,
                    overwrite_data=True,
                    return_original_on_error=True,
                    max_sites=-50,
                )
                cto.set_n_jobs(self.n_jobs)
                try:
                    df = cto.featurize_dataframe(
                        df,
                        featurizer_type,
                        multiindex=self.multiindex,
                        inplace=False,
                    )
                except Exception as e:
                    logger.warning(
                        self._log_prefix + "Could not decorate oxidation states due "