Skip to content

Commit

Permalink
Add python CLI for GFD mining
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonChern committed Oct 1, 2024
1 parent 103425e commit 13beab4
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Task(StrEnum):
aucc_verification = auto()
gfd_verification = auto()
nd_verification = auto()
gfd_mining = auto()


class Algorithm(StrEnum):
Expand Down Expand Up @@ -61,6 +62,7 @@ class Algorithm(StrEnum):
gfd_verifier = auto()
egfd_verifier = auto()
naive_nd_verifier = auto()
gfd_miner = auto()


HELP = 'help'
Expand Down Expand Up @@ -311,6 +313,10 @@ class Algorithm(StrEnum):
Algorithms: NAIVE_ND_VERIFIER
Default: NAIVE_ND_VERIFIER
'''
GFD_MINING_HELP = '''Discover graph functional dependencies in graph structures.
For more information about the primitive and the algorithms, refer to
“Discovering Graph Functional Dependencies” by Fan Wenfei et al.
'''
PYRO_HELP = '''A modern algorithm for discovery of approximate functional
dependencies. Approximate functional dependencies are defined in the
“Efficient Discovery of Approximate Dependencies” paper by S.Kruse and
Expand Down Expand Up @@ -472,6 +478,7 @@ class Algorithm(StrEnum):
a given numerical dependecy holds. For more information refer to "Efficient
derivation of numerical dependencies" by P. Ciaccia et al.
'''
GFD_MINER_HELP = '''An algorithm for searching for dependencies in a given graph'''

OPTION_TYPES = {
str: 'STRING',
Expand Down Expand Up @@ -499,6 +506,7 @@ class Algorithm(StrEnum):
Task.aucc_verification: AUCC_VERIFICATION_HELP,
Task.gfd_verification: GFD_VERIFICATION_HELP,
Task.nd_verification: ND_VERIFICATION_HELP,
Task.gfd_mining: GFD_MINING_HELP,
}

ALGO_HELP_PAGES = {
Expand Down Expand Up @@ -531,6 +539,7 @@ class Algorithm(StrEnum):
Algorithm.egfd_verifier: GFD_VERIFIER_HELP,
Algorithm.apriori: APRIORI_HELP,
Algorithm.naive_nd_verifier: NAIVE_ND_VERIFIER_HELP,
Algorithm.gfd_miner: GFD_MINER_HELP,
}

TaskInfo = namedtuple('TaskInfo', ['algos', 'default'])
Expand Down Expand Up @@ -572,6 +581,8 @@ class Algorithm(StrEnum):
Algorithm.naive_gfd_verifier),
Task.nd_verification: TaskInfo([Algorithm.naive_nd_verifier],
Algorithm.naive_nd_verifier),
Task.nd_verification: TaskInfo([Algorithm.gfd_miner],
Algorithm.gfd_miner),
}

ALGOS = {
Expand Down Expand Up @@ -604,6 +615,7 @@ class Algorithm(StrEnum):
Algorithm.egfd_verifier: desbordante.gfd_verification.algorithms.EGfdValid,
Algorithm.apriori: desbordante.ar.algorithms.Apriori,
Algorithm.naive_nd_verifier: desbordante.nd_verification.algorithms.NDVerifier,
Algorithm.gfd_miner: desbordante.gfd_mining.algorithms.GfdMiner,
}


Expand Down Expand Up @@ -739,7 +751,7 @@ def get_algo_result(algo: desbordante.Algorithm, algo_name: str) -> Any:
result = algo.get_list_ods()
case algo_name if algo_name in TASK_INFO[Task.ind].algos:
result = algo.get_inds()
case algo_name if algo_name in TASK_INFO[Task.gfd_verification].algos:
case algo_name if algo_name in TASK_INFO[Task.gfd_verification].algos or algo_name == Algorithm.gfd_miner:
result = algo.get_gfds()
case Algorithm.fd_first:
result = algo.get_cfds()
Expand Down

0 comments on commit 13beab4

Please sign in to comment.