git clone https://github.com/alercebroker/lc_classifier.git
python -m pip install -r requirements.txt
python -m pip install -e .
Some packages like matplotlib and tqdm are necessary to run the examples.
Check the available Jupyter notebooks in the examples directory.
This library provides an extensive number of feature extractors for astronomical light curves, including period computation, autoregresive models, parametric models, statistical features, etc. We also provide tools to transform your data into the format that this library expects (Pandas dataframes).
If you want more samples you can use our ShortTransientAugmenter class. More data augmentation techniques will be implemented in further releases.
Two classifiers are available: A traditional Random Forest model, and a hierarchical model made from 4 Random Forest classifiers.
Before computing features, we preprocess the time series with filters and boundary conditions:
- Drop duplicate observations.
- Discard noisy detections.
- Discard bogus.
- Filter time series with more than 5 detections.
- Discard invalid values (like nans and infinite).
Feature extractors extend the following classes:
FeatureExtractor
FeatureExtractorSingleBand
. This type of feature extractor runs independently on each available band.
Check out the existent feature extractors in the directory lc_classifier/features/extractors.
The easiest way to profile a step is using cProfile, for this we just have to run the step with the following command:
python -m cProfile -o <outputfile> profiling/<functionality>.py
After that you can run snakeviz
(first install it).
snakeviz <outputfile>
You must first install the following packages:
pip install coverage pytest
All scripts of tests must be in tests
folder. For run all tests:
coverage run --source lc_classifier -m pytest -x -s tests/
If you want run a specify functionality you can run:
coverage run --source lc_classifier -m pytest -x -s tests/<functionality>
After that you can see a report of tests:
coverage report
This repository comes with a Dockerfile to test the model.
To build the image run
docker build -t alerce/lc_classifier
Then run the container
docker run --rm -p 8888:8888 alerce/lc_classifier
The container comes with a jupyter notebook and some examples in http://localhost:8888
If you use this library, please cite our work:
@inproceedings{sanchez2020alert,
title={Alert Classification for the ALeRCE Broker System: The Light Curve Classifier},
author={S{\'a}nchez-S{\'a}ez, P and Reyes, I and Valenzuela, C and F{\"o}rster, F and Eyheramendy, S and Elorrieta, F and Bauer, FE and Cabrera-Vives, G and Est{\'e}vez, PA and Catelan, M and others},
year={2020}
}