This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""An object to show a realtime plot of the value of a discrete line.""" | |
from matplotlib import pyplot as plt | |
from matplotlib.ticker import MaxNLocator | |
class RealtimePlot(object): | |
"""A simple realtime plot to show the value of a discrete line.""" | |
def __init__(self, figsize: tuple=(4, 4)) -> None: | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib as mpl | |
import matplotlib.pyplot as plt | |
import numpy as np | |
import pandas as pd | |
def heatmap(data, | |
size_scale:int = 100, | |
figsize: tuple = (15, 12), | |
x_rotation: int = 270, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A simple method wrapping around `confusion_matrix`.""" | |
def confusion_dataframe(*args, **kwargs): | |
""" | |
Generate an sklearn confusion matrix as a DataFrame. | |
Args: | |
*args: positional args for `confusion_matrix` | |
**kwargs: keyword args for `confusion_matrix` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""A method to calculate the number of True/False Positive/Negative guesses.""" | |
import numpy as np | |
def tpfp(predictions: np.ndarray, | |
ground_truth: np.ndarray, | |
negative: int=0.0, | |
positive: int=1.0, | |
normalize: bool=True) -> dict: | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Array(object): | |
"""A list that indexes like an array [1...n] (for algorithm analysis).""" | |
def __init__(self, items: list) -> None: | |
"""Create a new array from a list.""" | |
self.items = items | |
def __repr__(self) -> str: | |
"""Return an executable string represention of `self`.""" | |
return '{}({})'.format(self.__class__.__name__, self.items) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""This Python script counts words in a Markdown / LaTeX document(s). | |
Usage: | |
python3 count_words.py <filename or directory> | |
It will ignore ATX headers, LaTeX & Markdown comments, and LaTeX markup tags. | |
TODO: inline HTML, Markdown images & tables | |
""" |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.