Skip to content

Commit

Permalink
Merge pull request #1 from karlhigley/from-nvtabular
Browse files Browse the repository at this point in the history
Add framework utils from NVTabular
  • Loading branch information
karlhigley authored May 4, 2021
2 parents c172cf4 + f170b71 commit 1aef0e0
Show file tree
Hide file tree
Showing 13 changed files with 1,281 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/merlin_models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
15 changes: 15 additions & 0 deletions src/merlin_models/tensorflow/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
25 changes: 25 additions & 0 deletions src/merlin_models/tensorflow/feature_column_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import tensorflow as tf
from tensorflow.python.feature_column import feature_column_v2 as fc


def _make_categorical_embedding(name, vocab_size, embedding_dim):
column = tf.feature_column.categorical_column_with_identity(name, vocab_size)
if embedding_dim is None:
return tf.feature_column.indicator_column(column)
else:
return tf.feature_column.embedding_column(column, embedding_dim)
21 changes: 21 additions & 0 deletions src/merlin_models/tensorflow/layers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from .embedding import DenseFeatures, LinearFeatures
from .interaction import DotProductInteraction
from .outer_product import XDeepFmOuterProduct

__all__ = [LinearFeatures, DenseFeatures, DotProductInteraction, XDeepFmOuterProduct]
Loading

0 comments on commit 1aef0e0

Please sign in to comment.