Is it possible to access feature specs from model?


I’m working on a task that requires a generalized way of retrieving feature names from a keras model alone. Ideally I’d be able to load a pretrained model, and access it’s feature’s names.

I’ve looked through the docs and haven’t found much, and also am a little bit concerned that there is no such solution. I’ve seen it done using sklearn’s feature_names_in attribute, so is there a keras/tf equivalent? Any insight is greatly appreciated.

Hi @Rawan_Mahdi, Unlike sklearn there is no equivalent for getting feature names in tensorflow, because tensorflow/keras models mainly focus on the shape and dimensions of the input tensors rather than the individual features. The model utilizes the input features as tensors, regardless of name.If you want to see each layer input and output shape you can use model.summary() to get those details. Thank You.