Skip to content

Instantly share code, notes, and snippets.

View CamilleMo's full-sized avatar

Camille Moatti CamilleMo

View GitHub Profile
@CamilleMo
CamilleMo / logging.md
Last active February 26, 2017 18:59
This is a guide on the logging module

Introduction

The logging module can make your life easier especially when writing a multi-threaded program. It will help generate a .log file so you can make ex-post controls. You can also use it for debugging.

Example

script.py :

#!/usr/bin/env python
@CamilleMo
CamilleMo / multiprocessing.md
Last active December 22, 2022 03:46
This is a guide on how to use the multiprocessing module

Introduction

The multiprocessing module was defined in PEP 371 by Jesse Noller and Richard Oudkerk. The idea behind this module is to take advantage of multiple processors on a machine. This module is very similar to the threading module.
Given that you use processes you can avoid the Global Interpreter Lock (GIL). Let's start by using the Process class.

Getting Started With Multiprocessing

The Process class is very similar to the threading module’s Thread class.

@CamilleMo
CamilleMo / numpy_tricks.ipynb
Last active February 26, 2017 19:29 — forked from rossant/numpy_tricks
Numpy performance tricks
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CamilleMo
CamilleMo / Data_analysis_workflow.ipynb
Created March 15, 2017 11:05
Proper way to start a Data / ML project
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@CamilleMo
CamilleMo / apply.py
Created April 25, 2017 13:16
Apply method with Pandas
df['CDM'] = None
# La fonction ci-dessous va servir à mapper les CDM
def f(x):
portfolio_code = x['account_name_2']
asset_class = x['major_asset_type']
if 'BT ' in x['security_name'] : return 0 # pour les billets de treso
if 'ECP ' in x['security_name'] : return 0 # pour les billets de treso
if 'CD ' in x['security_name'] : return 0 # pour les billets de treso
if 'ETF' in x['security_name'] : return 0 # pour les ETF
@CamilleMo
CamilleMo / ExWorkflow.txt
Created May 12, 2017 04:54
Express Workflow
npm install express-generator -g
express --view=pug passport-local-express
J’ai eu un problème d’autorisations sur /usr/local :
réglé grace à : sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
install dependencies:
@CamilleMo
CamilleMo / configuration.ini
Last active February 6, 2019 11:02
A starting point
[DEFAULT]
ServerAliveInterval = 45
Compression = yes
CompressionLevel = 9
ForwardX11 = yes
[bitbucket.org]
User = hg
[topsecret.server.com]
import numpy as np
#Input array
X=np.array([[1,0,1,0],[1,0,1,1],[0,1,0,1]])
#Output
y=np.array([[1],[1],[0]])
#Sigmoid Function
def sigmoid (x):
@CamilleMo
CamilleMo / Bayesian_VaR.ipynb
Created June 18, 2017 10:52
Bayesian VaR with PyMC3
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.