Skip to main content

Utils for training models

Project description

ge

Utils for training models

To install: pip install ge

Overview

The ge package provides utility functions for evaluating and constructing formulas for fitted models, particularly useful in the context of machine learning and data analysis. The main functionalities include calculating normalized root mean square error (NRMSE), cross-validated root mean square error (CV RMSE), and generating a string representation of a model's formula with fitted parameters.

Functions

nrmse

Calculates the normalized root mean square error between predicted and actual data. This is used to measure the accuracy of a model, normalized by the range of the data.

Usage:

from ge import nrmse
actual_data = [1, 2, 3, 4, 5]
predicted_data = [1.1, 1.9, 3.0, 3.9, 5.1]
error = nrmse(actual_data, predicted_data)
print("NRMSE:", error)

cv_rmse

Calculates the cross-validated root mean square error between predicted and actual data, normalized by the mean of the actual data. This provides a scale-independent measure of prediction error, useful for comparing models across different datasets.

Usage:

from ge import cv_rmse
actual_data = [1, 2, 3, 4, 5]
predicted_data = [1.1, 1.9, 3.0, 3.9, 5.1]
error = cv_rmse(actual_data, predicted_data)
print("CV RMSE:", error)

formula_str

Generates a string representation of a fit function's formula with parameters injected. This is particularly useful for documenting and sharing the exact mathematical formula used in model fitting.

Usage:

from ge import formula_str
from scipy.optimize import curve_fit

# Define a model function
def model_func(x, a, b):
    return a + b * x

# Example data
xdata = [0, 1, 2, 3, 4]
ydata = [0, 2, 4, 6, 8]

# Fit the model to the data
params, _ = curve_fit(model_func, xdata, ydata)

# Generate formula string
formula = formula_str(model_func, params)
print("Fitted formula:", formula)

Installation

To install the ge package, use the following pip command:

pip install ge

This package is designed to be lightweight and easy to integrate into existing Python projects, particularly those involving data analysis and machine learning.

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

ge-0.0.5.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

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

ge-0.0.5-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file ge-0.0.5.tar.gz.

File metadata

  • Download URL: ge-0.0.5.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for ge-0.0.5.tar.gz
Algorithm Hash digest
SHA256 d26488ec0dde4e8cd395448a5875cedc46aea9561ba6a34981a7a63e259681c9
MD5 121d75b8429158600ea930dfebad4c50
BLAKE2b-256 6edb59b72758d49bbea0cf23b60e850904ebc27ed23c013bf9c46860953b0bb0

See more details on using hashes here.

File details

Details for the file ge-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: ge-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.13

File hashes

Hashes for ge-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 106510f9f0b8b03ae4955a3625c789ece0e5348f1836d75b9a7f3d9cc940e52c
MD5 857d4eb9264a585cad727744501349f1
BLAKE2b-256 d065435a04b17b005bfaff501b39ee3786510e45f4f990947ea41f862db62f78

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