code: def test_multitask_classification_regularization():
      """Test regularizing a MultitaskClassifier."""
      n_tasks = 10
      n_samples = 10
      n_features = 3
  
      # Generate dummy dataset
      np.random.seed(123)
      ids = np.arange(n_samples)
      X = np.random.rand(n_samples, n_features)
      y = np.zeros((n_samples, n_tasks))
      w = np.ones((n_samples, n_tasks))
      dataset = dc.data.NumpyDataset(X, y, w, ids)
  
      classification_metric = dc.metrics.Metric(
          dc.metrics.accuracy_score,
          task_averager=np.mean,
          n_tasks=n_tasks,
      )
      model = dc.models.MultitaskClassifier(
          n_tasks,
          n_features,
          layer_sizes=[1000],
          dropouts=0,
          weight_decay_penalty=1.0,
          weight_decay_penalty_type="l1",
          batch_size=n_samples,
          learning_rate=0.0003,
      )
  
      # Fit trained model
      model.fit(dataset, nb_epoch=500)
  
      # Eval model on train
      scores = model.evaluate(dataset, [classification_metric])
      assert scores[classification_metric.name] > 0.9
  
      # Most weights should be close to zero.
  
      elements = 0.0
      num_nonzero = 0.0
      for p in model.model.parameters():
          if len(p.shape) == 2 and p.shape[0] == 1000:
              elements += p.numel()
              num_nonzero += (p.abs() > 1e-3).sum()
      assert num_nonzero / elements < 0.1
  
imports: import os
  import numpy
  import pytest
  from flaky import flaky
  from sklearn.ensemble import RandomForestClassifier
  from sklearn.ensemble import RandomForestRegressor
  import deepchem
  from deepchem.models.optimizers import Adam
label_desc: Use image node_id 12 for calling a global function with example usage: test_multitask_classification_regularization() without return types