Prediction

Prediction is the way to productize the Ensemble created in the previous steps. Once an Ensemble is created, users can upload additional Datasources that may be used for predictions.

‘Prediction’ API includes querying of predictions (Get, List and Delete) and creating a Prediction to get predictions on existing Ensembles and uploaded Datasources.

class fireflyai.resources.prediction.Prediction[source]
classmethod create(ensemble_id: int, data_id: int = None, file_path: str = None, download_details: Dict[KT, VT] = None, remove_header: bool = False, data_name: str = None, header: List[T] = None, wait: bool = None, api_key: str = None) → fireflyai.firefly_response.FireflyResponse[source]

Create a prediction from a given ensemble and prediction datasource.

The prediction datasource should include all the of original features, without the target column (unless the ensemble belongs to a timeseries task). The prediction uses the ensemble to produce the prediction’s results file.

Parameters:
  • ensemble_id (int) – Ensemble to use for the prediction.
  • data_id (int) – Datasource to run the prediction on.
  • wait (Optional[bool]) – Should the call be synchronous or not.
  • api_key (Optional[str]) – Explicit api_key, not required if fireflyai.authenticate was run prior.
Returns:

Prediction ID, if successful and wait=False or Prediction if successful and wait=True; raises FireflyError otherwise.

Return type:

FireflyResponse

classmethod delete(id: int, api_key: str = None) → fireflyai.firefly_response.FireflyResponse[source]

Deletes a specific Prediction.

Parameters:
  • id (int) – Prediction ID.
  • api_key (Optional[str]) – Explicit api_key, not required, if fireflyai.authenticate() was run prior.
Returns:

“true” if deleted successfuly, raises FireflyClientError otherwise.

Return type:

FireflyResponse

classmethod get(id: int, api_key: str = None) → fireflyai.firefly_response.FireflyResponse[source]

Get information on a specific Prediction.

Information includes the state of the Prediction and other attributes.

Parameters:
  • id (int) – Prediction ID.
  • api_key (Optional[str]) – Explicit api_key, not required if fireflyai.authenticate was run prior.
Returns:

Information about the Prediction.

Return type:

FireflyResponse

classmethod list(search_term: str = None, page: int = None, page_size: int = None, sort: Dict[KT, VT] = None, filter_: Dict[KT, VT] = None, api_key: str = None) → fireflyai.firefly_response.FireflyResponse[source]

List the existing Predictions - supports filtering, sorting and pagination.

Parameters:
  • search_term (Optional[str]) – Return only records that contain the search_term in any field.
  • page (Optional[int]) – For pagination, which page to return.
  • page_size (Optional[int]) – For pagination, how many records will appear in a single page.
  • sort (Optional[Dict[str, Union[str, int]]]) – Dictionary of rules to sort the results by.
  • filter (Optional[Dict[str, Union[str, int]]]) – Dictionary of rules to filter the results by.
  • api_key (Optional[str]) – Explicit api_key, not required, if fireflyai.authenticate() was run prior.
Returns:

Predictions are represented as nested dictionaries under hits.

Return type:

FireflyResponse