text: from d3m import index
  from d3m.metadata.base import ArgumentType
  from d3m.metadata.pipeline import Pipeline, PrimitiveStep
  
  from kf_d3m_primitives.pipeline_base import PipelineBase
  
  class LstmFcnPipeline(PipelineBase):
  
      def __init__(
          self,
          epochs: int = 5000,
          attention_lstm: bool = True,
      ):
  
          pipeline_description = Pipeline()
          pipeline_description.add_input(name="inputs")
  
          # Ts formatter
          step = PrimitiveStep(
              primitive=index.get_primitive(
                  "d3m.primitives.data_preprocessing.data_cleaning.DistilTimeSeriesFormatter"
              )
          )
          step.add_argument(
              name="inputs", argument_type=ArgumentType.CONTAINER, data_reference="inputs.0"
          )
          step.add_output("produce")
          pipeline_description.add_step(step)
  
          # DS to DF on formatted ts DS
          step = PrimitiveStep(
              primitive=index.get_primitive(
                  "d3m.primitives.data_transformation.dataset_to_dataframe.Common"
              )
          )
          step.add_argument(
              name="inputs",
              argument_type=ArgumentType.CONTAINER,
              data_reference="steps.0.produce",
          )
          step.add_output("produce")
          pipeline_description.add_step(step)
  
          # DS to DF on input DS
          step = PrimitiveStep(
              primitive=index.get_primitive(
                  "d3m.primitives.data_transformation.dataset_to_dataframe.Common"
              )
          )
          step.add_argument(
              name="inputs", argument_type=ArgumentType.CONTAINER, data_reference="inputs.0"
          )
          step.add_output("produce")
          pipeline_description.add_step(step)
  
          # column parser on input DF
          step = PrimitiveStep(
              primitive=index.get_primitive(
                  "d3m.primitives.data_transformation.column_parser.Common"
              )
          )
          step.add_argument(
              name="inputs",
              argument_type=ArgumentType.CONTAINER,
              data_reference="steps.2.produce",
          )
          step.add_output("produce")
          step.add_hyperparameter(
              name="parse_semantic_types",
              argument_type=ArgumentType.VALUE,
              data=[
                  "http://schema.org/Boolean",
                  "http://schema.org/Integer",
                  "http://schema.org/Float",
                  "https://metadata.datadrivendiscovery.org/types/FloatVector",
              ],
          )
          pipeline_description.add_step(step)
  
          # parse target semantic types
          step = PrimitiveStep(
              primitive=index.get_primitive(
                  "d3m.primitives.data_transformation.extract_columns_by_semantic_types.Common"
              )
          )
          step.add_argument(
              name="inputs",
              argument_type=ArgumentType.CONTAINER,
              data_reference="steps.3.produce",
          )
          step.add_hyperparameter(
              name="semantic_types",
              argument_type=ArgumentType.VALUE,
              data=[
                  "https://metadata.datadrivendiscovery.org/types/Target",
              ],
          )
          step.add_output("produce")
          pipeline_description.add_step(step)
  
          # LSTM FCN
          step = PrimitiveStep(
              primitive=index.get_primitive(
                  "d3m.primitives.time_series_classification.convolutional_neural_net.LSTM_FCN"
              )
          )
          step.add_argument(
              name="inputs",
              argument_type=ArgumentType.CONTAINER,
              data_reference="steps.1.produce",
          )
          step.add_argument(
              name="outputs",
              argument_type=ArgumentType.CONTAINER,
              data_reference="steps.4.produce",
          )
          step.add_hyperparameter(
              name='epochs', argument_type=ArgumentType.VALUE, data=epochs
          )  
          step.add_hyperparameter(
              name='attention_lstm', argument_type=ArgumentType.VALUE, data=attention_lstm
          )  
          step.add_output("produce")
          pipeline_description.add_step(step)
          
          # construct predictions
          step = PrimitiveStep(
              primitive=index.get_primitive(
                  "d3m.primitives.data_transformation.construct_predictions.Common"
              )
          )
          step.add_argument(
              name="inputs",
              argument_type=ArgumentType.CONTAINER,
              data_reference="steps.5.produce",
          )
          step.add_argument(
              name="reference",
              argument_type=ArgumentType.CONTAINER,
              data_reference="steps.2.produce",
          )
          step.add_output("produce")
          pipeline_description.add_step(step)
  
          # Final Output
          pipeline_description.add_output(
              name="output predictions", data_reference="steps.6.produce"
          )
  
          self.pipeline = pipeline_description
  