QA Official

[ Keras ] Sequence Classification Using LSTM for Sequential Sequential Model Instances

https://qaofficial.com/post/2019/05/07/23538-keras-sequence-classification-using-lstm-for-sequential-sequential-model-instances.html 2019-05-07
Sequence Classification Using LSTM from keras.models import Sequential from keras.layers import Dense, Dropout from keras.layers import Embedding from keras.layers import LSTM model = Sequential() model.add(Embedding(max_features, output_dim=256)) model.add(LSTM(128)) model.add(Dropout(0.5)) model.add(Dense(1, activation='sigmoid')) model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) model.fit(x_train, y_train, batch_size=16, epochs=10) score = model.evaluate(x_test, y_test, batch_size=16)

in-depth introduction to Android Gradle building system (1: introduction)

https://qaofficial.com/post/2019/05/07/68251-in-depth-introduction-to-android-gradle-building-system-1-introduction.html 2019-05-07
gradle是Android开发中引入的全新的构建系统,因为全新的构建系统主要是出于下面的目的: 1. 方便复用代码和资源 2. 构建多种版本的apk更

multi-class loss function categorical_crossentropy in Keras

https://qaofficial.com/post/2019/05/07/23542-multi-class-loss-function-categorical_crossentropy-in-keras.html 2019-05-07
from keras.utils.np_utils import to_categorical Note: When using categorical_crossentropy loss function, your label should be multi-class mode. For example, if you have 10 classes, the label of each sample should be a 10-dimensional vector, which is 1 at the index position corresponding to the value and the rest is 0. This method can be used for conversion: from keras.utils.np_utils import to_categorical categorical_labels = to_categorical(int_labels, num_classes=None) take mnist data set as an example:

python Batch Processing Files/Operation Files

https://qaofficial.com/post/2019/05/07/68506-python-batch-processing-files/operation-files.html 2019-05-07
Python Batch Processing/Operation Files python is very practical to process files automatically, especially in a lot of repetitive work. This article takes batch processing of text files under different folders as an example: os module File Path Status: E:\CSDN ………….\demo1 ……………………\demo1dir ……………………\demo11.txt ……………………\demo12.txt ……………………\demo13.txt ………….\demo2 ……………………\demo2dir ……………………\demo21.txt ……………………\demo22.txt ……………………\demo23.txt ………….\demo3 ……………………\demo3dir ……………………\demo31.txt ……………………\demo32.txt ……………………\demo33.txt ………….\demo.txt @python import os PATH = r'E:\CSDN' for elem in os.walk(PATH): print(elem) ('E:\\CSDN', ['demo1', 'demo2', 'demo3'], ['demo.

residual residual VS error

https://qaofficial.com/post/2019/05/07/68315-residual-residual-vs-error.html 2019-05-07
In statistics and optimization, statistical errors and residuals are two closely related and easily confused measures of "deviation of a sample from the mean": the error of a sample is the deviation of the sample from the (unobservable) population mean or actual function, while the residual of a sample is the difference between the sample and either (1) the (observed) sample mean or (2) the regressed (fitted) function value.

two-class svm & one-class svm & exemplar svm

https://qaofficial.com/post/2019/05/07/68373-two-class-svm-ampamp-one-class-svm-ampamp-exemplar-svm.html 2019-05-07
1. Let's start with a typical svm. Assuming we use data of class A and class B, we need to train a classifier to distinguish these two types of data, then we can find the division hyperplane between class A and class B by training a two-class SVM. 2. What should I do if I only have A data and I just want to identify whether an instance is A?

use of python command line argument sys.argv

https://qaofficial.com/post/2019/05/07/68423-use-of-python-command-line-argument-sys.argv.html 2019-05-07
sys.argv is a command line parameter. since the command line is mentioned, it needs to be used under the command line, such as cmd (command prompt) window under Windows or Terminal under Linux. can no longer be used in IDE environment (Pycharm compiler, etc.), even if it is used, it can only be sys.argv[0], indicating the path of the script, such as: C:/users/Administrator/Desktop/Python _ OpenCV/Test1/TT/1.py. In addition, other sys.argv[1], sys.argv[2]

use traceback to obtain detailed exception information

https://qaofficial.com/post/2019/05/07/68446-use-traceback-to-obtain-detailed-exception-information.html 2019-05-07
try: 1/0 except Exception,e: print e If the wrong flower is wrapped in this way, the output result is integer division or modulo by zero. I only know that the error was reported, but I don't know which function and line in which file reported the error. It is better not to wrap it up! The traceback module is used below. try: 1/0 except Exception,e: traceback.print_exec() output result is

JS Event Delegation Concept and Function

https://qaofficial.com/post/2019/05/06/25008-js-event-delegation-concept-and-function.html 2019-05-06
1, why use event delegation Generally speaking, dom needs to have an event handler, and we will just set up an event handler for it directly. What if a lot of dom needs to add event handlers?For example, we have 100 li, each li has the same click click event, maybe we will use the for loop method to traverse all li, and then add events to them, what impact

Matlab Parallel Programming Method

https://qaofficial.com/post/2019/05/06/23452-matlab-parallel-programming-method.html 2019-05-06
This article will talk about the parallel methods and techniques in matlab. We do not involve GPU acceleration here. We mainly consider for loop parallelism and data parallelism.It is divided into the following sections: 1. How to parallel? 2. parfor vs. SPMD 3. Notes and Experience Summary ----------------------------------------------------------- 1. How to Parallel? 1. Request a number of workers;2. Issue the normal command to run the program.