Browse Source

update package structure

pull/3/head
Tony-HYX 3 years ago
parent
commit
37c1c446d9
27 changed files with 18 additions and 20 deletions
  1. +0
    -0
      abl/__init__.py
  2. +0
    -0
      abl/abducer/__init__.py
  3. +6
    -5
      abl/abducer/abducer_base.py
  4. +2
    -2
      abl/abducer/kb.py
  5. +1
    -1
      abl/framework.py
  6. +8
    -5
      abl/framework_hed.py
  7. +0
    -0
      abl/models/__init__.py
  8. +0
    -0
      abl/models/basic_model.py
  9. +0
    -0
      abl/models/lenet5.py
  10. +0
    -5
      abl/models/nn.py
  11. +0
    -1
      abl/models/wabl_models.py
  12. +0
    -0
      abl/utils/plog.py
  13. +1
    -1
      abl/utils/utils.py
  14. +0
    -0
      examples/datasets/data_generator.py
  15. +0
    -0
      examples/datasets/hed/BK.pl
  16. +0
    -0
      examples/datasets/hed/README.md
  17. +0
    -0
      examples/datasets/hed/get_hed.py
  18. +0
    -0
      examples/datasets/hed/learn_add.pl
  19. +0
    -0
      examples/datasets/hwf/README.md
  20. +0
    -0
      examples/datasets/hwf/get_hwf.py
  21. +0
    -0
      examples/datasets/mnist_add/get_mnist_add.py
  22. +0
    -0
      examples/datasets/mnist_add/test_data.txt
  23. +0
    -0
      examples/datasets/mnist_add/train_data.txt
  24. +0
    -0
      examples/example.py
  25. +0
    -0
      examples/nonshare_example.py
  26. +0
    -0
      examples/share_example.py
  27. +0
    -0
      examples/weights/all_weights_here.txt

weights/all_weights_here.txt → abl/__init__.py View File


+ 0
- 0
abl/abducer/__init__.py View File


abducer/abducer_base.py → abl/abducer/abducer_base.py View File

@@ -10,16 +10,17 @@
#
# ================================================================#

import sys
# import sys

sys.path.append(".")
sys.path.append("..")
# sys.path.append(".")
# sys.path.append("..")

import abc
from abducer.kb import *
# TODO 尽量别用import *
from .kb import *
import numpy as np
from zoopt import Dimension, Objective, Parameter, Opt
from utils.utils import confidence_dist, flatten, hamming_dist
from ..utils.utils import confidence_dist, flatten, hamming_dist

import math
import time

abducer/kb.py → abl/abducer/kb.py View File

@@ -21,7 +21,7 @@ sys.path.append("..")

from collections import defaultdict
from itertools import product, combinations
from utils.utils import flatten, reform_idx, hamming_dist, check_equal
from ..utils.utils import flatten, reform_idx, hamming_dist, check_equal

from multiprocessing import Pool

@@ -299,7 +299,7 @@ class add_prolog_KB(prolog_KB):
class HED_prolog_KB(prolog_KB):
def __init__(self, pseudo_label_list=[0, 1, '+', '=']):
super().__init__(pseudo_label_list)
self.prolog.consult('./datasets/hed/learn_add.pl')
self.prolog.consult('../examples/datasets/hed/learn_add.pl')

# corresponding to `con_sol is not None` in `consistent_score_mapped` within `learn_add.py`
def logic_forward(self, exs):

framework.py → abl/framework.py View File

@@ -14,7 +14,7 @@ import pickle as pk

import numpy as np

from utils.plog import INFO, DEBUG, clocker
from .utils.plog import INFO, DEBUG, clocker

def block_sample(X, Z, Y, sample_num, epoch_idx):
part_num = (len(X) // sample_num)

framework_hed.py → abl/framework_hed.py View File

@@ -16,12 +16,15 @@ import torch.nn as nn
import numpy as np
import os

from utils.plog import INFO, DEBUG, clocker
from utils.utils import flatten, reform_idx, block_sample, gen_mappings, mapping_res, remapping_res
from .utils.plog import INFO, DEBUG, clocker
from .utils.utils import flatten, reform_idx, block_sample, gen_mappings, mapping_res, remapping_res

from models.nn import MLP, SymbolNetAutoencoder
from models.basic_model import BasicModel, BasicDataset
from datasets.hed.get_hed import get_pretrain_data
from .models.nn import MLP, SymbolNetAutoencoder
from .models.basic_model import BasicModel, BasicDataset

import sys
sys.path.append("..")
from examples.datasets.hed.get_hed import get_pretrain_data

def result_statistics(pred_Z, Z, Y, logic_forward, char_acc_flag):
result = {}

+ 0
- 0
abl/models/__init__.py View File


models/basic_model.py → abl/models/basic_model.py View File


models/lenet5.py → abl/models/lenet5.py View File


models/nn.py → abl/models/nn.py View File

@@ -10,9 +10,6 @@
#
# ================================================================#

import sys

sys.path.append("..")

import torchvision

@@ -23,8 +20,6 @@ from torch.autograd import Variable
import torchvision.transforms as transforms
import numpy as np

from models.basic_model import BasicModel
import utils.plog as plog


class LeNet5(nn.Module):

models/wabl_models.py → abl/models/wabl_models.py View File

@@ -21,7 +21,6 @@ from sklearn.preprocessing import StandardScaler
from sklearn.svm import SVC
from sklearn.gaussian_process import GaussianProcessClassifier
from sklearn.gaussian_process.kernels import RBF
from models.basic_model import BasicModel

import pickle as pk
import random

utils/plog.py → abl/utils/plog.py View File


utils/utils.py → abl/utils/utils.py View File

@@ -1,5 +1,5 @@
import numpy as np
from utils.plog import INFO
from .plog import INFO
from collections import OrderedDict

# for multiple predictions, modify from `learn_add.py`

datasets/data_generator.py → examples/datasets/data_generator.py View File


datasets/hed/BK.pl → examples/datasets/hed/BK.pl View File


datasets/hed/README.md → examples/datasets/hed/README.md View File


datasets/hed/get_hed.py → examples/datasets/hed/get_hed.py View File


datasets/hed/learn_add.pl → examples/datasets/hed/learn_add.pl View File


datasets/hwf/README.md → examples/datasets/hwf/README.md View File


datasets/hwf/get_hwf.py → examples/datasets/hwf/get_hwf.py View File


datasets/mnist_add/get_mnist_add.py → examples/datasets/mnist_add/get_mnist_add.py View File


datasets/mnist_add/test_data.txt → examples/datasets/mnist_add/test_data.txt View File


datasets/mnist_add/train_data.txt → examples/datasets/mnist_add/train_data.txt View File


example.py → examples/example.py View File


nonshare_example.py → examples/nonshare_example.py View File


share_example.py → examples/share_example.py View File


+ 0
- 0
examples/weights/all_weights_here.txt View File


Loading…
Cancel
Save