ALE "Gutenberg Children Books" 2019-04-04 50_clusters

"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
.
Server 94, fresh clone of singnet repository, fresh ull environment ~ 2018-03-18 Check 2018-04-03 results for MWC=1

This notebook is shared as static cALEd-50-GCB-LG-E-noQuotes-2019-04-04.html.
Output data shared via cALEd-50-GCB-LG-E-noQuotes-2019-04-04 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-04 10:51:05 UTC :: module_path: /home/obaskov/94/language-learning

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' :   [50]        ,
    '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/GC_LGEnglish_noQuotes_fullyParsed.ull'
cp = rp  # corpus path = reference_path
out_dir = module_path + '/output/' + 'cALEd-50-GCB-LG-E-noQuotes-' + str(UTC())[:10]
print(UTC(), '\n', out_dir)
2019-04-04 10:51:05 UTC 
 /home/obaskov/94/language-learning/output/cALEd-50-GCB-LG-E-noQuotes-2019-04-04

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

min_word_count = 31, 21, 11

In [3]:
%%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 [4]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---5031---0.080%53%0.59[949, 738, 307, 240, 217]
Cleaned dictionary: 3341 words, grammar learn time: 00:01:19, grammar test time: 00:52:40
In [6]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---5021---0.082%55%0.61[1309, 1225, 407, 364, 340]
Cleaned dictionary: 4417 words, grammar learn time: 00:02:16, grammar test time: 01:03:53
In [8]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---5011---0.085%58%0.63[2447, 2256, 542, 525, 414]
Cleaned dictionary: 6866 words, grammar learn time: 00:05:25, grammar test time: 01:12:58
In [12]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---506---0.088%59%0.64[3686, 3002, 1408, 785, 397]
Cleaned dictionary: 10053 words, grammar learn time: 00:14:45, grammar test time: 01:24:00
In [16]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---502---0.089%61%0.65[14869, 1423, 706, 686, 616]
Cleaned dictionary: 19326 words, grammar learn time: 01:29:11, grammar test time: 01:28:00
In [20]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---501---0.089%61%0.65[10050, 7610, 1683, 1370, 539]
Cleaned dictionary: 22641 words, grammar learn time: 02:13:52, grammar test time: 01:11:21

Save results

In [21]:
display(html_table([header] + table))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotescALWEdwardeuclideannone---5031---0.080%53%0.59[949, 738, 307, 240, 217]
GCBLG-E-noQuotescALWEdwardeuclideannone---5021---0.082%55%0.61[1309, 1225, 407, 364, 340]
GCBLG-E-noQuotescALWEdwardeuclideannone---5011---0.085%58%0.63[2447, 2256, 542, 525, 414]
GCBLG-E-noQuotescALWEdwardeuclideannone---506---0.088%59%0.64[3686, 3002, 1408, 785, 397]
GCBLG-E-noQuotescALWEdwardeuclideannone---502---0.089%61%0.65[14869, 1423, 706, 686, 616]
GCBLG-E-noQuotescALWEdwardeuclideannone---501---0.089%61%0.65[10050, 7610, 1683, 1370, 539]
In [22]:
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-04 22:10:53 UTC :: 6 tests finished, elapsed 11.3 hours
Results saved to /home/obaskov/94/language-learning/output/cALEd-50-GCB-LG-E-noQuotes-2019-04-04/all_tests_table.txt