Skip to content

Instantly share code, notes, and snippets.

@MMesch
MMesch / robust_fourier_sklearn.py
Created May 22, 2017 16:27
Robust Fourier Transform and Custom Features with Scikit Learn
#!/usr/bin/env python
"""
Robust non-linear feature estimation with scikit-learn applied to
the Fourier Transform.
"""
from matplotlib import pyplot as plt
import numpy as np
from sklearn.base import TransformerMixin
from sklearn.pipeline import make_pipeline
@MMesch
MMesch / robust_splines_sklearn.py
Last active July 6, 2023 23:04
Robust Spline Regression with Scikit-Learn
#!/usr/bin/env python
"""
Robust B-Spline regression with scikit-learn
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate as si
from sklearn.base import TransformerMixin
from sklearn.pipeline import make_pipeline
@MMesch
MMesch / bspline_basis_scipy.py
Created July 21, 2017 12:51
simple script that extracts an ND Bspline basis from scipy (plots in 1D and 2D)
#!/usr/bin/env python
"""
ND Bspline basis class for Python
"""
import numpy as np
import scipy.interpolate as si
import matplotlib.pyplot as plt
import itertools
@MMesch
MMesch / robust_2dsplines_sklearn.py
Created August 1, 2017 14:35
Robust Spline Regression with scikit learn
#!/usr/bin/env python
"""
2D BSpline Regression with Scikitlearn.
"""
import matplotlib.pyplot as plt
import numpy as np
import scipy.interpolate as si
import itertools
@MMesch
MMesch / minimal_cwt.py
Last active September 11, 2018 13:26
Minimal Continuous Wavelet Transform
#!/usr/bin/env python
"""Mini implementation of continuous wavelet transform (Morlet wavelet)."""
import numpy as np
import matplotlib.pyplot as plt
def continuous_wavelet_transform(signal, frequencies, time_step=1.0,
wavelet_width=5):
@MMesch
MMesch / init.vim
Created November 25, 2017 11:24
my .vimrc (neovim) file
"some basic options
set shiftwidth=4
set expandtab
set nowrap
set colorcolumn=80
"let &colorcolumn=join(range(80, 999), ",")
" autopep 8 when hitting gq
au FileType python setlocal formatprg=autopep8\ -
@MMesch
MMesch / sklearn_tree.js
Created January 15, 2018 11:13
simple d3 visualization of scikit-learn tree
var plot_tree = function(data, chart){
// set some layout variables
var positionInfo = chart.getBoundingClientRect();
var el_height = positionInfo.height;
var el_width = positionInfo.width;
var margin = {top: 20, right: 20, bottom: 30, left: 40},
svg_width = el_width - margin.left - margin.right,
svg_height = el_height - margin.top - margin.bottom;
@MMesch
MMesch / README.md
Last active January 15, 2018 23:43
Scikit-learn Decision Tree

Visualization of scikit-learn decision trees. Hover with the mouse over the paths to see the decision rules and a histogram of the classes that remain at a certain node in the tree. Checkout this repository to see how to use it in python and also directly in the jupyter notebook.

@MMesch
MMesch / README.md
Last active January 31, 2018 12:21
food network

Visualization of the time-dependent correlation matrix of the food production of 245 countries from the united nations.

@MMesch
MMesch / README.md
Created March 5, 2018 14:11
python refactoring commands

Python Refactoring Strategies

project structure and workflow

git and CI

check if git and CI are setup

folder tree