Skip to content

Update orphan GRB classifier model retrained with sklearn 1.5.2#684

Open
sedlachevre wants to merge 3 commits intoastrolabsoftware:masterfrom
sedlachevre:master
Open

Update orphan GRB classifier model retrained with sklearn 1.5.2#684
sedlachevre wants to merge 3 commits intoastrolabsoftware:masterfrom
sedlachevre:master

Conversation

@sedlachevre
Copy link
Copy Markdown

IMPORTANT: Please create an issue first before opening a Pull Request.
Linked to issue(s): Closes #683 (comment)

If this is a new release, did you issue the corresponding schema in fink-client?

N/A

What changes were proposed in this pull request?

The orphan GRB afterglow classifier model was retrained with scikit-learn 1.5.2 to replace the old model which was incompatible with the current sklearn versions due to the removal of sklearn.ensemble._gb_losses in sklearn 1.0.

How is the issue this PR is referenced against solved with this PR?

How was this patch tested?

The new model was locally tested on a sample of 1915 simulated orphan afterglow light curves and 695195 events from the ELAsTiCC data set (playing the role of background) and showed great accuracy.

@JulienPeloton
Copy link
Copy Markdown
Member

Thank you @sedlachevre ! Could you uncomment this line in your fork:

# spark_unit_tests(globs)

and push, to trigger the test suite on this module?

@bregeon
Copy link
Copy Markdown

bregeon commented Apr 2, 2026

@JulienPeloton I am a bit surprised by the error of the test-suite above:
/opt/fink-broker/spark/bin/load-spark-env.sh: line 68: ps: command not found
indeed when I run the container locally, I have the same error and the procps package is indeed not installed in the container... it does not appear to be mandatory, but well :)

@sedlachevre, actually, the error above is not a blocker, the real issue is that we need to add the following import from fink_science.tester import spark_unit_tests in processor.py (see rubin/hostless_detection/processor.py)

@JulienPeloton
Copy link
Copy Markdown
Member

Yes, ps is not installed in the container, but we do not need it (despite Spark complaining, it is not required for this work).

@JulienPeloton
Copy link
Copy Markdown
Member

Thanks for the change -- looking at the continuous integration, the test on orphans is failing usinng previous setup:

test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3938135Z File "/__w/fink-science/fink-science/fink_science/__init__.py", line ?, in __main__.orphan_grb
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3938873Z Failed example:
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3939206Z     df.filter(df["prob"] > 0.0).count()
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3941283Z Expected:
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3941904Z     0
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3942164Z Got:
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3942409Z     6
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3942720Z **********************************************************************
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3943189Z 1 items had failures:
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3943533Z    1 of  10 in __main__.orphan_grb
test-suite (rubin)	UNKNOWN STEP	2026-04-03T11:50:55.3943921Z ***Test Failed*** 1 failures.

Is that expected? Can you inspect these 6 objects that have non-zero probability?

@sedlachevre
Copy link
Copy Markdown
Author

I ran the test locally on the same data and I also got 6 objects with a non-zero probability but these probabilities are very small (p<0.00003). This is expected with our machine learning model and should not be a problem for orphan detection. Is it possible to only count objects with a probability higher than 0.1 instead of 0.0 (df.filter(df["prob"] > 0.1).count()) ?

@JulienPeloton
Copy link
Copy Markdown
Member

Sure! You can update the test accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Orphan GRB newly trained model

3 participants