Unverified Commit 4da76e23 authored by Bharath Ramsundar's avatar Bharath Ramsundar Committed by GitHub
Browse files

Merge pull request #2097 from nd-02110114/add-type-annotate-evaluate

Fix docs errors and Update type annotation
parents fe566a82 de903234
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -119,7 +119,7 @@ class GraphData:
    Returns
    -------
    dgl.DGLGraph
      Graph data for PyTorch Geometric
      Graph data for DGL

    Notes
    -----
+5 −1
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ import collections
import logging
from functools import reduce
from operator import mul
from typing import Dict, List, Optional
from typing import cast, Dict, List, Optional

from deepchem.data import Dataset
from deepchem.trans import Transformer
@@ -155,6 +155,8 @@ class GridHyperparamOpt(HyperparamOpt):

      evaluator = Evaluator(model, valid_dataset, output_transformers)
      multitask_scores = evaluator.compute_model_performance([metric])
      # NOTE: this casting is workaround. This line doesn't effect anything to the runtime
      multitask_scores = cast(Dict[str, float], multitask_scores)
      valid_score = multitask_scores[metric.name]
      hp_str = _convert_hyperparam_dict_to_filename(hyper_params)
      all_scores[hp_str] = valid_score
@@ -180,6 +182,8 @@ class GridHyperparamOpt(HyperparamOpt):
      return best_model, best_hyperparams, all_scores
    train_evaluator = Evaluator(best_model, train_dataset, output_transformers)
    multitask_scores = train_evaluator.compute_model_performance([metric])
    # NOTE: this casting is workaround. This line doesn't effect anything to the runtime
    multitask_scores = cast(Dict[str, float], multitask_scores)
    train_score = multitask_scores[metric.name]
    logger.info("Best hyperparameters: %s" % str(best_hyperparams))
    logger.info("train_score: %f" % train_score)
+2 −2
Original line number Diff line number Diff line
@@ -484,8 +484,8 @@ def cosine_dist(x, y):
  themselves could be different batches. Using vectors or tensors of all 0s
  should be avoided.

  Method
  ------
  Methods
  -------
  The vectors in the input tensors are first l2-normalized such that each vector
  has length or magnitude of 1. The inner product (dot product) is then taken 
  between corresponding pairs of row vectors in the input tensors and returned.
+2 −2
Original line number Diff line number Diff line
@@ -41,8 +41,8 @@ class Model(BaseEstimator):
    This is intended only for convenience of subclass implementations
    and should not be invoked directly.

    Parameters:
    -----------
    Parameters
    ----------
    model_instance: object
      Wrapper around ScikitLearn/Keras/Tensorflow model object.
    model_dir: str, optional (default None)
+7 −7
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ class Optimizer(object):
    -------
    a new PyTorch optimizer implementing the algorithm
    """
    raise NotImplemented("Subclasses must implement this")
    raise NotImplementedError("Subclasses must implement this")


class LearningRateSchedule(object):
@@ -82,7 +82,7 @@ class LearningRateSchedule(object):
    -------
    a PyTorch scheduler implementing the schedule
    """
    raise NotImplemented("Subclasses must implement this")
    raise NotImplementedError("Subclasses must implement this")


class AdaGrad(Optimizer):
@@ -93,8 +93,8 @@ class AdaGrad(Optimizer):
  The more updates a parameter receives, the smaller the updates. See [1]_ for
  a full reference for the algorithm.

  Returns
  -------
  References
  ----------
  .. [1] Duchi, John, Elad Hazan, and Yoram Singer. "Adaptive subgradient
     methods for online learning and stochastic optimization." Journal of machine
     learning research 12.7 (2011).
Loading