API Reference

September 10, 2026 · View on GitHub

The API reference is generated automatically from the Python docstrings. Select a specific module below or from the sidebar navigation.

Stability tiers

PhilanthroPy follows Semantic Versioning. Which promise applies to a symbol depends on its tier.

TierPromiseBreaking change requires
Tier 1: StableThe signature and the meaning of the return value are fixed.A major release, preceded by one full published minor emitting DeprecationWarning.
Tier 2: BetaWorks and is tested, but the shape may still move.A minor release, called out under Breaking in CHANGELOG.md.
Tier 3: ExperimentalNo guarantees at all. May change or disappear without a deprecation cycle.Nothing.

Everything reachable from philanthropy.__all__ is listed below. A symbol not listed here is not public, whatever its name looks like.

Tier 1: Stable

SymbolModule
CRMCleaner, FiscalYearTransformer, RFMTransformerpreprocessing
WealthScreeningImputer, WealthScreeningImputerKNN, WealthPercentileTransformerpreprocessing
ShareOfWalletScorer, PlannedGivingSignalTransformerpreprocessing
DonorPropensityModel, MajorGiftClassifier, LapsePredictormodels
PlannedGivingIntentScorer, ShareOfWalletRegressor, MovesManagementClassifiermodels
PropensityScorermodels
every function in philanthropy.metricsmetrics
FiscalYearGroupedSplittermodel_selection
generate_synthetic_donor_data, load_ciob_fundraisingdatasets
save_model, load_model, make_donor_datasetutils
donor_feature_importanceinspection

Tier 2: Beta

SymbolModuleWhy not Tier 1
EncounterTransformer, EncounterRecencyTransformerpreprocessingClinical schema conventions are still settling across AMCs.
GratefulPatientFeaturizerpreprocessingDefault service-line capacity weights are illustrative, not benchmarked.
DischargeToSolicitationWindowTransformerpreprocessingWindow bounds and the position-score curve may be re-tuned.
SolicitationWindowTransformerpreprocessingSupported alias of the above; shares its tier.
MatchingGiftFeaturizerpreprocessingThe employer-normalisation rules will grow.
AskAmountRecommendermodelsThe ask-ladder multipliers are a heuristic.
constituent_events_to_features, read_constituent_eventsingestTracks the UniSchema ConstituentEvent schema, which is versioned upstream.
civicrm_contributions_to_features, read_civicrm_contributionsingestTracks CiviCRM's contribution export labels and APIv4 field names, which move with the CRM.
raisers_edge_gifts_to_features, read_raisers_edge_gifts, DEFAULT_EXCLUDED_GIFT_TYPESingestTracks Raiser's Edge export labels and the RE NXT gift-type vocabulary; the excluded-type default will grow as real exports arrive.
plot_affinity_distribution, plot_retention_waterfallvisualisationChart composition is presentation, not contract.
fetch_kdd98_donorsdatasetsReturns the raw upstream columns untyped; may gain as-of date parsing as the real-data leakage replication in #124 lands.
make_donor_paneldatasetsThe returned dict may gain keys (pledges, appeals, soft credits) as more of the library needs panel-shaped fixtures; existing keys and their columns will not change silently.
GiftIntervalCalibrator, GiftIntervalmodelsThe conformity-score menu is expected to grow (conformalised quantile regression is not shipped), which adds score values rather than changing existing ones.

Tier 3: Experimental

SymbolModuleWhy
FinancialForecastModelmodelsThe hybrid LSTM-ARIMA surrogate is an approximation of a method the dependency policy rules out; its accuracy characteristics are not established.
UpliftTLearnerexperimentalfit(X, y, treatment) breaks the sklearn signature and the estimator is not check_estimator compliant.

Score scales

Every domain method returns a number on its own scale. None of them are calibrated probabilities.

MethodReturnsScale
DonorPropensityModel.predict_affinity_score(n,) float0–100, monotone in predict_proba
MajorGiftClassifier.predict_affinity_score(n,) float0–100, from calibrated probabilities
LapsePredictor.predict_lapse_score(n,) float0–100, higher = more likely to lapse
PlannedGivingIntentScorer.predict_intent_score(n,) float0–100
UpliftTLearner.predict_uplift_score(n,) float−1 to 1, negative means the appeal suppresses giving
ShareOfWalletScorer.transform(n, 2) floatcapacity_utilisation_ratio 0–1; capacity_tier in {0, 1, 2}
ShareOfWalletRegressor.capacity_ratio(n,) floatUnbounded ratio ≥ 0 (capacity ÷ historical giving)
DischargeToSolicitationWindowTransformer.transform(n, 2) floatin_solicitation_window in {0, 1}; window_position_score 0–1
GratefulPatientFeaturizer.transform(n, 4) floatUnbounded counts and weighted sums, all ≥ 0
AskAmountRecommender.ask_ladder(n, 3) floatDollars, not a score: conservative / target / stretch
MovesManagementClassifier.action_prioritydictNot an array: stage, confidence (0–1), portfolio_summary
FinancialForecastModel.predict_revenue_forecast(horizon,) floatDollars per future period, length is horizon, not len(X)
GiftIntervalCalibrator.predict_gift_intervalGiftIntervalNot a score: two (n,) dollar bounds, plus the attained_level they certify, which is r / (n + 1) and not the requested 1 - alpha

Deprecations

!!! info "This page is built from main, which is ahead of the release" pip install philanthropy currently gives you 0.7.1. The tier tables above describe the API as it stands on main; the deprecations below are live in the version you actually have installed.

Removed in 0.7.0

If you are upgrading from 0.6.0, these are gone, each after one full published minor of DeprecationWarning:

RemovedUse instead
AskAmountRecommender.predict_ask_arrayask_ladder
ShareOfWalletRegressor.predict_capacity_ratiocapacity_ratio
MovesManagementClassifier.predict_action_priorityaction_priority
PlannedGivingIntentScorer.predict_bequest_intent_scorepredict_intent_score

The predict_ prefix is reserved for methods that take X alone and return one value per row. The first three returned a (n, 3) dollar matrix, required a second argument, and returned a dict respectively.

Three constructor parameters that had no effect are gone too; passing any of them is now a TypeError: LapsePredictor(lapse_window_years=...), PropensityScorer(estimator=...), FiscalYearGroupedSplitter(fiscal_year_start=...).

donor_acquisition_cost, cost_per_dollar_raised and fundraising_roi are now keyword-only: they do not share an argument order, so a positional call was silently accepted and returned a plausible wrong number. Write them with keywords and the upgrade is a no-op.

Four accidental second import paths moved behind underscores, so 1.0 does not freeze them: metrics.scoringmetrics._scoring, preprocessing.transformerspreprocessing._transformers, models.propensitymodels._propensity_baseline, utils.testingutils._testing. Every public symbol they export is unchanged; import from the subpackage (from philanthropy.metrics import ...), as the documented examples always have, and nothing breaks.

Live in 0.7.0, removed in 0.8.0

DeprecatedUse instead
WealthScreeningImputerKNN(group_col_idx=...)nothing; see below

group_col_idx has no replacement because there is nothing to replace. It was documented for a long time as stratifying KNN imputation per group "improving local accuracy" while being stored and never read, then implemented, and the implementation is what retired it: measured across several synthetic two-group pools and on five Python versions in CI, per-group and global KNN imputation produce bit-identical output (50263.48615163204 both ways). A donor's nearest neighbours by feature distance almost always share their group already, and KNNImputer weights distance by column magnitude, so a 0/1 group flag barely registers.

If you need per-group behaviour, split the frame by group and fit one imputer per part. That is explicit, and it costs nothing that the parameter was buying.

Live in 0.7.1, removed in 0.9.0

DeprecatedUse instead
ShareOfWalletScorer output name sow_scorecapacity_utilisation_ratio

ShareOfWalletScorer.transform column 0 is now named capacity_utilisation_ratio in get_feature_names_out(): the formula is capacity ÷ clipped modelled wealth, which is capacity utilisation. It was never share of wallet; the docstring has said so since the class shipped, and the old name claimed a quantity the formula does not compute. The values, the column order, and the capacity_tier encoding are unchanged, so code that reads the column positionally needs nothing. Code that spells the name can call get_legacy_feature_names_out() for one published minor: it returns the old ["sow_score", "capacity_tier"] spelling under a DeprecationWarning and is removed in 0.9.0.