def drawMolsByTopic(topicModel, topicIdx, idsLabelToShow=[0], topicProbThreshold = 0.5, baseRad=0.5, molSize=(250,150),\
numRowsShown=3, color=(.0,.0, 1.), maxMols=100):
result = generateMoleculeSVGsbyTopicIdx(topicModel, topicIdx, idsLabelToShow=idsLabelToShow, \
topicProbThreshold = topicProbThreshold, baseRad=baseRad,\
molSize=molSize,color=color, maxMols=maxMols)
if len(result) == 1:
print(result)
return
svgs, namesSVGs = result
finalsvgs = []
for svg in svgs:
# make the svg scalable
finalsvgs.append(svg.replace('<svg','<svg preserveAspectRatio="xMinYMin meet" viewBox="0 0 '+str(molSize[0])\
+' '+str(molSize[1])+'"'))
tableHeader = 'Molecules in topic '+str(topicIdx)+' (sorted by decending probability)'
return display(HTML(utilsDrawing.drawSVGsToHTMLGrid(finalsvgs[:maxMols],cssTableName='overviewTab',tableHeader=tableHeader,\
namesSVGs=namesSVGs[:maxMols], size=molSize, numRowsShown=numRowsShown, numColumns=4)))
# produces a svg grid of the molecules belonging to a certain topic and highlights this topic within the molecules
评论列表
文章目录