Note to self to update a PR:
1. git checkout <branch-of-fork>
2. git add <filename>
3. git commit -m "updated the feature"
4. git push origin <branch-of-fork>
OR
4. git push fork <branch-of-fork>
# Based on the solution here: https://stackoverflow.com/questions/44580644/subtract-mean-from-pyspark-dataframe | |
# Function to normalise (standardise) PySpark dataframes | |
def standardize_train_test_data(train_df, test_df, columns): | |
''' | |
Add normalised columns to the input dataframe. | |
formula = [(X - mean) / std_dev] | |
Inputs : training dataframe, list of column name strings to be normalised | |
Returns : dataframe with new normalised columns, averages and std deviation dataframes | |
''' |
%%html | |
<style> | |
.output_wrapper, .output { | |
height:auto !important; | |
max-width:9000px; | |
} | |
.output_scroll { | |
box-shadow:none !important; | |
webkit-box-shadow:none !important; | |
} |
def plot_confusion_matrix(cm, | |
classes, | |
normalize, | |
title): | |
''' | |
PARAMETERS: | |
- cm: SKL.METRICS confustion matrix | |
- Classes: the labels used in the classification | |
- normalize=False : (True will normalise the values, can be useful for large sample with few outliers) | |
- title : should be set to: 'Confusion matrix' |
# for multi class problems decide whether the model was correct going long or short | |
def correct_quadrant_classifications(cls_labels, cm): | |
#Find nuumber of correct classifications | |
correct_clf = 0 | |
if len(cls_labels) % 2 == 0: | |
for i in range(0, len(cls_labels)): | |
correct_clf = correct_clf + cm[i][i] | |
# calculate the rate of correct predictions | |
correct_clf_rate = correct_clf/cm.sum() | |
#print('\n{:.0f} out of {:.0f} predictions were correct'.format(correct_clf, cm.sum())) |
1. type cd C: in Cygwin: | |
2. cd: Program Files/Anaconda3/Scripts | |
3. python aws |
echo "First, you must manually donwload CUDA8 from https://developer.nvidia.com/cuda-downloads" | |
echo "Ideas taken from https://github.com/BVLC/caffe/wiki/OpenCV-3.2-Installation-Guide-on-Ubuntu-16.04 and http://www.pyimagesearch.com/2016/10/24/ubuntu-16-04-how-to-install-opencv/" | |
echo "Installing Nvidia drivers" | |
# Start clean | |
sudo apt purge nvidia-* | |
# Add the PPA | |
sudo add-apt-repository ppa:graphics-drivers/ppa | |
sudo apt update | |
sudo apt-get install nvidia-367 |
#!/usr/bin/env python | |
""" | |
TIC-TAC-TOE | |
A basic two-player game of tic-tac-toe | |
Written by Morgan McGuire | |
www.github.com/morganmcg1 | |
""" |
Add to your ~/.gitconfig | |
[alias] | |
lg = !"git lg1" | |
lg1 = !"git lg1-specific --all" | |
lg2 = !"git lg2-specific --all" | |
lg3 = !"git lg3-specific --all" | |
lg1-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(auto)%d%C(reset)' | |
lg2-specific = log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(auto)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an%C(reset)' |
Note to self to update a PR:
1. git checkout <branch-of-fork>
2. git add <filename>
3. git commit -m "updated the feature"
4. git push origin <branch-of-fork>
OR
4. git push fork <branch-of-fork>