JSON-AI Config

api.high_level.code_from_json_ai(json_ai)[source]

Autogenerates custom code based on the details you specified inside your JsonAI.

Parameters:

json_ai (JsonAI) – A JsonAI object

Return type:

str

Returns:

Code (text) generate based on the JsonAI you created

api.high_level.code_from_problem(df, problem_definition)[source]
Parameters:
  • df (DataFrame) – The raw data

  • problem_definition (Union[ProblemDefinition, dict]) – The manual specifications for your predictive problem

Return type:

str

Returns:

The text code generated based on your data and problem specifications

api.high_level.json_ai_from_problem(df, problem_definition)[source]

Creates a JsonAI from your raw data and problem definition. Usually you would use this when you want to subsequently edit the JsonAI, the easiest way to do this is to unload it to a dictionary via to_dict, modify it, and then create a new object from it using lightwood.JsonAI.from_dict. It’s usually better to generate the JsonAI using this function rather than writing it from scratch.

Parameters:
  • df (DataFrame) – The raw data

  • problem_definition (Union[ProblemDefinition, dict]) – The manual specifications for your predictive problem

Return type:

JsonAI

Returns:

A JsonAI object generated based on your data and problem specifications

api.high_level.predictor_from_code(code)[source]
Parameters:

code (str) – The Predictor’s code in text form

Return type:

PredictorInterface

Returns:

A lightwood Predictor object

api.high_level.predictor_from_json_ai(json_ai)[source]

Creates a ready-to-train Predictor object based on the details you specified inside your JsonAI.

Parameters:

json_ai (JsonAI) – A JsonAI object

Return type:

PredictorInterface

Returns:

A lightwood Predictor object

api.high_level.predictor_from_problem(df, problem_definition)[source]

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.

Parameters:
  • df (DataFrame) – The raw data

  • problem_definition (Union[ProblemDefinition, dict]) – The manual specifications for your predictive problem

Return type:

PredictorInterface

Returns:

A lightwood Predictor object

api.high_level.predictor_from_state(state_file, code=None)[source]
Parameters:
  • state_file (str) – The file containing the pickle resulting from calling save on a Predictor object

  • code (Optional[str]) – The Predictor’s code in text form

Return type:

PredictorInterface

Returns:

A lightwood Predictor object