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.5.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.5-py3-none-any.whl (2.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: phosadsorption-0.2.5.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.5.tar.gz
Algorithm Hash digest
SHA256 16ef8748e1fa0cd3e1fb4a6c6ca7cad30a85db94b2434b01808171ad457762d1
MD5 77d2d38d1c93de6de674b76517926acc
BLAKE2b-256 9a71a5101f38fbbaffd7c87890e49413d351601ba7932d788fb0c8ddd17e06c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: phosadsorption-0.2.5-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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 bc558290983abdb0ebd60607d5e544962ffcb1d93473e03be949871750e7ffb5
MD5 ab2d93d935d472b3f9a944ab692a4feb
BLAKE2b-256 238312f651ad3a14858570ef6ea7e221f32c38d93a259b586ee3be30ca7dc0e6

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