We propose a novel reasoning engine for context-aware ubiquitous computing middleware in this paper. Our reasoning engine supports both rulebased reasoning and machine learning reasoning. Our main contribution is to utilize feature selection method to filter the low-level contexts which are not useful for certain special high-level context reasoning. As a result, rules and learning models in the reasoning engine’s knowledge base are refined since useless context have been filtered. The merits of our proposed reasoning engine are described in details in this paper.