Skip to content

Instantly share code, notes, and snippets.

View makdoudN's full-sized avatar
🏠
Working from home

Makdoud makdoudN

🏠
Working from home
View GitHub Profile
@DanielWeitzenfeld
DanielWeitzenfeld / day_of_week_seasonality-v2.ipynb
Created January 21, 2023 16:51
GRW/Day-of-week seasonality in PyMC
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@veekaybee
veekaybee / searchrecs.md
Last active February 3, 2025 14:37
Understanding search and recommendations

How are search and recommendations the same, and how are they different?

TL;DR:

  • The design of both search and recommendations is to find and filter information
  • Search is a "recommendation with a null query"
  • Search is "I want this", recommendations is "you might like this"
@veekaybee
veekaybee / chatgpt.md
Last active March 10, 2025 07:45
Everything I understand about chatgpt

ChatGPT Resources

Context

ChatGPT appeared like an explosion on all my social media timelines in early December 2022. While I keep up with machine learning as an industry, I wasn't focused so much on this particular corner, and all the screenshots seemed like they came out of nowhere. What was this model? How did the chat prompting work? What was the context of OpenAI doing this work and collecting my prompts for training data?

I decided to do a quick investigation. Here's all the information I've found so far. I'm aggregating and synthesizing it as I go, so it's currently changing pretty frequently.

Model Architecture

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@SupreethRao99
SupreethRao99 / WeightedKappaLoss.py
Created November 5, 2021 09:57
Pytorch Implementation of WeightedKappaLoss
import torch
import torch.nn as nn
import torch.nn.functional as F
from typing import Optional
class WeightedKappaLoss(nn.Module):
"""
Implements Weighted Kappa Loss. Weighted Kappa Loss was introduced in the
[Weighted kappa loss function for multi-class classification
@neelabalan
neelabalan / df_to_table.py
Created October 3, 2021 16:57 — forked from avi-perl/df_to_table.py
Convert a pandas.DataFrame object into a rich.Table object for stylized printing in Python.
from datetime import datetime
from typing import Optional
import pandas as pd
from rich import box
from rich.console import Console
from rich.table import Table
console = Console()
@RuolinZheng08
RuolinZheng08 / tree_traversal_template.py
Created November 20, 2020 15:19
[Algo] Tree Traversal Template
# DFS
def preorder(self, root):
if not root:
return []
ret = []
stack = [root]
while stack:
node = stack.pop()
ret.append(node.val)
if node.right:
@slinderman
slinderman / jax_minimize_wrapper.py
Last active November 8, 2024 18:53
A simple wrapper for scipy.optimize.minimize using JAX. UPDATE: This is obsolete now that `jax.scipy.optimize.minimize` is exists!
"""
A collection of helper functions for optimization with JAX.
UPDATE: This is obsolete now that `jax.scipy.optimize.minimize` is exists!
"""
import numpy as onp
import scipy.optimize
from jax import grad, jit
from jax.tree_util import tree_flatten, tree_unflatten
from jax.flatten_util import ravel_pytree
@theclanks
theclanks / pandas_memory_reduction.py
Created August 5, 2020 14:48
Reducing pandas memory usage
## Function to reduce the DF size
def reduce_mem_usage(df, verbose=True):
numerics = ['int16', 'int32', 'int64', 'float16', 'float32', 'float64']
start_mem = df.memory_usage().sum() / 1024**2
for col in df.columns:
col_type = df[col].dtypes
if col_type in numerics:
c_min = df[col].min()
c_max = df[col].max()
if str(col_type)[:3] == 'int':
@willwhitney
willwhitney / tree_stack.py
Last active July 7, 2024 21:37
utils for stacking and unstacking jax pytrees to deal with vmap
import numpy as np
from jax import numpy as jnp
from jax.lib import pytree
def tree_stack(trees):
"""Takes a list of trees and stacks every corresponding leaf.
For example, given two trees ((a, b), c) and ((a', b'), c'), returns
((stack(a, a'), stack(b, b')), stack(c, c')).