implement the framework and KNN