I am trying to build a text classification(dataset=17 classess and total 127 texts) model using ANN in c++ but after several approaches i am not able to reach that accuracy , any suggestion would be a great help:
below is the model and the respective code for the reference:
int64_t input_size = all_words.size();
int64_t output_size = all_categories.size();
int64_t hidden_size = 250;
double learning_rate = 0.001;
ANN model(input_size, hidden_size, output_size);
struct ANN : torch::nn::Module {
ANN(int64_t input_size, int64_t hidden_size, int64_t output_size) {
i2h = register_module(“i2h”, torch::nn::Linear(input_size, hidden_size));
h2o = register_module(“h2o”, torch::nn::Linear(hidden_size, output_size));
softmax = register_module(“softmax”, torch::nn::LogSoftmax(1));
}
torch::Tensor forward(torch::Tensor x) {
x = i2h->forward(x);
x = h2o->forward(x);
x = softmax->forward(x);
return x;
}
torch::nn::Linear i2h{nullptr}, h2o{nullptr};
torch::nn::LogSoftmax softmax{nullptr};
};