def get_train_test(pandas_data, target_col):
# Separating target from the rest of the data
x = pandas_data.drop(target_col, 1)
x = data_scaling.scale_numeric_data(x)
# Selection of training/target data for validation and training.
target_loc = pandas_data.columns.get_loc(target_col)
data = pd.DataFrame.as_matrix(pandas_data)
y = data[:, target_loc]
x = pd.DataFrame.as_matrix(x)
# Selecting training and test sets
return cross_validation.train_test_split(x, y, test_size=0.2)
# Removes the target column from the input data.
# Returns two DataFrames.
评论列表
文章目录