Skip to content

Commit 6f443f7

Browse files
committed
print probas
1 parent abe72d8 commit 6f443f7

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

pycona/query_generation/pqgen_solve.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,21 @@ def generate(self, X=None):
108108

109109
if len(B) > self.blimit:
110110
# Sort constraints by probability and take first 5000 with highest probability
111+
111112
B = sorted(B, key=lambda c: self.env.bias_proba[c], reverse=True)[:2000]
113+
114+
print("Probabilities of true constraints: -------------------------")
115+
oracle_correct_pred = 0
116+
for c in self.env.oracle.constraints:
117+
if c in set(B):
118+
print(f"Proba of constraint {c}: {self.env.bias_proba[c]}")
119+
if self.env.bias_proba[c] > 0.5:
120+
oracle_correct_pred += 1
121+
print(f"Number of true constraints in C_T with probability > 0.5: {oracle_correct_pred}")
122+
123+
# Find indices of max probability constraints after sorting
124+
max_prob_indices = [i for i, c in enumerate(B) if self.env.bias_proba[c] > 0.5]
125+
print(f"After sorting - Number of constraints with probability > 0.5: {len(max_prob_indices)}")
112126

113127
# We want at least one constraint to be violated to assure that each answer of the user
114128
# will lead to new information
@@ -145,6 +159,8 @@ def generate(self, X=None):
145159
flag2 = s.solve(time_limit=(self.time_limit), num_workers=8)
146160

147161
print("flag2: ", flag2)
162+
print("min proba: ", min(self.env.bias_proba[c] for c in B))
163+
print("max proba: ", max(self.env.bias_proba[c] for c in B))
148164
print("objective value: ", objective.value())
149165

150166
if flag2:

0 commit comments

Comments
 (0)