Module Expr Str Import alias identifier Import alias identifier ImportFrom alias Import alias identifier ImportFrom alias ImportFrom alias Assign TupleStore NameStore NameStore Call NameLoad keyword Num keyword Num Assign NameStore Call NameLoad keyword Num Assign NameStore Call AttributeLoad NameLoad attr keyword NameLoad keyword Num keyword Num keyword Num Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Print BinOpMod Str Call AttributeLoad NameLoad attr NameLoad NameLoad Assign TupleStore NameStore NameStore NameStore TupleLoad SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num SubscriptLoad NameLoad Index Num Assign NameStore Call AttributeLoad NameLoad attr SubscriptLoad AttributeLoad NameLoad attr Slice Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Num Num keyword TupleLoad Num Num Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Call AttributeLoad NameLoad attr NameLoad keyword Num Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Assign NameStore Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad NameLoad AttributeLoad NameLoad attr Assign NameStore Call AttributeLoad NameLoad attr AttributeLoad NameLoad attr Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad Expr Call AttributeLoad NameLoad attr TupleLoad Assign NameStore Call AttributeLoad SubscriptLoad AttributeLoad NameLoad attr Slice BinOpMult Num Num attr Num Num Assign NameStore Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Slice BinOpMult Num Num Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr Num Num keyword TupleLoad Num Num Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad keyword Str keyword Num keyword Num Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr NameLoad keyword Str keyword Num keyword Num Expr Call AttributeLoad SubscriptLoad NameLoad Index Num attr Str For NameStore NameLoad body Expr Call AttributeLoad NameLoad attr TupleLoad Expr Call AttributeLoad NameLoad attr TupleLoad Expr Call AttributeLoad NameLoad attr
N/A N/A 
==================================
Learning interactions on a 2d grid
==================================
Simple pairwise model with arbitrary interactions on a 4-connected grid.
The inputs contain a cross pattern with a separate state for the center.
The crosses are placed randomly in the image and noise is added.

The center state is not encoded in the input, so that the task can not be
solved without pairwise interactions.
 N/A numpy np N/A matplotlib.pyplot plt pystruct.models GridCRF N/A pystruct.learners ssvm pystruct.datasets generate_crosses_explicit pystruct.utils expand_sym N/A N/A X Y N/A generate_crosses_explicit n_samples 50 noise 10 N/A crf N/A GridCRF neighborhood 4 N/A clf N/A N/A ssvm OneSlackSSVM model crf C 100 inference_cache 100 tol 0.1 N/A N/A N/A clf fit X Y N/A Y_pred N/A N/A np array N/A N/A clf predict X N/A N/A overall accuracy (training set): %f N/A N/A clf score X Y N/A N/A x y y_pred N/A N/A X N/A 0 N/A Y N/A 0 N/A Y_pred N/A 0 N/A y_pred N/A N/A y_pred reshape N/A N/A x shape N/A 2 N/A N/A fig plots N/A N/A plt subplots 1 4 figsize N/A 12 4 N/A N/A N/A N/A plots N/A 0 matshow y N/A N/A N/A N/A plots N/A 0 set_title ground truth N/A N/A N/A N/A plots N/A 1 matshow N/A N/A np argmax x axis -1 N/A N/A N/A N/A plots N/A 1 set_title input N/A N/A N/A N/A plots N/A 2 matshow y_pred N/A N/A N/A N/A plots N/A 2 set_title prediction N/A loss_augmented N/A N/A N/A clf model loss_augmented_inference x y N/A clf w N/A loss_augmented N/A N/A loss_augmented reshape N/A y shape N/A N/A N/A N/A plots N/A 3 matshow loss_augmented N/A N/A N/A N/A plots N/A 3 set_title loss augmented N/A p plots N/A N/A N/A N/A p set_xticks N/A N/A N/A N/A p set_yticks N/A N/A w_un N/A N/A N/A N/A clf w N/A N/A 3 3 reshape 3 3 N/A w_pw N/A expand_sym N/A N/A clf w N/A N/A 3 3 N/A N/A fig plots N/A N/A plt subplots 1 2 figsize N/A 8 4 N/A N/A N/A N/A plots N/A 0 matshow w_un cmap gray vmin -5 vmax 5 N/A N/A N/A N/A plots N/A 0 set_title Unary weights N/A N/A N/A N/A plots N/A 1 matshow w_pw cmap gray vmin -5 vmax 5 N/A N/A N/A N/A plots N/A 1 set_title Pairwise weights N/A p plots N/A N/A N/A N/A p set_xticks N/A N/A N/A N/A p set_yticks N/A N/A N/A N/A plt show