ALE "Gutenberg Children Books" 2019-04-05 TMWC=51

"Gutenberg Children Books" corpus, new "LG-E-noQuotes" dataset (GC_LGEnglish_noQuotes_fullyParsed.ull),
trash filter off: min_word_count = 31,21,11,6,2,1, max_sentence_length off, Link Grammar 5.5.1;
Test dataset min_word_count = 21
.

This notebook is shared as static TMWC_51_cALEd-500-GCB-LG-E-noQuotes-2019-04-05.html.
Output data shared via TMWC_51_cALEd-500-GCB-LG-E-noQuotes-2019-04-05 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)
out_dir = module_path + '/output/' + 'TMWC_51_cALEd-500-GCB-LG-E-noQuotes-' + str(UTC())[:10]
if check_dir(out_dir, True): print(out_dir[13:])
/94/language-learning/output/TMST_51_cALEd-500-GCB-LG-E-noQuotes_2019-04-05_

Corpus test settings

In [2]:
corpus = 'GCB' # 'Gutenberg-Children-Books' 
dataset = 'LG-E-noQuotes'  # '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'       :   'log+'      ,
    'template_path' :   'poc-turtle',
    'linkage_limit' :   1000        }
#rp = module_path + '/data/GCB/LG-E-noQuotes/'
rp = module_path + \
    '/data/GCB/GCB-LG-E-noQuotes-filtered-parses/GCB-LG-E-noQuotes-MWC=051.ull'
cp = rp  # corpus path = reference_path
if check_dir(rp, False): print(rp[13:])
else: print('Test set not found!')
/94/language-learning/data/GCB/GCB-LG-E-noQuotes-filtered-parses/GCB-LG-E-noQuotes-MWC=051.ull

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

In [3]:
%%capture
table = []
line = [['', corpus, dataset, 0, 0, 'none']]
kwargs['min_word_count'] = 51
a, _, header, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
header[0] = ''
table.extend(a)
In [4]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---50051---0.080%75%0.81[139, 103, 91, 85, 81]
Cleaned dictionary: 2297 words, grammar learn time: 00:04:53, grammar test time: 00:03:18
In [6]:
display(html_table([header] + a)); print(test_stats(log))
LineCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---50031---0.080%74%0.8[264, 217, 157, 148, 134]
Cleaned dictionary: 3341 words, grammar learn time: 00:05:58, grammar test time: 00:03:29
In [8]:
display(html_table([header] + a)); print(test_stats(log))
LineCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---50021---0.080%74%0.8[332, 303, 264, 234, 208]
Cleaned dictionary: 4417 words, grammar learn time: 00:06:31, grammar test time: 00:03:36
In [10]:
display(html_table([header] + a)); print(test_stats(log))
LineCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---50011---0.079%74%0.8[384, 378, 344, 313, 271]
Cleaned dictionary: 6866 words, grammar learn time: 00:10:25, grammar test time: 00:03:58
In [14]:
display(html_table([header] + a)); print(test_stats(log))
LineCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---5006---0.078%73%0.79[824, 453, 444, 399, 364]
Cleaned dictionary: 10053 words, grammar learn time: 00:21:29, grammar test time: 00:04:15
In [18]:
display(html_table([header] + a)); print(test_stats(log))
LineCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---5002---0.077%73%0.78[2729, 1318, 1212, 608, 518]
Cleaned dictionary: 19326 words, grammar learn time: 01:37:34, grammar test time: 00:04:01
In [22]:
display(html_table([header] + a)); print(test_stats(log))
LineCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---5001---0.076%73%0.78[5292, 1438, 823, 821, 649]
Cleaned dictionary: 22641 words, grammar learn time: 02:21:12, grammar test time: 00:03:50

Save results

In [23]:
display(html_table([header] + table))
LineCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---50051---0.080%75%0.81[139, 103, 91, 85, 81]
GCBLG-E-noQuotescALWEdwardeuclideannone---50031---0.080%74%0.8[264, 217, 157, 148, 134]
GCBLG-E-noQuotescALWEdwardeuclideannone---50021---0.080%74%0.8[332, 303, 264, 234, 208]
GCBLG-E-noQuotescALWEdwardeuclideannone---50011---0.079%74%0.8[384, 378, 344, 313, 271]
GCBLG-E-noQuotescALWEdwardeuclideannone---5006---0.078%73%0.79[824, 453, 444, 399, 364]
GCBLG-E-noQuotescALWEdwardeuclideannone---5002---0.077%73%0.78[2729, 1318, 1212, 608, 518]
GCBLG-E-noQuotescALWEdwardeuclideannone---5001---0.076%73%0.78[5292, 1438, 823, 821, 649]
In [24]:
print(UTC(), ':: 6 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-05 23:57:55 UTC :: 6 tests finished, elapsed 5.2 hours
Results saved to /home/obaskov/94/language-learning/output/TMST_51_cALEd-500-GCB-LG-E-noQuotes_2019-04-05_/all_tests_table.txt