Skip to content

Instantly share code, notes, and snippets.

View alik604's full-sized avatar
👨‍🎓
Full time student

K. Ali Pardhan alik604

👨‍🎓
Full time student
View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tomquisel
tomquisel / prefit_voting_classifier.py
Last active March 15, 2022 20:45
Version of scikit-learn's VotingClassifier that uses prefit models rather than requiring a refit.
class VotingClassifier(object):
"""Stripped-down version of VotingClassifier that uses prefit estimators"""
def __init__(self, estimators, voting='hard', weights=None):
self.estimators = [e[1] for e in estimators]
self.named_estimators = dict(estimators)
self.voting = voting
self.weights = weights
def fit(self, X, y, sample_weight=None):
raise NotImplementedError
@tartakynov
tartakynov / fourex.py
Last active April 23, 2024 02:55
Fourier Extrapolation in Python
import numpy as np
import pylab as pl
from numpy import fft
def fourierExtrapolation(x, n_predict):
n = x.size
n_harm = 10 # number of harmonics in model
t = np.arange(0, n)
p = np.polyfit(t, x, 1) # find linear trend in x
x_notrend = x - p[0] * t # detrended x