data_splitting.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:MENGEL 作者: CodeSpaceHQ 项目源码 文件源码
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.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号