2022/03/03
How does this type of scam earn money
2022/02/18
Monte Carlo simulation in Python
This is a good article to talk about Monte Carlo simulation.
https://www.mikulskibartosz.name/monte-carlo-simulation-in-python/
2022/02/11
statsmodels (a good stats package)
In [1]: import numpy as np
In [2]: import statsmodels.api as sm In [3]: import statsmodels.formula.api as smf # Load data In [4]: dat = sm.datasets.get_rdataset("Guerry", "HistData").data # Fit regression model (using the natural log of one of the regressors) In [5]: results = smf.ols('Lottery ~ Literacy + np.log(Pop1831)', data=dat).fit() # Inspect the results In [6]: print(results.summary())
matplotlib plot settings
method 1
import matplotlib
matplotlib.rc('xtick', labelsize=20)
matplotlib.rc('ytick', labelsize=20)
matplotlib.rc('font',family='
method 2
import matplotlib.pyplot as plt
SMALL_SIZE = 8
MEDIUM_SIZE = 10
BIGGER_SIZE = 12
plt.rc('font', size=SMALL_SIZE) # controls default text sizes
plt.rc('axes', titlesize=SMALL_SIZE) # fontsize of the axes title
plt.rc('axes', labelsize=MEDIUM_SIZE) # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE) # fontsize of the tick labels
plt.rc('ytick', labelsize=SMALL_SIZE) # fontsize of the tick labels
plt.rc('legend', fontsize=SMALL_SIZE) # legend fontsize
plt.rc('figure', titlesize=BIGGER_SIZE) # fontsize of the figure title
method 3
matplotlib.rc('xtick', labelsize=20)
matplotlib.rc('ytick', labelsize=20)
matplotlib.rc('font', size=20)
matplotlib.rc('axes', titlesize=20)
matplotlib.rc('axes', labelsize=20)
matplotlib.rc('legend', fontsize=20)
matplotlib.rc('figure', titlesize=20)
method 4
#size=25
size=15
params = {'legend.fontsize': 'large',
'figure.figsize': (20,8),
'axes.labelsize': size,
'axes.titlesize': size,
'xtick.labelsize': size*0.75,
'ytick.labelsize': size*0.75,
'axes.titlepad': 25}
plt.rcParams.update(params)
2022/02/09
beta-PERT Monte Carlo Simulation
Here, we are running Beta-PERT Monte Carlo simulation.
from scipy import stats as stats
from scipy.stats import beta as beta
from scipy.stats import rv_continuous
import matplotlib.pylab as plt
class Beta_PERT(rv_continuous):
def _shape(self, minimum, mode, maximum, lamb):
alpha = 1+lamb*(mode-minimum)/(maximum-minimum)
beta = 1+lamb*(maximum-mode)/(maximum-minimum)
return [alpha,beta]
def _cdf(self,x, minimum, mode, maximum, lamb):
s_alpha, s_beta = self._shape(minimum, mode, maximum, lamb)
z = (x-minimum)/(maximum-minimum)
cdf = beta.cdf(z,s_alpha,s_beta)
return cdf
pert = Beta_PERT(name="pert")
rv_1 = pert(0.02,0.05,0.2,4)
rv_2 = pert(1,5,20,4)
N = 5000
freq = rv_1.rvs(N)
loss = rv_2.rvs(N)
ALE = freq*loss
2021/12/07
Common hedging strategies
- Long/Short Equity Strategy
- Market Neutral Strategy
- Merger Arbitrage Strategy
- Convertible Arbitrage Strategy
- Capital Structure Arbitrage Strategy
- Fixed-Income Arbitrage Strategy
- Event-Driven Strategy
- Global Macro Strategy
- Short Only Strategy
2021/10/21
L1 and L2 loss function
http://www.chioka.in/differences-between-l1-and-l2-as-loss-function-and-regularization/
How to Supercharge Your Python Classes with Class Methods
How to Supercharge Your Python Classes with Class Methods | by Siavash Yasini | May, 2024 | Towards Data Science As we just mentioned, a c...
-
https://kubernetes.io/blog/2019/07/23/get-started-with-kubernetes-using-python/ A Kubernetes service - I’m using Docker Desktop with Kub...
-
Five basic elements about reinforcement learning: agent, state, environment, policy, reward. Here is an example https://builtin.com/data-...
-
Comparison among bestText to Image AI generation Here are some results for "every success starts from small steps" 1) Dalle E 2,...
-
https://www.analyseup.com/python-machine-learning/catboost-python-tutorial.html
-
How to Set Up a Task Queue with Celery and RabbitMQ https://www.linode.com/docs/development/python/task-queue-celery-rabbitmq/