Neurosynth topic-based decoding via NiMARE

You don’t need all of those steps. You can just fetch the LDA50 features directly and feed them into the conversion function, just like the default TFIDF weights.

Yes, the format of Neurosynth and NeuroQuery files has been changed in order to (1) minimize the space used by the database and (2) use the same convention in both. However, NiMARE can work with these new files just fine.

Take a look at this:

import os
from pprint import pprint

import nimare

out_dir = os.path.abspath("/Users/m246120/Desktop/dAD_BPR/Decoding/")
os.makedirs(out_dir, exist_ok=True)

# Fetch Neurosynth with *just* the LDA50 features
files = nimare.extract.fetch_neurosynth(
    data_dir=out_dir,  # version 0.0.10 switched to data directory
    version="7",
    overwrite=False,
    source="abstract",
    vocab="LDA50",  # Note the difference here
)
neurosynth_db = files[0]
pprint(neurosynth_db)
# Note the "keys" file. That has the top 30 words for each topic.
# It *doesn't* go in the Dataset at all though.

# Get the Dataset object
neurosynth_dset = nimare.io.convert_neurosynth_to_dataset(
    coordinates_file=neurosynth_db["coordinates"],
    metadata_file=neurosynth_db["metadata"],
    annotations_files=neurosynth_db["features"],
)

From there you can use whichever decoder best fits your analysis. No need to run a model.
The GCLDA method (gclda_decode_map) won’t work, since it relies on probability distributions that are available in a GCLDA model, but not an LDA one, but the others would.

If you want to decode an unthresholded map, you can use the CorrelationDecoder, but you should be aware that it’s currently very slow, and it’s generally easier to just loop through the features and run the meta-analyses with your own script, as discussed in Issue: fitting nimare.decode.continuous.CorrelationDecoder to Neurosynth dataset. You can find the template for such a script in that topic.

The CorrelationDecoder has a parameter, frequency_threshold, that determines how studies are divided into being “about that feature” and “not about that feature”. When you run a meta-analysis on a larger Dataset like Neurosynth, you are going to want to separate the studies into those that are “positive” (about) the feature and those that are negative. For Neurosynth’s standard TFIDF values, the default threshold to do this is 0.001, based on the original Neurosynth code. However, for the LDA topic model weights, the default in Neurosynth’s code is 0.05 (i.e., frequency_threshold=0.05).