-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Fix model save error when using acc metric model save issue - Fix model error when all feature columns are dense
- Loading branch information
Showing
14 changed files
with
114 additions
and
96 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
Author: | ||
Weichen Shen,[email protected] | ||
zanshuxun, [email protected] | ||
""" | ||
from __future__ import print_function | ||
|
@@ -75,7 +76,7 @@ def forward(self, X, sparse_feat_refine_weight=None): | |
|
||
sparse_embedding_list += varlen_embedding_list | ||
|
||
linear_logit = torch.zeros([X.shape[0], 1]).to(sparse_embedding_list[0].device) | ||
linear_logit = torch.zeros([X.shape[0], 1]).to(self.device) | ||
if len(sparse_embedding_list) > 0: | ||
sparse_embedding_cat = torch.cat(sparse_embedding_list, dim=-1) | ||
if sparse_feat_refine_weight is not None: | ||
|
@@ -476,6 +477,10 @@ def _log_loss(self, y_true, y_pred, eps=1e-7, normalize=True, sample_weight=None | |
sample_weight, | ||
labels) | ||
|
||
@staticmethod | ||
def _accuracy_score(y_true, y_pred): | ||
return accuracy_score(y_true, np.where(y_pred > 0.5, 1, 0)) | ||
|
||
def _get_metrics(self, metrics, set_eps=False): | ||
metrics_ = {} | ||
if metrics: | ||
|
@@ -490,8 +495,7 @@ def _get_metrics(self, metrics, set_eps=False): | |
if metric == "mse": | ||
metrics_[metric] = mean_squared_error | ||
if metric == "accuracy" or metric == "acc": | ||
metrics_[metric] = lambda y_true, y_pred: accuracy_score( | ||
y_true, np.where(y_pred > 0.5, 1, 0)) | ||
metrics_[metric] = self._accuracy_score | ||
self.metrics_names.append(metric) | ||
return metrics_ | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
Cython>=0.28.5 | ||
tensorflow==1.15.4 | ||
tensorflow==2.7.2 | ||
scikit-learn==1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,12 @@ | |
long_description = fh.read() | ||
|
||
REQUIRED_PACKAGES = [ | ||
'torch>=1.1.0', 'tqdm', 'sklearn', 'tensorflow' | ||
'torch>=1.1.0', 'tqdm', 'scikit-learn', 'tensorflow' | ||
] | ||
|
||
setuptools.setup( | ||
name="deepctr-torch", | ||
version="0.2.7", | ||
version="0.2.8", | ||
author="Weichen Shen", | ||
author_email="[email protected]", | ||
description="Easy-to-use,Modular and Extendible package of deep learning based CTR(Click Through Rate) prediction models with PyTorch", | ||
|
@@ -37,6 +37,7 @@ | |
'Programming Language :: Python :: 3.5', | ||
'Programming Language :: Python :: 3.6', | ||
'Programming Language :: Python :: 3.7', | ||
'Programming Language :: Python :: 3.8', | ||
'Topic :: Scientific/Engineering', | ||
'Topic :: Scientific/Engineering :: Artificial Intelligence', | ||
'Topic :: Software Development', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.