| @@ -21,4 +21,4 @@ jobs: | |||
| uses: py-actions/flake8@v2 | |||
| with: | |||
| max-line-length: "100" | |||
| args: --ignore=E203,W503,F821,E266 | |||
| args: --ignore=E203,W503,F821 | |||
| @@ -50,14 +50,14 @@ def main(): | |||
| # Build logger | |||
| print_log("Abductive Learning on the HED example.", logger="current") | |||
| ### Working with Data | |||
| # -- Working with Data ------------------------------ | |||
| print_log("Working with Data.", logger="current") | |||
| total_train_data = get_dataset(train=True) | |||
| train_data, val_data = split_equation(total_train_data, 3, 1) | |||
| test_data = get_dataset(train=False) | |||
| ### Building the Learning Part | |||
| # -- Building the Learning Part --------------------- | |||
| print_log("Building the Learning Part.", logger="current") | |||
| # Build necessary components for BasicNN | |||
| @@ -81,7 +81,7 @@ def main(): | |||
| # Build ABLModel | |||
| model = ABLModel(base_model) | |||
| ### Building the Reasoning Part | |||
| # -- Building the Reasoning Part -------------------- | |||
| print_log("Building the Reasoning Part.", logger="current") | |||
| # Build knowledge base | |||
| @@ -90,11 +90,11 @@ def main(): | |||
| # Create reasoner | |||
| reasoner = HedReasoner(kb, dist_func="hamming", use_zoopt=True, max_revision=args.max_revision) | |||
| ### Building Evaluation Metrics | |||
| # -- Building Evaluation Metrics -------------------- | |||
| print_log("Building Evaluation Metrics.", logger="current") | |||
| metric_list = [ConsistencyMetric(kb=kb)] | |||
| ### Bridge Learning and Reasoning | |||
| # -- Bridging Learning and Reasoning ---------------- | |||
| print_log("Bridge Learning and Reasoning.", logger="current") | |||
| bridge = HedBridge(model, reasoner, metric_list) | |||
| @@ -117,13 +117,13 @@ def main(): | |||
| # Build logger | |||
| print_log("Abductive Learning on the HWF example.", logger="current") | |||
| ### Working with Data | |||
| # -- Working with Data ------------------------------ | |||
| print_log("Working with Data.", logger="current") | |||
| train_data = get_dataset(train=True, get_pseudo_label=True) | |||
| test_data = get_dataset(train=False, get_pseudo_label=True) | |||
| ### Building the Learning Part | |||
| # -- Building the Learning Part --------------------- | |||
| print_log("Building the Learning Part.", logger="current") | |||
| # Build necessary components for BasicNN | |||
| @@ -146,7 +146,7 @@ def main(): | |||
| # Build ABLModel | |||
| model = ABLModel(base_model) | |||
| ### Building the Reasoning Part | |||
| # -- Building the Reasoning Part -------------------- | |||
| print_log("Building the Reasoning Part.", logger="current") | |||
| # Build knowledge base | |||
| @@ -160,11 +160,11 @@ def main(): | |||
| kb, max_revision=args.max_revision, require_more_revision=args.require_more_revision | |||
| ) | |||
| ### Building Evaluation Metrics | |||
| # -- Building Evaluation Metrics -------------------- | |||
| print_log("Building Evaluation Metrics.", logger="current") | |||
| metric_list = [SymbolAccuracy(prefix="hwf"), ReasoningMetric(kb=kb, prefix="hwf")] | |||
| ### Bridge Learning and Reasoning | |||
| # -- Bridging Learning and Reasoning ---------------- | |||
| print_log("Bridge Learning and Reasoning.", logger="current") | |||
| bridge = SimpleBridge(model, reasoner, metric_list) | |||
| @@ -81,12 +81,12 @@ def main(): | |||
| # Build logger | |||
| print_log("Abductive Learning on the MNIST Addition example.", logger="current") | |||
| ### Working with Data | |||
| # -- Working with Data ------------------------------ | |||
| print_log("Working with Data.", logger="current") | |||
| train_data = get_dataset(train=True, get_pseudo_label=True) | |||
| test_data = get_dataset(train=False, get_pseudo_label=True) | |||
| ### Building the Learning Part | |||
| # -- Building the Learning Part --------------------- | |||
| print_log("Building the Learning Part.", logger="current") | |||
| # Build necessary components for BasicNN | |||
| @@ -117,7 +117,7 @@ def main(): | |||
| # Build ABLModel | |||
| model = ABLModel(base_model) | |||
| ### Building the Reasoning Part | |||
| # -- Building the Reasoning Part -------------------- | |||
| print_log("Building the Reasoning Part.", logger="current") | |||
| # Build knowledge base | |||
| @@ -133,11 +133,11 @@ def main(): | |||
| kb, max_revision=args.max_revision, require_more_revision=args.require_more_revision | |||
| ) | |||
| ### Building Evaluation Metrics | |||
| # -- Building Evaluation Metrics -------------------- | |||
| print_log("Building Evaluation Metrics.", logger="current") | |||
| metric_list = [SymbolAccuracy(prefix="mnist_add"), ReasoningMetric(kb=kb, prefix="mnist_add")] | |||
| ### Bridge Learning and Reasoning | |||
| # -- Bridging Learning and Reasoning ---------------- | |||
| print_log("Bridge Learning and Reasoning.", logger="current") | |||
| bridge = SimpleBridge(model, reasoner, metric_list) | |||
| @@ -82,12 +82,12 @@ def main(): | |||
| # Build logger | |||
| print_log("Abductive Learning on the MNIST Addition example.", logger="current") | |||
| ### Working with Data | |||
| # -- Working with Data ------------------------------ | |||
| print_log("Working with Data.", logger="current") | |||
| train_data = get_dataset(train=True, get_pseudo_label=True) | |||
| test_data = get_dataset(train=False, get_pseudo_label=True) | |||
| ### Building the Learning Part | |||
| # -- Building the Learning Part --------------------- | |||
| print_log("Building the Learning Part.", logger="current") | |||
| # Build necessary components for BasicNN | |||
| @@ -117,7 +117,7 @@ def main(): | |||
| # Build ABLModel | |||
| model = ABLModel(base_model) | |||
| ### Building the Reasoning Part | |||
| # -- Building the Reasoning Part -------------------- | |||
| print_log("Building the Reasoning Part.", logger="current") | |||
| # Build knowledge base | |||
| @@ -133,11 +133,11 @@ def main(): | |||
| kb, max_revision=args.max_revision, require_more_revision=args.require_more_revision | |||
| ) | |||
| ### Building Evaluation Metrics | |||
| # -- Building Evaluation Metrics -------------------- | |||
| print_log("Building Evaluation Metrics.", logger="current") | |||
| metric_list = [SymbolAccuracy(prefix="mnist_add"), ReasoningMetric(kb=kb, prefix="mnist_add")] | |||
| ### Bridge Learning and Reasoning | |||
| # -- Bridging Learning and Reasoning ---------------- | |||
| print_log("Bridge Learning and Reasoning.", logger="current") | |||
| bridge = SimpleBridge(model, reasoner, metric_list) | |||
| @@ -32,7 +32,7 @@ def main(): | |||
| # Build logger | |||
| print_log("Abductive Learning on the ZOO example.", logger="current") | |||
| ### Working with Data | |||
| # -- Working with Data ------------------------------ | |||
| print_log("Working with Data.", logger="current") | |||
| X, y = load_and_preprocess_dataset(dataset_id=62) | |||
| @@ -41,7 +41,7 @@ def main(): | |||
| test_data = tab_data_to_tuple(X_test, y_test) | |||
| train_data = tab_data_to_tuple(X_unlabel, y_unlabel) | |||
| ### Building the Learning Part | |||
| # -- Building the Learning Part --------------------- | |||
| print_log("Building the Learning Part.", logger="current") | |||
| # Build base model | |||
| @@ -50,7 +50,7 @@ def main(): | |||
| # Build ABLModel | |||
| model = ABLModel(base_model) | |||
| ### Building the Reasoning Part | |||
| # -- Building the Reasoning Part -------------------- | |||
| print_log("Building the Reasoning Part.", logger="current") | |||
| # Build knowledge base | |||
| @@ -59,11 +59,11 @@ def main(): | |||
| # Create reasoner | |||
| reasoner = Reasoner(kb, dist_func=consitency) | |||
| ### Building Evaluation Metrics | |||
| # -- Building Evaluation Metrics -------------------- | |||
| print_log("Building Evaluation Metrics.", logger="current") | |||
| metric_list = [SymbolAccuracy(prefix="zoo"), ReasoningMetric(kb=kb, prefix="zoo")] | |||
| ### Bridging learning and reasoning | |||
| # -- Bridging Learning and Reasoning ---------------- | |||
| print_log("Bridge Learning and Reasoning.", logger="current") | |||
| bridge = SimpleBridge(model, reasoner, metric_list) | |||