How to find the optimal number k of components?
To find the optimal number of components in NLPCA is the same difficult problem as in classical linear PCA,
a) test several numbers k
When you use NLPCA in recommended hierarchical mode, the components will be ranked/ordered as in classical linear PCA. You could set k=10 (or maybe better only 5) nonlinear components and later check the results of the first, first two, first three,... components, to find the optimal number for your problem.
However, when you use NLPCA in the faster classical symmetric mode, even though the nonlinear component-subspace is the same, the components have no order, hence you would need to set the exact number you need.
b) use missing data validation for estimating the best k
Missing data estimation is used to estimate the optimal complexity parameter (weight-decay).