Skip to main content

A library for hw4

Project description

simon_library

simon_library is a Python package designed for data preprocessing and model evaluation. The library contains a set of utilities for cleaning data, feature engineering, splitting data, training models, and evaluating performance using ROC AUC. This package is especially useful for data science and machine learning tasks.

Installation

You can install the simon_library package via pip:

pip install simon_library

Available Functions

  1. get_data(path) Loads a CSV file into a pandas DataFrame with error handling and logging.

Parameters:

path (str): The path to the CSV file to be loaded. Returns:

pd.DataFrame: The loaded DataFrame if successful, otherwise None.

  1. clean_data(df) Cleans the data by handling missing values and preparing it for further analysis.

Parameters:

df (pd.DataFrame): The DataFrame to clean. Returns:

pd.DataFrame: The cleaned DataFrame.

  1. create_features(df) Generates additional features from existing columns, including encoding categorical variables and adding new binary features.

Parameters:

df (pd.DataFrame): The DataFrame to create features from. Returns:

pd.DataFrame: The DataFrame with new and transformed features.

  1. split_data(df, target, test_size=0.2, random_state=42) Splits the DataFrame into training and testing sets.

Parameters:

df (pd.DataFrame): The DataFrame to split. target (str): The target column to predict. test_size (float): Proportion of the data to be used as the test set. random_state (int): Random seed for reproducibility. Returns:

X_train, X_test, y_train, y_test: Split training and test sets.

  1. train_model(X_train, X_test, y_train, y_test, model) Trains the provided model on the training set and evaluates it on the test set.

Parameters:

X_train, X_test: Feature sets for training and testing. y_train, y_test: Target values for training and testing. model: A scikit-learn model to train. Returns:

accuracy: Accuracy score on the test set. train_predictions_proba, test_predictions_proba: Predicted probabilities for training and testing sets.

  1. get_roc_auc(y_train, y_test, train_predictions, test_predictions) Calculates the ROC AUC score for both training and test sets.

Parameters:

y_train, y_test: True target values for the training and test sets. train_predictions, test_predictions: Predicted probabilities for the training and test sets. Returns:

roc_auc_train, roc_auc_test: ROC AUC scores for training and test sets.

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

simon_library-0.7.0.tar.gz (8.6 kB view details)

Uploaded Source

Built Distribution

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

simon_library-0.7.0-py3-none-any.whl (12.0 kB view details)

Uploaded Python 3

File details

Details for the file simon_library-0.7.0.tar.gz.

File metadata

  • Download URL: simon_library-0.7.0.tar.gz
  • Upload date:
  • Size: 8.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for simon_library-0.7.0.tar.gz
Algorithm Hash digest
SHA256 d156982e63a77174dfce3a3a4ef5d784d109539d4e9b5b42116b65fd950e435c
MD5 ca9c56774b0d0db71bf01e77be1e365a
BLAKE2b-256 feae7c47bcd979b4fe08dee064771d4fa8b806f4533c8c4ceae011aa899cc34e

See more details on using hashes here.

File details

Details for the file simon_library-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: simon_library-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 12.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.13.0

File hashes

Hashes for simon_library-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8a78f66f5f72f10176efcf0e4183a694ab9b9c89beba14164dc889c9f6157b37
MD5 5699cb1c307e4023cd00db26376adac3
BLAKE2b-256 08b228ef62d510647df03889bd3c6def6b39b11726604e6e2e2e8e5cce6d54fd

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