docstr: Test computing uncertainty for a CNN regression model.
docstr_tok: ["Test","computing","uncertainty","for","a","CNN","regression","model","."]
code: def test_cnn_regression_uncertainty(self):
      """Test computing uncertainty for a CNN regression model."""
      n_samples = 10
      n_features = 2
      n_tasks = 1
      noise = 0.1
  
      np.random.seed(123)
      X = np.random.randn(n_samples, 10, n_features)
      y = np.sum(X, axis=(1, 2)) + np.random.normal(
          scale=noise, size=(n_samples,)
      )
      y = np.reshape(y, (n_samples, n_tasks))
      dataset = dc.data.NumpyDataset(X, y)
  
      model = dc.models.CNN(
          n_tasks,
          n_features,
          dims=1,
          dropouts=0.1,
          kernel_size=3,
          pool_type="average",
          mode="regression",
          learning_rate=0.005,
          uncertainty=True,
      )
  
      # Fit trained model
      model.fit(dataset, nb_epoch=300)
  
      # Predict the output and uncertainty.
      pred, std = model.predict_uncertainty(dataset)
      assert np.mean(np.abs(y - pred)) < 0.3
      assert noise < np.mean(std) < 1.0
  
file_path: deepchem/deepchem/models/tests/test_cnn.py
imports: import deepchem
  import numpy
  import pytest
  import unittest
  from flaky import flaky
label_desc: Use image node_id 4 for calling the TestCNN obj's underlying member method code with example usage: obj.test_cnn_regression_uncertainty() without return types