Skip to content

Commit

Permalink
Merge pull request #10 from manujosephv/develop
Browse files Browse the repository at this point in the history
-- added documentation
  • Loading branch information
manujosephv authored May 1, 2021
2 parents 5ea29cb + 5e79fa4 commit 033344a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
4 changes: 4 additions & 0 deletions docs/history.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,7 @@ History
- Refactored the classes to separate backbones from the head of the models
- Changed the saving and loading model to work for custom parameters that you pass in `fit`

0.5.0 (2021-03-18)
------------------
- Added more documentation
- Added Zenodo citation
31 changes: 31 additions & 0 deletions docs/other_features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Apart from training and using Deep Networks for tabular data, PyTorch Tabular also has some cool features which can help your classical ML/ sci-kit learn pipelines

## Categorical Embeddings

The CategoryEmbedding Model can also be used as a way to encode your categorical columns. instead of using a One-hot encoder or a variant of TargetMean Encoding, you can use a learned embedding to encode your categorical features. And all this can be done using a scikit-learn style Transformer.

### Usage Example

```python
# passing the trained model as an argument
transformer = CategoricalEmbeddingTransformer(tabular_model)
# passing the train dataframe to extract the embeddings and replace categorical features
# defined in the trained tabular_model
train_transformed = transformer.fit_transform(train)
# using the extracted embeddings on new dataframe
val_transformed = transformer.transform(val)
```

## Feature Extractor

What if you want to use the features learnt by the Neural Network in your ML model? Pytorch Tabular let's you do that as well, and with ease. Again, a scikit-learn style Transformer does the job for you.

```python
# passing the trained model as an argument
dt = DeepFeatureExtractor(tabular_model)
# passing the train dataframe to extract the last layer features
# here `fit` is there only for compatibility and does not do anything
enc_df = dt.fit_transform(train)
# using the extracted embeddings on new dataframe
val_transformed = transformer.transform(val)
```
4 changes: 3 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
site_name: PyTorch Tabular
nav:
- Getting Started:
- " ": index.md
- "PyTorch Tabular": index.md
- Tutorials:
- Basic Usage: "tutorials/01-Basic_Usage.ipynb"
- Advanced Usage: "tutorials/02-Advanced_Usage.ipynb"
Expand All @@ -18,6 +18,8 @@ nav:
- Experiment Tracking: experiment_tracking.md
- Tabular Model:
- TabularModel: tabular_model.md
- Other Features:
- "Other Features": other_features.md
# - FAQ: faq.md
- API:
- API: apidocs.md
Expand Down

0 comments on commit 033344a

Please sign in to comment.