# QA Official

### HDU-2768 Cat vs. Dog (maximum independent set)

https://qaofficial.com/post/2019/05/07/68671-hdu-2768-cat-vs.-dog-maximum-independent-set.html 2019-05-07
topic meaning ccc cats, ddd dogs, vvv individual votes are given. Everyone may only like a cat, hate a dog, or like a dog, hate a cat.Ask how many people can be satisfied at most by removing some cats and dogs. thinking It is not difficult to see that liking a cat, hating a dog and liking a dog, hating a cat may be mutually exclusive.We will also introduce a concept of "

### KNN Classification Algorithm and MATLAB Program and Results

https://qaofficial.com/post/2019/05/07/68925-knn-classification-algorithm-and-matlab-program-and-results.html 2019-05-07
K K-nearest Neighbor k-Nearest Neighbor algorithm In the picture on the right, which class should the green circle be assigned, is it a red triangle or a blue square?If K=3, because the proportion of red triangles is 2/3, the green circle will be assigned to the red triangle class; if K=5, because the proportion of blue squares is 3/5, the green circle will be assigned to the blue square class.

### Keras Official Case

https://qaofficial.com/post/2019/05/07/23424-keras-official-case.html 2019-05-07
Keras Official Case Labels (Space Separated): Keras Learning MLP Multi-classification Problem import keras from keras.models import Sequential from keras.layers import Dense, Dropout, Activation from keras.optimizers import SGD # Generate dummy data import numpy as np x_train = np.random.random((1000, 20)) y_train = keras.utils.to_categorical(np.random.randint(10, size=(1000, 1)), num_classes=10) x_test = np.random.random((100, 20)) y_test = keras.utils.to_categorical(np.random.randint(10, size=(100, 1)), num_classes=10) model = Sequential() # Dense(64) is a fully-connected layer with 64 hidden units.

### Keras source code reading -Dropout

Dropout Meaning During learning, some features are immediately removed to avoid over-fitting. Dropout Layer Source Code dropout layer is in core.py under layer class Dropout(Layer): '''Applies Dropout to the input. Dropout consists in randomly setting a fraction p of input units to 0 at each update during training time, which helps prevent overfitting. # Arguments p: float between 0 and 1. Fraction of the input units to drop.

### LeetCode（292） Nim Game

https://qaofficial.com/post/2019/05/07/68366-leetcode292-nim-game.html 2019-05-07
topic You are playing the following Nim Game with your friend: There is a heap of stones on the table, each time one of you take turns to remove 1 to 3 stones. The one who removes the last stone will be the winner. You will take the first turn to remove the stones. Both of you are very clever and have optimal strategies for the game. Write a function to determine whether you can win the game given the number of stones in the heap.

### TensorFlow Implements Convolution Neural Network for Image Classification (Code Details)

https://qaofficial.com/post/2019/05/07/23560-tensorflow-implements-convolution-neural-network-for-image-classification-code-details.html 2019-05-07
Here we use cifar10 as our experimental database.First download the TensorFlow Models library to use the classes of CIFAR-10 data provided therein. git clone https://github.com/tensorflow/models.git cd models/tutorials/image/cifar10 Start to Build CNN Network import cifar10 import cifar10_input import tensorflow as tf import numpy as np import time max_steps = 3000 # 训练轮数（每一轮一个batch参与训练）

### pageContext.findAttribute () and pageContext.getAttribute ()

https://qaofficial.com/post/2019/05/07/68909-pagecontext.findattribute-and-pagecontext.getattribute.html 2019-05-07
1、abstract Object findAttribute(String name) in page, request, session (if valid) and application Scope (scope) looks for the Attribute named name, and returns the object when it is found, but returns null when it is not found. 2、abstract Object getAttribute(String name) find the attribute related to name in page scope, return the object if found, and return null if not found. The difference between the two is that the search range is different.

### python&amp;#x27;s import differs from from from...import

https://qaofficial.com/post/2019/05/07/68445-pythonamp#x27s-import-differs-from-from-from...import.html 2019-05-07
Use import or from...import to import the corresponding module in python.Modules are actually collection files of some functions and classes. They can realize some corresponding functions. When we need to use these functions, we can directly import the corresponding modules into our programs and then we can use them.This is similar to the include header file in C language. In Python, we use import to import the modules we need.