i'm trying to develop an algrothim that takes in 2 matrices and calculates a score based on unique elements in the matrices.
High level steps:
- Take matrices A and B, convert them into vectors, then into sets
- Divide the cardinality of the intersection of A and B by the maximum cardinality of A or B
I currently write the formula as such:
$$ SS(A,B)=\frac{\mathrm{card}(\theta(\mathrm{vec}(A))\cap\theta(\mathrm{vec}(B))}{\mathrm{max}(\mathrm{card}\big(\theta(\mathrm{vec}(A))\big),\mathrm{card}\big(\theta(\mathrm{vec}(B))\big))} $$
A = [[ 1 1 2], B = [[ 1 1 3], C = [[ 3 4 3]
[ 1 2 3], [ 1 1 5], [ 3 3 4]
[ 2 3 4]] [ 1 5 3]] [ 1 3 2]]
The answers should be:
SS(A,B) = 0.8
SS(A,C) = 1.0
Have i expressed the formula for SS in correctly? Is there another formula that does this?
I'd probably come up with a name for the function
$$f(A, B) := \frac{|A \cap B|}{\max(|A|, |B|)} = \min\left(\frac{|A \cap B|}{|A|}, \frac{|A \cap B|}{|B|}\right)$$
I'd probably also write the set of elements of a matrix $A$ as $\{a_{ij}\}$ or something of the sort rather than as $\theta(\operatorname{vec}(A))$.
So then you could just write
$$SS(A, B) := f(\{a_{ij}\}, \{b_{k\ell}\}).$$
But first I think I'd consider why I'm looking at the set of entries of a matrix in the first place. It seems like a weird thing to look at in most cases.