Commit 6069a093 authored by Ubuntu's avatar Ubuntu
Browse files

-r2_score +test

parent 1f95554a
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -71,10 +71,6 @@ def pearson_r2_score(y, y_pred):
  """Computes Pearson R^2 (square of Pearson correlation)."""
  return pearsonr(y, y_pred)[0]**2

def r2_score(y, y_pred):
  """Computes R^2 using coefficient of determination (can be negative)."""
  return r2_score(y, y_pred)

def prc_auc_score(y, y_pred):
  """Compute area under precision-recall curve"""
  assert y_pred.shape == y.shape
+5 −0
Original line number Diff line number Diff line
@@ -55,3 +55,8 @@ def test_graph_conv_regression_model():
  model.save()
  model = TensorGraph.load_from_dir(model.model_dir)
  scores = model.evaluate(dataset, [metric], transformers)

  caffeine = 'CN1C(=O)N(C)c2ncn(C)c2C1=O'
  asprin = 'CC(=O)Oc1ccccc1C(=O)O'
  mols = np.array([caffeine, asprin])
  out = model.predict_on_smiles(mols, transformers)