ALE clustering Gutenberg Children Books 2019-04-02 MWC=1

"Gutenberg Children Books" corpus, new "LG-E-noQuotes" dataset (GC_LGEnglish_noQuotes_fullyParsed.ull),
trash filter off: min_word_count = 1, max_sentence_length off; 50/500/1000/2000 clusters, Link Grammar 5.5.1

Server 94, fresh clone, repo last update 2018-03-25, ull environment: Repeat line 51 of ULL Project Plan / parses

This notebook is shared as static cALEd-GCB-LG-E-noQuotes-LG_551-MWC=1-S94-2019-04-02.html.
Output data shared via cALEd-GCB-LG-E-noQuotes-LG_551-MWC=1-S94-2019-04-02 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-02 15:16:55 UTC :: module_path: /home/obaskov/94/language-learning

Corpus test settings

In [15]:
corpus = 'GCB' # 'Gutenberg-Children-Books-Caps' 
dataset = 'LG-E-noQuotes'  # 'LG-E-clean'
kwargs = {
    # 'max_sentence_length' :   25  ,
    # 'max_unparsed_words'  :   0   ,
    'left_wall'     :   ''          ,
    'period'        :   False       ,
    'context'       :   1           ,
    'min_word_count':   1           ,
    'word_space'    :   'sparse'    ,
    'clustering'    :   ['agglomerative', 'ward'],
    'clustering_metric' : ['silhouette', 'cosine'],
    'cluster_range' :   500         ,   # 50/500/1000/2000
    'top_level'     :   0.01        ,
    'grammar_rules' :   2           ,
    'max_disjuncts' :   1000000     ,   # off
    'stop_words'    :   []          ,
    'tmpath'        :   tmpath      ,
    'verbose'       :   'log+'      ,
    'template_path' :   'poc-turtle',
    'linkage_limit' :   1000        }
rp = module_path + '/data/' + corpus + '/LG-E-noQuotes/'
cp = rp  # corpus path = reference_path
runs = (1,1)
out_dir = module_path + '/output/' + 'cALEd-GCB-LG-E-noQuotes-LG_551-MWC=1-S94-' + str(UTC())[:10]
if check_corpus(rp, 'min'): print(UTC(), '\n', out_dir)
2019-04-03 03:16:02 UTC 
 /home/obaskov/94/language-learning/output/cALEd-GCB-LG-E-noQuotes-LG_551-MWC=1-S94-2019-04-03

Tests: min_word_count = 1; 50/500/1000/2000 clusters

In [3]:
%%capture
table = []
kwargs['cluster_range'] = 50
line = [['ALE50', corpus, dataset, 0, 0, 'none']]
a, _, header, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
header[0] = 'ALE'
table.extend(a)
In [4]:
display(html_table([header] + a)); print(test_stats(log))
ALECorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
ALE50GCBLG-E-noQuotescALWEdwardeuclideannone---501---0.089%61%0.65[10050, 7610, 1683, 1370, 539]
Cleaned dictionary: 22641 words, grammar learn time: 02:15:39, grammar test time: 01:12:24
In [6]:
display(html_table([header] + a)); print(test_stats(log))
ALECorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
ALE500GCBLG-E-noQuotescALWEdwardeuclideannone---5001---0.068%63%0.69[5292, 1438, 823, 821, 649]
Cleaned dictionary: 22641 words, grammar learn time: 02:20:52, grammar test time: 00:24:44
In [8]:
display(html_table([header] + a)); print(test_stats(log))
CellCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
ALE1000GCBLG-E-noQuotescALWEdwardeuclideannone---10001---0.065%62%0.68[4151, 1007, 686, 653, 398]
Cleaned dictionary: 22641 words, grammar learn time: 02:23:23, grammar test time: 00:22:25
In [12]:
display(html_table([header] + a)); print(test_stats(log))
CellCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
ALE2000GCBLG-E-noQuotescALWEdwardeuclideannone---20001---0.063%60%0.66[3315, 601, 588, 521, 481]
Cleaned dictionary: 22641 words, grammar learn time: 02:36:58, grammar test time: 00:22:36

Save results

In [13]:
display(html_table([header] + table))
CellCorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
ALE50GCBLG-E-noQuotescALWEdwardeuclideannone---501---0.089%61%0.65[10050, 7610, 1683, 1370, 539]
ALE500GCBLG-E-noQuotescALWEdwardeuclideannone---5001---0.068%63%0.69[5292, 1438, 823, 821, 649]
ALE1000GCBLG-E-noQuotescALWEdwardeuclideannone---10001---0.065%62%0.68[4151, 1007, 686, 653, 398]
ALE2000GCBLG-E-noQuotescALWEdwardeuclideannone---20001---0.063%60%0.66[3315, 601, 588, 521, 481]
In [14]:
print(UTC(), ':: 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-03 03:16:02 UTC :: finished, elapsed 12.0 hours
Results saved to /home/obaskov/94/language-learning/output/cALEd-GCB-LG-E-noQuotes-LG_551-MWC=1-S94-2019-04-02/all_tests_table.txt