code
stringlengths
3
6.57k
logSumExpTensor(a)
len(a.size()
denom.view(-1, 1)
expand(-1, a.size()
len(a.size()
denom.view(a.size()
expand(-1, a.size()
a.size()
return (a-denom)
computeF1(hyps, golds, prefix, labels_to_ix=None, baseline=False, write_results=False)
unfreeze_dict(h)
unfreeze_dict(t)
enumerate(hyps, start=0)
word_tags.items()
sum(f1_precision_scores.values()
sum(f1_precision_total.values()
f1_precision_scores.keys()
enumerate(golds, start=0)
word_tags.items()
sum(f1_recall_scores.values()
sum(f1_recall_total.values()
f1_recall_scores.keys()
sum(f1_recall_total.values()
print("Writing F1 scores...")
open(prefix + '_results_f1.txt', 'ab')
file.write(pickle.dumps(f1_scores)
file.write("\nMacro-averaged F1 Score: " + str(f1_average)
file.write("\nMicro-averaged F1 Score: " + str(f1_micro_score)
getCorrectCount(golds, hyps)
enumerate(golds, start=0)
word_tags.items()
LinkageError(Exception)
clusterSubfamilies(similarities, n_clusters=0, linkage='all', method='tsne', cutoff=0.0, **kwargs)
one(s)
ImportError('need sklearn module')
isinstance(similarities, np.ndarray)
TypeError('similarities should be a numpy ndarray')
ValueError('similarities must be a square matrix')
isinstance(n_clusters, int)
TypeError('clusters must be an instance of int')
ValueError('clusters must be a positive integer')
ValueError('clusters can\'t be longer than similarities matrix')
range(n_clusters,n_clusters+1)
range(2,10,1)
isListLike(linkage)
val.lower()
ValueError('linkage must be one or more of: \'ward\', \'average\', \'complete\', or \'single\'')
len(linkage)
ValueError('linkage must be one or more of: \'ward\', \'average\', \'complete\', or \'single\'')
x.lower()
isinstance(linkage, str)
TypeError('linkage must be an instance of str or list-like of strs')
ValueError('linkage must one or more of: \'ward\', \'average\', \'complete\', or \'single\'')
isinstance(method, str)
TypeError('method must be an instance of str')
ValueError('method must be either \'tsne\' or \'spectral\'')
isinstance(cutoff, float)
TypeError('cutoff must be an instance of float')
TSNE(n_components=2)
embedding.fit_transform(similarities)
np.where(similarities > cutoff, 0, -1)
SpectralEmbedding(n_components=2)
embedding.fit_transform(kirchhoff)
AgglomerativeClustering(linkage=link, n_clusters=x)
clustering.fit(transform)
silhouette_score(transform, clustering.labels_)
getCoords(data)
data._getCoords()
hasattr(data, '_getCoords')
data.getCoords()
checkCoords(data)
getLinkage(names, tree)
tree.get_terminals()
len(tree_terminals)
len(names)
ValueError('inconsistent number of terminals in tree and names')
len(names)
index(names, clade.name)
len(terminals)
reversed(tree.get_nonterminals()
len(nonterminals)
LinkageError('wrong number of terminal clades')
np.zeros((n-1, 4)
_indexOfClade(clade)
clade.is_terminal()
index(terminals, clade)
index(nonterminals, clade)
_height_of(clade)
clade.is_terminal()
max(_height_of(c)
_dfs(clade)
clade.is_terminal()
_indexOfClade(clade)
_indexOfClade(clade_a)
_indexOfClade(clade_b)
min(a, b)
max(a, b)
_height_of(clade)
clade.count_terminals()
_dfs(clade_a)