four steps
- extract the eigenvectors of entity as the input, which is usually complicated but now can be directly obtained from datasets
- define structures of Neural Network and IO(i.e. the forward-feed algorithms)
- train to update the parameters(may utilize the backprob.)
- estimate for testing
forward-propagation(fully-connected)
- neurons:
linear conbination of inputs,which means multi-input for one output - form of algorithm:
multiply of matrices
tf.matmul(a1,a2)
parameters and tf.Variables
- tf.Variable is for saving and updating the parameters
- tf.Variable is required to be initialized
- tf.Variable
weights=tf.Variable(tf.random_normal([2,3],stddev=2))
#stddev is the standard deviation,mean so
biases=tf.Variable(tf.zeros([])
#------
w2=tf.Variable(weights.initialized_value())
random function for initializing
function_name | random distribution | para. |
---|---|---|
tf.random_normal | mormal distribution | mean,stddev,dtype |
tf.truncated_normal | normal dis. but will self-adjusted when mean is more than twice as deviation | as above |
tf.random_uniform | uniform dist. | minimum,maximum,dtype |
- note:
the additonal para. seed is useful when the identical random value is needed
tf.initalize_all_variables()
- Variable :special tensor
- dtype invariance
- shape is alterable(validate_shape=False)
tensorflow for training NN
steps
- initialize the variables and apoch=1
- get a batch of training data(batch_size is given)
- forward-probagation to obtain the estimator
- define the loss function(cost function)
- back-probagation to solve the optimization(minimize the cost) and then update the variables
- repeat the steps above until the target is met
网友评论