This article explains some of the other common layers, including: Softmax-loss layer, Inner product layer, accuracy layer, reshape layer and dropout layer, and their parameter configuration.1, Softmax-lossThe Softmax-loss layer and the Softmax layer are calculated roughly the same. Softmax is a classifier that calculates the probability of a class (likelihood) and is a generalization of the logistic regression.The Logistic regression can only be used
Gl. h and Glu. H, you only need to include this file */# Include # Include
/* Initialize the material attributes, light source attributes, and illumination model, and open the depth buffer */Void Init (void){Glfloat mat _ ecular [] = {1.0, 1.0, 1.0, 1.0 };Glfloat mat_shinine [] ={ 50.0 };Glfloat light_position [] = {1.0, 1.0, 1.0, 0.0 };
Glclearcolor (0.0, 0.0, 0.0, 0.0 );Glshademodel (gl_smooth );
Glmaterialfv (gl_front, GL _ ecular, mat _ ecular );Glmaterialfv (gl_front, gl_shinine, mat_shin
) followed by an array of the same size containing phase data (in radians) for each pixel. the data is stored row-wise.
The mstar files available from the CIS Web site have had the ASCII header removed. the following snippet of Matlab code will read a single image provided the file has been opened resulting in a file pointer, FP:
Mstar_size = n_rows * n_cols;
[Tmp_data, num] =
Fread (FP, mstar_size * 2, 'float ');
% Reshape works by column, but mstar
") plt.title ("Ch-2 Wavedata ") Plt.grid (' on ') #标尺, on: There, off: none. Plt.subplot (5,1,5) Plt.plot (time,wavedata[:,2]) Plt.xlabel ("Time (s)") Plt.ylabel ("AmpliTude ") plt.title (" Ch-3 wavedata ") Plt.grid (' on ') #标尺, on: There, off: none. Plt.show ():Single channel is a special case of multichannel, so the multi-channel read mode for any channel WAV files are applicable. It is important to note that Wavedata is different from the previous data structure after
Reproduced in: http://blog.csdn.net/miangangzhen/article/details/51281989#!usr/bin/env Python3#-*-coding:utf-8-*-ImportNumPy as NPImportMath#definition of sigmoid funtion#numpy.exp work for arrays. defsigmoid (x):return1/(1 + np.exp (-x))#definition of sigmoid derivative funtion#input must be sigmoid function ' s resultdefsigmoid_output_to_derivative (Result):returnresult* (1-result)#Init Training SetdefGettrainingset (nameofset): Setdict= { "Sin": Getsinset (),}returnSetdict[nameofset]
): Endpoint Indicates whether 10 is the generated elementNp.concatenate (): Concatenation of multiple arrays
Dimension transformations of arrays
. Reshape (SHAPE): Does not change the current array, generated by shape. Resize (Shape): Changes the current array, generated by shape. swapaxes (Ax1, AX2): Swap two dimensions. Flatten (): Descending dimension of an array, returning a collapsed one
Type transformation of an array
(a)
> >> bool (42.0)
True
>>> float (true)
You can specify the type of the parameter in many parameters of a function, of course, this type parameter is optional. As follows:
>>> Arange (7, dtype=uint16)
Output array
When outputting an array, the NumPy is displayed in a particular layout in a similar way to a nested list:
The first line is output from left to right
Each row is output from top to bottom
Each slice is separated from the next by a blank
programThe example comes from the Wunda machine learning programming problem. The sample is the same as the digital recognition of multiple classifications in logistic regression.1, calculate the loss function, and gradientfunction [J Grad] = nncostfunction (Nn_params, ... input_layer_size, ... Hidden_layer_size, ... num_labels, ... X, Y, lambda) Theta1 = reshape (Nn_params (1:hidden_layer_size * (input_layer_size +
First, the index
The order in which the values are taken is from the perimeter to the innermost element position, which is written sequentially.
1.1. Single Value IndexImport NumPy as NPA = Np.arange (+). Reshape (2,2,4) print ("original array: \ n", a) print ("single value index: \ n", a[1][1][2]) >>> original array: [[[0] 1 2 3] [4 5 6 7] [[8 9] [12 13 14 15]]] Single value index value: 141.2. Fancy Index
You can index m
A complex number, represented by two 64-bit floating-point numbers
64
Object
Object
O
Python Object Type
String
String_
S
Fixed-length string type (1 bytes per character)
Unicode_
U
string of fixed-length Unicode type
Third, array modification (attributes)
Shape modification:. Reshape (),. T
Dimen
typeNp.full (Shape, Val): All Val-generatedNp.eye (n): Generating the Unit matrix
Np.ones_like (a): Generates an array of all 1 by the shape of array aNp.zeros_like (a): similarlyNp.full_like (A, Val): similarly
Np.linspace (1,10,4): Generate arrays based on spacing between start and start dataNp.linspace (1,10,4, endpoint = False): Endpoint Indicates whether 10 is a generated elementNp.concatenate (): Dimension transformation of an array
. Reshape (
About the transpose of the array, NumPy provides the transpose function and. T property two implementations, General transpose is more convenient to use, in addition to the conversion of the two axes can also be used swapreaxes , the following examples to do the introduction.
#一维数组转置 >>> arr = np.arange (6) >>> print arr [0, 1, 2, 3, 4, 5] >>> PR int Np.transpose (arr) [0, 1, 2, 3, 4, 5] #一维还是一维 ... #二维数组转置 >>> arr = np.arange (6). Reshape ((2
Common LINALG functions
function
Description
Diag
Returns the diagonal (or non-diagonal) elements of a matrix in the form of a one-dimensional array, or converts a one-dimensional array to a matrix (non-diagonal element 0)
Dot
Standard matrix multiplication
Trace
Calculates the and of the diagonal elements
Det
Determinant of a computed matrix
Eigvals
Calculate the eigenvalues of a matrix
as this:1 (3,4,5)); // Initializes an array of 3*4*5 with 1 to 60 digits B = Randn (345// Initializes an array of 3*4*5 with a random number Other initialization functions are linspace (), logspace (), ones (), zeros (), eyes (), and so on. These functions can also be used with reshape (), such as:c = Linspace (02). Reshape (345);In all of these initializations, tuples are an important component.Three, ra
Dtype
The data type object of the array element
Ndim
Dimensions of an array
Shape
The shape of an array
Data
A python buffer object that holds the array data
Flat
Returns a one-dimensional iterator of an array
Imag
Returns the imaginary part of an array
Real
Returns the real part of an array
Nbytes
The byte length of all elements in the array
Instance:
>>> A
boundary expansion of two-dimensional transpose convolutionIt is important to note that the padding,stride is still the value specified by the convolution process and will not change. Example
Because the above is only a theoretical explanation of the purpose of transpose the convolution, and does not explain how to rebuild the input by the output after the convolution. Here's an example of how to feel. For example, with input data: After 3x3,reshape
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.