POC-English-Amb+disAmb test 2018-08-09

Updated optimal clustering search (2018-08-05), server 88.99.210.144
Each line is calculated 1x, parsing metrics tested 1x for each calculation.
The calculation table is shared as 'short_table.txt' in data folder
http://langlearn.singularitynet.io/data/clustering_2018/POC-English-Amb-2018-08-09/
This notebook is shared as static html via
http://langlearn.singularitynet.io/data/clustering_2018/html/POC-English-Amb-2018-08-09.html
A multi-run version of this test is NOT shared via
http://langlearn.singularitynet.io/data/clustering_2018/html/POC-English-Amb-2018-08-08-multi.html

Basic settings

In [1]:
import os, sys, time
from IPython.display import display
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path: sys.path.append(module_path)
grammar_learner_path = module_path + '/src/grammar_learner/'
if grammar_learner_path not in sys.path: sys.path.append(grammar_learner_path)
from utl import UTC
from read_files import check_dir
from widgets import html_table
from pqa_table import table_damb
tmpath = module_path + '/tmp/'
if check_dir(tmpath, True, 'none'):
    table = []
    long_table = []
    header = ['Line','Corpus','Parsing','LW','"."','Generalization','Space','Rules','PA','PQ']
    start = time.time()
    print(UTC(), ':: module_path =', module_path)
else: print(UTC(), ':: could not create temporary files directory', tmpath)
2018-08-09 17:52:29 UTC :: module_path = /home/obaskov/language-learning

Grammar Learner corpus-specific parameters

In [2]:
corpus = 'POC-English-Amb'
out_dir = module_path + '/output/'+ corpus + '-' + str(UTC())[:10]
runs = (1,1)    # (attempts to learn grammar per line, grammar tests per attempt)
if runs != (1,1): out_dir += '-multi'
kwargs = {
    'left_wall'     :   ''          ,
    'period'        :   False       ,
    'word_space'    :   'vectors'   ,
    'clustering'    :   ('kmeans', 'kmeans++', 10),
    'cluster_range' :   (2,50,3)    ,
    'tmpath'        :   tmpath      , 
    'verbose'       :   'min'       ,
    'template_path' :   'poc-turtle',
    'linkage_limit' :   1000        ,
    'categories_generalization': 'off'}
lines = [
    [26, 'POC-English-Amb'    , 'MST-fixed-manually'             ,'LW','.', 'none'  ], 
    [27, 'POC-English-Amb'    , 'LG-English'                     ,'LW','.', 'none'  ], 
    [28, 'POC-English-Amb'    , 'R=6-Weight=6:R-mst-weight=+1:R' ,'LW','.', 'none'  ], 
    [29, 'POC-English-Amb'    , 'MST-fixed-manually'             , 0  , 0 , 'none'  ], 
    [30, 'POC-English-Amb'    , 'MST-fixed-manually'             , 0  , 0 , 'rules' ], 
    [31, 'POC-English-Amb'    , 'LG-English'                     , 0  , 0 , 'none'  ], 
    [32, 'POC-English-Amb'    , 'LG-English'                     , 0  , 0 , 'rules' ], 
    [33, 'POC-English-Amb'    , 'R=6-Weight=6:R-mst-weight=+1:R' , 0  , 0 , 'none'  ], 
    [34, 'POC-English-Amb'    , 'R=6-Weight=6:R-mst-weight=+1:R' , 0  , 0 , 'rules' ], 
    [35, 'POC-English-disAmb' , 'R=6-Weight=6:R-mst-weight=+1:R' , 0  , 0 , 'none'  ], 
    [36, 'POC-English-disAmb' , 'R=6-Weight=6:R-mst-weight=+1:R' , 0  , 0 , 'rules' ], 
    [37, 'POC-English-disAmb' , 'R=6-Weight=6:R-mst-weight=+1:R-adagram' , 0  , 0 , 'rules' ], 
    [38, 'POC-English-Amb'    , 'R=6-Weight=1-mst-weight=+1:R'   , 0  , 0 , 'none'  ], 
    [39, 'POC-English-disAmb' , 'R=6-Weight=1-mst-weight=+1:R'   , 0  , 0 , 'none'  ], 
    [40, 'POC-English-disAmb' , 'R=6-Weight=1-mst-weight=+1:R'   , 0  , 0 , 'rules' ], 
    [41, 'POC-English-disAmb' , 'R=6-Weight=1-mst-weight=+1:R-adagram'   , 0  , 0 , 'rules' ], 
    [42, 'POC-English-Amb'    , 'LG-ANY-all-parses'              , 0  , 0 , 'none'  ], 
    [43, 'POC-English-disAmb' , 'LG-ANY-all-parses'              , 0  , 0 , 'none'  ], 
    [44, 'POC-English-disAmb' , 'LG-ANY-all-parses'              , 0  , 0 , 'rules' ],
    [45, 'POC-English-disAmb' , 'LG-ANY-all-parses-adagram'      , 0  , 0 , 'rules' ]]
rp = module_path + '/data/POC-English-Amb/MST-fixed-manually/poc-english_ex-parses-gold.txt'
cps = (rp,rp)   # (test) corpus_paths for Amb and disAmb corpora
rps = (rp,rp)   # reference_paths for Amb and disAmb corpora

POC-English-Amb, 5 datasets; ...-disAmb, 6 datasets

ULL Project Plan ⇒ Parses ⇒ lines 20-39

Connectors-DRK-Connectors

In [3]:
%%capture
kwargs['context'] = 1
kwargs['grammar_rules'] = 1
average21, long21 = table_damb(lines, out_dir, cps, rps, runs, **kwargs)
table.extend(average21)
long_table.extend(long21)
In [4]:
display(html_table([header]+average21))
print(UTC())
LineCorpusParsingLW"."GeneralizationSpaceRulesPAPQ
26POC-English-AmbMST-fixed-manuallyLW + nonecDRKc3670%61%
27POC-English-AmbLG-EnglishLW + nonecDRKc3681%62%
28POC-English-AmbR=6-Weight=6:R-mst-weight=+1:RLW + nonecDRKc3390%58%
29POC-English-AmbMST-fixed-manually -- -- nonecDRKc3473%65%
31POC-English-AmbLG-English -- -- nonecDRKc3384%67%
33POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonecDRKc3085%54%
35POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonecDRKc2886%54%
38POC-English-AmbR=6-Weight=1-mst-weight=+1:R -- -- nonecDRKc2086%56%
39POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- nonecDRKc2688%57%
42POC-English-AmbLG-ANY-all-parses -- -- nonecDRKc2688%57%
43POC-English-disAmbLG-ANY-all-parses -- -- nonecDRKc2786%56%
2018-08-09 17:53:16 UTC

Connectors-DRK-Disjuncts

In [5]:
%%capture
kwargs['grammar_rules'] = 2
average22, long22 = table_damb(lines, out_dir, cps, rps, runs, **kwargs)
table.extend(average22)
long_table.extend(long22)
In [6]:
display(html_table([header]+average22))
print(UTC())
LineCorpusParsingLW"."GeneralizationSpaceRulesPAPQ
26POC-English-AmbMST-fixed-manuallyLW + nonecDRKd340%0%
27POC-English-AmbLG-EnglishLW + nonecDRKd360%0%
28POC-English-AmbR=6-Weight=6:R-mst-weight=+1:RLW + nonecDRKd3375%49%
29POC-English-AmbMST-fixed-manually -- -- nonecDRKd3437%33%
30POC-English-AmbMST-fixed-manually -- -- rulescDRKd2740%34%
31POC-English-AmbLG-English -- -- nonecDRKd3320%16%
32POC-English-AmbLG-English -- -- rulescDRKd3020%16%
33POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonecDRKd2872%51%
34POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulescDRKd2875%53%
35POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonecDRKd3070%50%
36POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulescDRKd2875%53%
37POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R-adagram -- -- rulescDRKd3079%55%
38POC-English-AmbR=6-Weight=1-mst-weight=+1:R -- -- nonecDRKd2079%56%
39POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- nonecDRKd2471%49%
40POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- rulescDRKd2080%56%
41POC-English-disAmbR=6-Weight=1-mst-weight=+1:R-adagram -- -- rulescDRKd2278%52%
42POC-English-AmbLG-ANY-all-parses -- -- nonecDRKd2387%59%
43POC-English-disAmbLG-ANY-all-parses -- -- nonecDRKd2595%65%
44POC-English-disAmbLG-ANY-all-parses -- -- rulescDRKd2895%67%
45POC-English-disAmbLG-ANY-all-parses-adagram -- -- rulescDRKd2489%64%
2018-08-09 18:24:43 UTC

Disjuncts-DRK-Disjuncts

In [7]:
%%capture
kwargs['context'] = 2
average23, long23 = table_damb(lines, out_dir, cps, rps, runs, **kwargs)
table.extend(average23)
long_table.extend(long23)
In [8]:
display(html_table([header]+average23))
print(UTC())
LineCorpusParsingLW"."GeneralizationSpaceRulesPAPQ
26POC-English-AmbMST-fixed-manuallyLW + nonedDRKd340%0%
27POC-English-AmbLG-EnglishLW + nonedDRKd46%2%
28POC-English-AmbR=6-Weight=6:R-mst-weight=+1:RLW + nonedDRKd3182%50%
29POC-English-AmbMST-fixed-manually -- -- nonedDRKd3038%33%
30POC-English-AmbMST-fixed-manually -- -- rulesdDRKd2840%34%
31POC-English-AmbLG-English -- -- nonedDRKd3418%15%
32POC-English-AmbLG-English -- -- rulesdDRKd2218%15%
33POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonedDRKd693%62%
34POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulesdDRKd693%62%
35POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonedDRKd3863%46%
36POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulesdDRKd3667%51%
37POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R-adagram -- -- rulesdDRKd497%70%
38POC-English-AmbR=6-Weight=1-mst-weight=+1:R -- -- nonedDRKd2075%55%
39POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- nonedDRKd2456%41%
40POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- rulesdDRKd2361%46%
41POC-English-disAmbR=6-Weight=1-mst-weight=+1:R-adagram -- -- rulesdDRKd3352%41%
42POC-English-AmbLG-ANY-all-parses -- -- nonedDRKd598%64%
43POC-English-disAmbLG-ANY-all-parses -- -- nonedDRKd2291%63%
44POC-English-disAmbLG-ANY-all-parses -- -- rulesdDRKd2095%67%
45POC-English-disAmbLG-ANY-all-parses-adagram -- -- rulesdDRKd3373%57%
2018-08-09 18:25:49 UTC

Disjuncts-ILE-Disjuncts

In [9]:
%%capture
kwargs['word_space'] = 'discrete'
kwargs['clustering'] = 'group'
average24, long24 = table_damb(lines, out_dir, cps, rps, runs, **kwargs)
table.extend(average24)
long_table.extend(long24)
In [10]:
display(html_table([header]+average24))
print(UTC())
LineCorpusParsingLW"."GeneralizationSpaceRulesPAPQ
26POC-English-AmbMST-fixed-manuallyLW + nonedILEd390%0%
27POC-English-AmbLG-EnglishLW + nonedILEd390%0%
28POC-English-AmbR=6-Weight=6:R-mst-weight=+1:RLW + nonedILEd4067%45%
29POC-English-AmbMST-fixed-manually -- -- nonedILEd3736%32%
30POC-English-AmbMST-fixed-manually -- -- rulesdILEd2840%34%
31POC-English-AmbLG-English -- -- nonedILEd3718%14%
32POC-English-AmbLG-English -- -- rulesdILEd3118%15%
33POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonedILEd3861%44%
34POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulesdILEd3475%53%
35POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonedILEd3963%46%
36POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulesdILEd3667%51%
37POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R-adagram -- -- rulesdILEd3670%52%
38POC-English-AmbR=6-Weight=1-mst-weight=+1:R -- -- nonedILEd3953%42%
39POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- nonedILEd4147%38%
40POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- rulesdILEd3752%42%
41POC-English-disAmbR=6-Weight=1-mst-weight=+1:R-adagram -- -- rulesdILEd3952%41%
42POC-English-AmbLG-ANY-all-parses -- -- nonedILEd3874%52%
43POC-English-disAmbLG-ANY-all-parses -- -- nonedILEd3989%61%
44POC-English-disAmbLG-ANY-all-parses -- -- rulesdILEd3395%67%
45POC-English-disAmbLG-ANY-all-parses-adagram -- -- rulesdILEd3770%56%
2018-08-09 18:25:53 UTC

All tests (all entries for multi-test runs > (1.1))

In [11]:
display(html_table([header]+long_table))
LineCorpusParsingLW"."GeneralizationSpaceRulesPAPQ
26POC-English-AmbMST-fixed-manuallyLW + nonecDRKc 36 70%61%
27POC-English-AmbLG-EnglishLW + nonecDRKc 36 81%62%
28POC-English-AmbR=6-Weight=6:R-mst-weight=+1:RLW + nonecDRKc 33 90%58%
29POC-English-AmbMST-fixed-manually -- -- nonecDRKc 34 73%65%
31POC-English-AmbLG-English -- -- nonecDRKc 33 84%67%
33POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonecDRKc 30 85%54%
35POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonecDRKc 28 86%54%
38POC-English-AmbR=6-Weight=1-mst-weight=+1:R -- -- nonecDRKc 20 86%56%
39POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- nonecDRKc 26 88%57%
42POC-English-AmbLG-ANY-all-parses -- -- nonecDRKc 26 88%57%
43POC-English-disAmbLG-ANY-all-parses -- -- nonecDRKc 27 86%56%
26POC-English-AmbMST-fixed-manuallyLW + nonecDRKd 34 0%0%
27POC-English-AmbLG-EnglishLW + nonecDRKd 36 0%0%
28POC-English-AmbR=6-Weight=6:R-mst-weight=+1:RLW + nonecDRKd 33 75%49%
29POC-English-AmbMST-fixed-manually -- -- nonecDRKd 34 37%33%
30POC-English-AmbMST-fixed-manually -- -- rulescDRKd 27 40%34%
31POC-English-AmbLG-English -- -- nonecDRKd 33 20%16%
32POC-English-AmbLG-English -- -- rulescDRKd 30 20%16%
33POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonecDRKd 28 72%51%
34POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulescDRKd 28 75%53%
35POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonecDRKd 30 70%50%
36POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulescDRKd 28 75%53%
37POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R-adagram -- -- rulescDRKd 30 79%55%
38POC-English-AmbR=6-Weight=1-mst-weight=+1:R -- -- nonecDRKd 20 79%56%
39POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- nonecDRKd 24 71%49%
40POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- rulescDRKd 20 80%56%
41POC-English-disAmbR=6-Weight=1-mst-weight=+1:R-adagram -- -- rulescDRKd 22 78%52%
42POC-English-AmbLG-ANY-all-parses -- -- nonecDRKd 23 87%59%
43POC-English-disAmbLG-ANY-all-parses -- -- nonecDRKd 25 95%65%
44POC-English-disAmbLG-ANY-all-parses -- -- rulescDRKd 28 95%67%
45POC-English-disAmbLG-ANY-all-parses-adagram -- -- rulescDRKd 24 89%64%
26POC-English-AmbMST-fixed-manuallyLW + nonedDRKd 34 0%0%
27POC-English-AmbLG-EnglishLW + nonedDRKd 4 6%2%
28POC-English-AmbR=6-Weight=6:R-mst-weight=+1:RLW + nonedDRKd 31 82%50%
29POC-English-AmbMST-fixed-manually -- -- nonedDRKd 30 38%33%
30POC-English-AmbMST-fixed-manually -- -- rulesdDRKd 28 40%34%
31POC-English-AmbLG-English -- -- nonedDRKd 34 18%15%
32POC-English-AmbLG-English -- -- rulesdDRKd 22 18%15%
33POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonedDRKd 6 93%62%
34POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulesdDRKd 6 93%62%
35POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonedDRKd 38 63%46%
36POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulesdDRKd 36 67%51%
37POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R-adagram -- -- rulesdDRKd 4 97%70%
38POC-English-AmbR=6-Weight=1-mst-weight=+1:R -- -- nonedDRKd 20 75%55%
39POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- nonedDRKd 24 56%41%
40POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- rulesdDRKd 23 61%46%
41POC-English-disAmbR=6-Weight=1-mst-weight=+1:R-adagram -- -- rulesdDRKd 33 52%41%
42POC-English-AmbLG-ANY-all-parses -- -- nonedDRKd 5 98%64%
43POC-English-disAmbLG-ANY-all-parses -- -- nonedDRKd 22 91%63%
44POC-English-disAmbLG-ANY-all-parses -- -- rulesdDRKd 20 95%67%
45POC-English-disAmbLG-ANY-all-parses-adagram -- -- rulesdDRKd 33 73%57%
26POC-English-AmbMST-fixed-manuallyLW + nonedILEd 39 0%0%
27POC-English-AmbLG-EnglishLW + nonedILEd 39 0%0%
28POC-English-AmbR=6-Weight=6:R-mst-weight=+1:RLW + nonedILEd 40 67%45%
29POC-English-AmbMST-fixed-manually -- -- nonedILEd 37 36%32%
30POC-English-AmbMST-fixed-manually -- -- rulesdILEd 28 40%34%
31POC-English-AmbLG-English -- -- nonedILEd 37 18%14%
32POC-English-AmbLG-English -- -- rulesdILEd 31 18%15%
33POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonedILEd 38 61%44%
34POC-English-AmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulesdILEd 34 75%53%
35POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- nonedILEd 39 63%46%
36POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R -- -- rulesdILEd 36 67%51%
37POC-English-disAmbR=6-Weight=6:R-mst-weight=+1:R-adagram -- -- rulesdILEd 36 70%52%
38POC-English-AmbR=6-Weight=1-mst-weight=+1:R -- -- nonedILEd 39 53%42%
39POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- nonedILEd 41 47%38%
40POC-English-disAmbR=6-Weight=1-mst-weight=+1:R -- -- rulesdILEd 37 52%42%
41POC-English-disAmbR=6-Weight=1-mst-weight=+1:R-adagram -- -- rulesdILEd 39 52%41%
42POC-English-AmbLG-ANY-all-parses -- -- nonedILEd 38 74%52%
43POC-English-disAmbLG-ANY-all-parses -- -- nonedILEd 39 89%61%
44POC-English-disAmbLG-ANY-all-parses -- -- rulesdILEd 33 95%67%
45POC-English-disAmbLG-ANY-all-parses-adagram -- -- rulesdILEd 37 70%56%
In [12]:
from write_files import list2file
print(UTC(), ':: finished, elapsed', str(round((time.time()-start)/3600, 1)), 'hours')
table_str = list2file(table, out_dir+'/short_table.txt')
if runs == (1,1):
    print('Results saved to', out_dir + '/short_table.txt')
else:
    long_table_str = list2file(long_table, out_dir+'/long_table.txt')
    print('Average results saved to', out_dir + '/short_table.txt\n'
          'Detailed results for every run saved to', out_dir + '/long_table.txt')
2018-08-09 18:25:53 UTC :: finished, elapsed 0.6 hours
Results saved to /home/obaskov/language-learning/output/POC-English-Amb-2018-08-09/short_table.txt