implemented predict method