This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
standardized = (data - np.mean(data)) / np.std(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bad | |
data.drop('target', axis=1) | |
# good | |
data = data.drop('target', axis=1)j |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# bad | |
Var=1 | |
# good | |
var = 1 | |
# bad | |
def adder ( x =10 ,y= 5): | |
return x+y | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# this search isn't wide enough | |
useless_search = sklearn.model_selection.GridSearchCV( | |
sklearn.ensemble.RandomForestRegressor(n_estimators=10), param_grid={'n_estimators': [10, 15, 20] | |
) | |
# this search is more informative | |
useful_search = sklearn.model_selection.GridSearchCV( | |
sklearn.ensemble.RandomForestRegressor(n_estimators=10), param_grid={'n_estimators': [10, 100, 1000] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import itertools | |
def calc_num_combinations(data): | |
return len(list(itertools.permutations(data, len(data)))) | |
def test_calc_num_combinations(): | |
test_data = ( | |
((0, ), 1), ((0, 1), 2), ((0, 1, 2), 6) | |
) | |
for data, length in test_data: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
data = ['awake'] * 1000 + ['asleep'] * 500 + ['dreaming'] * 50 | |
pd.Series(data).value_counts().plot(kind='bar') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pandas as pd | |
data = np.concatenate([ | |
np.random.normal(5, 1, 10000), | |
np.random.normal(-5, 1, 10000), | |
np.array([-20, 20] * 1000) | |
]) | |
pd.DataFrame(data).plot(kind='hist', legend=None, bins=100) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
A feedforward neural network aka multilayer perceptron. | |
Single hidden layer with relu as the activation function | |
after the input & hidden layers. | |
Linear activation function after the output layer. | |
Built using 100% pure numpy. | |
Adam Green - adgefficiency.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ENCODING | |
set encoding=utf8 | |
scriptencoding utf-8 | |
" VUNDLE SETUP | |
" git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim | |
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Jan 25 10:12:34 2017 | |
@author: Adam Green | |
adam.green@adgefficiency.com | |
adgefficiency.com | |
""" | |
import os |
NewerOlder