docstr: Single Layer Perceptron with Dropout.
  
  Parameters
  ----------
  input_shape : tuple
      Shape of data to be trained
  num_hidden : int
      Number of nodes in hidden layer
  act_hidden : string
      Activation function used in hidden layer
  dropout : float
      Dropout ratio
  num_out : 10
      Number of nodes in output layer
  act_out : string
      Activation function used in output layer
  optimizer :  string
      Select optimizer. Default adam.
  loss : string
      Select loss function for measuring accuracy.
      Default sparse_categorical_crossentropy.
docstr_tok: ["Single","Layer","Perceptron","with","Dropout",".","Parameters","--","--","--","--","--","input_shape",":","tuple","Shape","of","data","to","be","trained","num_hidden",":","int","Number","of","nodes","in","hidden","layer","act_hidden",":","string","Activation","function","used","in","hidden","layer","dropout",":","float","Dropout","ratio","num_out",":","10","Number","of","nodes","in","output","layer","act_out",":","string","Activation","function","used","in","output","layer","optimizer",":","string","Select","optimizer",".","Default","adam",".","loss",":","string","Select","loss","function","for","measuring","accuracy",".","Default","sparse_categorical_crossentropy","."]
code: def __init__(
      self,
      input_shape=(28, 28),
      num_hidden=128,
      act_hidden="relu",
      dropout=0.2,
      num_out=10,
      act_out="softmax",
      optimizer="adam",
      loss="sparse_categorical_crossentropy",
  ):
      """Single Layer Perceptron with Dropout.
  
      Parameters
      ----------
      input_shape : tuple
          Shape of data to be trained
      num_hidden : int
          Number of nodes in hidden layer
      act_hidden : string
          Activation function used in hidden layer
      dropout : float
          Dropout ratio
      num_out : 10
          Number of nodes in output layer
      act_out : string
          Activation function used in output layer
      optimizer :  string
          Select optimizer. Default adam.
      loss : string
          Select loss function for measuring accuracy.
          Default sparse_categorical_crossentropy.
  
      """
      self.accuracy = None
      self.loss = None
  
      model = tf.keras.models.Sequential(
          [
              tf.keras.layers.Flatten(input_shape=input_shape),
              tf.keras.layers.Dense(num_hidden, activation=act_hidden),
              tf.keras.layers.Dropout(dropout),
              tf.keras.layers.Dense(num_out, activation=act_out),
          ]
      )
  
      model.compile(
          optimizer=optimizer, loss=loss, metrics=["accuracy"]
      )
  
      self.model = model
  
file_path: dipy/dipy/nn/model.py
imports: from dipy.utils.optpkg import optional_package
label_desc: Use image node_id 1 to create a new SingleLayerPerceptron object  with example: obj = SingleLayerPerceptron(input_shape, num_hidden, act_hidden, dropout, num_out, act_out, optimizer, loss)