Skip to content

Latest commit

 

History

History
98 lines (76 loc) · 5.03 KB

File metadata and controls

98 lines (76 loc) · 5.03 KB

Kepler-Zero API

API for Kepler-Zero Model in FastAPI

Classification Model

The API expects and loads an classification model at ./model/kepler_zero_format.joblib, which contains

  • trained Random Forest model
  • preprocessing pipeline
  • skewed feature metadata
  • decision threshold
  • evaluation metrics

API Routes

Route Method Description
/predict POST Get prediction if the exoplanet candidate represented by the data is really an exoplanet or not
/health GET Returns API health with status, model, version and other training information

Running

The service is containerized using Docker.

From the repo root:

docker compose up --build

This will:

  • build the API image
  • start the FastAPI server

API will be available at:

http://localhost:8000

Alternatively, using uv and uvicorn

uv sync --locked
uvicorn main:app --host 0.0.0.0 --port 8000

Testing

Run tests with

uv run test.py
Running test for Kepler-Zero API at http://127.0.0.1:8000...
Health Check: online (Model: Kepler-Zero-RF)

TEST CASE                                                    | ACTUAL          | RESULT          | PROB    | MATCH
------------------------------------------------------------------------------------------------------------------------
Earth-like (G-type Star)                                     | Confirmed       | Confirmed       | 97.0    | PASS
The Monster (Binary Star)                                    | False Positive  | False Positive  | 1.8     | PASS
Deep Space Cold Planet                                       | Confirmed       | Confirmed       | 98.6    | PASS
Super-Earth (Fast Orbit)                                     | Confirmed       | False Positive  | 40.6    | FAIL
Hot Jupiter                                                  | Confirmed       | False Positive  | 70.8    | FAIL
Red Dwarf Candidate                                          | Confirmed       | Confirmed       | 76.4    | PASS
Low Density (Glitch)                                         | False Positive  | False Positive  | 37.4    | PASS
Giant Star Noise                                             | False Positive  | False Positive  | 9.4     | PASS
Sun-Twin Candidate                                           | Confirmed       | False Positive  | 1.8     | FAIL
High Radiation Scorcher                                      | False Positive  | False Positive  | 1.4     | PASS
Borderline Confidence Earth                                  | Confirmed       | False Positive  | 7.4     | FAIL
High Confidence False Signal                                 | False Positive  | False Positive  | 7.4     | PASS
Missing Insolation Edge                                      | Confirmed       | Confirmed       | 80.8    | PASS
Noisy Measurement (Jitter)                                   | False Positive  | False Positive  | 74.6    | PASS
Extreme Cold Rogue-like                                      | False Positive  | False Positive  | 41.0    | PASS
Puffy Low Density Planet                                     | Confirmed       | False Positive  | 21.0    | FAIL
Ultra Dim Detection Limit                                    | False Positive  | False Positive  | 42.4    | PASS
Binary Star Mimic                                            | False Positive  | False Positive  | 9.0     | PASS
Young Star Activity Noise                                    | False Positive  | Confirmed       | 80.2    | FAIL WARN
Near Perfect Earth Analog                                    | Confirmed       | False Positive  | 1.8     | FAIL
Conflicting Signals Case                                     | False Positive  | False Positive  | 34.6    | PASS
Small Planet Large Star (Diluted Transit)                    | False Positive  | False Positive  | 49.2    | PASS
Same Planet Smaller Star (Strong Signal)                     | Confirmed       | Confirmed       | 76.2    | PASS
High Temp but Low Insolation (Mismatch)                      | False Positive  | False Positive  | 74.0    | PASS
Consistent Warm Planet                                       | Confirmed       | Confirmed       | 89.0    | PASS
Inflated Radius but Small Star                               | Confirmed       | False Positive  | 7.0     | FAIL
Inflated Radius but Giant Star                               | False Positive  | False Positive  | 25.8    | PASS
Cold but High Insolation (Impossible Physics)                | False Positive  | False Positive  | 42.4    | PASS
Very Dim but Strong Ratio                                    | Confirmed       | Confirmed       | 82.6    | PASS
Bright Star Weak Transit                                     | False Positive  | False Positive  | 64.0    | PASS
Edge Ratio Threshold Case                                    | Confirmed       | False Positive  | 63.8    | FAIL

Summary: 22 passed, 9 failed
Pass rate: 71.0%