Skip to content

Kazurl/OptiML

Repository files navigation

OptiML

Project with intention to provide various financial modelling efforts, as well as machine learning models that can provide a benchmark of trained predicted stock price mechanisms.

OptiML: Installation and Setup Guide

The following guide explains how to set up and run OptiML project locally on your machine. (Installing prerequisites, running locally or on Kubernetes using Docker and Minikube)

Prerequisites

  • Python 3.12+ (for local dev)
  • Docker (Download & Install)
  • kubectl (Install Guide)
  • Minikube (Install Guide)

Or, to just clone the Project Repo by itself using Git

  • in this case, just skip to Section 3: Clone the Project Repo

1. Full Setup Instructions

1.1. Install Required Tools

  1. Install Docker
    • Mac:
      • Download Docker Desktop from here
    • Linux:
      • Use your distribution's package manager
    • Windows:
      • Download Docker Desktop for Windows
  2. Install kubectl
  3. Install Minikube

2. Running the Project (Docker/ Kubernetes-Minikube)

2.1. Dockerized Local Run

  1. Build Docker Image
docker build -t <your-dockerhub-username>/optiml:latest .
  1. Run the Image
docker run -p 8501:8501 <your-dockerhub-username>/optiml:latest
  1. Visit http://localhost:8501 in your browser

2.2. Kubernetes Deployment with Minikube

  1. Start Minikube
minikube start
  1. Build the Docker image and Push to Docker Hub
docker build -t <your-dockerhub-username>/optiml:latest .
docker push <your-dockerhub-username>/optiml:latest

⚠️ Ensure image: <your-dockerhub-username>/optiml:latest in your deployment YAML matches this tag.

  1. Apply Kubernetes Manifests
kubectl apply -f k8s/deployment.yaml
kubectl apply -f k8s/service.yaml
  1. Access the app
minikube service optiml-app-service

This command automatically opens browser to the running app

  1. 🔧 Troubleshooting and Additional Notes
  • Image Not Updating? 🤔 Remember to rebuild and push Docker image after any code change, then use

    kubectl rollout restart deployment optiml-app
    

    to refresh the apop in Kubernetes

  • Check Pod Status:

kubectl get pods
kubectl describe pod <pod-name>
  • Requirements: All Python requirements are in requirements.txt
  • File Structure Example:
optiml/
├── streamlit_app.py
├── requirements.txt
├── Dockerfile
├── k8s/
│   ├── deployment.yaml
│   └── service.yaml
├── app/
└── utils/
  1. Environment Cleanup Do this when you want to stop running the app
  • Minikube
minikube stop
minikube delete
  • Kubernetes resources
kubectl delete -f k8s/deployment.yaml
kubectl delete -f k8s/service.yaml
  1. *Updating the App

Skip this if plainly running app After code changes:

  1. Rebuild and push Docker image
  2. Restart deployment or re-apply yaml
  3. Pull latest code on cluster if using CI/CD efforts Full processes and commands can be found in UPDATE_PROCESS.txt within project files.

2.3. Running on Cloned Project [No Docker/ K8s]

  1. Clone the Project in your console or IDE terminals
git clone https://github.com/Kazurl/OptiML.git
cd optiml
  1. Set up virtual environment (recommended)
source venv/bin/activate  # mac/linux
# or
.\venv\Scripts\activate  # Windows
  1. Install dependencies
pip install --upgrade pip
pip install -r requirements.txt
  1. Run the Streamlit app
streamlit run streamlit_app.py
  1. Automatically opened in browser at http://localhost:8501

About

Project with intention to provide various financial modelling efforts, as well as machine learning models that can provide a benchmark of trained predicted stock price mechanisms.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages