prediction module

This module handles the prediction phase using a pre-trained Keras neural network model. It loads the catalog, pre-processes the data (normalization and feature engineering), and generates predictions (AGN vs Pulsar) based on the provided model.

prediction.model_prediction(catalog_path=PosixPath('/home/runner/work/Progetto_Computings/Progetto_Computings/files/gll_psc.csv'), model_path=PosixPath('/home/runner/work/Progetto_Computings/Progetto_Computings/dnn/keras_models/prediction_model.keras'), threshold=0.63)[source]

Performs predictions on the provided astronomical catalog using a trained Keras model.

The function loads the catalog and the model, normalizes the input features using StandardScaler, and computes the classification (AGN or Pulsar) based on the specified threshold.

Parameters:
  • catalog_path (str or pathlib.Path, optional) – Path to the input CSV catalog containing source data. Defaults to custom_paths.csv_path.

  • model_path (str or pathlib.Path, optional) – Path to the saved Keras model (.keras). Defaults to custom_paths.model_path.

  • threshold (float, optional) – The decision threshold for the binary classification. Values >= threshold are classified as Pulsar, otherwise AGN. Defaults to 0.63.

Returns:

An array of string labels (‘AGN’ or ‘Pulsar’) corresponding to the predictions.

Return type:

numpy.ndarray