Instance Method

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.

Declaration

func recommendations(fromUsers: [MLIdentifier], maxCount: Int = 10, restrictingToItems: [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 containing columns with user identifiers, item identifiers, scores and ranks (numbered between 1 and the maxCount).

See Also

Testing a Recommender

func recommendations<T>(fromUsers: MLDataColumn<T>, maxCount: Int, restrictingToItems: MLDataColumn<T>?, excluding: MLDataTable?, excludingObserved: Bool) -> MLDataTable

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

protocol MLIdentifier

A type the Create ML framework can use as a machine learning identifier.

func getSimilarItems<T>(fromItems: MLDataColumn<T>, maxCount: Int) -> MLDataTable

Returns the top ranked similar items based on the model’s similarity type.

func getSimilarItems(fromItems: [MLIdentifier], maxCount: Int) -> MLDataTable

Returns the top ranked similar items based on the model’s similarity type.