chap_core.predictor package

Submodules

chap_core.predictor.feature_spec module

class chap_core.predictor.feature_spec.Feature(*, id: str, name: str, description: str, optional: bool = False)[source]

Bases: BaseModel

description: str
id: str
model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

name: str
optional: bool

chap_core.predictor.model_registry module

chap_core.predictor.naive_estimator module

class chap_core.predictor.naive_estimator.NaiveEstimator[source]

Bases: object

train(data: DataSet) NaivePredictor[source]
class chap_core.predictor.naive_estimator.NaivePredictor(mean_dict: dict)[source]

Bases: object

classmethod load(filename: str)[source]
mean_dict: dict
predict(historic_data: DataSet, future_data: DataSet, num_samples: int = 100) DataSet[source]
save(filename: str)[source]

chap_core.predictor.naive_predictor module

class chap_core.predictor.naive_predictor.MultiRegionNaivePredictor(*args, **kwargs)[source]

Bases: object

TODO: This should be a linear regression of prev cases and season for each location.

predict(future_weather: DataSet[ClimateData]) HealthData[source]
train(data: DataSet[ClimateHealthTimeSeries])[source]
class chap_core.predictor.naive_predictor.MultiRegionPoissonModel(*args, **kwargs)[source]

Bases: object

predict(data: DataSet[ClimateData]) DataSet[HealthData][source]
train(data: DataSet[ClimateHealthTimeSeries])[source]
class chap_core.predictor.naive_predictor.NaiveForecastSampler[source]

Bases: object

sample(weather_data: ClimateData, n_samples: int = 1) HealthData[source]
train(time_series: ClimateHealthTimeSeries)[source]
class chap_core.predictor.naive_predictor.NaivePredictor(lead_time=1)[source]

Bases: object

This should be a linear regression of prev cases and season

predict(future_climate_data: ClimateData) HealthData[source]
train(data: ClimateHealthTimeSeries)[source]

chap_core.predictor.poisson module

class chap_core.predictor.poisson.Poisson(alpha=1, fit_intercept=True)[source]

Bases: object

predict(x)[source]

X has shape (n_samples, n_features)

train(x, y)[source]
Train the model on a dataframe that has the column Disease, plus other features. The feature order is

expected to be the same between training and prediction without explicit feature names.

sample_data = pd.DataFrame({

“Disease”: [1, 2, 3, 4, 5], “Disease1”: [1, 2, 3, 4, 5], “Disease2”: [1, 2, 3, 4, 5], “Rain”: [1, 2, 3, 4, 5], “Temperature”: [1, 2, 3, 4, 5],

})

chap_core.predictor.protocol module

class chap_core.predictor.protocol.IsMultiRegionForecastSampler(*args, **kwargs)[source]

Bases: Protocol

Model that can sample forward for multiple locations in time given a set of weather data.

sample(future_weather: DataSet[ClimateData], n_samples: int = 1) DataSet[HealthData][source]
train(data: DataSet[ClimateHealthTimeSeries])[source]
class chap_core.predictor.protocol.IsMultiRegionPredictor(*args, **kwargs)[source]

Bases: Protocol

predict(future_weather: DataSet[ClimateData]) DataSet[HealthData][source]
train(spatio_temporal_climate_health_data: DataSet[ClimateHealthTimeSeries])[source]
class chap_core.predictor.protocol.IsPredictor[source]

Bases: Protocol

predict(x)[source]
train(x, y)[source]
class chap_core.predictor.protocol.IsSampler(*args, **kwargs)[source]

Bases: Protocol

Model that can sample forward in time given a set of weather data.

sample(weather_data: ClimateData, n_samples: int = 1) HealthData[source]
train(time_series: ClimateHealthTimeSeries)[source]

chap_core.predictor.published_models module

class chap_core.predictor.published_models.ExternalModelSpec(*, name: str, parameters: dict, features: list[Feature], period: PeriodType = PeriodType.any, description: str = 'No Description yet', author: str = 'Unknown Author', targets: str = 'disease_cases', github_link: str)[source]

Bases: ModelSpec

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

Module contents

class chap_core.predictor.MultiRegionNaivePredictor(*args, **kwargs)[source]

Bases: object

TODO: This should be a linear regression of prev cases and season for each location.

predict(future_weather: DataSet[ClimateData]) HealthData[source]
train(data: DataSet[ClimateHealthTimeSeries])[source]
class chap_core.predictor.MultiRegionPoissonModel(*args, **kwargs)[source]

Bases: object

predict(data: DataSet[ClimateData]) DataSet[HealthData][source]
train(data: DataSet[ClimateHealthTimeSeries])[source]