문서 보기역링크PDF로 내보내기맨 위로 이 문서는 읽기 전용입니다. 원본을 볼 수는 있지만 바꿀 수는 없습니다. 문제가 있다고 생각하면 관리자에게 문의하세요. # Perceptron Each neuron can be initialized with specific weights. Keras provides a few choices, the most common of which are listed as follows: - `random_uniform`: Weights are initialized to uniformly random small values in (-0.05, 0.05). In other words, any value within the given interval is equally likely to be drawn. - `random_normal`: Weights are initialized according to a Gaussian, with a zero mean and small standard deviation of 0.05. For those of you who are not familiar with a Gaussian, think about a symmetric bell curve shape. - `zero`: All weights are initialized to zero A full list is available at https://keras.io/initializations/ Keras supports a number of activation functions, and a full list is available at https://keras.io/activations/. # One-hot encoding - OHE Once we define the model, we have to compile it so that it can be executed by the Keras backend(either Theano or TensorFlow). Theare are a few choices to be made during compilation: - We need to select the `optimizer` that is the specific algorithm used to update weights while we train our model - We need to select the `objective function` that is usede by the optimizer to navigate the space of weights (frequently, objective functions are called `loss function`, and the process of optimization is defined as a process of loss `minimization`) - We need to evaluate the trained model Once the model is compiled, it can be then trained with the `fit()` function, which specifies a few parameters: - `epochs`: this is the number of times the model is exposed to the training set. At each iteration, the optimizer tries to adjust the weights so that the objective function is minimized. - `batch_size`: This is the number of training instances observed before the optimizer performs a weight update. ```python score = model.evaluate(X_test, Y_test, verbose=VERBOSE) print("Test score:", score[0]) print('Test accuracy:', score[1]) ``` # Predictg output When a net is trained, it can be course be used for predictions. In Keras, this is very simple. We can use the following method: ```python # Ccalculate predictions predictions = model.predict(X) ``` For a given input, several types of output can be computed, including a method: - model.evaluate(): This is used to compute the loss values - model.predict_classes(): This is used to compute category outputs - model.predict_proba(): This si used to compute class probabilities # Configuring Keras - image_dim_ordering : Can be either `tf` for the TensorFlow image ordering or `th` for Theano image ordering - epsilon: The `epsilon` value used druing computation - floatx: Can be either `float32` or `float64` - backend: Can be either `tensorflow` or `theano` `th` : (depth, width, and height) `tf` : (width, height, and depth) If you install a GPU-enabled TensorFlow version, then Keras will automatically use your configured GPU when TensorFlow is selected as the backend open/perceptron.txt 마지막으로 수정됨: 2020/06/02 09:25저자 127.0.0.1