Skip to content

Instantly share code, notes, and snippets.

View brinnaebent's full-sized avatar

RunsData brinnaebent

View GitHub Profile
from distutils.core import setup
setup(name='packagename',
packages = ['packagename'],
version='0.1',
description='Brief Description HERE',
url='https://github.com/yourusername/packagename',
download_url = 'https://github.com/yourusername/packagename/archive/0.1.tar.gz', #FILL IN LATER
author='YOU',
author_email='YOUR EMAIL',
import numpy as np
import pandas as pd
'''
Here is a basic description of what these functions do!
Find more information at this link: Link to your GitHub/webpage here
'''
"""
Brief description of what this function does.
Args:
argument1 (argument type, ie string): description of argument
argument2 (argument type, ie string): description of argument
Returns:
return1 (argument type, ie string): description of return
"""
$cd directory
$git clone https://github.com/yourname/nameofpackage.git
$ pip install twine ## Only the first time you do this
#Repeat this every time you update your directory
$ cd local_package_directory
$ python setup.py sdist
$ twine upload dist/*
[metadata]
description-file = README.md
$ cd directory
$ git clone https://github.com/username/username.github.io.git
import numpy as np
import pandas as pd
def LOOCV_featureselection(data, ids, outcomevar, dropcols, idcolumn, numestimators=1000):
# Separate data for leave-one-person-out-cross-validation (LOOCV)
LOOCV_O = ids
data[idcolumn] = data[idcolumn].apply(str)
data_filtered = data[data[idcolumn] != LOOCV_O]
data_cv = data[data[idcolumn] == LOOCV_O]
# Train data - all other people in dataframe
data_train = data_filtered.drop(columns=dropcols)
X_train = data_train.drop(columns=[outcomevar])
feature_list = list(X_train.columns) #Get a feature list to use for importances later on
X_train= np.array(X_train) #Re-format as numpy array for input into model
y_train = np.array(data_train[outcomevar]) #Outcome variable here