A financial model package trained on data from Taiwan fiscal year 1999-2009
Project description
Financial Model Taiwan
Financial Model Taiwan is a Python package designed to preprocess, train, and predict financial models. It includes functionalities for data ingestion, preprocessing, resampling, model training, evaluation, and optimization. This package aims to provide a comprehensive solution for financial modeling with support for various machine learning algorithms and techniques.
Model Architecture
The following image illustrates the model architecture:
Workflow Overview
-
Data Ingestion:
- Load data from CSV files.
- Split data into training and testing sets.
-
Preprocessing Pipeline:
- Define preprocessing steps.
- Handle missing values.
- Standardize/normalize data.
- Select important features.
-
Resampling:
- Perform data resampling to handle class imbalance.
-
Initial Model Training:
- Train multiple models: Random Forest, Logistic Regression, SVM, Gradient Boosting, XGBoost, KSBBoost, ANN.
- Evaluate models based on performance metrics.
- Select the best performing models for stacking.
-
Optimizing Model for Performance:
- Stack the best models (XGBoost and Random Forest).
- Optimize hyperparameters using Optuna.
- Tune the stacked model.
- Adjust thresholds to minimize type I and type II errors.
- Increase recall and finalize the model.
Installation
You can install the package via pip:
pip install financial_model_taiwan
Usage
Training a New Model
from financial_model_taiwan import FinModel
pipeline = FinModel(data_path='data/train_data.csv', target_column='target')
pipeline.data_ingestion()
pipeline.data_preprocessing()
pipeline.data_resampling()
pipeline.train_model()
pipeline.save_model('models/trained_model.bin')
evaluation_results = pipeline.evaluate_model()
print(evaluation_results)
Using a Pre-trained Model
from financial_model_taiwan import FinModel
pipeline = FinModel(data_path='data/train_data.csv', target_column='target', model_path='models/trained_model.bin')
pipeline.data_ingestion()
pipeline.data_preprocessing()
pipeline.load_model()
evaluation_results = pipeline.evaluate_model()
print(evaluation_results)
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
Hashes for financial_model_taiwan-1.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b328c0a9adc9f8419d1ec505159a86b5faec8fcb12a75ccb149534977249d7d1 |
|
MD5 | 04e962a5b64d9b5ded5a978b4a0cfef1 |
|
BLAKE2b-256 | 73d2a4cb9a319f3a954f39e62eeebe6a91ae0c623d4ed6219f08cbd3f1bfc94d |
Hashes for financial_model_taiwan-1.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 10b9c8031426609f84dbbe5a464a588e71c72cf6006bbc71d73fded035d33afb |
|
MD5 | 29a86fdaffaaabf96b9cbff3b8b79ba0 |
|
BLAKE2b-256 | 7459c9becc2b51a327c503d3f5aeb766e2cec4cb4423180673bd452adf18bb06 |