From 51007ea1ac2a87c60fa9aa2c16a27f9483f3b5ef Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Sun, 23 Feb 2014 14:36:35 +0100 Subject: [PATCH 1/3] REL say that 0.2 is the current release --- doc/index.rst | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/index.rst b/doc/index.rst index d0de1fc5..aa3e4692 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -15,7 +15,7 @@ to make use of structured prediction algorithms. The design tries to stay as close as possible to the interface and conventions of `scikit-learn `_. -PyStruct 0.1 is out now! Install it via pip: +The current version is PyStruct 0.2 which you can install via pip: pip install pystruct diff --git a/setup.py b/setup.py index 70c46a21..30339cb4 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ os.remove('MANIFEST') setup(name="pystruct", - version="0.2-dev", + version="0.2", install_requires=["ad3", "pyqpbo"], packages=['pystruct', 'pystruct.learners', 'pystruct.inference', 'pystruct.models', 'pystruct.utils', 'pystruct.datasets', From 1d6b2b980aee40bd22a276fe0f984c61542593c0 Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Sun, 23 Feb 2014 14:56:15 +0100 Subject: [PATCH 2/3] MISC remove IPython debugging traces. --- examples/multi_class_svm.py | 2 -- examples/plot_snakes.py | 6 ++---- pystruct/models/latent_graph_crf.py | 2 -- pystruct/models/latent_node_crf.py | 2 -- pystruct/models/multilabel_svm.py | 2 -- pystruct/tests/test_learners/test_primal_dual.py | 3 --- 6 files changed, 2 insertions(+), 15 deletions(-) diff --git a/examples/multi_class_svm.py b/examples/multi_class_svm.py index f62ffef0..1b433960 100644 --- a/examples/multi_class_svm.py +++ b/examples/multi_class_svm.py @@ -89,5 +89,3 @@ time_fw_batch_svm = time() - start print("Score with pystruct frankwolfe batch ssvm: %f (took %f seconds)" % (np.mean(y_pred == y_test), time_fw_batch_svm)) -#from IPython.core.debugger import Tracer -#Tracer()() diff --git a/examples/plot_snakes.py b/examples/plot_snakes.py index 9d2b0ad1..0bd82cd7 100644 --- a/examples/plot_snakes.py +++ b/examples/plot_snakes.py @@ -45,7 +45,7 @@ def one_hot_colors(x): x = x / 255 - flat = np.dot(x.reshape(-1, 3), 2 ** np.arange(3)) + flat = np.dot(x.reshape(-1, 3), 2 ** np.arange(3)) one_hot = label_binarize(flat, classes=[1, 2, 3, 4, 6]) return one_hot.reshape(x.shape[0], x.shape[1], 5) @@ -102,7 +102,7 @@ def main(): Y_train_flat = [y_.ravel() for y_ in Y_train] X_train_directions, X_train_edge_features = prepare_data(X_train) - + if 'ogm' in get_installed(): inference = ('ogm', {'alg': 'fm'}) else: @@ -152,8 +152,6 @@ def main(): a.set_xticks(()) a.set_yticks(()) plt.show() - from IPython.core.debugger import Tracer - Tracer()() if __name__ == "__main__": diff --git a/pystruct/models/latent_graph_crf.py b/pystruct/models/latent_graph_crf.py index 1467e3e5..1245956e 100644 --- a/pystruct/models/latent_graph_crf.py +++ b/pystruct/models/latent_graph_crf.py @@ -179,8 +179,6 @@ def latent(self, x, y, w): self.inference_method, relaxed=False) if (self.label_from_latent(h) != y).any(): print("inconsistent h and y") - from IPython.core.debugger import Tracer - Tracer()() h = np.hstack([0, np.cumsum(self.n_states_per_label)])[y] return h diff --git a/pystruct/models/latent_node_crf.py b/pystruct/models/latent_node_crf.py index 230f86d6..f240254f 100644 --- a/pystruct/models/latent_node_crf.py +++ b/pystruct/models/latent_node_crf.py @@ -535,8 +535,6 @@ def latent(self, x, y, w): self.inference_method, relaxed=False) if (h[:len(y)] != y).any(): print("inconsistent h and y") - from IPython.core.debugger import Tracer - Tracer()() h[:len(y)] = y return h diff --git a/pystruct/models/multilabel_svm.py b/pystruct/models/multilabel_svm.py index 573c82b3..87082f18 100644 --- a/pystruct/models/multilabel_svm.py +++ b/pystruct/models/multilabel_svm.py @@ -82,8 +82,6 @@ def _get_pairwise_potentials(self, x, w): def joint_feature(self, x, y): if isinstance(y, tuple): - #from IPython.core.debugger import Tracer - #Tracer()() y_cont, pairwise_marginals = y y_signs = 2 * y_cont[:, 1] - 1 unary_marginals = np.repeat(x[np.newaxis, :], len(y_signs), axis=0) diff --git a/pystruct/tests/test_learners/test_primal_dual.py b/pystruct/tests/test_learners/test_primal_dual.py index 0ab0fbbd..f69f3207 100644 --- a/pystruct/tests/test_learners/test_primal_dual.py +++ b/pystruct/tests/test_learners/test_primal_dual.py @@ -3,9 +3,6 @@ #from structured_svm import objective_primal, PrimalDSStructuredSVM #from toy_datasets import binary -#from IPython.core.debugger import Tracer -#tracer = Tracer() - #def test_primal_dual_binary(): #for C in [1, 100, 100000]: From 5e7c099d4400232ec378418ad8be1e5476686259 Mon Sep 17 00:00:00 2001 From: Andreas Mueller Date: Sun, 23 Feb 2014 15:27:59 +0100 Subject: [PATCH 3/3] make lp default inference in plot_svm_objectives --- examples/plot_svm_objectives.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/plot_svm_objectives.py b/examples/plot_svm_objectives.py index 1ec2dfa2..c552f169 100644 --- a/examples/plot_svm_objectives.py +++ b/examples/plot_svm_objectives.py @@ -20,7 +20,7 @@ X, Y = generate_crosses_explicit(n_samples=50, noise=10, size=6, n_crosses=1) n_labels = len(np.unique(Y)) -crf = GridCRF(n_states=n_labels, inference_method="dai") +crf = GridCRF(n_states=n_labels, inference_method="lp") n_slack_svm = NSlackSSVM(crf, check_constraints=False, max_iter=50, batch_size=1, tol=0.001)