Commit 5c827afc authored by Bharath Ramsundar's avatar Bharath Ramsundar
Browse files

Fixes

parent b04449fd
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -179,9 +179,6 @@ def normalize_labels_shape(y, mode=None, n_tasks=None, n_classes=None):
    # If 3D and last dimension isn't 1, assume this is one-hot encoded and return as-is.
    if y.shape[-1] != 1:
      return y
      #raise ValueError(
      #    "y must be a float scalar or a ndarray of shape `(N,)` or `(N, n_tasks)` or `(N, n_tasks, 1)`."
      #)
    y_out = np.squeeze(y, axis=-1)
  # Handle classification. We need to convert labels into one-hot
  # representation.
+2 −4
Original line number Diff line number Diff line
@@ -10,8 +10,7 @@ X = np.random.rand(N, n_feat)
y = np.random.randint(3, size=(N,))
dataset = dc.data.NumpyDataset(X, y)

sklearn_model = RandomForestClassifier(
    class_weight="balanced", n_estimators=50)
sklearn_model = RandomForestClassifier(class_weight="balanced", n_estimators=50)
model = dc.models.SklearnModel(sklearn_model)

# Fit trained model
@@ -20,8 +19,7 @@ model.fit(dataset)
model.save()

print("About to evaluate model")
train_scores = model.evaluate(dataset,
    sklearn.metrics.roc_auc_score, [])
train_scores = model.evaluate(dataset, sklearn.metrics.roc_auc_score, [])

print("Train scores")
print(train_scores)