ElectronegativityDiff featurizer not working for elastic_tensor data

I get the following error when using ElectornegativityDiff, should I use Ignore_errors = true in this case? What should I do to featurize correctly?

from matminer.datasets.convenience_loaders import load_elastic_tensor

df = load_elastic_tensor()

df = CompositionToOxidComposition().featurize_dataframe(df, “composition”)

from matminer.featurizers.composition import ElectronegativityDiff

Enf_feat =ElectronegativityDiff()

X = Enf_feat.featurize_dataframe(df,“composition_oxid”)

···

ElectronegativityDiff: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 1181/1181 [00:07<00:00, 157.40it/s]

multiprocessing.pool.RemoteTraceback:

“”"

Traceback (most recent call last):

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 401, in featurize_wrapper

return self.featurize(*x)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\composition.py”, line 465, in featurize

anions, anion_fractions = zip(*[(s, x) for s, x in comp.items() if s.oxi_state < 0])

ValueError: not enough values to unpack (expected 2, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 119, in worker

result = (True, func(*args, **kwds))

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 44, in mapstar

return list(map(*args))

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 416, in featurize_wrapper

reraise(type(e), type(e)(msg), sys.exc_info()[2])

File “C:\Users\aymer\Anaconda3\lib\site-packages\six.py”, line 692, in reraise

raise value.with_traceback(tb)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 401, in featurize_wrapper

return self.featurize(*x)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\composition.py”, line 465, in featurize

anions, anion_fractions = zip(*[(s, x) for s, x in comp.items() if s.oxi_state < 0])

ValueError: not enough values to unpack (expected 2, got 0)

To skip errors when featurizing specific compounds, consider running the batch featurize() operation (e.g., featurize_many(), featurize_dataframe(), etc.) with ignore_errors=True

“”"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File “”, line 1, in

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 252, in featurize_dataframe

pbar=pbar)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 375, in featurize_many

return p.map(func, entries, chunksize=self.chunksize)

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 266, in map

return self._map_async(func, iterable, mapstar, chunksize).get()

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 644, in get

raise self._value

ValueError: not enough values to unpack (expected 2, got 0)

To skip errors when featurizing specific compounds, consider running the batch featurize() operation (e.g., featurize_many(), featurize_dataframe(), etc.) with ignore_errors=True

Hello Nahom,

I believe this error is caused by running ElectronegativityDiff on a non-ionic compound.

I am on the fence about whether the solution to raise a more informative error, return nans, or return zeros for this condition.

Any thoughts on this?

Logan

···

On Mon, May 20, 2019, 4:07 AM Nahom Aymere [email protected] wrote:

I get the following error when using ElectornegativityDiff, should I use Ignore_errors = true in this case? What should I do to featurize correctly?
from matminer.datasets.convenience_loaders import load_elastic_tensor

df = load_elastic_tensor()

df = CompositionToOxidComposition().featurize_dataframe(df, “composition”)

from matminer.featurizers.composition import ElectronegativityDiff

Enf_feat =ElectronegativityDiff()

X = Enf_feat.featurize_dataframe(df,“composition_oxid”)


ElectronegativityDiff: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 1181/1181 [00:07<00:00, 157.40it/s]

multiprocessing.pool.RemoteTraceback:

“”"

Traceback (most recent call last):

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 401, in featurize_wrapper

return self.featurize(*x)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\composition.py”, line 465, in featurize

anions, anion_fractions = zip(*[(s, x) for s, x in comp.items() if s.oxi_state < 0])

ValueError: not enough values to unpack (expected 2, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 119, in worker

result = (True, func(*args, **kwds))

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 44, in mapstar

return list(map(*args))

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 416, in featurize_wrapper

reraise(type(e), type(e)(msg), sys.exc_info()[2])

File “C:\Users\aymer\Anaconda3\lib\site-packages\six.py”, line 692, in reraise

raise value.with_traceback(tb)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 401, in featurize_wrapper

return self.featurize(*x)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\composition.py”, line 465, in featurize

anions, anion_fractions = zip(*[(s, x) for s, x in comp.items() if s.oxi_state < 0])

ValueError: not enough values to unpack (expected 2, got 0)

To skip errors when featurizing specific compounds, consider running the batch featurize() operation (e.g., featurize_many(), featurize_dataframe(), etc.) with ignore_errors=True

“”"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File “”, line 1, in

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 252, in featurize_dataframe

pbar=pbar)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 375, in featurize_many

return p.map(func, entries, chunksize=self.chunksize)

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 266, in map

return self._map_async(func, iterable, mapstar, chunksize).get()

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 644, in get

raise self._value

ValueError: not enough values to unpack (expected 2, got 0)

To skip errors when featurizing specific compounds, consider running the batch featurize() operation (e.g., featurize_many(), featurize_dataframe(), etc.) with ignore_errors=True

You received this message because you are subscribed to the Google Groups “matminer” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To view this discussion on the web visit https://groups.google.com/d/msgid/matminer/1b41ac58-09ce-47d5-88dd-d511b788b76c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hi all,

A more informative error would be my vote.

We could also implement a precheck for this featurizer to avoid this situation in the future.

Thanks,

Alex

···

On Tue, May 21, 2019 at 5:14 AM Logan Ward [email protected] wrote:

Hello Nahom,

I believe this error is caused by running ElectronegativityDiff on a non-ionic compound.

I am on the fence about whether the solution to raise a more informative error, return nans, or return zeros for this condition.

Any thoughts on this?

Logan

On Mon, May 20, 2019, 4:07 AM Nahom Aymere [email protected] wrote:

I get the following error when using ElectornegativityDiff, should I use Ignore_errors = true in this case? What should I do to featurize correctly?
from matminer.datasets.convenience_loaders import load_elastic_tensor

df = load_elastic_tensor()

df = CompositionToOxidComposition().featurize_dataframe(df, “composition”)

from matminer.featurizers.composition import ElectronegativityDiff

Enf_feat =ElectronegativityDiff()

X = Enf_feat.featurize_dataframe(df,“composition_oxid”)


ElectronegativityDiff: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████| 1181/1181 [00:07<00:00, 157.40it/s]

multiprocessing.pool.RemoteTraceback:

“”"

Traceback (most recent call last):

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 401, in featurize_wrapper

return self.featurize(*x)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\composition.py”, line 465, in featurize

anions, anion_fractions = zip(*[(s, x) for s, x in comp.items() if s.oxi_state < 0])

ValueError: not enough values to unpack (expected 2, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 119, in worker

result = (True, func(*args, **kwds))

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 44, in mapstar

return list(map(*args))

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 416, in featurize_wrapper

reraise(type(e), type(e)(msg), sys.exc_info()[2])

File “C:\Users\aymer\Anaconda3\lib\site-packages\six.py”, line 692, in reraise

raise value.with_traceback(tb)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 401, in featurize_wrapper

return self.featurize(*x)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\composition.py”, line 465, in featurize

anions, anion_fractions = zip(*[(s, x) for s, x in comp.items() if s.oxi_state < 0])

ValueError: not enough values to unpack (expected 2, got 0)

To skip errors when featurizing specific compounds, consider running the batch featurize() operation (e.g., featurize_many(), featurize_dataframe(), etc.) with ignore_errors=True

“”"

The above exception was the direct cause of the following exception:

Traceback (most recent call last):

File “”, line 1, in

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 252, in featurize_dataframe

pbar=pbar)

File “C:\Users\aymer\Anaconda3\lib\site-packages\matminer\featurizers\base.py”, line 375, in featurize_many

return p.map(func, entries, chunksize=self.chunksize)

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 266, in map

return self._map_async(func, iterable, mapstar, chunksize).get()

File “C:\Users\aymer\Anaconda3\lib\multiprocessing\pool.py”, line 644, in get

raise self._value

ValueError: not enough values to unpack (expected 2, got 0)

To skip errors when featurizing specific compounds, consider running the batch featurize() operation (e.g., featurize_many(), featurize_dataframe(), etc.) with ignore_errors=True

You received this message because you are subscribed to the Google Groups “matminer” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To view this discussion on the web visit https://groups.google.com/d/msgid/matminer/1b41ac58-09ce-47d5-88dd-d511b788b76c%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “matminer” group.

To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].

To view this discussion on the web visit https://groups.google.com/d/msgid/matminer/CACSNaMzHxinnrWYAFrGL7Wuab%3DNBv705F7SDM12zr75wRQ9wvw%40mail.gmail.com.

For more options, visit https://groups.google.com/d/optout.