Skip to content

Instantly share code, notes, and snippets.

@cjaniake
cjaniake / sampling_example sql
Created October 11, 2024 01:06
Sampling using SQL
WITH randomized_data AS (
SELECT *,
ROW_NUMBER() OVER (ORDER BY RAND()) AS row_num
FROM your_table
),
total_row_count AS (
SELECT COUNT(*) AS total_rows
FROM your_table
),
full_samples AS (
@cjaniake
cjaniake / binomial_normal.ipynb
Created August 10, 2024 17:51
The normal approximation of the binomial distribution
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cjaniake
cjaniake / portuguese_plural_singular.py
Created May 27, 2020 19:54
NLP utility method to generate plural from singular and singular from plural in Portuguese
import nltk.corpus
import re
import string
import unicodedata
SYM_PATTERN = re.compile('[%s]' % string.punctuation)
DIG_PATTERN = re.compile('[0-9]')
def remove_sym(text):
text = re.sub(SYM_PATTERN, '', text)