Question: this is my first post so I'll try to make sure I'm following appropriate posting etiquette.

I have no experience whatsoever with html, d3, or javascript. I do however have some exposure to xml and svg. I'm trying to work through this tutorial: [<http://bost.ocks.org/mike/circles/]>. I spent several hours yesterday fruitlessly attempting to complete the first step, which is to change the color and radius of the three circles using d3.selectAll(). I've read through several posts on here and looked at other tutorials but I cannot for the life of me make the circles blue. Unfortunately the tutorial never shows the entirety of their code. I've been able to display the three black circles (original svg) in my browser but can't seem to get d3 to select them and carry out the changes. I'm not even sure if the xml is embedded within the html or if it is external and read in somehow.

Could someone post the html you would use to do this? Any assistance would be greatly appreciated.

Here is the xml corresponding to the circles:

```
<svg width="720" height="120">
<circle cx="40" cy="60" r="10"></circle>
 <circle cx="80" cy="60" r="10"></circle>
  <circle cx="120" cy="60" r="10"></circle>
</svg>

```

And here is the code to make the changes:

```
var circle = d3.selectAll("circle");
circle.style("fill", "steelblue");
circle.attr("r", 30);

```

Answer: 
@Aron's and @Roko Mijic's approaches neglect the fact that the function [`show_topics`](https://radimrehurek.com/gensim/models/hdpmodel.html#gensim.models.hdpmodel.HdpModel.show_topics) returns by default the top 20 words of each topic only. If one returns all the words that compose a topic, all the approximated topic probabilities in that case will be 1 (or 0.999999). I experimented with the following code, which is an adaptation of @Roko Mijic's:

```
def topic_prob_extractor(gensim_hdp, t=-1, w=25, isSorted=True):
    """
    Input the gensim model to get the rough topics' probabilities
    """
    shown_topics = gensim_hdp.show_topics(num_topics=t, num_words=w ,formatted=False)
    topics_nos = [x[0] for x in shown_topics ]
    weights = [ sum([item[1] for item in shown_topics[topicN][1]]) for topicN in topics_nos ]
    if (isSorted):
        return pd.DataFrame({'topic_id' : topics_nos, 'weight' : weights}).sort_values(by = "weight", ascending=False);
    else:
        return pd.DataFrame({'topic_id' : topics_nos, 'weight' : weights});

```

A better, yet I'm not sure if 100% valid, approach is the one mentioned [here](https://groups.google.com/d/msg/gensim/YujF90ahELE/KV2cNBpXV7IJ). You can get the topics' true weights (alpha vector) of the HDP model as:

```
alpha = hdpModel.hdp_to_lda()[0];

```

Examining the topics' equivalent alpha values is more logical than tallying up the weights of the first 20 words of each topic to approximate its probability of usage in the data.
I think you misunderstood the operation performed by the called method. Directly from the documentation you can see: 

> 
> Alias for show\_topics() that prints the top n most probable words for topics number of topics to log. Set topics=-1 to print all topics. 
> 
> 
> 

You trained the model without specifying the truncation level on the number of topics and the default one is 150. Calling the `print_topics` with `topics=-1` you'll get the top 20 words for each topic , in your case 150 topics.

I'm still a newbie of the library, so maybe I' wrong