Skip to content

Instantly share code, notes, and snippets.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ujjwalx
ujjwalx / func.py
Created November 22, 2018 21:26
Imputation Data Generation Function
# Requires Numpy
def add_nan_to_data(train_inputs, miss_prob=0.2):
"""
Randomly flips a numpy ndarray entry to NaN with a supplied
probability.
WARNING: Do not try to add missing values to labels. This is
not unsupervised learning.
@ujjwalx
ujjwalx / load_map.py
Created September 27, 2018 18:41
Load City Map
import numpy as np
def get_city_map():
"""
Returns a map of the city with buildings marked with '0' in a numpy array.
Accepts no arguments.
"""
city_map = np.array([[ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ],