Skip to content

Instantly share code, notes, and snippets.

View loiseaujc's full-sized avatar

Jean-Christophe loiseaujc

View GitHub Profile
# --> Import standard Python libraries.
import numpy as np
from scipy.special import expit
from scipy.linalg import norm
# --> Import sklearn utility functions.
from sklearn.base import BaseEstimator, ClassifierMixin
class LogisticRegression_Newton(BaseEstimator, ClassifierMixin):
# --> Import standard Python libraries.
import numpy as np
from scipy.special import expit
from scipy.linalg import norm
# --> Import sklearn utility functions.
from sklearn.base import BaseEstimator, ClassifierMixin
class LogisticRegression_GD(BaseEstimator, ClassifierMixin):
@loiseaujc
loiseaujc / Adaline.py
Created May 4, 2020 11:07
Implementation of Adaline (Adaptive Linear Neurons) in Python.
# --> Import standard Python libraries.
import numpy as np
# --> Import sklearn utility functions to create derived-class objects.
from sklearn.base import BaseEstimator, ClassifierMixin
# --> Redefine the Heaviside function.
def H(x): return np.heaviside(x-0.5, 1).astype(np.int)
@loiseaujc
loiseaujc / spod.py
Created December 6, 2019 09:03
Python implementation of the spectral proper orthogonal decomposition.
"""
Spectral Proper Orthogonal Decomposition
-----------------------------------------
This module implements the Spectral Proper Orthogonal Decomposition class. The
present implementation corresponds to the batch algorithm originally proposed
in [1]. Note that a streaming algorithm has also been proposed in [2].
References
----------
@loiseaujc
loiseaujc / Rosenblatt.py
Last active December 11, 2021 20:23
Implementation of Rosenblatt's perceptron using Python.
# --> Import standard Python libraries.
import numpy as np
# --> Import sklearn utility functions to create derived-class objects.
from sklearn.base import BaseEstimator, ClassifierMixin
# --> Redefine the Heavisde function.
H = lambda x: np.heaviside(x, 1).astype(np.int)
class Rosenblatt(BaseEstimator, ClassifierMixin):