docstr: Initialize the CNN 1D denoiser with the given parameters.
  
  Parameters
  ----------
  sig_length : int
      Length of the DWI signal.
  optimizer : str, optional
      Name of the optimization algorithm to use. Options: 'adam', 'sgd',
      'rmsprop', 'adagrad', 'adadelta'.
  loss : str, optional
      Name of the loss function to use. Available options are
      'mean_squared_error', 'mean_absolute_error',
      'mean_absolute_percentage_error', 'mean_squared_logarithmic_error',
      'squared_hinge', 'hinge', 'categorical_hinge', 'logcosh',
      'categorical_crossentropy', 'sparse_categorical_crossentropy',
      'binary_crossentropy', 'kullback_leibler_divergence', 'poisson',
      'cosine_similarity'.
      Suggested to go with 'mean_squared_error'.
  metrics : tuple of str or function, optional
      List of metrics to be evaluated by the model during training and
      testing. Available options are 'accuracy', 'binary_accuracy',
      'categorical_accuracy', 'top_k_categorical_accuracy',
      'sparse_categorical_accuracy', 'sparse_top_k_categorical_accuracy',
      and any custom function.
  loss_weights : float or dict, optional
      Scalar coefficients to weight the loss contributions of different
      model outputs. Can be a single float value or a dictionary mapping
      output names to scalar coefficients.
docstr_tok: ["Initialize","the","CNN","1D","denoiser","with","the","given","parameters",".","Parameters","--","--","--","--","--","sig_length",":","int","Length","of","the","DWI","signal",".","optimizer",":","str",",","optional","Name","of","the","optimization","algorithm","to","use",".","Options",":","'adam","'",",","'sgd","'",",","'rmsprop","'",",","'adagrad","'",",","'adadelta","'",".","loss",":","str",",","optional","Name","of","the","loss","function","to","use",".","Available","options","are","'mean_squared_error","'",",","'mean_absolute_error","'",",","'mean_absolute_percentage_error","'",",","'mean_squared_logarithmic_error","'",",","'squared_hinge","'",",","'hinge","'",",","'categorical_hinge","'",",","'logcosh","'",",","'categorical_crossentropy","'",",","'sparse_categorical_crossentropy","'",",","'binary_crossentropy","'",",","'kullback_leibler_divergence","'",",","'poisson","'",",","'cosine_similarity","'",".","Suggested","to","go","with","'mean_squared_error","'",".","metrics",":","tuple","of","str","or","function",",","optional","List","of","metrics","to","be","evaluated","by","the","model","during","training","and","testing",".","Available","options","are","'accuracy","'",",","'binary_accuracy","'",",","'categorical_accuracy","'",",","'top_k_categorical_accuracy","'",",","'sparse_categorical_accuracy","'",",","'sparse_top_k_categorical_accuracy","'",",","and","any","custom","function",".","loss_weights",":","float","or","dict",",","optional","Scalar","coefficients","to","weight","the","loss","contributions","of","different","model","outputs",".","Can","be","a","single","float","value","or","a","dictionary","mapping","output","names","to","scalar","coefficients","."]
code: def __init__(
      self,
      sig_length,
      optimizer="adam",
      loss="mean_squared_error",
      metrics=("accuracy",),
      loss_weights=None,
  ):
      """Initialize the CNN 1D denoiser with the given parameters.
  
      Parameters
      ----------
      sig_length : int
          Length of the DWI signal.
      optimizer : str, optional
          Name of the optimization algorithm to use. Options: 'adam', 'sgd',
          'rmsprop', 'adagrad', 'adadelta'.
      loss : str, optional
          Name of the loss function to use. Available options are
          'mean_squared_error', 'mean_absolute_error',
          'mean_absolute_percentage_error', 'mean_squared_logarithmic_error',
          'squared_hinge', 'hinge', 'categorical_hinge', 'logcosh',
          'categorical_crossentropy', 'sparse_categorical_crossentropy',
          'binary_crossentropy', 'kullback_leibler_divergence', 'poisson',
          'cosine_similarity'.
          Suggested to go with 'mean_squared_error'.
      metrics : tuple of str or function, optional
          List of metrics to be evaluated by the model during training and
          testing. Available options are 'accuracy', 'binary_accuracy',
          'categorical_accuracy', 'top_k_categorical_accuracy',
          'sparse_categorical_accuracy', 'sparse_top_k_categorical_accuracy',
          and any custom function.
      loss_weights : float or dict, optional
          Scalar coefficients to weight the loss contributions of different
          model outputs. Can be a single float value or a dictionary mapping
          output names to scalar coefficients.
  
      """
      if not have_tf:
          raise ImportError(
              "TensorFlow is not available. Please install "
              "TensorFlow 2+."
          )
      if not have_sklearn:
          raise ImportError(
              "scikit-learn is not available. Please install "
              "scikit-learn."
          )
      input_layer = Input(shape=(sig_length, 1))
      x = Conv1D(
          filters=16,
          kernel_size=16,
          kernel_initializer="Orthogonal",
          padding="same",
          name="Conv1",
      )(input_layer)
      x = Activation("relu", name="ReLU1")(x)
      max_pool_1d = tf.keras.layers.MaxPooling1D(
          pool_size=2, strides=2, padding="valid"
      )
      pool1 = max_pool_1d(x)
      x = Conv1D(
          filters=32, kernel_size=8, padding="same", name="Conv2"
      )(pool1)
      x = Activation("relu", name="ReLU2")(x)
      pool2 = max_pool_1d(x)
      pool2_flat = tf.keras.layers.Flatten()(pool2)
      logits = tf.keras.layers.Dense(
          units=sig_length, activation="relu"
      )(pool2_flat)
      model = Model(inputs=input_layer, outputs=logits)
      model.compile(
          optimizer=optimizer,
          loss=loss,
          metrics=metrics,
          loss_weights=loss_weights,
      )
      self.model = model
  
file_path: dipy/dipy/nn/cnn_1d_denoising.py
imports: from dipy.utils.optpkg import optional_package
  import numpy
label_desc: Use image node_id 1 to create a new Cnn1DDenoiser object  with example: obj = Cnn1DDenoiser(sig_length, optimizer, loss, metrics, loss_weights)