Skip to content

Instantly share code, notes, and snippets.

@boates
boates / testClassificationModel.py
Last active Jan 16, 2019
For running sklearn classification algorithms easily on pandas data frame. Also perform tests on model accuracy.
View testClassificationModel.py
def splitData(df, trainPerc=0.6, cvPerc=0.2, testPerc=0.2):
"""
return: training, cv, test
(as pandas dataframes)
params:
df: pandas dataframe
trainPerc: float | percentage of data for trainin set (default=0.6
cvPerc: float | percentage of data for cross validation set (default=0.2)
testPerc: float | percentage of data for test set (default=0.2)
(trainPerc + cvPerc + testPerc must equal 1.0)
You can’t perform that action at this time.