ILE clustering "Gutenberg Children Books" 2019-04-02

"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: check 2019-03-25 error 255 with MWC=2

This notebook is shared as static ILE-GCB-LG-E-noQuotes-LG_551-S94-2019-04-02.html.
Output data shared via ILE-GCB-LG-E-noQuotes-LG_551-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:17:06 UTC :: module_path: /home/obaskov/94/language-learning

Corpus test settings

In [2]:
corpus = 'GCB' # 'Gutenberg-Children-Books-Caps' 
dataset = 'LG-E-noQuotes'  # 'LG-E-clean'
kwargs = {
    'left_wall'     :   ''          ,
    'period'        :   False       ,
    'context'       :   2           ,   # 2: disjuncts
    'min_word_count':   1           ,
    'word_space'    :   'discrete'  ,   # 'sparse'    ,
    'clustering'    :   'group'     ,   # ('mean_shift', 2),
    'clustering_metric' : ['silhouette', 'cosine'],
    'cluster_range' :   [0]         ,   # auto
    '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/GC_LGEnglish_noQuotes_fullyParsed.ull'
cp = rp  # corpus path = reference_path
out_dir = module_path + '/output/' + 'ILE-GCB-LG-E-noQuotes-LG_551-S94-' + str(UTC())[:10]
print(UTC(), '\n', out_dir)
2019-04-02 15:17:06 UTC 
 /home/obaskov/94/language-learning/output/ILE-GCB-LG-E-noQuotes-LG_551-S94-2019-04-02

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

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-noQuotesdILEdg---none---193631---0.053%46%0.56[1, 0]
grammar learn time: 02:38:51, grammar test time: 00:19:39
In [6]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdg---none---266021---0.055%49%0.59[1, 0]
grammar learn time: 03:16:26, grammar test time: 00:21:53
In [8]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdg---none---425311---0.059%54%0.63[1, 0]
grammar learn time: 03:40:49, grammar test time: 00:22:32
In [12]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdg---none---65786---0.061%57%0.65[5, 1, 0]
grammar learn time: 04:42:49, grammar test time: 00:23:27
In [13]:
display(html_table([header] + table))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdg---none---193631---0.053%46%0.56[1, 0]
GCBLG-E-noQuotesdILEdg---none---266021---0.055%49%0.59[1, 0]
GCBLG-E-noQuotesdILEdg---none---425311---0.059%54%0.63[1, 0]
GCBLG-E-noQuotesdILEdg---none---65786---0.061%57%0.65[5, 1, 0]
In [14]:
print(UTC(), ':: 4 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-03 07:03:36 UTC :: 4 tests finished, elapsed 15.8 hours
Results saved to /home/obaskov/94/language-learning/output/ILE-GCB-LG-E-noQuotes-LG_551-S94-2019-04-02/all_tests_table.txt

min_word_count = 2

In [ ]:
%%capture
kwargs['min_word_count'] = 2
a, _, h, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
table.extend(a)

2019-03-26, 2019-04-03 Error:

ParserError: Process 'link-parser' terminated with exit code: 255 and error message:
'link-grammar: Info: Dictionary found at /home/obaskov/94/language-learning/output/ILE-GCB-LG-E-clean-2019-03-25/GCB_LG-E-noQuotes_dILEd_no-gen_mwc=2/dict_13629C_2019-03-26_0007/4.0.dict
link-grammar: Error: While parsing dictionary /home/obaskov/94/language-learning/output/ILE-GCB-LG-E-clean-2019-03-25/GCB_LG-E-noQuotes_dILEd_no-gen_mwc=2/dict_13629C_2019-03-26_0007/4.0.dict:
Connector, "(", "[", or "{" expected.
     Line 11278, next tokens: ";" "d'aulnoy" ":" "(" "AAPENV-" 
link-grammar: Info: Freeing dictionary /home/obaskov/94/language-learning/output/ILE-GCB-LG-E-clean-2019-03-25/GCB_LG-E-noQuotes_dILEd_no-gen_mwc=2/dict_13629C_2019-03-26_0007/4.0.dict
link-grammar: Fatal error: Unable to open dictionary.
'.

2019-04-03 dict path: /home/obaskov/94/language-learning/output/ILE-GCB-LG-E-noQuotes-LG_551-S94-2019-04-02/GCB_LG-E-noQuotes_dILEd_no-gen_mwc=2/dict_13629C_2019-04-03_0007/4.0.dict; executed in 7h 5m 38s, finished 14:09:14 2019-04-03

min_word_count = 1

Run twice: 2019-03-03 cell results lost due broken pipe, repeated 2019-04-04

In [23]:
%%capture
kwargs['min_word_count'] = 1
a, _, h, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
table.extend(a)
In [24]:
display(html_table([header] + a)); print(test_stats(log))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdg---none---194321---0.062%60%0.65[419, 173, 170, 80, 67]
grammar learn time: 10:15:39, grammar test time: 00:26:04

Save results

In [25]:
display(html_table([header] + table))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdg---none---193631---0.053%46%0.56[1, 0]
GCBLG-E-noQuotesdILEdg---none---266021---0.055%49%0.59[1, 0]
GCBLG-E-noQuotesdILEdg---none---425311---0.059%54%0.63[1, 0]
GCBLG-E-noQuotesdILEdg---none---65786---0.061%57%0.65[5, 1, 0]
GCBLG-E-noQuotesdILEdg---none---194321---0.062%60%0.65[419, 173, 170, 80, 67]
GCBLG-E-noQuotesdILEdg---none---194321---0.062%60%0.65[419, 173, 170, 80, 67]
In [26]:
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 15:21:36 UTC :: 6 tests finished, elapsed 48.1 hours
Results saved to /home/obaskov/94/language-learning/output/ILE-GCB-LG-E-noQuotes-LG_551-S94-2019-04-02/all_tests_table.txt