Skip to main content

Library for predicting phosphorus adsorption in soil

Project description

Phosadsorption

Phosadsorption is a Python library for predicting phosphorus (P) adsorption in soils using machine learning. It replaces traditional empirical models like the Langmuir isotherm with a data-driven approach built on XGBoost.

Why Phosadsorption?

While the Langmuir isotherm has been widely used to model phosphorus adsorption, it often fails to capture the variability seen in real-world soils with diverse physicochemical characteristics. This library introduces a multioutput XGBoost regressor trained on soil data to predict phosphorus adsorption across multiple equilibrium concentrations simultaneously.

Key Features

  • 🔬 Predicts phosphorus adsorption at 1, 2, 4, 6, and 10 mg/L equilibrium concentrations.
  • 📈 Outperforms traditional models like Langmuir in predictive accuracy.
  • 🧪 Built for soil scientists, agronomists, and environmental engineers.
  • 📦 Easy to install and use with just a few lines of code.

Installation

Install from PyPI:

pip install phosadsorption

Or install from TestPyPI for pre-release versions:

pip install --index-url https://test.pypi.org/simple/ phosadsorption

Example Usage

from phosadsorption import PhosAdsorption
from phosadsorption.visuals.plot import plot_pfp_vs_applied
import pandas as pd

# Load your input data
df = pd.read_excel("your_input.xlsx")

# Initialize and run the model
model = PhosAdsorption()
result = model.predict(df)

# Plot results for first sample
plot_pfp_vs_applied(result, sample_index=0)

Project Structure

phosadsorption/
├── model/
│   ├── model.py
│   └── multioutput_xgb_model.json
├── visuals/
│   └── plot.py
├── utils.py

License

MIT License

Citation

If you use this library in your work, please cite:

Iatrou, M. et al. (2025). Predicting Phosphorus Adsorption in Soils Using Machine Learning.
GitHub Repository: https://github.com/Mil-afk/soil_phosphorus_adsorption_data

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phosadsorption-0.2.6.tar.gz (2.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phosadsorption-0.2.6-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

Details for the file phosadsorption-0.2.6.tar.gz.

File metadata

  • Download URL: phosadsorption-0.2.6.tar.gz
  • Upload date:
  • Size: 2.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for phosadsorption-0.2.6.tar.gz
Algorithm Hash digest
SHA256 9725c0f731c7719f84af8521af29f11e7dd458df90be8b1b4cad36ae1f868411
MD5 4e2453a3dedd2905592bb937afcada40
BLAKE2b-256 018b5e828fa16ec7617124f47d6007a8cc30ef376bd5a267745d618ba76cb8b3

See more details on using hashes here.

File details

Details for the file phosadsorption-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: phosadsorption-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 2.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.13

File hashes

Hashes for phosadsorption-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 2a527c2ba8375421f070e48c5ba6cfb2837c8540cfa249b9db4f0757fb60f502
MD5 6562a65811ad33a8562b5c538323dca8
BLAKE2b-256 6143620f610a24a91ae510963eef90f11b6011b34bf88fc109631cb4d7aaca1c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page