updated n_components as local variable and added that as self.n_components_