$ cat gram/7.pcfg S: "a" B "a" "a" C "a" ; B: "b" [0.67] | "b" B [0.33] ; C: "c" [0.67] | "c" C [0.33] ; $ ./pcfg-generate-seq -i1 -n1000 -o seq/7-1k.seq gram/7.pcfg $ cat gram/7.rg S: . (.*) . . (.*) . ; $ ./topdown -i1 -n5000 --det-niter-goal=50 --od=td-learn/7_det.rg \ --oo=td-learn/7.log gram/7.rg seq/7-1k.seq $ ./topdown -i1 -n5000 --od=td-learn/7_out.rg --op=td-learn/7_out.pcfg \ --oo=- --simplify td-learn/7_det.rg seq/7-1k.seq Iteration 1: P: prob_gram 0.75566371, prob_term 1.00000000, prob_wpredict 0.85044431, prob_npredict 0.85060000, cycle_period 0 T: prob_gram 0.75566371, prob_term 1.00000000, prob_wpredict 0.85044431, prob_npredict 0.85060000, cycle_period 0 Finished.
$ cat td-learn/7_out.rg S: . ([^ "a" ]*) "a" . ([^ "a" ]*) "a" ;
$ cat td-learn/7_out.pcfg S: "a" _S_2A "a" "a" _S_5A "a" // 712 ; _S_2A: _S_2A "b" [0.59371429] // 1039 | [0.40628571] // 711 ; // 1750 _S_5A: _S_5A "c" [0.61083744] // 1116 | [0.38916256] // 711 ; // 1827
$ ./topdown -i-1 -n5000 --os=seq/7_random.seq --oo=- gram/7.rg seq/7-1k.seq [0]: prob_gram 0.42542803, prob_term 0.31487706, prob_wpredict 0.56737304, prob_npredict 0.56620000, cycle_period 32 prob_epredict 0.56620000
$ ./topdown -i1 -n5000 --os=seq/7_predict.seq --oo=- td-learn/7_out.rg seq/7-1k.seq [0]: prob_gram 0.75566371, prob_term 1.00000000, prob_wpredict 0.85044431, prob_npredict 0.85060000, cycle_period 0 prob_epredict 0.85060000
$ ./pcfg-predict-eval --prob-rand=0.56620000 gram/7.pcfg seq/7_predict.seq { "seq_len" : 5000, "wpredict_max" : 4288.85000000, "npredict_actual" : 4253, "wpredict_rand" : 2831.0, "prob_wpredict_max" : 0.85777000, "prob_npredict_actual" : 0.85060000, "prob_npredict_rand" : 0.56620000, "efficiency_rand, %" : 97.5 }