## Neural Network False Alarm Probability |

## AbstractThe ability to automatically and robustly self-verify periodicity present in time-series astronomical data is becoming more important as data sets rapidly increase in size. The age of large astronomical surveys has rendered manual inspection of time-series data less practical. Previous efforts in generating a false alarm probability to verify the periodicity of stars have been aimed towards the analysis of a constructed periodogram. However, these methods feature correlations with features that do not pertain to periodicity, such as light curve shape, slow trends and stochastic variability. The common assumption that photometric errors are Gaussian and well determined is also a limitation of analytic methods. We present a novel machine learning-based technique that directly analyses the phase-folded light curve for its false alarm probability. We show that the results of this method are largely insensitive to the shape of the light curve, and we establish minimum values for the number of data points and the amplitude-to-noise ratio. |

If the model is stored in the default path then:

` ````
import NN_FAP
# Assuming you have your time-series data in `time` and `mag` arrays
# Example: time = [t1, t2, t3, ...], mag = [m1, m2, m3, ...]
# Provide the period guess for phase-folding
period_guess = 1.23456
# Call the inference function to get the False Alarm Probability
FAP = NN_FAP.inference(period_guess, mag, time)
print(f"False Alarm Probability: {FAP}")
```
```

for using a custom path with the model:

` ````
import NN_FAP
# Assuming you have your time-series data in `time` and `mag` arrays
# Example: time = [t1, t2, t3, ...], mag = [m1, m2, m3, ...]
# Provide the period guess for phase-folding
period_guess = 1.23456
# Load the pre-trained model and KNN classifier using `get_model`
model_path = '/path/to/your/model_directory/'
knn, model = NN_FAP.get_model(model_path=model_path)
# Call the inference function with the loaded model and KNN
FAP = NN_FAP.inference(period_guess, mag, time, knn=knn, model=model)
print(f"False Alarm Probability: {FAP}")
```
```

...And to create the periodogram:

` ````
import NN_FAP
import numpy as np
# Assuming you have your time-series data in `time` and `mag` arrays
# Example: time = [t1, t2, t3, ...], mag = [m1, m2, m3, ...]
# Provide the list of period guesses for phase-folding:
start = 0.1 # Starting bound
stop = 1000 # Stopping bound
num_points = 1000000 # Number of points
freq_guesses = np.linspace(1/start, 1/stop, num_points) #its good to be linear in freq space
period_guesses = 1/freq_guesses
# Load the pre-trained model and KNN classifier using `get_model`
model_path = '/path/to/your/model_directory/'
knn, model = NN_FAP.get_model(model_path=model_path)
FAPS = []
for period_guess in period_guesses:
# Call the inference function with the loaded model and KNN
FAPS.append(NN_FAP.inference(period_guess, mag, time, knn=knn, model=model))
min_id = np.argmin(FAPS)
period = period_guesses[min_id]
FAP = FAPS[min_id]
print(f"False Alarm Probability: {FAP}")
print(f"Period: {period}")
```
```