当前位置: 首页>>代码示例>>Python>>正文


Python SdA.train_model方法代码示例

本文整理汇总了Python中SdA.train_model方法的典型用法代码示例。如果您正苦于以下问题:Python SdA.train_model方法的具体用法?Python SdA.train_model怎么用?Python SdA.train_model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SdA的用法示例。


在下文中一共展示了SdA.train_model方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1:

# 需要导入模块: import SdA [as 别名]
# 或者: from SdA import train_model [as 别名]
filename=data_dir + "GM12878_200bp_Data_3Cl_l2normalized_TestSet.txt";
test_set_x_org=numpy.loadtxt(filename,delimiter='\t',dtype='float32')
filename=data_dir + "GM12878_200bp_Classes_3Cl_l2normalized_TestSet.txt";
test_set_y_org=numpy.loadtxt(filename,delimiter='\t',dtype=object)
prev,test_set_y_org=cl.change_class_labels(test_set_y_org)

filename=data_dir + "GM12878_Features_Unique.txt";
features=numpy.loadtxt(filename,delimiter='\t',dtype=object)  

rng=numpy.random.RandomState(1000)

# train
classifier,training_time=SdA.train_model(train_set_x_org=train_set_x_org, train_set_y_org=train_set_y_org, 
                valid_set_x_org=valid_set_x_org, valid_set_y_org=valid_set_y_org, 
                pretrain_lr=0.1,finetune_lr=0.1, alpha=0.01, 
                lambda_reg=0.00005, alpha_reg=0.5, 
                n_hidden=[64,64,32], corruption_levels=[0.01,0.01,0.01],
                pretraining_epochs=5, training_epochs=1000,
                batch_size=200, rng=rng)
                        
# test
test_set_y_pred,test_set_y_pred_prob,test_time=SdA.test_model(classifier, test_set_x_org, batch_size=200)
print test_set_y_pred[0:20]
print test_set_y_pred_prob[0:20]
print test_time

# evaluate classification performance
perf,conf_mat=cl.perform(test_set_y_org,test_set_y_pred,numpy.unique(train_set_y_org))
print perf
print conf_mat
开发者ID:LazyXuan,项目名称:DECRES,代码行数:32,代码来源:main_SdA.py

示例2:

# 需要导入模块: import SdA [as 别名]
# 或者: from SdA import train_model [as 别名]
            pretrain_lr=0.1
            finetune_lr=0.1
            alpha=0.1
            lambda_reg=0.00005
            alpha_reg=0.5
            n_hidden=[256,128,64]
            corruption_levels=[0.01,0.01,0.01]
            pretraining_epochs=5
            training_epochs=1000
            batch_size=100

            # train, and extract features from training set
            classifier,training_time=SdA.train_model(train_set_x_org=train_set_x_org, train_set_y_org=train_set_y_org, 
                                                     valid_set_x_org=valid_set_x_org, valid_set_y_org=valid_set_y_org, 
                                                     pretrain_lr=pretrain_lr,finetune_lr=finetune_lr, alpha=alpha, 
                                                     lambda_reg=lambda_reg, alpha_reg=alpha_reg, 
                                                     n_hidden=n_hidden, corruption_levels=corruption_levels,
                                                     pretraining_epochs=pretraining_epochs, training_epochs=training_epochs,
                                                     batch_size=batch_size, rng=rng)
            
            # test the classifier
            test_set_y_pred,test_set_y_pred_prob,test_time=SdA.test_model(classifier, test_set_x_org, batch_size=200)
                        
            # evaluate classification performance
            perf_i,conf_mat_i=cl.perform(test_set_y_org,test_set_y_pred,numpy.unique(train_set_y_org))
            print perf_i
            print conf_mat_i
            if i==0:
                perf=perf_i
                conf_mat=conf_mat_i
                training_times=training_time
开发者ID:LazyXuan,项目名称:DECRES,代码行数:33,代码来源:main_SdA_new.py


注:本文中的SdA.train_model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。