Skip to content

Instantly share code, notes, and snippets.

View kwinkunks's full-sized avatar
🐍
Writing bugs

Matt Hall kwinkunks

🐍
Writing bugs
View GitHub Profile
@kwinkunks
kwinkunks / Mis-steps_in_machine_learning.ipynb
Created January 19, 2023 09:20
A notebook showing a simple data science exploration, but with mis-steps for discussion and teaching purposes
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
kwinkunks / Image_grid.py
Created October 16, 2022 13:01
Reshape a 4D array into a image grid
"""
Given a 4D array of shape (n, h, w, c) representing n images of shape (h, w, c),
make a single image consisting of a regular grid of smaller images.
License: MIT No attribution
"""
import numpy as np
def reshape(arr, rows, cols, pixels=False):
"""Reshapes a 4D array into a grid of images.
@kwinkunks
kwinkunks / Recover_data_with_known_colourmap.ipynb
Last active September 14, 2022 14:39
Demo of recovering data from an image with a known colourmap. Thank you to David Johnstone (Manchester) for the data example.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
kwinkunks / sdhe.py
Last active January 29, 2025 18:39
Confidence analysis of standard deviational ellipse and its extension into higher dimensional Euclidean space
# Properties of the scaled standard deviational hyperellipsoid.
#
# Author: Matt Hall, [email protected]
# Copyright: 2022, Matt Hall
# Licence: Apache 2.0, https://www.apache.org/licenses/LICENSE-2.0
#
# These small functions implement n-dimensional lookup of the beta-distribution
# approximation to this problem. They answer the questions, "What proportion
# of a multivariate Gaussian distribution is contained by `r` standard
# deviations?" and "How many standard deviations contain a proportion `p` of
@kwinkunks
kwinkunks / Adding_features.md
Created June 17, 2022 18:16
Why does adding features sometimes make a worse classifier?
@kwinkunks
kwinkunks / _Regressor_comparison.md
Last active October 21, 2024 09:56
Comparison of various regression algorithms

Regressor comparison

Regressor comparison

I wrote a blog post about this here.

I tweeted about it here and again

Inspired, of course, by the various wonderful comparisons in the sklearn docs, like this one for classifiers.

@kwinkunks
kwinkunks / Concatenating_strings.ipynb
Last active April 13, 2022 22:48
What's the fastest way to concatenate things into a string?
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
kwinkunks / unique.py
Last active March 2, 2022 17:18
Fast, ordered unique items from sequences
# We want to get unique items in a sequence, but to keep the order in which they appear.
# There are quite a few solutions here > http://www.peterbe.com/plog/uniqifiers-benchmark
# Good, up to date summary of methods > https://stackoverflow.com/a/17016257/3381305
# Some test data: text...
tdat = 100 * ['c', 'a', 'c', 'b', 'e', 'd', 'f', 'g', 'h', 'i', 'j', 'j']
tarr = np.array(tdat)
tser = pd.Series(tdat)
# ... and numbers.
narr = np.random.randint(0, 10, size=1200)
@kwinkunks
kwinkunks / Loading_subsurface_data_101.ipynb
Last active April 5, 2022 11:31
How to load various subsurface data types using Python
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@kwinkunks
kwinkunks / Back-interpolate_seismic_onto_wellbore.ipynb
Last active February 24, 2022 19:16
Extract seismic amplitudes onto a well path
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.