def METHOD_NAME(
    self, ids: DataFrame, features: Optional[DataFrame]
) -> Tuple[Optional[DataFrame], Optional[int]]:
    entity = "user" if "user_idx" in ids.columns else "item"
    als_factors = getattr(self.model, f"{entity}Factors")
    als_factors = als_factors.withColumnRenamed(
        "id", f"{entity}_idx"
    ).withColumnRenamed("features", f"{entity}_factors")
    return (
        als_factors.join(ids, how="right", on=f"{entity}_idx"),
        self.model.rank,
    )