Skip to content

Instantly share code, notes, and snippets.

View robertmaxwilliams's full-sized avatar
💭
student

Robert robertmaxwilliams

💭
student
View GitHub Profile
#! /usr/bin/python
# -*- coding: utf8 -*-
""" GAN-CLS """
import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import *
from tensorlayer.prepro import *
from tensorlayer.cost import *
import numpy as np
@robertmaxwilliams
robertmaxwilliams / 1d-convolution.c
Last active February 22, 2018 04:19
1d convolution in c for lidar data smoothing
#include <stdio.h>
/* Useful vidoes:
1d kernel for data processing:
https://www.youtube.com/watch?v=D0F-NPerCIE
numberphile on image bluring (same thing in 2d):
https://www.youtube.com/watch?v=C_zFhWdM4ic
excellent explanations in there. It introduced me to the concept.
*/
@robertmaxwilliams
robertmaxwilliams / discretize_gassian.py
Last active February 28, 2018 00:36
converts numbers into other numbers, good luck me in the future.
# copy filter from here and paste into stdin
# http://dev.theomader.com/gaussian-kernel-calculator/
input_string = input("paste in filter, it won't have spaces but that's okay: ")
float_filter = [float('0.'+x) for x in input_string.split('0.')][1:]
smallest = min(float_filter)
discrete_filter = [round(x/smallest) for x in float_filter]
print(discrete_filter)
from itertools import combinations
from copy import copy
import pdb
def grabpoints(size, mod, pointnums):
""" returns nums under size
that are divisible by mod,
duplicated on pointnums
"""
box = {n for n in range(size) if n%mod == 0}
import random
import subprocess
import shlex
cows = ['apt', 'beavis.zen', 'bong', 'bud-frogs', 'bunny', 'calvin', 'cheese', 'cock', 'cower',
'daemon', 'default', 'dragon', 'dragon-and-cow', 'duck', 'elephant', 'elephant-in-snake',
'eyes', 'flaming-sheep', 'ghostbusters', 'gnu', 'head-in', 'hellokitty', 'kiss', 'kitty',
'koala', 'kosh', 'luke-koala', 'mech-and-cow', 'meow', 'milk', 'moofasa', 'moose',
'mutilated', 'pony', 'pony-smaller', 'ren', 'sheep', 'skeleton', 'snowman',
'sodomized-sheep', 'stegosaurus', 'stimpy', 'suse', 'three-eyes', 'turkey', 'turtle', 'tux',

How to Classify a sklearn classifier

from sklearn.ensemble import RandomForestRegressor, ExtraTreesRegressor, AdaBoostRegressor, ExtraTreesClassifier, RandomForestClassifier, AdaBoostClassifier
from sklearn.gaussian_process import GaussianProcessRegressor
from sklearn.kernel_ridge import KernelRidge
from sklearn.linear_model import LinearRegression, Lasso, LogisticRegression
from sklearn.neural_network import MLPRegressor, MLPClassifier
from sklearn.svm import SVC, SVR
from sklearn.tree import DecisionTreeRegressor, DecisionTreeClassifier
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
$ cowsay 'hello world' | cowsay -n | cowsay -n | cowsay -n | cowsay -n
__________________________________________
/ ______________________________________ \
| / __________________________________ \ |
| | / ______________________________ \ | |
| | | / _____________ \ | | |
| | | | < hello world > | | | |
| | | | ------------- | | | |
| | | | \ ^__^ | | | |
| | | | \ (oo)\_______ | | | |
@robertmaxwilliams
robertmaxwilliams / dotmaker.py
Last active June 28, 2018 17:48
makes dot file from project dir
import os
import os.path as p
import random
import sys
# TODO: DO TO
PACKAGE_NAME = "mastml" #TODO
#pure_print = print
#def make_myprint(leader):
# def myprint(*args):
@robertmaxwilliams
robertmaxwilliams / oo-in-common-lisp.lisp
Created November 10, 2018 00:18
How to do basic object oriented in common list. Only for fun, if you actually want OO, use CLOS.
(defun inverse-collatz (n)
"returns a list with one or two values that collatz to n"
(cons (* 2 n)
(let ((other-result (/ (- n 1) 3)))
(if (integerp other-result)
(list other-result)
nil))))
;; use lambda closure to access lexically scoped variable "starting-list"