Modified create_sparse_feature_matrix with use of hash and function calls