If you have trained a model using scikit-learn in Python, you can access the column names of the features used in the model using the feature_names_
attribute. Here's how you can do it:
main.py236 chars11 lines
Replace X_train
with your input features and y_train
with your target variable. X_train.columns
assumes that your input features are provided as a pandas DataFrame.
Note: This method is specific to scikit-learn models. Different libraries or models may have different ways to access the column names.
gistlibby LogSnag