#Create: The creation of an array: The parameter can be either a list or a tuple. Use corresponding properties shape to get shape directlyPrint '222222222222222222222222222222222222222222\n'a=np.array ((1,2,3,4,5))#parameter is a tupleB=np.array ([6,7,8,9,0])#parameter is ListC=np.array ([[1,2,3],[4,5,6]])#parameter two-dimensional arrayPrintA, bPrintC.shape#[1 2 3 4 5] [6 7 8 9 0] (2L, 3L) #print A, B,#[1 2 3 4 5] [6 7 8 9 0]#(2L, 3L) Note: After print, add \ n newline; Note: Print a, B, no, no
dimension that is missing and/or length 1.
The popular point is that the "broadcast dimension" of a smaller array must be 1.
Let's take a look at the broadcast on the two-dimensional array. The shape of the arr (4,3), Arr.mean (0) (Ar.mean (index) can be easily understood as flattening the arr, such as shape (m,n,l,... ) Index 1 is processed after the shape is (m,l,... ) has a shape of (3,) that conforms to the broadcast principle and runs as follows:
>>> import NumPy as NP
>>> Arr=np.arange ()
methods of the Ndarray class, which need to be invoked using an instance of the Ndarray class.
>>> a= Np.random.random ((2,3))
>>> a
array ([[0.65806048, 0.58216761, 0.59986935],
[ 0.6004008, 0.41965453, 0.71487337]]
>>> a.sum ()
3.5750261436902333
>>> a.min ()
0.41965453489104032
>>> A.max ()
These operations treat an array as a one-dimensional linear list. However, you can perform the appropriate operation on the specified axis by specifying the axis paramet
, in_data):
Return 1/(1 + np.exp (in_data))
def forward (self, in_data): Return
self._sigmoid (Np.dot (SELF.W, in_data) + self. b
There's not much to see in the code, and notice that we randomly initialize the W in the parameter, and sometimes we let God randomly give us a neural network, and we can also look at random the great.
For the convenience of visualization, this is done with data input of 2 and output of 1. Okay, let's see number 1th first:
x = Np.linspace ( -10,1
One, variable batch renaming:
For example, to change the number of variables a_2 b_2 c_2 d_2 e_2 suffix to W
ren (*_2) (*W)
Second, check the duplicate data commonly used commands:
Duplicates report X//Reports x variable has no duplicates
Duplicates list x//list duplicate records
Bys X:gen Cn=_n
Browse if Cn>1
Drop CN//Browse specific duplicate values for next step analysis and processing
Duplicates drop x//delete duplicate value, keep first record of duplicate value
Third, the data transverse l
Iris Flower Classification is the representative of classical logistic regression, but its code contains a large number of Python library core processing patterns, this article is to dissect the Python code article.1 #The width and length of the flowers were taken by using the two feture labeled 2,3.2 #The first dimension takes ":" To represent all rows, the second dimension represents the column range, and this parameter pattern actually looks like reshape
How Matlab draws the envelopes of complex curvesHttp://jingyan.baidu.com/article/aa6a2c14d36c710d4c19c4a8.htmlIf a curve, such as a sound waveform, fluctuates greatly and is complex, it can be smoother and clearer by drawing envelopes. This experience helps newcomers to new MATLAB to complete this process.Tools/Materials
Matlab Software
Sample Data
Method/Step
Before and after the treatment of the effect of the comparison, illustrated by a sound wave Fourier transform (FFT)
function [H, array] = display_network(A, Opt_normalize, Opt_graycolor, cols, Opt_ Colmajor) % This function visualizes filters in matrix A. Each column of a is a% filter. We'll reshape each column into a square image and visualizes% on each cell of the visualization panel.% All other parameters is optional, usually you does not need to worry% about it.% Opt_normalize:whether We need to normalize , the filter so, all of% them can have similar contrast.
ndarray, you can perform dimension transformation and element type conversion.Dimension transformation of the ndarray
Method
Description
. Reshape (shape)
Returns a shape array without changing the array element. The original array remains unchanged.
. Resize (shape)
The function is consistent with. reshape (), but the original array is modified.
. Swapaxes (ax1
size of hidden layers, and train a new network. We can observe the influence of parameters on the learning results.
The algorithm code is as follows:
#! Usr/bin/env python3 #-*-coding: UTF-8-*-import numpy as npimport math # definition of sigmoid funtion # numpy. exp work for arrays. def sigmoid (x): return 1/(1 + np. exp (-x) # definition of sigmoid derivative funtion # input must be sigmoid function's resultdef sigmoid_output_to_derivative (result): return result * (1-result) # init training
", then you can omit to write.When Python uses slice syntax, it produces slice objects. Extended slice syntax allows for different index tile operations to include step slices, multidimensional slices, and omitted slices. The syntax for a multidimensional slice is sequence[start1:end1,start2:end2], or use the ellipsis, Sequence[...,start1:end1]. The slice object can also be slice () by the built-in function.Selection of two-dimensional arrays:First we said that the syntax for multidimensional ar
Logistic Regression with a neural Network mindset V4Simply using the logistic to realize the cat's recognition, the logistic can be regarded as a simple neural network structure, the following is the main code:1.Import NumPy as Npimport Matplotlib.pyplot as Pltimport h5pyimport scipyfrom PIL import imagefrom scipy import Ndimagefrom Lr_utils Import Load_dataset%matplotlib Inline2.# # # START CODE here # # # (≈3 lines of code) M_train = Train_set_x_orig.shape[0]m_test = TEST_SET_X_ORIG.SHAPE[0]NU
1. TopicsIn Matlab, there is a very useful function reshape that can reshape a matrix to another new matrix of different sizes, but retains its original data.gives a matrix represented by a two-dimensional array, and two positive integers r c , respectively, representing the number of rows and columns of the matrix you want to refactor.The reconstructed matrix requires that all elements of the original matr
I. inke
1. catch a cold at first: scallion white (even silk), ginger slices 5 yuan, a bowl of boiling water, add a proper amount of brown sugar to take a warm meal (onion ginger does not need to take it down), and immediately go to bed, sweating becomes more and more intense.
2. catch a cold for multiple days: It is used the same as the first one during the day. In addition, you need to paste it into a paste with the garlic head before going to bed at night (Yongquan Point, each foot can be fill
western medicine doctors.I. inke
1. catch a cold at the beginning: scallion white (even silk), ginger slices 5 yuan, a bowl of water fried open, add a proper amount of red Pond said hot once under (onion ginger does not need to take down), and immediately go to bed, sweating becomes more and more intense.
2. catch a cold for multiple days: It is used the same as the first one during the day. In addition, you need to paste it into a paste with the garlic head before going to bed at night (Yongqu
a long time in ancient times. It brings together many famous, wonderful, and secret techniques in ancient and modern times. It is not only convenient for the people, but also an essential report for every family. It is also of great reference value for some professional doctors of Chinese and Western medicine.
Civil practical earthwork (I)
I. inke
1. catch a cold at first: scallion white (even silk), ginger slices 5 yuan, a bowl of boiling water, add a proper amount of brown sugar
, and secret techniques in ancient and modern times. It not only brings convenience to the people, but also makes every family more valuable. It is also of great reference value for some professional Chinese and western medicine doctors.I. inke1. catch a cold at the beginning: scallion white (even silk), ginger slices 5 yuan, a bowl of water fried open, add a proper amount of red Pond said hot once under (onion ginger does not need to take down), and immediately go to bed, sweating becomes more
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.