标签:ted inner style test containe constrain sse type orm
1. keras.engine.input_layer.Input()
def Input(shape=None, batch_shape=None, | |
name=None, dtype=None, sparse=False, | |
tensor=None): |
用来实例化一个keras tensor
2. class Dense(Layer):
keras.layers.Dense(units, activation=None, use_bias=True, kernel_initializer=‘glorot_uniform‘, bias_initializer=‘zeros‘, kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None)
def __init__(self, units, | |
activation=None, | |
use_bias=True, | |
kernel_initializer=‘glorot_uniform‘, | |
bias_initializer=‘zeros‘, | |
kernel_regularizer=None, | |
bias_regularizer=None, | |
activity_regularizer=None, | |
kernel_constraint=None, | |
bias_constraint=None, | |
**kwargs): |
Dense 是一个类,用来regular densely-connected NN layer.
3. from keras.models import Sequential, Model
4. from keras.utils.np_utils import to_categorical
categorical_labels = to_categorical(int_labels, num_classes=None)
说明:
例如如果你有10个类别,每一个样本的标签应该是一个10维的向量,该向量在对应有值的索引位置为1其余为0。
EXAMPLE:
假设y_test为100x1的向量,100表示样本数,标签为标量,这时候将标签扩充为10维的向量,即:y_test为100x10。10维向量中,值为1表示这个样本属于这个类别,其他9个地方的值都为0。
y_test = to_categorical(y_test, 10)
标签:ted inner style test containe constrain sse type orm
原文地址:https://www.cnblogs.com/shencangzaiyunduan/p/11963295.html