Recommendation for item
Recommender systems with Collaborative Filtering help suggest relevant items by analyzing the behavior of different users and items.
For example, imagine you liked a movie on a streaming platform. Using the item-item method, it’s possible to recommend a movie based on what you just watched.
This method works like an "invisible network of friends," helping you discover new things that perfectly match the item.
EXAMPLE OF USE
To generate the file with all the necessary configurations for later use:
When the "FindBestModel" procedure is completed, the file will be created in the directory specified as a parameter.
To use the model from the generated file:
The database structure can be found here.
CLASSES AND METHODS GUIDE
TEasyAIRecommendationFromItem
constructor Create(aItemsToRecommendCount : Integer); : creates the object with the dataset that will be used for training.
aItemsToRecommendCount : maximum amount of items that will be recommended.
procedure LoadDataset(aDataSet : String; aHasHeader : Boolean = True); : loads the database for training or use in models that require it.
aDataSet : CSV file path.
aHasHeader : indicates whether the file has a header.
procedure LoadDataset(aDataSet : TDataSet); : loads the database for training or use in models that require it.
aDataSet : TDataSet object that contains the data that will be used for training.
procedure FindBestModel(aPathResultFile: String; aMode : TEasyTestingMode = tmStandard; aMaxThreads : Integer = 0; aCsvResultModels : String = ''; aLogFile : String = ''); : tests multiple model options to find and prepare the best one for use in predictions.
aPathResultFile : path where the configurations of the found model are saved; before use, just load it to prepare the entire object for predictions.
aMode : search mode that will be performed, having 3 options:
tmFast : tests only the most likely best models. It is the fastest mode;
tmStandard : tests the most likely best models, as well as exploring more extreme parameters;
tmExtensive : tests a large number of models, including those from other methods. It's the slowest mode.
aMaxThreads : optional, the maximum number of threads to be used simultaneously. If set to 0, it will use the number of threads available in the CPU.
aCsvResultModels : optional, the path where a CSV file will be saved containing each tested method along with its results.
aLogFile : optional, the path of the log file.
procedure LoadFromFile(aPath : String); : loads the file generated in "FindBestModel" to create and prepare the use of the best model found.
function RecommendItem(aFromItemSample : TArray<Double>) : TArray; : returns X recommended items based on an item that was not in the dataset.
aFromItemSample : data of the item that will receive the recommendation, each position X of the array represents the rating of that item for the user at index X.
function RecommendItem(aFromItemID : Integer) : TArray; : returns X recommended items based on an item that was already in the dataset.
aFromItemID : ID of the item that will receive the recommendation.
Last updated