Edge Featured Potts Model by fgregg · Pull Request #99 · pystruct/pystruct · GitHub
Skip to content
29 changes: 21 additions & 8 deletions pystruct/inference/inference_methods.py
3 changes: 2 additions & 1 deletion pystruct/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
from .unstructured_svm import BinaryClf, MultiClassClf
from .multilabel_svm import MultiLabelClf
from .edge_feature_graph_crf import EdgeFeatureGraphCRF
from .potts_edge_feature_graph_crf import PottsEdgeFeatureGraphCRF

__all__ = ["StructuredModel", "CRF", "GridCRF", "GraphCRF",
"DirectionalGridCRF", "BinaryClf", "LatentGridCRF",
"LatentDirectionalGridCRF", "MultiClassClf", "LatentGraphCRF",
"MultiLabelClf", "ChainCRF", "LatentNodeCRF", "EdgeFeatureGraphCRF",
"EdgeFeatureLatentNodeCRF"]
"EdgeFeatureLatentNodeCRF", "PottsEdgeFeatureGraphCRF"]
2 changes: 1 addition & 1 deletion pystruct/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def batch_inference(self, X, w, relaxed=None):
return [self.inference(x, w, relaxed=relaxed)
for x in X]

def loss(self, y, y_hat):
def loss(self, y, y_hat, x=None):
# hamming loss:
if isinstance(y_hat, tuple):
return self.continuous_loss(y, y_hat[0])
Expand Down
216 changes: 216 additions & 0 deletions pystruct/models/potts_edge_feature_graph_crf.py
Loading