Skip to main content

Modules containing reusable functions for machine learning visualization plotting

Project description

Python Machine Learning (ML) Plot

Build Release CodeQL Codecov Release Version PyPI Python License

Modules containing reusable functions for machine learning visualization plotting

Compatibility

  • Python 3.13 or later

Setup

Add Dependency

python3 -m pip install opengood.py-ml-plot

Note: See Release version badge above for latest version.

Features

Classification Model Plotting

Display a classification model results visualization:

import pandas as pd
from matplotlib.colors import ListedColormap
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import StandardScaler

from opengood.py_ml_plot import display_classification_plot

dataset = pd.read_csv("data.csv")
x = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values

x_train, _, y_train, y_test = train_test_split(x, y, test_size=0.2, random_state=0)

sc = StandardScaler()
x_train = sc.fit_transform(x_train)

classifier = LogisticRegression(random_state=0)
classifier.fit(x_train, y_train)

display_classification_plot(
    x_train,
    y_train,
    sc,
    classifier,
    ListedColormap(("salmon", "dodgerblue")),
    "Logistic Regression (Training Set)",
    "Age",
    "Estimated Salary",
)

Development

Python Virtual Environment

Create Python virtual environment:

cd ~/workspace/opengood-aio/py-ml-plot/.venv
python3 -m venv ~/workspace/opengood-aio/py-ml-plot/.venv
source .venv/bin/activate

Install Packages

python3 -m pip install matplotlib
python3 -m pip install numpy
python3 -m pip install pandas
python3 -m pip install scikit-learn

Create Requirements File

pip freeze > requirements.txt

Run Tests

python -m pytest tests/

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

opengood_py_ml_plot-1.10.0.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

opengood_py_ml_plot-1.10.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

Details for the file opengood_py_ml_plot-1.10.0.tar.gz.

File metadata

  • Download URL: opengood_py_ml_plot-1.10.0.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for opengood_py_ml_plot-1.10.0.tar.gz
Algorithm Hash digest
SHA256 03d8a7aaf8422342d340d79b5bdad78b5820a377acd9f8cf8a2870f3362060d2
MD5 027e5f57eb9ebd69938b5a7c34069ce7
BLAKE2b-256 88709f436ed69d75629faf1313e048dd2cd095050d7ea1bdc12341b58a701f91

See more details on using hashes here.

File details

Details for the file opengood_py_ml_plot-1.10.0-py3-none-any.whl.

File metadata

File hashes

Hashes for opengood_py_ml_plot-1.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 50d0e134c87696a5bb711d9f0ee347e36722b5dc7cc078d647ccc3f9d74dc469
MD5 1fadffff681dd7bfd22402f028d459f6
BLAKE2b-256 2a13e5caa84aac628cb6233d9fe02829d99919cc760b55f6c453f037ea888151

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