Skip to content

Instantly share code, notes, and snippets.

View awwong1's full-sized avatar
🕳️
some

Alexander Wong awwong1

🕳️
some
View GitHub Profile
This file has been truncated, but you can view the full file.
{
"class" : "HiddenMarkovModel",
"name" : "LabelTrainedJaveTokenHMM",
"start" : {
"class" : "State",
"distribution" : null,
"name" : "LabelTrainedJaveTokenHMM-start",
"weight" : 1.0
},
"end" : {
from model.hmm_pom import Trained10StateHMM, Trained100StateHMM
from model.ngram import KenLM10Gram
from analyze.parser import SourceCodeParser
TEST_SRC = """
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
$ ./insyn.py --test-atn-hmm-model expMultinomialHMM(algorithm='viterbi', init_params='ste', n_components=1133,
n_iter=10, params='ste', random_state=None,
startprob_prior=array([1., 0., ..., 0., 0.]), tol=0.01,
transmat_prior=array([[0., 1., ..., 0., 0.],
[0., 0., ..., 0., 0.],
...,
[0., 0., ..., 0., 0.],
[0., 0., ..., 0., 0.]]),
verbose=True)
idx: 1/44 score: -2.639058036757866
@awwong1
awwong1 / insyn fix output.txt
Created November 28, 2018 22:22
insyn fix output
$ ./insyn.py --log info --test-ngram-model example/HelloWorld.java
Loading the LM will be faster if you build a binary file.
Reading /home/alexander/sandbox/src/github.com/awwong1/cmput563_insyn/model/java-tokenstr-10grams.arpa
----5---10---15---20---25---30---35---40---45---50---55---60---65---70---75---80---85---90---95--100
****************************************************************************************************
PUBLIC CLASS IDENTIFIER LBRACE PUBLIC STATIC VOID IDENTIFIER LPAREN IDENTIFIER LBRACKET RBRACKET IDENTIFIER RPAREN LBRACE IF LPAREN TRUE RPAREN LBRACE IDENTIFIER DOT IDENTIFIER DOT IDENTIFIER LPAREN STRINGLITERAL RPAREN SEMI RBRACE RBRACE RBRACE EOF
example/HelloWorld.java: MOD from LBRACE to INTLITERAL at 3
INFO:analyze.ngram_tester:suggest MOD INTLITERAL into LBRACE at 3 (score: -12.189971923828125)
INFO:analyze.ngram_tester:suggest DEL INTLITERAL at 3 (score: -21.153898239135742)
INFO:analyze.ngram_tester:suggest MOD INTLITERAL into LPAREN at 3 (score: -21.760189056396484)
@awwong1
awwong1 / hhmm output
Created November 26, 2018 15:48
hhmm output
$ ./model/HHMM.py
./model/HHMM.py:111: RuntimeWarning: invalid value encountered in true_divide
PI[col, row, :] = np.nan_to_num(PI[col, row, :] / np.sum(PI[col, row, :]))
./model/HHMM.py:110: RuntimeWarning: invalid value encountered in true_divide
A[col, row, :] = np.nan_to_num(A[col, row, :] / np.sum(A[col, row, :]))
Training iteration 0
./model/HHMM.py:157: RuntimeWarning: invalid value encountered in true_divide
ergPIVis[col, row, :] = np.nan_to_num(ergPI[col, row, :] / np.sum(ergPI[col, row, :]))
./model/HHMM.py:156: RuntimeWarning: invalid value encountered in true_divide
ergAVis[col, row, :] = np.nan_to_num(ergA[col, row, :] / np.sum(ergA[col, row, :]))
@awwong1
awwong1 / hhmm.png
Last active November 19, 2018 19:39
HHMM Example
hhmm.png
$ ./insyn.py --parse-example --db-offset 0
============== SOURCE CODE ==============
package com.cl.interpolatordebugger;
import android.app.Application;
import android.test.ApplicationTestCase;
/**
* <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a>
*/
@awwong1
awwong1 / q_ex.m
Created November 14, 2018 04:51
HHMM paper figure 3 bottom
```
q(:,:,1) = [1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
1 1 1 1 1 1 1 2 0 0 0 0 0 0 0 0 0;
1 1 1 1 2 1 1 1 1 1 1 2 1 1 1 1 2;
1 1 2 1 1 1 1 1 1 2 1 1 1 1 2 0 0];
q(:,:,2) = [8 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
0 5 0 7 0 0 5 0 0 0 0 0 0 0 0 0 0;
0 0 0 3 0 7 0 0 0 0 0 5 0 0 0 0 0;
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
```
@awwong1
awwong1 / .block
Last active November 12, 2018 20:20
D3 Workshop: Part 3 - Conference Data
license: mit
@awwong1
awwong1 / .block
Last active November 12, 2018 19:35
D3 Workshop: Part 2 - SVGs and d3 Transitions
license: mit