This file contains hidden or 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
#check if na values exist at all | |
df.isnull().any().any() | |
#if above returns true for any series | |
df.isnull().any() | |
#check for NA values | |
data.isnull().sum() | |
#replace NA values | |
# for real values |
This file contains hidden or 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
# train-test split | |
from sklearn.cross_validation import train_test_split | |
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.4) | |
#get accuracy score | |
print metrics.accuracy_score(y,predict_y) | |
#get optimum value of k in knn | |
k_range = range(1,26) | |
scores = [] |
This file contains hidden or 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
def clean_data(train,test): | |
obj_cols = [] #list to store columns that have been read as objects | |
for col in train.columns: | |
if train[col].dtype==object: | |
obj_cols.append(col) | |
preprocessor = preprocessing.LabelEncoder() | |
for col in obj_cols: | |
preprocessor.fit(list(train[col].values) + list(test[col].values)) | |
train[col] = preprocessor.transform(list(train[col].values)) |
This file contains hidden or 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
# credits @mmueller https://www.kaggle.com/mmueller/liberty-mutual-group-property-inspection-prediction/xgb-feature-importance-python/code | |
import pandas as pd | |
import xgboost as xgb | |
import operator | |
from matplotlib import pylab as plt | |
def ceate_feature_map(features): | |
outfile = open('xgb.fmap', 'w') | |
i = 0 | |
for feat in features: |
This file contains hidden or 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
https://github.com/Far0n/kaggle-homesite/blob/master/top15_homesite_xgb.py | |
https://github.com/matefh/kaggle-homesite/blob/master/model.r |
This file contains hidden or 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
#include <iostream> | |
#include <math.h> | |
using namespace std; | |
template <class T> | |
struct Node { | |
T value; | |
Node *left; | |
Node *right; |
This file contains hidden or 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
#Taken from | |
#http://askubuntu.com/questions/160253/encrypting-decrypting-a-single-file-in-ubuntu-12-04-lts/160334 | |
Encrypt--> openssl des3 < youfile.txt > yourfile.txt.des3 | |
Decrypt--> openssl des3 -d < yourfile.txt.des3 > yourfile.txt.decrypted | |
#http://stackoverflow.com/questions/16056135/how-to-use-openssl-to-encrypt-decrypt-files?noredirect=1&lq=1 | |
Encrypt --> gpg --output encrypted.data --symmetric --cipher-algo AES256 un_encrypted.data | |
Decrypt --> gpg --output un_encrypted.data --decrypt encrypted.data |
This file contains hidden or 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
#! /bin/sh | |
sudo add-apt-repository ppa:kilian/f.lux | |
sudo add-apt-repository ppa:gnome-terminator | |
sudo apt-get update | |
# install dropbox | |
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf - | |
~/.dropbox-dist/dropboxd |
This file contains hidden or 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
~/.bash_funcs | |
~/.bashrc | |
~/.bash_completion | |
/etc/rc.local | |
/etc/bluetooth/main.conf | |
/etc/sudoers |
This file contains hidden or 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
; Global settings | |
[redshift] | |
temp-day=6500K | |
temp-night=5000 | |
transition=1 | |
;gamma=0.8:0.7:0.8 | |
gamma=1.000:1.000:1.000 | |
;location-provider=geoclue (no more internet connection required!!) | |
location-provider=manual | |
adjustment-method=vidmode |