The feature reduction from the vast amount of data collected from the Internet is challenging and labor-intensive. Data imbalance is another problem in decision-making analysis that leads to a biased model favoring classes with larger samples. This paper proposes a hybrid model using autoencoder and machine learning models. It deals with feature reduction and handles imbalance attack classes using SMOTE method to balance the dataset, and then AE is trained. The bottleneck code of AE is stacked with different classifiers on datasets such as NSL-KDD, UNSW-NB15 and BoT-IoT to evaluate the proposed method. The performance of the proposed approach shows improvement over attack detection without AE. The most noticeable change occurred for SVM on the NSL-KDD dataset that shows doubled improvement of accuracy. In the case of UNSW-NB15, the results vary and see an improvement for the LR model. The BoT-IoT dataset sees the lowest performance variation, i.e., 0%-6%.