class_docstr: Helper class to create model test data, setup and run experiment.
  
  Contain the needed model experiment statistics as class attributes.
class_docstr_tok: ["Helper","class","to","create","model","test","data",",","setup","and","run","experiment",".","Contain","the","needed","model","experiment","statistics","as","class","attributes","."]
code: def __init__(self, csv_filename, tmpdir):
      self.tmpdir = tmpdir
      self.csv_file = os.path.join(tmpdir, csv_filename)
      self.input_features = [
          category_feature(encoder={"vocab_size": 10})
      ]
      self.output_features = [
          category_feature(
              decoder={"vocab_size": 2}, reduce_input="sum"
          )
      ]
      data_csv = generate_data(
          self.input_features, self.output_features, self.csv_file
      )
      self.model = self._create_model()
      test_df, train_df, val_df = obtain_df_splits(data_csv)
      (
          self.train_stats,
          self.preprocessed_data,
          self.output_dir,
      ) = self.model.train(
          training_set=train_df,
          validation_set=val_df,
          output_directory=os.path.join(tmpdir, "results"),
      )
      (
          self.test_stats_full,
          predictions,
          self.output_dir,
      ) = self.model.evaluate(
          dataset=test_df,
          collect_overall_stats=True,
          collect_predictions=True,
          output_directory=self.output_dir,
          return_type="dict",
      )
      self.output_feature_name = self.output_features[0][NAME]
      self.ground_truth_metadata = self.preprocessed_data[3]
      self.ground_truth = test_df[self.output_feature_name]
      # probabilities need to be list of lists containing each row data
      # from the probability columns
      # ref: https://ludwig-ai.github.io/ludwig-docs/latest/user_guide/api/LudwigModel#evaluate - Return
      self.probability = predictions[self.output_feature_name][
          PROBABILITY
      ]
      self.probabilities = predictions[self.output_feature_name][
          PROBABILITIES
      ]
      self.predictions = predictions[self.output_feature_name][
          PREDICTIONS
      ]
  
      # numeric encoded values required for some visualizations
      of_metadata = self.ground_truth_metadata[self.output_feature_name]
      self.predictions_num = [
          of_metadata["str2idx"][x] for x in self.predictions
      ]
  
imports: import glob
  import logging
  import os
  from tempfile import TemporaryDirectory
  import numpy
  import pytest
  from ludwig import visualize
  from ludwig.api import LudwigModel, TrainingStats
  from ludwig.constants import BATCH_SIZE, ENCODER, NAME, PREDICTIONS, PROBABILITIES, PROBABILITY, TRAINER, TYPE
  from ludwig.data.split import get_splitter
  from ludwig.globals import HYPEROPT_STATISTICS_FILE_NAME
  from ludwig.utils.data_utils import read_csv
  from tests.integration_tests.utils import bag_feature, binary_feature, category_feature, generate_data, LocalTestBackend, number_feature, sequence_feature, set_feature, text_feature
label_desc: Use image node_id 1 to create a new Experiment object  with example: obj = Experiment(csv_filename, tmpdir)