<!--
{
  "availability" : [
    "macOS: 10.15.0 - 14.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLRecommender/recommendations(fromUsers:maxCount:restrictingToItems:excluding:excludingObserved:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML13MLRecommenderV15recommendations9fromUsers8maxCount18restrictingToItems9excluding0L8ObservedAA11MLDataTableVSayAA12MLIdentifier_pG_SiAMSgAKSgSbtKF::OverloadGroup"
  },
  "title" : "recommendations(fromUsers:maxCount:restrictingToItems:excluding:excludingObserved:)"
}
-->

# recommendations(fromUsers:maxCount:restrictingToItems:excluding:excludingObserved:)

Retrieves the highest scored item for the given array of users, based on item similarity and the rating column.

```
func recommendations(fromUsers: [any MLIdentifier], maxCount: Int = 10, restrictingToItems: [any MLIdentifier]? = nil, excluding userItemObservations: MLDataTable? = nil, excludingObserved: Bool = true) throws -> MLDataTable
```

## Parameters

`fromUsers`

An array of user identifiers.

`maxCount`

The maximum number of recommendations per user. The default is `10`.

`restrictingToItems`

An array of item identifiers that defines the only values the recommender can use this
set of recommendations. By default, the parameter is `nil`, meaning there are no restrictions.

`userItemObservations`

A data table of user-item observations to exclude from recommendations. The default
is `nil`, meaning no observations are excluded. The column names for the user identifiers and item
identifiers must be the same as those provided in the training data.

`excludingObserved`

Set this value to `true` to omit training data from the recommendations, or `false` to
include them. The default is `true`.

## Return Value

An [`MLDataTable`](/documentation/CreateML/MLDataTable) containing columns with user identifiers, item identifiers, scores and ranks
(numbered between `1` and the `maxCount`).

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)