Skip to content

Instantly share code, notes, and snippets.

View raineydavid's full-sized avatar
🎯
Hit the spot

L David raineydavid

🎯
Hit the spot
View GitHub Profile
@Sparrow0hawk
Sparrow0hawk / flags-and-emissions.ipynb
Last active November 11, 2021 14:41
flags-and-emissions.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@raineydavid
raineydavid / proportions_of_missing_data_in_dataframe_columns.py
Created October 20, 2021 07:43 — forked from ltfschoen/proportions_of_missing_data_in_dataframe_columns.py
Calculate percentage of NaN values in a Pandas Dataframe for each column. Exclude columns that do not contain any NaN values
# Author: Luke Schoen 2017
import pandas as pd
import numpy as np
import functools
# Create DataFrame
# df = pd.DataFrame(np.random.randn(10,2))
# Populate with NaN values
df = pd.DataFrame({'col1': ['1.111', '2.111', '3.111', '4.111'], 'col2': ['4.111', '5.111', np.NaN, '7.111'], 'col3': ['8', '9', np.NaN, np.NaN], 'col4': ['12', '13', '14', '15']})
@jaspervdj
jaspervdj / README.md
Last active April 13, 2023 13:59
ZuriHac Calendar
<?
# MIT license, do whatever you want with it
#
# This is my invoice.php page which I use to make invoices that customers want,
# with their address on it and which are easily printable. I love Stripe but
# their invoices and receipts were too wild for my customers on Remote OK
#
require_once(__DIR__.'/../vendor/autoload.php');
@lizthegrey
lizthegrey / attributes.rb
Last active August 29, 2025 15:40
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
import tensorflow as tf
import pandas as pd
from sklearn.model_selection import StratifiedKFold
def tf_cross_val_score(X, y, x_col_nms, n_classes):
"""
Takes features, number of classes, labels and feature vector names and returns 3 validation scores.
*X* Numpy ndarray - features
@FrancoisMB
FrancoisMB / supervised_ml_with_scikitlearn_tutorial.py
Last active January 16, 2020 06:41
The goal of this gist is to display how scikit learn works
# -*- coding: utf-8 -*-
"""
Created on Thu Oct 26 18:32:47 2017
Supervised machine learning with scikit learn
L'objectif de ce tutoriel est de vous introduire à la manipulation de scikit-learn.
Pour cela, on charge en mémoire de la donnée avant de voir comment mettre sur pied des modèles de machine learning supervisés.
On verra ensuite comment ensembler les modèles, puis comment utiliser les procédures de cross-validation, comment utiliser la fonctionnalité de grid search (ainsi qu'un module supplémentaire s'intégrant très bien à scikit-learn, qui permet de faire du grid search évolutionnaire), comment utiliser la fonctionnalité d'élimination récursive des features.
Notez que le but de ce tutoriel est de comprendre comment un objet "modèle" peut être passé pour être transformé en objet "modèle cross validé" puis à nouveau passé pour être transformé en objet "modèle cross validé optimisé via grid search", puis à nouveau pour être transformé en "modèle ensemblé résultant de plusieurs modèles qui ont été cro
@ltfschoen
ltfschoen / proportions_of_missing_data_in_dataframe_columns.py
Last active October 20, 2021 07:43
Calculate percentage of NaN values in a Pandas Dataframe for each column. Exclude columns that do not contain any NaN values
# Author: Luke Schoen 2017
import pandas as pd
import numpy as np
import functools
# Create DataFrame
# df = pd.DataFrame(np.random.randn(10,2))
# Populate with NaN values
df = pd.DataFrame({'col1': ['1.111', '2.111', '3.111', '4.111'], 'col2': ['4.111', '5.111', np.NaN, '7.111'], 'col3': ['8', '9', np.NaN, np.NaN], 'col4': ['12', '13', '14', '15']})
@spro
spro / pytorch-simple-rnn.py
Last active November 7, 2024 11:24
PyTorch RNN training example
import torch
import torch.nn as nn
from torch.nn import functional as F
from torch.autograd import Variable
from torch import optim
import numpy as np
import math, random
# Generating a noisy multi-sin wave
@drrk
drrk / .kitchen.yml
Last active March 29, 2017 14:21
Chef TTD Azure Workshop Test Kitchen Config
---
driver:
name: azurerm
driver_config:
subscription_id: '4801fa9d-YOUR-GUID-HERE-b265ff49ce21'
location: 'West Europe'
machine_size: 'Standard_D1'
transport: