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.9.0.tar.gz (4.0 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.9.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for opengood_py_ml_plot-1.9.0.tar.gz
Algorithm Hash digest
SHA256 82c2477f17489d1eb7590bbf8cf58a04fc96ea563eda3e2d60e3fd1926a60c5f
MD5 d5544df034257f4a7433274107eb0baf
BLAKE2b-256 0bdd7eec33b60fc6d9bbdd2d19bfb40e0f30f0d2df255f946addd6f401199df4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for opengood_py_ml_plot-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 80c15837e78ca72e9266d3b8c9d8230d68c60a5010f706c9c6f1a0c1ecdb14e9
MD5 e2822f8a4536452f22f55825e8b3c37d
BLAKE2b-256 75d21722676903d9e8b2ef3403691811f05b8e2842c48aecc48142baee56e131

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