language-learning icon indicating copy to clipboard operation
language-learning copied to clipboard

ppln.py broken

Open glicerico opened this issue 5 years ago • 8 comments

After PR https://github.com/singnet/language-learning/pull/258, the "mini-pipeline" ppln.py that does grammar-learning and parse-evaluation stopped working in my system. I get the following error:

Grammar Learner + Tester ppln v.0.0.1 started 2019-10-08 16:45:03 UTC | Python v.3.6.6

Traceback (most recent call last):
  File "../pipeline/ppln.py", line 107, in <module>
    main(sys.argv[1:])
  File "../pipeline/ppln.py", line 72, in main
    rules, re = learn(**kwargs)
  File "/home/andres/MyOpenCogSources/language-learning/src/grammar_learner/learner.py", line 139, in learn
    categories = add_disjuncts(categories, links, **kwargs)
  File "/home/andres/MyOpenCogSources/language-learning/src/grammar_learner/grammar_inducer.py", line 101, in add_disjuncts
    word_counts = { w: c for w, c in dict(zip(wdf["word"].to_list(), wdf["count"].to_list())).items() }
  File "/home/andres/src/miniconda3/envs/ull/lib/python3.6/site-packages/pandas/core/generic.py", line 4376, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'Series' object has no attribute 'to_list'

@alexei-gl If you can help, it'd be great, if not please let me know and I'll return to a previous commit to have it working.

glicerico avatar Oct 08 '19 17:10 glicerico

In any case, I think that

  1. It is better to fix the cause than to rollback to previous commit causing code divergence, given the changes made by @alexei-gl are done following Ben's requirements for the project benig currently conducted by @glicerico
  2. It is better to have unit test on every meaningful piece of code so the issues like that are discovered early at the point when the code is changed and not later when the development context is gone.

Practically, because of known reasons, if @alexei-gl can not provide quick solution, I'd suggest @glicerico to take ownership of this for the time being...

akolonin avatar Oct 09 '19 03:10 akolonin

@glicerico, did it stop working after switching LG/python/pandas versions or after the last PR?

alexei-gl avatar Oct 09 '19 14:10 alexei-gl

@glicerico, why don't you use pipeline (ull-cli) instead of ppln.py?

alexei-gl avatar Oct 09 '19 14:10 alexei-gl

@glicerico , give me a link to configuration file you are using when you get error.

alexei-gl avatar Oct 09 '19 14:10 alexei-gl

@glicerico, did it stop working after switching LG/python/pandas versions or after the last PR?

I just checked: it stopped working after PR#258. As the messages in the error above show, it's related to this line of code:

File "/home/andres/MyOpenCogSources/language-learning/src/grammar_learner/grammar_inducer.py", line 101, in add_disjuncts word_counts = { w: c for w, c in dict(zip(wdf["word"].to_list(), wdf["count"].to_list())).items() }

Specifically to converting wdf["word"].to_list()

glicerico avatar Oct 11 '19 16:10 glicerico

@alexei-gl

@glicerico, why don't you use pipeline (ull-cli) instead of ppln.py?

Because ppln.py does what I want to do: learn grammar and evaluate. But if you recommend ull-cli, I'll use that instead

glicerico avatar Oct 11 '19 16:10 glicerico

@alexei-gl , this is an example json file that I use with ppln.py, which gives me the above error with PR https://github.com/singnet/language-learning/pull/258, but not with the previous ones: https://github.com/glicerico/rangram/blob/automation/templates/tmp.json

glicerico avatar Oct 11 '19 16:10 glicerico

@alexei-gl , I am using ull-cli now, thanks for the suggestion. However, this issue persists. Here's the template for the json file I'm using now... the missing paths are filled depending on the corpus being tested: https://github.com/glicerico/rangram/blob/automation/templates/template-GL-GT-DB.json

glicerico avatar Oct 14 '19 07:10 glicerico