Feature learning plays an important role in improving the learning capability of any machine learner by reducing the data complexity. As one of feature learning methods, feature selection has a crucial role for a machine learning with huge and complex input data. We examine the feature weighting methods in existing machine learners and look at how they could be used for the accurate selection of the important features. In order to validate our idea, we consider Wi-Fi networks since pervasive Internet-of-Things (IoT) devices create huge traffics and vulnerable at the same time. Detecting known and unknown attacks in Wi-Fi networks remains great challenging tasks. We test and validate the feasibility of the selected features using a common neural network. This study demonstrates that the proposed weighted-based machine learning model can outperform other filter-based feature selection models. The experimental results not only demonstrate the effectiveness of the proposed model, achieving 99.72% F1 score, but also prove that combining a weight-based feature selection method with a light machine-learning classifier which leads to significantly improved performance, compared to the best result reported in the literature.