Skip to content

Instantly share code, notes, and snippets.

View Kirili4ik's full-sized avatar
🌏

Kirill Gelvan Kirili4ik

🌏
View GitHub Profile
@Kirili4ik
Kirili4ik / IV_and_WoE.py
Last active July 21, 2021 13:34
IV and WoE in Python (easy), Information value and Weight of evidence calculations function. Check https://contrib.scikit-learn.org/category_encoders/woe.html
def get_IV(df, feature, target):
lst = []
# optional
# df[feature] = df[feature].fillna("NULL")
unique_values = df[feature].unique()
for val in unique_values:
lst.append([feature, # Feature name
val, # Value of a feature (unique)
@the-bass
the-bass / rename_state_dict_keys.py
Last active May 12, 2024 17:37
Rename the parameters of a PyTorch module's saved state dict. Last tested with PyTorch 1.0.1.
import torch
from collections import OrderedDict
def rename_state_dict_keys(source, key_transformation, target=None):
"""
source -> Path to the saved state dict.
key_transformation -> Function that accepts the old key names of the state
dict as the only argument and returns the new key name.
target (optional) -> Path at which the new state dict should be saved
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 21, 2024 01:45
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname