Skip to main content

Pure Kernel Regression: noise-free, explainable tabular regression via high-purity feature windows

Project description

Pure Kernel Regression (PKR)

A rule‑based, explainable alternative to black‑box regression that trusts only the "cleanest" regions of your feature space.


🌟 Why PKR?

  • Noise‑proof: uses only regions where ≥90 % of training rows share the same extreme label.
  • Explainable: every prediction is traced to a single kernel rule — or falls back to a safe median.
  • Plug‑and‑play: one call to pkr.fit(train) and pkr.predict(test) — no hyper‑parameter hunt.

⚙️ Algorithm in 60 seconds

  1. Extreme–label flagging
       Compute the 20th (q20) and 80th (q80) percentiles of the target.
       * y ≤ q20 ⇒ y_bin = 0
       * y ≥ q80 ⇒ y_bin = 1
  2. Exhaustive window scan (1‑D → 3‑D)
       * Numeric cols: 0.5‑wide sliding windows, step 0.25
       * Categorical : exact match
  3. Keep only “clean kernels”
       ≥90 % rows share the same y_bin and count ≥ 10.
  4. Representative values
       * rep0 = 33rd percentile of rows with y_bin = 0
       * rep1 = 66th percentile of rows with y_bin = 1
       * rep_mid = global median of y
  5. Prediction rule
       * No matching kernel → rep_mid
       * One match → rep0 or rep1 (by label)
       * Many matches → average of the matched reps

🔧 Quick start

pip install pkr   # (coming soon)
from pkr import PKR

model = PKR(max_dim=3)
model.fit(train_df, target="Listening_Time_minutes")

pred = model.predict(test_df)
submission = test_df[["id"]].assign(Listening_Time_minutes=pred)
submission.to_csv("submission.csv", index=False)

A full Google Colab demo notebook is in /notebooks/PKR_demo.ipynb.


📂 Repository layout

├── src/                 # core library
│   └── pkr.py
├── notebooks/           # demos (Colab & Kaggle)
├── examples/            # sample data + CLI
└── README.md            # you are here

📈 Roadmap

  • PyPI package
  • Auto‑kernel pruning for high‑dim data
  • Stacking helper (PKR + any ML model)

🖋 Citation

If you build on PKR, please cite (pending arXiv link):

@misc{yusuf2025pkr,
  title  = {Pure Kernel Regression: Noise‑free Region Rules for Fast Tabular Prediction},
  author = {Yusuf Burak …},
  year   = {2025},
  url    = {https://github.com/YusufBurak/PKR}
}

📜 License

MIT — free for personal & commercial use with attribution.

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

pkr_regression-0.0.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

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

pkr_regression-0.0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file pkr_regression-0.0.1.tar.gz.

File metadata

  • Download URL: pkr_regression-0.0.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for pkr_regression-0.0.1.tar.gz
Algorithm Hash digest
SHA256 727d51f16af32adebcd402926849b34c028d29a095bbbcb74fded44c853a8a50
MD5 0d1f8672714f4a5da14fe2a01e452a42
BLAKE2b-256 ee4cc764794b11d8605e969bb3cbf96d10bea3f937e5f64d628ba84a7c4c859c

See more details on using hashes here.

File details

Details for the file pkr_regression-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pkr_regression-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for pkr_regression-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5f43daa0851330ad849cac2947e9d439f2df5a4ba0aca86a86cd4b9cfff6307
MD5 6fe65a505757935ce95314c4f9475649
BLAKE2b-256 8c81b5c50a36e0282327345a4da9b24a4edc24a101bbea3b6cb38e8273a77d51

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