Skip to content

Instantly share code, notes, and snippets.

View jgoerner's full-sized avatar
:octocat:
Getting Schwifty

Joshua Görner jgoerner

:octocat:
Getting Schwifty
  • Cäciliengroden
View GitHub Profile
@jgoerner
jgoerner / kevin-bacon.db.sql
Created April 6, 2022 04:10
SQLite snippet to create a fraction of a movie database to show the Six Degrees of Kevin Bacon
BEGIN TRANSACTION;
DROP TABLE IF EXISTS "actors";
CREATE TABLE IF NOT EXISTS "actors" (
"actor_id" INTEGER,
"name" TEXT,
PRIMARY KEY("actor_id")
);
DROP TABLE IF EXISTS "roles";
CREATE TABLE IF NOT EXISTS "roles" (
"role_id" INTEGER,
mkdir -p adapter/in adapter/out application/port/in application/port/out application/service domain;
touch adapter/in/.gitkeep adapter/out/.gitkeep application/port/in/.gitkeep application/port/out/.gitkeep application/service/.gitkeep domain/.gitkeep
@jgoerner
jgoerner / mocking_data.py
Created March 21, 2020 21:56
Corona Hackathon Mock Data Generation
### IMPORTS ###
from datetime import datetime
from random import random, randint
import uuid
from faker import Faker
import numpy as np
import pandas as pd
from sqlalchemy import create_engine
from tqdm import tqdm
@jgoerner
jgoerner / docker-compose.yml
Created March 19, 2019 19:56
docker-compose using external volume
version: "3"
services:
jupyter:
image: jupyter/scipy-notebook
ports:
- 8888:8888
volumes:
- jp_vol:/home/jovyan/work
@jgoerner
jgoerner / gmm_soft_clutering.py
Created February 8, 2019 10:29
Mix Soft Clustering of GMM
# Import
import numpy as np
from matplotlib.colors import ListedColormap, to_rgba_array
import matplotlib.pyplot as plt
from scipy.stats import multivariate_normal
from sklearn.mixture import GaussianMixture
# Config
%config InlineBackend.figure_format = 'retina'
%matplotlib inline
@jgoerner
jgoerner / check_row.py
Created February 8, 2019 10:21
Get rows of 2D array that match a given other row
import numpy as np
foo = np.array([
[1, 2, 3],
[1, 2, 3],
[1, 2, 9],
])
bar = [1, 2, 3]
@jgoerner
jgoerner / gist:7a363f9d3670418fc6c99f5f2ea53a7f
Last active June 14, 2023 15:57
Feature Engineering for NLP using sklearn FeatureUnion
# A little snippet to show how to use sklearn transformer interface
# to extract NLP features
# necessary imports
import pandas as pd
from sklearn.base import TransformerMixin
from sklearn.pipeline import FeatureUnion
# load your dataset
df_train = pd.read_csv("./data/train/cwi_training.txt", sep="\t", names=["sentence", "word", "index", "label"])