Skip to content

Extract feature vector from prediction #522

Answered by dosubot bot
dpvargas asked this question in Q&A
Discussion options

You must be logged in to vote

You can extract feature vectors from a model in PyTorch Tabular using the DeepFeatureExtractor. Here's how you can do it:

# Pass the trained model as an argument
dt = DeepFeatureExtractor(tabular_model)
# Use the train dataframe to extract the last layer features
# The `fit` method is there only for compatibility and does not perform any operation
enc_df = dt.fit_transform(train)
# Use the extracted embeddings on a new dataframe
val_transformed = dt.transform(val)

This example demonstrates how to use the DeepFeatureExtractor to obtain feature vectors from a trained model [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by manujosephv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant