/* Copyright 2016 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef EMBEDDING_NETWORK_H_ #define EMBEDDING_NETWORK_H_ #include <vector> #include "embedding_network_params.h" #include "feature_extractor.h" #include "float16.h" namespace chrome_lang_id { // Classifier using a hand-coded feed-forward neural network. // // No gradient computation, just inference. // // Based on the more general nlp_saft::EmbeddingNetwork. // // Classification works as follows: // // Discrete features -> Embeddings -> Concatenation -> Hidden+ -> Softmax // // In words: given some discrete features, this class extracts the embeddings // for these features, concatenates them, passes them through one or two hidden // layers (each layer uses Relu) and next through a softmax layer that computes // an unnormalized score for each possible class. Note: there is always a // softmax layer. // // NOTE(salcianu): current code can easily be changed to allow more than two // hidden layers. Feel free to do so if you have a genuine need for that. class EmbeddingNetwork { … }; } // namespace chrome_lang_id #endif // EMBEDDING_NETWORK_H_