code: def tune_parameters():
      # Load data
      restaurant_visits_rows = load_data(FLAGS.input_file)
      # Create aggregate_params, data_extractors and public partitions.
      aggregate_params = get_aggregate_params()
      public_partitions = (
          list(range(1, 8)) if FLAGS.public_partitions else None
      )
      backend = pipeline_dp.LocalBackend()
  
      if FLAGS.run_on_preaggregated_data:
          input = list(
              analysis.preaggregate(
                  restaurant_visits_rows, backend, get_data_extractors()
              )
          )
          data_extractors = pipeline_dp.PreAggregateExtractors(
              partition_extractor=lambda row: row[0],
              preaggregate_extractor=lambda row: row[1],
          )
          hist = computing_histograms.compute_dataset_histograms_on_preaggregated_data(
              input, data_extractors, backend
          )
      else:
          input = restaurant_visits_rows
          data_extractors = get_data_extractors()
          hist = computing_histograms.compute_dataset_histograms(
              input, data_extractors, backend
          )
      # Hist is 1-element iterable and the single element is a computed histogram.
      hist = list(hist)[0]
  
      minimizing_function = (
          parameter_tuning.MinimizingFunction.ABSOLUTE_ERROR
      )
      parameters_to_tune = parameter_tuning.ParametersToTune(
          max_partitions_contributed=True,
          max_contributions_per_partition=True,
      )
      tune_options = parameter_tuning.TuneOptions(
          epsilon=1,
          delta=1e-5,
          aggregate_params=aggregate_params,
          function_to_minimize=minimizing_function,
          parameters_to_tune=parameters_to_tune,
          pre_aggregated_data=FLAGS.run_on_preaggregated_data,
      )
  
      result, per_partition = parameter_tuning.tune(
          input,
          backend,
          hist,
          tune_options,
          data_extractors,
          public_partitions,
      )
      if FLAGS.output_file_per_partition_analysis:
          write_to_file(
              per_partition, FLAGS.output_file_per_partition_analysis
          )
  
      # Here's where the lazy iterator initiates computations and gets transformed
      # into actual results
      result = list(result)
  
      # Save the results
      write_to_file(result, FLAGS.output_file)
  
file_path: pipelinedp/examples/restaurant_visits/run_without_frameworks_tuning.py
imports: from absl import app
  from absl import flags
  import pipeline_dp
  import pandas
  import analysis
  from analysis import parameter_tuning
  from pipeline_dp.dataset_histograms import computing_histograms
label_desc: Use image node_id 5 for calling a global function with example usage: tune_parameters() without return types