Skip to content
Permalink
e25a21fb86
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
15 lines (10 sloc) 376 Bytes
from utils.vector import dot_prod, norm
def expression_specificity(condition, profile):
values = [v for k, v in profile.items()]
vector = [v if k == condition else 0 for k, v in profile.items()]
dot_product = dot_prod(values, vector)
mul_len = norm(values) * norm(vector)
if mul_len != 0:
return dot_product/mul_len
else:
return 0