Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Extract feature vector from prediction #522

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

Is there any way to obtain the feature vector that the model extracts during the process of making a prediction with given data?

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 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 | Incorrect Sources | Too Verbose | Hallucination | Other

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

AltStyle によって変換されたページ (->オリジナル) /