3DCNN学习记录-函数篇

在学习3DCNN过程中,遇到许多新函数一知半解,现在记录学习一下。(后续补充)

train_test_split: 

需要从sklearn.model_selection 导入,导入方式如下:from sklearn.model_selection import train_test_split

X_train,X_test, y_train, y_test =cross_validation.train_test_split(train_data,train_target,test_size=0.2, random_state=42)

 

train_data:所要划分的样本特征集  ,所有的文件李彪
train_target:所要划分的样本结果  ,  标签集
test_size:样本占比,如果是整数的话就是样本的数量
random_state:是随机数的种子。

stratify是为了保持split前类的分布。比如有100个数据,80个属于A类,20个属于B类。如果train_test_split(... test_size=0.25, stratify = y_all), 那么split之后数据如下: 
training: 75个数据,其中60个属于A类,15个属于B类。 
testing: 25个数据,其中20个属于A类,5个属于B类。 

 img = img.convert()

 PIL有九种不同模式: 1,L,P,RGB,RGBA,CMYK,YCbCr,I,F。

1 代表 二值图像,

L 代表 灰度图像
P ------------------(8位像素,使用调色板映射到任何其他模式)
RGB------------------(3x8位像素,真彩色)
RGBA------------------(4x8位像素,带透明度掩模的真彩色)
CMYK--------------------(4x8位像素,分色)
YCbCr--------------------(3x8位像素,彩色视频格式)
I-----------------------(32位有符号整数像素)
F------------------------(32位浮点像素)

 

收集关键字参数:**params(输出字典)

def print_params3(**params):     

    print(params)         ##{'z':1,'x':2,'y':3}

print_params3(x=1,y=2,z=3)

def print_params3(title,*pospar,**keypar):#定义,位置参数+收集位置参数+收集关键字参数

    print(title,pospar,keypar)

print_params3(99,100,111,x=1,y=2,z=3)#调用

99

(100,111)

{'z':1,'x':2,'y':3}

 

 

 

Guess you like

Origin blog.csdn.net/abc123mma/article/details/111171870