API Reference
Note
This section documents the public API of the co2_emissions_ml package.
For tutorials and usage examples, see Tutorial.
Modules
- co2_emissions_ml.preprocessing.build_preprocessor(X: DataFrame) ColumnTransformer[source]
Construct a ColumnTransformer that scales numeric features and one-hot encodes categoricals.
- co2_emissions_ml.preprocessing.build_target_transformer() PowerTransformer[source]
Returns a Yeo–Johnson power transformer for the target variable.
- co2_emissions_ml.models.fit_cluster_model(X, y, preprocessor, target_transformer, n_trials=60)[source]
Fit the stacked ensemble (3 GBMs + MLP meta-learner + Ridge residuals). Returns a dict bundling all fitted elements.
- co2_emissions_ml.models.predict_bundle(bundle, X_new)[source]
Given a fitted bundle, return inverse‐transformed predictions for new X.
- co2_emissions_ml.evaluation.compute_metrics(y_true, y_pred)[source]
Returns a dict of common regression metrics.