ALE "Gutenberg Children Books" 2019-04-24 500_clusters

"Gutenberg Children Books" corpus, new "sequential_parses.ull" dataset,
trash filter off: min_word_count = 31,21,11,6,2,1, max_sentence_length off, Link Grammar 5.5.1
.
Server 94, fresh clone of singnet repository 2019-04-03, fresh ull environment ~ 2018-03-18

This notebook is shared as static cALEd-500-GCB-sequential_parses-2019-04-24.html.
Output data shared via cALEd-500-GCB-sequential_parses-2019-04-24 directory.

Basic settings

In [1]:
import os, sys, time
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path: sys.path.append(module_path)
from src.grammar_learner.utl import UTC, test_stats
from src.grammar_learner.read_files import check_dir, check_corpus
from src.grammar_learner.write_files import list2file
from src.grammar_learner.widgets import html_table
from src.grammar_learner.pqa_table import table_rows, params, wide_rows
tmpath = module_path + '/tmp/'
check_dir(tmpath, True, 'none')
start = time.time()
runs = (1,1)
print(UTC(), ':: module_path:', module_path)
2019-04-24 18:12:37 UTC :: module_path: /home/obaskov/94/ULL

Corpus test settings

In [2]:
corpus = 'GCB' # 'Gutenberg-Children-Books' 
dataset = 'LG-551-sequential-parses'  # 'LG-E-clean'
kwargs = {
    'left_wall'     :   ''          ,
    'period'        :   False       ,
    'context'       :   1           ,   # 1: connector-based word space
    'min_word_count':   1           ,   # 31,21,11,6,1
    'word_space'    :   'sparse'    ,
    'clustering'    :   ['agglomerative', 'ward'],
    'clustering_metric' : ['silhouette', 'cosine'],
    'cluster_range' :   [500]        ,
    'top_level'     :   0.01        ,
    'grammar_rules' :   2           ,   # disjunct-based grammar rules
    'max_disjuncts' :   1000000     ,   # off
    'stop_words'    :   []          ,
    'tmpath'        :   tmpath      ,
    'verbose'       :   '+'      ,
    'template_path' :   'poc-turtle',
    'linkage_limit' :   1000        }
rp = module_path + '/data/GCB/LG-E-noQuotes/GC_LGEnglish_noQuotes_fullyParsed.ull'
cp = rp  # corpus path = reference_path
out_dir = module_path + '/output/' + 'cALEd-500-GCB-sequential_parses-' + str(UTC())[:10]
print(UTC(), '\n', out_dir)
2019-04-24 18:12:37 UTC 
 /home/obaskov/94/ULL/output/cALEd-500-GCB-sequential_parses-2019-04-24

Tests: min_word_count = 31, 21, 11, 6, 2, 1

Check IndexError with min_word_count = 1

In [3]:
#%%capture
table = []
line = [['', corpus, dataset, 0, 0, 'none']]
kwargs['min_word_count'] = 1 # 31
a, _, header, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
header[0] = ''
table.extend(a)
Overal execution:   0%|          | 0/68826 [00:00<?, ?it/s]
GC_LGEnglish_noQuotes_fullyParsed.ull:   0%|          | 0/68826 [00:00<?, ?sentences/s]

Overal execution: 100%|##########| 68826/68826 [41:00<00:00, 27.97it/s]
GC_LGEnglish_noQuotes_fullyParsed.ull: 100%|##########| 68826/68826 [40:58<00:00, 27.99sentences/s]


Overal execution: 100%|##########| 68826/68826 [41:00<00:00, 27.97it/s]
In [4]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1
GCBLG-551-sequential-parsescALWEdwardeuclideannone---5001---0.083%51%0.55[3590, 2633, 1942, 1189, 933]
Cleaned dictionary: 30264 words, grammar learn time: 05:26:36, grammar test time: 00:41:01

min_word_count = 31, 21, 11, 6, 2

In [5]:
%%capture
table = []
line = [['', corpus, dataset, 0, 0, 'none']]
kwargs['min_word_count'] = 31
a, _, header, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
header[0] = ''
table.extend(a)
In [6]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1
GCBLG-551-sequential-parsescALWEdwardeuclideannone---50031---0.074%44%0.49[334, 259, 251, 239, 219]
Cleaned dictionary: 4829 words, grammar learn time: 00:12:49, grammar test time: 00:33:41
In [8]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1
GCBLG-551-sequential-parsescALWEdwardeuclideannone---50021---0.076%45%0.51[484, 299, 286, 283, 241]
Cleaned dictionary: 6279 words, grammar learn time: 00:13:40, grammar test time: 00:35:27
In [10]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1
GCBLG-551-sequential-parsescALWEdwardeuclideannone---50011---0.079%48%0.53[512, 478, 468, 465, 464]
Cleaned dictionary: 9480 words, grammar learn time: 00:21:13, grammar test time: 00:38:23
In [14]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1
GCBLG-551-sequential-parsescALWEdwardeuclideannone---5006---0.081%49%0.54[764, 691, 623, 614, 597]
Cleaned dictionary: 13754 words, grammar learn time: 00:43:24, grammar test time: 00:38:04
In [18]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1
GCBLG-551-sequential-parsescALWEdwardeuclideannone---5002---0.083%51%0.55[3037, 2433, 1627, 997, 904]
Cleaned dictionary: 28018 words, grammar learn time: 04:32:03, grammar test time: 00:41:21

Save results

In [19]:
display(html_table([header] + table))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1
GCBLG-551-sequential-parsescALWEdwardeuclideannone---50031---0.074%44%0.49[334, 259, 251, 239, 219]
GCBLG-551-sequential-parsescALWEdwardeuclideannone---50021---0.076%45%0.51[484, 299, 286, 283, 241]
GCBLG-551-sequential-parsescALWEdwardeuclideannone---50011---0.079%48%0.53[512, 478, 468, 465, 464]
GCBLG-551-sequential-parsescALWEdwardeuclideannone---5006---0.081%49%0.54[764, 691, 623, 614, 597]
GCBLG-551-sequential-parsescALWEdwardeuclideannone---5002---0.083%51%0.55[3037, 2433, 1627, 997, 904]
In [20]:
print(UTC(), ':: 5 tests finished, elapsed', str(round((time.time()-start)/3600.0, 1)), 'hours')
table_str = list2file(table, out_dir + '/all_tests_table.txt')
print('Results saved to', out_dir + '/all_tests_table.txt')
2019-04-25 09:30:42 UTC :: 5 tests finished, elapsed 15.3 hours
Results saved to /home/obaskov/94/ULL/output/cALEd-500-GCB-sequential_parses-2019-04-24/all_tests_table.txt