ElectronegativityDiff featurizer not working for elastic_tensor data

71 views
Skip to first unread message

Nahom Aymere

unread,
May 20, 2019, 5:07:30 AM5/20/19
to matminer
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 "<stdin>", line 1, in <module>
  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

Logan Ward

unread,
May 21, 2019, 8:14:41 AM5/21/19
to Nahom Aymere, matminer
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

--
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 matminer+u...@googlegroups.com.
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.

Alex Dunn

unread,
May 21, 2019, 10:54:38 PM5/21/19
to Logan Ward, Nahom Aymere, matminer
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

Reply all
Reply to author
Forward
0 new messages