JSON-AI Config

api.json_ai.code_from_json_ai(json_ai)[source]

Generates a custom PredictorInterface given the specifications from JsonAI object.

Parameters

json_ai (JsonAI) – JsonAI object with fully specified parameters

Return type

str

Returns

Automated syntax of the PredictorInterface object.

api.json_ai.generate_json_ai(type_information, statistical_analysis, problem_definition)[source]

Given TypeInformation, StatisticalAnalysis, and the ProblemDefinition, generate a JSON config file with the necessary elements of the ML pipeline populated.

Parameters
  • TypeInformation – Specifies what data types each column within the dataset are

  • statistical_analysis (StatisticalAnalysis) –

  • problem_definition (ProblemDefinition) – Specifies details of the model training/building procedure, as defined by ProblemDefinition

Return type

JsonAI

Returns

JSON-AI object with fully populated details of the ML pipeline

api.json_ai.lookup_encoder(col_dtype, col_name, is_target, problem_defintion, is_target_predicting_encoder, statistical_analysis)[source]

Assign a default encoder for a given column based on its data type, and whether it is a target. Encoders intake raw (but cleaned) data and return an feature representation. This function assigns, per data type, what the featurizer should be. This function runs on each column within the dataset available for model building to assign how it should be featurized.

Users may override to create a custom encoder to enable their own featurization process. However, in order to generate template JSON-AI, this code runs automatically. Users may edit the generated syntax and use custom approaches while model building.

For each encoder, “args” may be passed. These args depend an encoder requires during its preparation call.

Parameters
  • col_dtype (str) – A data-type of a column specified

  • col_name (str) – The name of the column

  • is_target (bool) – Whether the column is the target for prediction. If true, only certain possible feature representations are allowed, particularly for complex data types.

  • problem_definition – The ProblemDefinition criteria; this populates specifics on how models and encoders may be trained.

  • is_target_predicting_encoder (bool) –

api.json_ai.validate_json_ai(json_ai)[source]

Checks the validity of a JsonAI object

Parameters

json_ai (JsonAI) – A JsonAI object

Return type

bool

Returns

Whether the JsonAI is valid, i.e. doesn’t contain prohibited values, unknown values and can be turned into code.