Skip to content

Commit faea4fd

Browse files
committed
Remove excess comments
1 parent 97ff59d commit faea4fd

11 files changed

+61
-1020
lines changed

Explain-Da-V/Foofah/foofah.py

+1-56
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
import argparse
2-
# from .foofah_libs.generate_prog import create_python_prog
32
import contextlib
43
import csv
54
import json
65
import os
76
import queue
87
from timeit import default_timer as timer
98

10-
# from . import foofah_libs.operators as Operations
119
import numpy as np
1210
from Foofah.foofah_libs.foofah_node import FoofahNode
1311
from Foofah.foofah_libs.generate_prog import create_python_prog
14-
# from .foofah_libs.foofah_node import FoofahNode
1512
from Foofah.foofah_libs.operators import *
1613
from tabulate import tabulate
1714

@@ -476,24 +473,16 @@ def main(
476473
raw_data = [list(map(str, x)) for x in test_data["InputTable"]]
477474
target = [list(map(str, x)) for x in test_data["OutputTable"]]
478475

479-
# print(target)
480-
481476
if if_auto_read:
482477
raw_data = extract_table(raw_data)
483478

484479
start = timer()
485-
# a = lambda x, p1, s: f_split_first(x, p1, s)
486-
# print(a(raw_data, 0, ' '))
487-
# exit()
488480
search_space = None
489-
# print(what_to_explain)
490481
if what_to_explain == "columns":
491482
if target_type == "TEXTUAL":
492483
search_space = add_ops_column()
493484
elif target_type == "BINARY_CLASSIFICATION":
494485
search_space = add_ops_column_text_to_class()
495-
# elif target_type == 'MULTICLASS_CLASSIFICATION':
496-
# search_space = add_ops_column_text_to_class()
497486
else:
498487
search_space = add_ops_column_text_to_numeric()
499488
elif what_to_explain == "row":
@@ -524,32 +513,8 @@ def main(
524513
p3=not p3off,
525514
)
526515

527-
# if search_algo == ALGO_BFS:
528-
# final_node, open_nodes, closed_nodes = a_star_search(raw_data, target, add_ops(), debug_level,
529-
# timeout, batch=if_batch, algo=search_algo,
530-
# p1=not p1off, p2=not p2off, p3=not p3off)
531-
#
532-
# # elif search_algo == ALGO_A_STAR:
533-
# # final_node, open_nodes, closed_nodes = a_star_search(raw_data, target, add_ops(), debug_level,
534-
# # timeout = 5, batch=if_batch, epsilon=epsilon,
535-
# # bound=bound, algo=search_algo, p1=not p1off,
536-
# # p2=not p2off,
537-
# # p3=not p3off)
538-
# elif search_algo == ALGO_A_STAR:
539-
# final_node, open_nodes, closed_nodes = a_star_search(raw_data, target, add_ops_column(), debug_level,
540-
# timeout = ext_time_limit, batch=if_batch, epsilon=epsilon,
541-
# bound=bound, algo=search_algo, p1=not p1off,
542-
# p2=not p2off,
543-
# p3=not p3off)
544-
# elif search_algo == ALGO_A_STAR_NAIVE:
545-
# final_node, open_nodes, closed_nodes = a_star_search(raw_data, target, add_ops(), debug_level,
546-
# timeout, batch=if_batch, epsilon=epsilon,
547-
# bound=bound, algo=search_algo, p1=not p1off,
548-
# p2=not p2off,
549-
# p3=not p3off)
550-
551516
end = timer()
552-
# if_detail = ext_if_detail
517+
553518
if final_node:
554519
path = reconstruct_path(final_node)
555520
# Some statistics
@@ -560,25 +525,6 @@ def main(
560525
branch_factor = max(np.real(np.roots(poly)))
561526
create_python_prog(path, raw_data, True)
562527

563-
# if not if_detail:
564-
# return
565-
# program = create_python_prog(path, raw_data, True)
566-
#
567-
# print("# A Program Has Been Successfully Synthesized")
568-
# print("#")
569-
# print(("# Input file:", test_file))
570-
# print(("# Total operations:", len(path) - 1))
571-
# print(("# Time elapsed: %.3f s Nodes visited: %d Nodes created: %d" % (
572-
# (end - start), num_visited, nodes_created)))
573-
# print(("# Naive branching factor: %d Effective branching factor: %.2f" % (
574-
# len(add_ops()), branch_factor)))
575-
# print(("# Make child time: %.2f s Heuristic time: %.2f s" % (
576-
# sum(final_node.times['children']), sum(final_node.times['scores']))))
577-
# print(("#", "-" * 50))
578-
# print()
579-
# print(program)
580-
581-
# else:
582528
with open("foofah_log", "w") as o:
583529
with contextlib.redirect_stdout(o):
584530
print(("-" * 50))
@@ -729,7 +675,6 @@ def main(
729675
json.dump(test_data, outfile)
730676

731677
else:
732-
# print("*** Solution Not Found ***")
733678
return False
734679
return True
735680

Explain-Da-V/Foofah/foofah_libs/foofah_node.py

-2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,10 @@
1111
from .operators import add_extract
1212
from .prune_rules import invalid_node, unlikely_introduce_symbols
1313

14-
# import foofah_utils
1514

1615
MAX_TABLE_OPS = 3
1716
MAX_SYNTAX = 4
1817

19-
# CPP = True
2018
CPP = False
2119

2220
NODE_COUNTER = {"nodes": 0}

Explain-Da-V/Foofah/foofah_libs/foofah_table_graph.py

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
from itertools import groupby
77
from operator import itemgetter
88

9-
# import foofah_utils
109

1110
COST_DELETE_EXISTING_CELL = 1
1211
COST_DELETE_CELL = 1

Explain-Da-V/Foofah/foofah_libs/generate_prog.py

+1-19
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,6 @@
55

66
def create_python_prog(path, input_data=None, output_file=None):
77
out_prog = ""
8-
# out_prog = "#\n# Synthetic Data Transformation Program\n#\n"
9-
# out_prog += "# Author:\n"
10-
# now = time.strftime("%c")
11-
# out_prog += "# Datetime: %s\n#\n\n" % (now)
12-
#
13-
# out_prog += "from foofah_libs.operators import *\n\n"
14-
15-
# if input_data:
16-
# out_prog += "#\n# Raw Data\n#\n"
17-
# out_prog += "t = " + str(input_data) + "\n\n"
18-
19-
# out_prog += "#\n# Data Transformation\n#\n"
20-
# print(input_data)
21-
228
Operations.PRUNE_1 = False
239

2410
for i, n in enumerate(reversed(path)):
@@ -35,13 +21,9 @@ def create_python_prog(path, input_data=None, output_file=None):
3521
params_to_apply += [
3622
param_to_add,
3723
]
38-
# print('--')
39-
# print(n.operation[0]['name'] + str(params_to_apply))
40-
# print(n.operation[0]['fxn'](input_data, *params_to_apply))
24+
4125
out_prog += ")\n"
42-
# out_prog = out_prog[:-1] + "\n"
4326
if output_file:
4427
fo = open("foo.txt", "w")
4528
fo.write(out_prog)
46-
# exit()
4729
return out_prog

0 commit comments

Comments
 (0)