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

"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
.

This notebook is shared as static ILE-GCB-LG-E-noQuotes-2019-04-18.html.
Output data shared via ILE-GCB-LG-E-noQuotes-2019-04-18 directory.
Previous results: ILE-GCB-LG-E-noQuotes-2019-03-25.html, data -- ILE-GCB-LG-E-noQuotes-2019-03-25

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-20 16:55:23 UTC :: module_path: /home/obaskov/94/ULL

Corpus test settings

In [2]:
corpus = 'GCB' # 'Gutenberg-Children-Books-Caps' 
dataset = 'LG-E-noQuotes'  # 'LG-E-clean'
kwargs = {
    'max_sentence_length':  100     ,  # use new ull parses parsing
    'max_unparsed_words' :  10      ,
    'left_wall'     :   ''          ,
    'period'        :   False       ,
    'context'       :   2           ,
    'min_word_count':   2           ,  # error check
    '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'
cp = rp  # corpus path = reference_path
out_dir = module_path + '/output/' + 'ILE-GCB-LG-E-noQuotes-' + str(UTC())[:10]
print(UTC(), '\n', out_dir)
2019-04-20 16:55:23 UTC 
 /home/obaskov/94/ULL/output/ILE-GCB-LG-E-noQuotes-2019-04-20

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

min_word_count = 31, 21, 11, 6

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 [11]:
display(html_table([header] + table))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdwardeuclideannone---187431---0.049%41%0.51[1, 0]
GCBLG-E-noQuotesdILEdwardeuclideannone---257021---0.052%45%0.55[1, 0]
GCBLG-E-noQuotesdILEdwardeuclideannone---415111---0.056%50%0.6[1, 0]
GCBLG-E-noQuotesdILEdwardeuclideannone---64826---0.060%54%0.64[5, 1, 0]
In [12]:
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-21 01:12:26 UTC :: 4 tests finished, elapsed 8.3 hours
Results saved to /home/obaskov/94/ULL/output/ILE-GCB-LG-E-noQuotes-2019-04-20/all_tests_table.txt

min_word_count = 2

In [13]:
%%capture
kwargs['min_word_count'] = 2
a, _, h, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
table.extend(a)
In [14]:
display(html_table([header] + a))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdwardeuclideannone---135462---0.063%59%0.67[25, 22, 15, 11, 10]

min_word_count = 1

In [17]:
%%capture
kwargs['min_word_count'] = 1
a, _, h, log, rules = wide_rows(line, out_dir, cp, rp, runs, **kwargs)
table.extend(a)
In [18]:
display(html_table([header] + a))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdwardeuclideannone---194321---0.062%60%0.65[419, 173, 170, 80, 67]

Save results

In [19]:
display(html_table([header] + table))
CorpusParsingSpaceLinkageAffinityG12nThresholdRulesMWCNNSIPAPQF1Top 5 cluster sizes
GCBLG-E-noQuotesdILEdwardeuclideannone---187431---0.049%41%0.51[1, 0]
GCBLG-E-noQuotesdILEdwardeuclideannone---257021---0.052%45%0.55[1, 0]
GCBLG-E-noQuotesdILEdwardeuclideannone---415111---0.056%50%0.6[1, 0]
GCBLG-E-noQuotesdILEdwardeuclideannone---64826---0.060%54%0.64[5, 1, 0]
GCBLG-E-noQuotesdILEdwardeuclideannone---135462---0.063%59%0.67[25, 22, 15, 11, 10]
GCBLG-E-noQuotesdILEdwardeuclideannone---194321---0.062%60%0.65[419, 173, 170, 80, 67]
In [20]:
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-21 16:22:29 UTC :: 6 tests finished, elapsed 23.5 hours
Results saved to /home/obaskov/94/ULL/output/ILE-GCB-LG-E-noQuotes-2019-04-20/all_tests_table.txt