Created
September 8, 2020 08:23
-
-
Save kayhman/f3dfae2eb222462fe426f1b8f982ac76 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import matplotlib.pyplot as plt | |
x = np.linspace(-20, 20, 200) | |
y = np.abs(x) | |
alpha = 0.2 | |
y_Q = np.where(x > 0, alpha * x, (alpha - 1) * x) | |
y_logcosh = np.where(x > 0, alpha * np.log(np.cosh(x)), (1 - alpha) * np.log(np.cosh(x))) | |
plt.plot(x, y_Q, label=f'Q = 0.2') | |
plt.plot(x, y_logcosh, label=f'Smooth Q=0.2 regression using log_cosh') | |
plt.legend(loc='upper left') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment