A single Python file with some tools for visualizing machine learning in the terminal.

Related tags

Machine Learningmlvt
Overview

Machine Learning Visualization Tools

A single Python file with some tools for visualizing machine learning in the terminal.

This demo is composed of three ideas, which are explained below. Here's how to get started:

git clone https://github.com/bwasti/mlvt.git
cd mlvt
python3 -m pip install -r requirements.txt
python3 test.py # demo above

or just copy the mlvt.py file!

mlvt.Reprint

Reprint helps with in-line animations. It works by keeping track of how much it printed so far and reprinting it when flush() is called.

You can use the with statement to hijack print statements and auto_flush=True to avoid calling flush() in a loop, like so:

print("loading!")
with mlvt.Reprint(auto_flush=True) as rp:
  for i in range(100):
    print(f"{i+1}%") # Reprint detects the loop and overwrites in-place
    time.sleep(0.02)
print("done!")

reprint.gif

or, if you'd prefer to avoid contexts, loop-detection and hijacked builtins

print("loading!")
rp = mlvt.Reprint()
for i in range(100):
  rp.print(f"{i+1}%")
  rp.flush()
  time.sleep(0.02)
print("done!")

mlvt.horiz_concat

horiz_concat concatenates multi-line strings horizontally, accounting for padding and ANSI escape sequences (for color text).

a = """
{ hello! }
          \_    
"""
b = """
 ___
|. .|
| ^ |
| o |
"""
print(mlvt.horiz_concat(a, b, padding=2))

yields


               ___
{ hello! }    |. .|
          \_  | ^ |
              | o |
              

plotille wrappers

Finally, there are a couple of small plotille wrappers that decouple updating charts and printing them. That library is great on its own, so I encourage you to check it out!

import mlvt
import numpy as np

# all charts take in width, height, color
hist = mlvt.Histogram(32, 8, color="bright_blue")
hist.update(np.random.randn(100))
print(hist)

gives us

 (Counts)  ^
8.80000000 |
7.70000000 | ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
6.60000000 | ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
5.50000000 | ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⡇⣶⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
4.40000000 | ⠀⠀⠀⠀⠀⠀⠀⠀⢰⣶⣶⠀⠀⢸⡇⣿⠀⢰⣶⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
3.30000000 | ⠀⠀⠀⠀⠀⠀⠀⣿⢸⣿⣿⣿⣿⢸⣿⣿⣿⢸⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
2.20000000 | ⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⢸⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣿⠀⠀⠀⢸⡇⠀⠀
1.10000000 | ⠀⠀⢀⣀⡀⣿⣀⣿⣿⣿⣿⣿⣿⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⣇⣸⡇⠀⠀
         0 | ⠀⠀⢸⣿⡇⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⣿⣿⡇⠀⠀
-----------|-|---------|---------|---------|-> (X)
           | -2.124059 -0.741902 0.6402548 2.0224115
Owner
Bram Wasti
https://twitter.com/bwasti
Bram Wasti
Learn Machine Learning Algorithms by doing projects in Python and R Programming Language

Learn Machine Learning Algorithms by doing projects in Python and R Programming Language. This repo covers all aspect of Machine Learning Algorithms.

Ravi Chaubey 6 Oct 20, 2022
Stock Price Prediction Bank Jago Using Facebook Prophet Machine Learning & Python

Stock Price Prediction Bank Jago Using Facebook Prophet Machine Learning & Python Overview Bank Jago has attracted investors' attention since the end

Najibulloh Asror 3 Feb 10, 2022
Python/Sage Tool for deriving Scattering Matrices for WDF R-Adaptors

R-Solver A Python tools for deriving R-Type adaptors for Wave Digital Filters. This code is not quite production-ready. If you are interested in contr

8 Sep 19, 2022
Price Prediction model is used to develop an LSTM model to predict the future market price of Bitcoin and Ethereum.

Price Prediction model is used to develop an LSTM model to predict the future market price of Bitcoin and Ethereum.

2 Jun 14, 2022
Interactive Web App with Streamlit and Scikit-learn that applies different Classification algorithms to popular datasets

Interactive Web App with Streamlit and Scikit-learn that applies different Classification algorithms to popular datasets Datasets Used: Iris dataset,

Samrat Mitra 2 Nov 18, 2021
Datetimes for Humans™

Maya: Datetimes for Humans™ Datetimes are very frustrating to work with in Python, especially when dealing with different locales on different systems

Timo Furrer 3.4k Dec 28, 2022
Relevance Vector Machine implementation using the scikit-learn API.

scikit-rvm scikit-rvm is a Python module implementing the Relevance Vector Machine (RVM) machine learning technique using the scikit-learn API. Quicks

James Ritchie 204 Nov 18, 2022
Library for machine learning stacking generalization.

stacked_generalization Implemented machine learning *stacking technic[1]* as handy library in Python. Feature weighted linear stacking is also availab

114 Jul 19, 2022
ML-powered Loan-Marketer Customer Filtering Engine

In Loan-Marketing business employees are required to call the user's to buy loans of several fields and in several magnitudes. If employees are calling everybody in the network it is also very length

Sagnik Roy 13 Jul 02, 2022
Project to deploy a machine learning model based on Titanic dataset from Kaggle

kaggle_titanic_deploy Project to deploy a machine learning model based on Titanic dataset from Kaggle In this project we used the Titanic dataset from

Vivian Yamassaki 8 May 23, 2022
My project contrasts K-Nearest Neighbors and Random Forrest Regressors on Real World data

kNN-vs-RFR My project contrasts K-Nearest Neighbors and Random Forrest Regressors on Real World data In many areas, rental bikes have been launched to

1 Oct 28, 2021
Falken provides developers with a service that allows them to train AI that can play their games

Falken provides developers with a service that allows them to train AI that can play their games. Unlike traditional RL frameworks that learn through rewards or batches of offline training, Falken is

Google Research 223 Jan 03, 2023
A simple machine learning python sign language detection project.

SST Coursework 2022 About the app A python application that utilises the tensorflow object detection algorithm to achieve automatic detection of ameri

Xavier Koh 2 Jun 30, 2022
List of Data Science Cheatsheets to rule the world

Data Science Cheatsheets List of Data Science Cheatsheets to rule the world. Table of Contents Business Science Business Science Problem Framework Dat

Favio André Vázquez 11.7k Dec 30, 2022
Official code for HH-VAEM

HH-VAEM This repository contains the official Pytorch implementation of the Hierarchical Hamiltonian VAE for Mixed-type Data (HH-VAEM) model and the s

Ignacio Peis 8 Nov 30, 2022
Visualize classified time series data with interactive Sankey plots in Google Earth Engine

sankee Visualize changes in classified time series data with interactive Sankey plots in Google Earth Engine Contents Description Installation Using P

Aaron Zuspan 76 Dec 15, 2022
Decision Tree Regression algorithm implemented on Python from scratch.

Decision_Tree_Regression I implemented the decision tree regression algorithm on Python. Unlike regular linear regression, this algorithm is used when

1 Dec 22, 2021
Tutorial for Decision Threshold In Machine Learning.

Decision-Threshold-ML Tutorial for improve skills: 'Decision Threshold In Machine Learning' (from GeeksforGeeks) by Marcus Mariano For more informatio

0 Jan 20, 2022
GRaNDPapA: Generator of Rad Names from Decent Paper Acronyms

Generator of Rad Names from Decent Paper Acronyms

264 Nov 08, 2022
Built on python (Mathematical straight fit line coordinates error predictor machine learning foundational model)

Sum-Square_Error-Business-Analytical-Tool- Built on python (Mathematical straight fit line coordinates error predictor machine learning foundational m

om Podey 1 Dec 03, 2021