用CNN与RNN(LSTM)提取DNA序列中的特征的定义函数

该博客介绍了如何运用卷积神经网络(CNN)和长短期记忆网络(RNN/LSTM)来处理和提取DNA序列中的特征。内容涵盖了数据的读取以及CNN和RNN的整合应用,但未详细展开全连接层和评估指标的计算过程。
# -*- coding: utf-8 -*-
# read the data of npy,the data is input(label)
import os
import numpy as np
import tensorflow as tf
import time
import math

batch_size = 128
path =os.getcwd()
keep_prob = tf.placeholder(tf.float32)

# In order to get the suitable type of data and label 
def initial_data(all_data,all_label): #data and label are all the name of .npy
    Data_Examples = np.load(path+'/'+ all_data)   # all_data = .npy
    Data_Labels = np.load(path+'/'+ all_label)
    Data_Labels = tf.one_hot(Data_Labels,2,1,0)
    Data_Labels = tf.to_float(Data_Labels,name = 'Data_Labels')
    return Data_Examples,Data_Labels

    
def get_batch_data(t_enh,t_enh_label,t_pro,t_pro_label):
    t_enh = tf.cast(t_enh, tf.float32)
    t_enh_label = tf.cast(t_enh_label, tf.float32)
    t_pro = tf.cast(t_pro, tf.float32)
&nb
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值