Skip to content

Commit

Permalink
Update example in Readme (#26)
Browse files Browse the repository at this point in the history
* Update example in Readme

* Restructure examples and link from Readme

* Update gitignore
  • Loading branch information
mats-claassen authored May 14, 2024
1 parent 503d022 commit be3ac55
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

experiments/
11 changes: 7 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,14 @@ Here is a basic example of how to use TF Tabular:

```python
from tf_tabular.builder import InputBuilder
from tf_tabular.numeric_processor import NumericProcessor

# Define columns to use and specify additional parameters:
categoricals = ['Pclass', 'Sex']
categoricals = ['Pclass', 'Embarked']
numericals = ['Age', 'Fare']
# ....

# Build model:
input_builder = InputBuilder(numeric_processor=NumericProcessor(num_projection=8, cross_features=False))
input_builder = InputBuilder()
input_builder.add_inputs_list(categoricals=categoricals,
numericals=numericals,
normalization_params=norm_params,
Expand All @@ -49,7 +48,11 @@ Which will produce a model like this:
![Netron Model View](/media/images/example_netron.png)


Look at the examples folder for more complete examples.
## Examples
The **examples** folder includes more complete examples including:
* [Titanic](examples/titanic/titanic.ipynb): A simple binary classification example using the Titanic dataset.
* [MovieLens](examples/movielens/movielens.ipynb): A two tower retrieval model using the MovieLens dataset.
* [MovieLens Sequential](examples/sequential/movielens_sequential.ipynb): Another two tower retrieval model build on the MovieLens dataset preprocessed so that the input of the model is the list of movies the user has interacted with.

## Contributing
Contributions to TF Tabular are welcome. If you have a feature you'd like to add, or a bug you'd like to fix, please open a pull request.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/titanic.ipynb → examples/titanic/titanic.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv('data/titanic.csv')"
"df = pd.read_csv('titanic.csv')"
]
},
{
Expand Down
Binary file modified media/images/example_netron.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be3ac55

Please sign in to comment.