Skip to content

Instantly share code, notes, and snippets.

View thesfinox's full-sized avatar

Riccardo thesfinox

View GitHub Profile
@thesfinox
thesfinox / wavelets.py
Created April 8, 2022 13:42
Applying wavelet deconstruction and reconstruction
# -*- coding: utf-8 -*-
"""
Denoise using wavelet transformations.
@author: Riccardo Finotello <riccardo.finotello@gmail.com>
"""
from typing import Optional
import numpy as np
import pywt
@thesfinox
thesfinox / statsmodels_ols.py
Created January 11, 2022 17:11
Statsmodels regression (formula API)
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
import statsmodels.formula.api as sm
sns.set_theme()
#######################
# #
@thesfinox
thesfinox / mp_distr.py
Created March 9, 2021 07:58
Marchenko-Pastur Distribution
# Marchenko-Pastur distribution
# see https://en.wikipedia.org/wiki/Marchenko%E2%80%93Pastur_distribution
def marchenko_pastur(x, c, var=1.0):
'''
Marchenko-Pastur PDF.
Arguments:
x: independent variable,
c: phase transition parameter,
@thesfinox
thesfinox / parallel-scikit.py
Created July 3, 2020 17:33
Example for using Joblib for parallel training using Scikit-learn
from sklearn.ensemble import GradientBoostingRegressor
from joblib import Parallel, delayed
# create a list of parameters
params = [{'learning_rate': 0.01, 'subsample': 0.8, 'n_estimators': 100},
{'learning_rate': 0.03, 'subsample': 0.5, 'n_estimators': 300},
{'learning_rate': 0.001, 'subsample': 0.9, 'n_estimators': 50},
{'learning_rate': 0.003, 'subsample': 0.1, 'n_estimators': 10},
]