epic-open-source / seismometer

AI model evaluation with a focus on healthcare
https://epic-open-source.github.io/seismometer/
BSD 3-Clause "New" or "Revised" License
179 stars 21 forks source link

Expose memory loader #34

Closed diehlbw closed 3 months ago

diehlbw commented 3 months ago

Overview

30 created a pattern for future data loaders and an option for using pre-loaded dataframes.

This exposes that functionality to be passed in at setup.

Description of changes

Add two optional paramaters to run setup.

Starting Functional Tests:

Run the example notebook and verify that old pattern works without change.

Turn the urllib.requests cell into a raw or markdown cell (this assumes that the dataset has been pulled locally from the first run) Add something like the following to a first cell or two :

import seismometer.data.loader as dload
import seismometer.configuration
import seismometer
# Load data from files without calling Seismogram
config = seismometer.configuration.ConfigProvider('.')
loader = dload.loader_factory(config)
data = loader.load_data()

# Now pass that loaded frame through
import pandas as pd
import seismometer as sm
sm.run_startup(config_path='.', predictions_frame=data, events_frame=pd.DataFrame(), log_level=1)

Restart and rerun the

Modifying run_startup revealed some state was unintentionally shared between testcases, so tests were updated to more specifically test the intended logger

Author Checklist