QA Official

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

pytorch (1) precautions for BN layer in pytorch

https://qaofficial.com/post/2019/04/24/68636-pytorch-1-precautions-for-bn-layer-in-pytorch.html 2019-04-24
When modifying a code recently, when using the network for reasoning, it was found that changing the batch size size of the test set each time would result in different reasoning results and even erroneous results. Later, it was found that BN layer was defined in the network. BN layer would transform the data in a Batch into positive distribution during the training process. During the reasoning process, the data were processed using the parameters in the training process.

selenium+chromedriver&amp;#x27;s Reverse Climbing Solution

https://qaofficial.com/post/2019/04/24/68610-selenium-chromedriveramp#x27s-reverse-climbing-solution.html 2019-04-24
Problem Background: This problem is encountered in climbing a shopping mall on a certain evening. The original plan was to use Selenium+Chrome Driver+Mitm Proxy for happy brushing. However, after a few days, it was found that the brushing could not come out, and it would jump directly to the login interface (obviously, it was encountered with reverse climbing) To tell the truth, this is the first time that selenium has been used to climb backwards, so large-scale tests and comparisons have been made.