3.7.8.2. renom.utility.preprocess.data_label_split package

class DataLabelSplit ( data , col , shuffle )

ひとつの行列から、データの列とラベルの列に分割する関数。

transform ( )

Split array between train data array and input data array.

data_label_split ( data , col=None , shuffle=False )

ひとつの行列から、列を指定してデータ行列とラベル行列に分割する関数。

Param ndarray data:

データとラベルが含まれた行列

Param object slice,list,int:

データが含まれる列のリスト

Param bool shuffle:

行をシャッフルするかどうか

戻り値: ラベル行列
戻り値: データ行列
Example:
>>> from renom.utility.preprocess import data_label_split
>>> arr
array([[0, 1, 2, 3, 4],
       [5, 6, 7, 8, 9],
       [10,11,12,13,14]])
>>> array_train,array_input=data_label_split(arr,[2,4])
>>> array_train
array([[2., 4.],
       [7., 9.],
       [12.,14.]])
>>> array_input
array([[0, 1, 3],
       [5, 6, 8],
       [10,11,13]])
>>> array_train,array_input=data_label_split(arr,[-4,-1])
>>> array_train
array([[1., 4.],
       [6., 9.],
       [11.,14.]])
>>> array_input
array([[0, 1, 3],
       [5, 6, 8],
       [10,11,13]])
>>> array_train,array_input=data_label_split(arr,slice(1,4))
>>> array_train
array([[ 1,  2,  3],
       [ 6,  7,  8],
       [11, 12, 13]])
>>> array_input
array([[ 0,  4],
       [ 5,  9],
       [10, 14]])
>>> array_train,array_input=data_label_split(arr,slice(3,None))
>>> array_train
array([[ 3,  4],
       [ 8,  9],
       [13, 14]])
>>> array_input
array([[ 0,  1,  2],
       [ 5,  6,  7],
       [10, 11, 12]])
>>> array_train,array_input=data_label_split(arr,slice(2,-1))
>>> array_train
array([[ 2,  3],
       [ 7,  8],
       [12, 13]])
>>> array_input
array([[ 0,  1,  4],
       [ 5,  6,  9],
       [10, 11, 14]])
>>> array_train,array_input=data_label_split(arr,2)
>>> array_train
array([[0,  1],
       [5,  6],
       [10, 11]])
>>> array_input
array([[ 2,  3,  4],
       [ 7,  8,  9],
       [12, 13, 14]])
>>> array_train,array_input=data_label_split(arr,-2)
>>> array_train
array([[ 0,  1,  2],
       [ 5,  6,  7],
       [10, 11, 12]])
>>> array_input
array([[ 3,  4],
       [ 8,  9],
       [13, 14]])