Happymath is a high-level mathematical modeling Python library. Its core philosophy lies in reducing users' learning costs through high-level encapsulation, enabling efficient mathematical modeling. It is particularly suitable for mathematical modeling competitions and applied mathematics fields.
Project description
HappyMath
HappyMath is a comprehensive mathematical computing and machine learning library that provides unified interfaces for automated machine learning, multi-criteria decision making, differential equations, and mathematical optimization.
Features
🤖 AutoML - Automated Machine Learning
- Classification: Automated model selection and hyperparameter tuning for classification tasks
- Regression: Intelligent regression model building with feature engineering
- Clustering: Unsupervised learning with automatic algorithm selection
- Anomaly Detection: Outlier and anomaly identification algorithms
- Time Series: Specialized time series forecasting and analysis
📊 Decision - Multi-Criteria Decision Making (MCDM)
A comprehensive framework for multi-criteria decision analysis with 80+ algorithms:
- Subjective Weighting: AHP, BWM, FUCOM, ROC, and more
- Objective Weighting: CRITIC, Entropy, MEREC, PSI, and others
- Scoring Methods: TOPSIS, VIKOR, SAW, MOORA, and 30+ algorithms
- Outranking Methods: ELECTRE and PROMETHEE families
- Fuzzy Decision Making: Complete fuzzy methodology support
🔧 DiffEq - Differential Equations
Unified interface for solving differential equations:
- Ordinary Differential Equations (ODE): Initial value and boundary value problems
- Partial Differential Equations (PDE): Various numerical methods
- Symbolic Analysis: Symbolic computation and analysis tools
- Multiple Solvers: SciPy, SymPy, and custom implementations
⚙️ Opt - Mathematical Optimization
Comprehensive optimization framework supporting:
- Linear Programming: Simplex and interior point methods
- Nonlinear Programming: Gradient-based and derivative-free methods
- Multi-objective Optimization: Pareto front analysis
- Constraint Handling: Various constraint types and formulations
- Solver Integration: Pyomo, Pymoo, and specialized solvers
Installation
pip install happymath
Note: When installing with pip, the ipopt solver is not included by default, and LightGBM models cannot be properly installed, which may cause AutoML errors. If you install via pip, it is recommended to manually install these two packages through conda.
Requirements
- Python 3.11+
- All dependencies are automatically installed
Quick Start
AutoML Example
from happymath import AutoML
import pandas as pd
# Load your data
data = pd.read_csv('your_data.csv')
X, y = data.drop('target', axis=1), data['target']
# Automated classification
automl = AutoML.ClassificationML()
model = automl.fit(X, y)
predictions = model.predict(X_test)
Decision Analysis Example
from happymath import Decision
import numpy as np
# Decision matrix and criteria types
dm_data = np.array([[250, 16, 12], [200, 16, 8], [300, 32, 16]])
criteria = ['min', 'max', 'max']
# Calculate weights and rankings
weighting = Decision.ObjWeighting()
weights = weighting.decide(dataset=dm_data, criterion_type=criteria).get_weights()
scoring = Decision.ScoringDecision()
rankings = scoring.decide(dataset=dm_data, weights=weights, criterion_type=criteria).get_rankings()
print(rankings)
Differential Equations Example
from happymath import DiffEq
import numpy as np
# Define ODE system
def ode_func(t, y):
return -y + np.sin(t)
# Solve ODE
solver = DiffEq.ODE()
result = solver.solve(ode_func, t_span=[0, 10], y0=[1.0])
t, y = result.get_solution()
Optimization Example
from happymath import Opt
import numpy as np
# Define optimization problem
def objective(x):
return x[0]**2 + x[1]**2
# Solve optimization problem
optimizer = Opt.Optimization()
result = optimizer.minimize(objective, x0=[1.0, 1.0])
optimal_x = result.x
optimal_value = result.fun
Documentation
For detailed documentation, tutorials, and examples, please visit our documentation page.
Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you have any questions or need help, please:
- Open an issue on GitHub
- Contact us at: tonghui_zou@happymath.com.cn
- Visit our homepage: https://github.com/HappyMathLabs/happymath
Citation
If you use HappyMath in your research, please cite:
@software{happymath2024,
title={HappyMath: A Comprehensive Mathematical Computing Library},
author={HappyMathLabs},
year={2024},
url={https://github.com/HappyMathLabs/happymath}
}
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file happymath-0.1.2.tar.gz.
File metadata
- Download URL: happymath-0.1.2.tar.gz
- Upload date:
- Size: 233.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49ebf9f2f54c64c3c28741e74ed6e06d112ddd408c078417587371baf2d2112a
|
|
| MD5 |
94350cb5e8477f54102a599393fbc588
|
|
| BLAKE2b-256 |
83945e014c910aae1f28e8f3a69821814b1506765f0f87fac618c97a8e932826
|
File details
Details for the file happymath-0.1.2-py3-none-any.whl.
File metadata
- Download URL: happymath-0.1.2-py3-none-any.whl
- Upload date:
- Size: 349.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40712064d624f4f1d46c483e2ded50214a97a37c80887ac12bdc5f498ffbb17f
|
|
| MD5 |
7241bc7a2710f8991847dd4632c2e003
|
|
| BLAKE2b-256 |
2910e292f22677944364f6ed7f30a6e48beaaf1902a601739af1bac1dbd7e1a4
|