QA Official

Code of Several Sorting Algorithms

https://qaofficial.com/post/2019/04/24/68596-code-of-several-sorting-algorithms.html 2019-04-24
Select Sort void select(int[] a) { for(int i = 0; i < a.length;i ++) { for(int j = i; j < a.length; j ++) { int ai = a[i]; int aj = a[j]; if(a[i] > a[j]) { a[i] = aj a[j] = ai; } } } bubble sort void bubble(int[] a) { BOOL exchanged = YES; for (int i = 0; i < a.length - 1 && exchanged; i ++) { exchanged = NO; for (int j = 0; j < (a.

Deep Learning Common Network Structure

https://qaofficial.com/post/2019/04/24/68590-deep-learning-common-network-structure.html 2019-04-24
LeNet: Gradient-based Learning Applied to Document Recognition AlexNet: ImageNet Classification with Deep Convolution Neural Networks ZFNet: visualizing and understanding convolutional networks VGGNet: Very Deep Convolution Network for Large Scale Image Recognition NiN: Network in Network GoogLeNet: Involved FurtherInception-v3: Rethinking the Initial Architecture of Computer Vision ResNet: Depth Residual Learning for Image RecognitionStochastic_Depth: deep network with random depthWResNet: weighted residuals for very deep networksinception-resnet: INCEPTION-V4, INCEPTION-RESNET and the Influence of Remaining Connections on LearningFractalnet: ultra-deep neural network without residual error WRN: Wide Residual Network ResNeXt: aggregate residual transformation of deep neural networks DenseNet: Densely Connected Convolution Network PyramidNet: Deep Pyramid Residual Network DPN: Dual Path NetworkSqueezeNet:AlexNet Level Accuracy, 50-fold Reduction of Parameters, Model Size Less than 0.

Explanation of Selection Sorting Algorithm

https://qaofficial.com/post/2019/04/24/69765-explanation-of-selection-sorting-algorithm.html 2019-04-24
Select sorting, that is, directly select a minimum (or maximum) number from the array inside to be sorted, take out a minimum number each time, compare with the remaining numbers, and then sequentially put into the new array until all are taken out For example, there are arrays [10, 1, 18, 30, 23, 12, 7, 5, 18, 17], and we use a sort method from small to large. For the first pass, the outer subscript is 0, corresponding to the array value of 10

Functions upper () and lower ()

https://qaofficial.com/post/2019/04/24/68631-functions-upper-and-lower.html 2019-04-24
When learning map function today, I wrote an example and saw the upper function that I did not touch. a = ‘hello’ a.upper() print(a)==》‘HELLO’ Write your own example as follows: # coding:utf-8 def normalize(name): return name[0].upper()+name[1:].lower() L1=['adam','LISA','barT'] result=list(map(normalize,L1)) print(result) output: Adam Lisa Bart

Most Fully Native AJAX Request Steps

https://qaofficial.com/post/2019/04/24/68549-most-fully-native-ajax-request-steps.html 2019-04-24
The following code is the most fully native AJAX request, including setting and obtaining the request header. <script> btn.onclick=function(){ var xhr=new XMLHttpRequest();//Create xhr Object-Belong to XML XHR. OnReadyStateChange = Function () {//Where is the event listening request executed if(xhr.readyState===4){ if(xhr.status===200){ var header=xhr.getAllResponseHeaders();//Get all response headers doResponse(xhr);//Response Successfully Invokes Processing Response Data Function }else{ alert (" response exception");//response failed }

Scrapy Simulates Forms and Ajax Sends POST Requests

https://qaofficial.com/post/2019/04/24/68547-scrapy-simulates-forms-and-ajax-sends-post-requests.html 2019-04-24
scrapy.FormRequest Ordinary GET requests can be realized by using the scrapy.Request class, but when a simulated form or Ajax submits a post request, the Request class can also pass parameters using body, which is not as convenient as the subclass FormRequest class, because it comes with formdata, which is specially used to set form field data, and the default method is POST. def start_requests(self): form_data = {'f1':'1', 'f2':'100'} # 表

Some Ways for Python to shuffle Training Dataset

https://qaofficial.com/post/2019/04/24/68602-some-ways-for-python-to-shuffle-training-dataset.html 2019-04-24
1. shuffle through arrays image_list=[] # list of images label_list=[] # list of labels temp = np.array([image_list, label_list]) temp = temp.transpose() np.random.shuffle(temp) images = temp[:, 0] # array of images (N,) labels = temp[:, 1] 2. shuffle via Index image_list=[] # list of images label_list=[] # list of labels ##如果image_list存的是读取的特

Usage of lower () Function in Python

https://qaofficial.com/post/2019/04/24/68600-usage-of-lower-function-in-python.html 2019-04-24
python String Function Usage Complete Book Link lower () function Description: Converts all uppercase letters in a string to lowercase letters. syntax: str.lower() -> str returns a string Program Example: str1 = "I Love Python" str2 = "Groß - α" #德语 大写α print(str1.casefold()) print(str1.lower()) print(str2.casefold()) print(str2.lower()) Program Running Result: i love python i love python gross - α gro

cmp settings when Python is drawing with plt

https://qaofficial.com/post/2019/04/24/68605-cmp-settings-when-python-is-drawing-with-plt.html 2019-04-24
In python, sometimes it is necessary to draw a picture. For example, a matrix is displayed in the form of an image. It was used well before. Every time plt.imshow () is used, it is a color picture. For some reason, suddenly it is all black and white. Therefore, the value of cmap needs to be set as follows: plt.imshow(confusion_matrix_percent,cmap='gray') plt.colorbar() plt.show()In the above code, setting CMAP =' gray' means to draw a gray map.

foundation of deep learning (1)-softmax and logsoftmax

https://qaofficial.com/post/2019/04/24/68577-foundation-of-deep-learning-1-softmax-and-logsoftmax.html 2019-04-24
softmax: redefined the output layer of multilayer neural network, noting that it is only related to the output layer and not related to other layers. softmax function, also known as normalized exponential (view of exponential family distribution); 1. softmax We know that in the process of feedforward of the neural network, the input of the output layer is: in the mechanism of softmax, in order to obtain the output of