Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Predict example refactor #136

Merged
merged 2 commits into from
Apr 13, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@

from chainer_chemistry import datasets as D
from chainer_chemistry.dataset.converters import concat_mols
from chainer_chemistry.models.prediction import Classifier
try:
from chainer_chemistry.models.prediction import Classifier
except ImportError:
print('[WARNING] If you want to use Classifier in Chainer Chemistry, '
'please install the library from master branch.\n See '
'https://github.com/pfnet-research/chainer-chemistry#installation'
' for detail.')
from chainer_chemistry.training.extensions.roc_auc_evaluator import \
ROCAUCEvaluator

Expand All @@ -23,7 +29,6 @@


# Disable errors by RDKit occurred in preprocessing Tox21 dataset.

lg = RDLogger.logger()
lg.setLevel(RDLogger.CRITICAL)

Expand Down Expand Up @@ -101,6 +106,9 @@ def main():
# ---- predict ---
print('Predicting...')

# We need to feed only input features `x` to `predict`/`predict_proba`.
# This converter extracts only inputs (x1, x2, ...) from the features which
# consist of input `x` and label `t` (x1, x2, ..., t).
def extract_inputs(batch, device=None):
return concat_mols(batch, device=device)[:-1]

Expand Down