athulkrishna2015 / Transition-metal-Chalcogens

project
0 stars 0 forks source link

CompositionError: ( is an invalid formula! #1

Open DrAshish88 opened 1 year ago

DrAshish88 commented 1 year ago

Processing Input Data: 92%|█████████▏| 1263/1377 [00:00<00:00, 6946.72it/s]

CompositionError Traceback (most recent call last) in <cell line: 1>() 1 for f in ['jarvis', 'magpie', 'mat2vec', 'oliynyk', 'onehot','random_200']: ----> 2 X_train_unscaled, y_train, formulae_train, skipped_train = generate_features(df, elem_prop=f, drop_duplicates=False, extend_features=False, sum_feat=True) 3 4 SEED = 42 5 X_train_unscaled, X_test_unscaled, y_train, y_test = train_test_split(X_train_unscaled, y_train, test_size=0.20, random_state=SEED)

4 frames /usr/local/lib/python3.10/dist-packages/CBFV/composition.py in generate_features(df, elem_prop, drop_duplicates, extend_features, sum_feat, mini) 281 if 'x' in formula: 282 continue --> 283 l1, l2 = _element_composition_L(formula) 284 formula_mat.append(l1) 285 count_mat.append(l2)

/usr/local/lib/python3.10/dist-packages/CBFV/composition.py in _element_composition_L(formula) 97 98 def _element_composition_L(formula): ---> 99 comp_frac = _element_composition(formula) 100 atoms = list(comp_frac.keys()) 101 counts = list(comp_frac.values())

/usr/local/lib/python3.10/dist-packages/CBFV/composition.py in _element_composition(formula) 86 87 def _element_composition(formula): ---> 88 elmap = parse_formula(formula) 89 elamt = {} 90 natoms = 0

/usr/local/lib/python3.10/dist-packages/CBFV/composition.py in parse_formula(formula) 62 expanded_formula = formula.replace(m.group(), expanded_sym) 63 return parse_formula(expanded_formula) ---> 64 sym_dict = get_sym_dict(formula, 1) 65 return sym_dict 66

/usr/local/lib/python3.10/dist-packages/CBFV/composition.py in get_sym_dict(f, factor) 26 f = f.replace(m.group(), "", 1) 27 if f.strip(): ---> 28 raise CompositionError(f'{f} is an invalid formula!') 29 return sym_dict 30

CompositionError: ( is an invalid formula!

DrAshish88 commented 1 year ago

Dear Athul, The area is new for me, please help. I have watched your youtube video as well and followed the exact code. The error I am facing is Composition error as shown above. How to rectify the same?

athulkrishna2015 commented 1 year ago

Dear Athul, The area is new for me, please help. I have watched your youtube video as well and followed the exact code. The error I am facing is Composition error as shown above. How to rectify the same?

Hi I am not the author of Kaaiian / CBFV. you can ask there for more help

May I ask which University are you working?

DrAshish88 commented 1 year ago

Ok I will check the dataframe. I am working in G H Raisoni College of Engineering and Management Pune, India.

On Wed, 14 Jun, 2023, 17:42 Athulkrishna, @.***> wrote:

Dear Athul, The area is new for me, please help. I have watched your youtube video as well and followed the exact code. The error I am facing is Composition error as shown above. How to rectify the same?

Hi I am not the author of Kaaiian https://github.com/Kaaiian/ CBFV https://github.com/Kaaiian/CBFV. you can ask there for more help

  • By reading the error provided, I think there is something wrong with the chemical formula in the df(data frame) you have provided.
  • I suggest you check the formula column in the df. Check whether bad data is present there?

May I ask which University are you working?

— Reply to this email directly, view it on GitHub https://github.com/athulkrishna2015/Transition-metal-Chalcogens/issues/1#issuecomment-1591073790, or unsubscribe https://github.com/notifications/unsubscribe-auth/A6IET3TVCCKLEMRXWPIDGUDXLGTCHANCNFSM6AAAAAAZGHFTZ4 . You are receiving this because you authored the thread.Message ID: @.*** com>

DrAshish88 commented 1 year ago

Thanks for help, the error got rectified.