Predictions

class Predictions(session_kwargs, client, return_type='raw')

Methods

get(id)

Show the specified prediction

list(*[, model_id])

List predictions

list_schedules(id)

Show the prediction schedule

Examples

>>> import civis
>>> client = civis.APIClient()
>>> client.predictions.list(...)
get(id: int) Response

Show the specified prediction

Parameters:
idint

The ID of the prediction.

Returns:
civis.Response
  • idint

    The ID of the prediction.

  • model_idint

    The ID of the model used for this prediction.

  • scored_table_idint

    The ID of the source table for this prediction.

  • scored_table_namestr

    The name of the source table for this prediction.

  • output_table_namestr

    The name of the output table for this prediction.

  • statestr

    The state of the last run of this prediction.

  • errorstr

    The error, if any, of the last run of this prediction.

  • started_atstr (date-time)

    The start time of the last run of this prediction.

  • finished_atstr (date-time)

    The end time of the last run of this prediction.

  • last_runcivis.Response
    • id : int

    • state : str

    • created_atstr (time)

      The time that the run was queued.

    • started_atstr (time)

      The time that the run started.

    • finished_atstr (time)

      The time that the run completed.

    • errorstr

      The error message for this run, if present.

  • scored_tablesList[civis.Response]

    An array of created prediction tables.

    • idint

      The ID of the table with created predictions.

    • schemastr

      The schema of table with created predictions.

    • namestr

      The name of table with created predictions.

    • created_atstr (date-time)

      The time when the table with created predictions was created.

    • score_statsList[civis.Response]

      An array of metrics on the created predictions.

      • score_namestr

        The name of the score.

      • histogramList[int]

        The histogram of the distribution of scores.

      • avg_scorefloat (float)

        The average score.

      • min_scorefloat (float)

        The minimum score.

      • max_scorefloat (float)

        The maximum score.

  • schedulecivis.Response
    • scheduledbool

      If the item is scheduled.

    • scheduled_daysList[int]

      Days of the week, based on numeric value starting at 0 for Sunday. Mutually exclusive with scheduledDaysOfMonth

    • scheduled_hoursList[int]

      Hours of the day it is scheduled on.

    • scheduled_minutesList[int]

      Minutes of the day it is scheduled on.

    • scheduled_runs_per_hourint

      Deprecated in favor of scheduled minutes.

    • scheduled_days_of_monthList[int]

      Days of the month it is scheduled on, mutually exclusive with scheduledDays.

  • limiting_sqlstr

    A SQL WHERE clause used to scope the rows to be predicted.

  • primary_keyList[str]

    The primary key or composite keys of the table being predicted.

list(*, model_id: int = None) Response

List predictions

Parameters:
model_idint, optional

If specified, only return predictions associated with this model ID.

Returns:
civis.Response
  • idint

    The ID of the prediction.

  • model_idint

    The ID of the model used for this prediction.

  • scored_table_idint

    The ID of the source table for this prediction.

  • scored_table_namestr

    The name of the source table for this prediction.

  • output_table_namestr

    The name of the output table for this prediction.

  • statestr

    The state of the last run of this prediction.

  • errorstr

    The error, if any, of the last run of this prediction.

  • started_atstr (date-time)

    The start time of the last run of this prediction.

  • finished_atstr (date-time)

    The end time of the last run of this prediction.

  • last_runcivis.Response
    • id : int

    • state : str

    • created_atstr (time)

      The time that the run was queued.

    • started_atstr (time)

      The time that the run started.

    • finished_atstr (time)

      The time that the run completed.

    • errorstr

      The error message for this run, if present.

list_schedules(id: int) Response

Show the prediction schedule

Parameters:
idint

ID of the prediction associated with this schedule.

Returns:
civis.Response
  • idint

    ID of the prediction associated with this schedule.

  • schedulecivis.Response
    • scheduledbool

      If the item is scheduled.

    • scheduled_daysList[int]

      Days of the week, based on numeric value starting at 0 for Sunday. Mutually exclusive with scheduledDaysOfMonth

    • scheduled_hoursList[int]

      Hours of the day it is scheduled on.

    • scheduled_minutesList[int]

      Minutes of the day it is scheduled on.

    • scheduled_runs_per_hourint

      Deprecated in favor of scheduled minutes.

    • scheduled_days_of_monthList[int]

      Days of the month it is scheduled on, mutually exclusive with scheduledDays.

  • score_on_model_buildbool

    Whether the prediction will run after a rebuild of the associated model.