Skip to content

Commit

Permalink
Support query vertex diversity of single operators.
Browse files Browse the repository at this point in the history
  • Loading branch information
wzh99 committed Nov 7, 2022
1 parent 9f12a4b commit 4547301
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gencog/metric/div.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,12 @@ def record(self, opr: Operation):
# Record hash for this operation
self._hash[op].add(h)

def __getitem__(self, op: Op):
return min(len(self._hash[op]) / self._space[op].total, 1)

@property
def op_div(self):
return np.array([min(len(self._hash[op]) / self._space[op].total, 1) for op in self._ops])
return np.array([self[op] for op in self._ops])

@property
def result(self) -> float:
Expand Down

0 comments on commit 4547301

Please sign in to comment.