In any examples or guides using mne.preprocessing.ICA, the value of n_components seems to be set more or less arbitrarily, often at values around 20.
Is there any method in mne to optimize the number of components? If not, I think it should be relatively straightforward to use cross-validation, which is what I will do, but I just want to make sure I am not missing something as I am new to mne. A related question is whether there is any measure of model fit that is available? There is a variance-explained function, but unless I am missing something, there is nothing like log-likelihood or other common measures.
The number of components you select is a personal choise. As a rule of thumb you can choose as many conponents as your EEG channels, as @richard has previously pointed out (1)(2). However, note that you need to have enough data points to be able to compute that many components. As pointed out in EEGLABβs website:
ICA works best when given a large amount of basically similar and mostly clean data. When the number of channels (N) is large (>>32), then a considerable amount of data may be required to find N components.
I agree with you that MNE-python uses only variance-explained as a measure of model fit. For other methods you will need to provide the code yourself.