I basically have a python script that tries a variety of dimensionality reduction techniques combined with a variety of classifiers. I attempted to collect the most informative features for each classifier:
if 'forest' in type(classifier).__name__.lower():
importances = classifier.feature_importances_
coefs_with_fns = numpy.argsort(importances)[::-1]
else:
coefs_with_fns = sorted(zip(classifier.coef_, reduced_training.columns))
While this works in principal, the output is just a series of integers, which (i assume) correspond to the column numbers in the feature array before the classifier. Which brings me to the problem: This array is the direct result of one dimensionality reduction method, which throws away all the previously attached column labels.
So my question is: is there a way to trace back the result of the dimensionality reduction to the actual columns/labels in the original dataset?