Predictions
- class Predictions(session_kwargs, client, return_type='raw')
Civis API
/predictionsendpoint:import civis client = civis.APIClient() # Call client.predictions.<method>(<arguments>) to make a request, e.g.: client.predictions.list(...)
Methods
get(id)Show the specified prediction
get_schedules(id)Show the prediction schedule
list(*[, model_id])List predictions
list_schedules(id)Show the prediction schedule
- get(id: int) Response
Show the specified prediction
API URL:
GET /predictions/{id}- 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_run
civis.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.
- last_run
- 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.
- score_statsList[
- scored_tablesList[
- schedule
civis.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.
- schedule
- 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.
- get_schedules(id: int) Response
Show the prediction schedule
API URL:
GET /predictions/{id}/schedules- Parameters:
- idint
ID of the prediction associated with this schedule.
- Returns:
civis.Response- idint
ID of the prediction associated with this schedule.
- schedule
civis.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.
- schedule
- score_on_model_buildbool
Whether the prediction will run after a rebuild of the associated model.
- list(*, model_id: int = None) ListResponse
List predictions
API URL:
GET /predictions- Parameters:
- model_idint, optional
If specified, only return predictions associated with this model ID.
- Returns:
civis.ListResponse- 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_run
civis.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.
- last_run
- list_schedules(id: int) ListResponse
Show the prediction schedule
API URL:
GET /predictions/{id}/schedulesWarning
The method name
<client>.predictions.list_schedulesis deprecated and will be removed at civis-python v3.0.0 (no release timeline yet). Please switch to<client>.predictions.get_schedulesfor the same method.- Parameters:
- idint
ID of the prediction associated with this schedule.
- Returns:
civis.Response- idint
ID of the prediction associated with this schedule.
- schedule
civis.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.
- schedule
- score_on_model_buildbool
Whether the prediction will run after a rebuild of the associated model.