code: def predictor_from_problem(
      df: pd.DataFrame,
      problem_definition: Union[ProblemDefinition, dict],
  ) -> PredictorInterface:
      """
      Creates a ready-to-train ``Predictor`` object from some raw data and a ``ProblemDefinition``. Do not use this if you want to edit the JsonAI first. Usually you'd want to next train this predictor by calling the ``learn`` method on the same dataframe used to create it.
  
      :param df: The raw data
      :param problem_definition: The manual specifications for your predictive problem
  
      :returns: A lightwood ``Predictor`` object
      """  # noqa
      if not isinstance(problem_definition, ProblemDefinition):
          problem_definition = ProblemDefinition.from_dict(
              problem_definition
          )
  
      if problem_definition.ignore_features:
          log.info(
              f"Dropping features: {problem_definition.ignore_features}"
          )
          df = df.drop(columns=problem_definition.ignore_features)
  
      predictor_class_str = code_from_problem(df, problem_definition)
      return predictor_from_code(predictor_class_str)
  
imports: import os
  from typing import Union
  import dill
  import pandas
  from lightwood.api.types import JsonAI, ProblemDefinition
  from dataprep_ml.insights import statistical_analysis
  from type_infer.api import infer_types
  from lightwood.api.predictor import PredictorInterface
  from lightwood.api.json_ai import generate_json_ai
  from lightwood.helpers.codegen import code_from_json_ai, _module_from_code, _predictor_from_code
  import sys
  import gc
  import time
  from lightwood.helpers.log import log
  from shutil import copyfile
label_desc: Use image node_id 2 for calling a global function with example usage: predictor_from_problem(df, problem_definition) and returns: predictor_from_code