object
bm25_recommender
Content-based recommender using raw-count query profiles and Okapi BM25 relevance scores.
logtalk_load(bm25_recommender(loader))static, context_switching_callsPublic predicates
score_all/4
Scores catalog items in input order, preserving duplicates and validating the model once. An empty batch validates the model and user.
staticscore_all(Recommender,User,Items,Scores)score_all(+compound,+atomic,+list(atomic),-list(pair)) - one_or_errorinstantiation_errordomain_error(recommender,Recommender)type_error(atomic,Identifier)type_error(list,Items)domain_error(catalog_item,Item)score_content/4
Scores supplied content of the trained representation using frozen corpus statistics. Unseen terms contribute to document length but not matching relevance.
staticscore_content(Recommender,User,Content,Score)score_content(+compound,+atomic,+compound,-float) - one_or_errorinstantiation_errordomain_error(recommender,Recommender)type_error(atomic,User)domain_error(item_content,Content)domain_error(content_representation,Content)type_error(list,List)type_error(pair,Entry)domain_error(duplicate_feature,Feature)type_error(number,Count)domain_error(non_negative_finite_weight,Count)type_error(integer,Count)update_ratings/3
Returns a model with inserted or replaced ratings and rebuilt query profiles, retaining fitted corpus weights. New users are accepted but items must belong to the catalog.
staticupdate_ratings(Recommender,Ratings,UpdatedRecommender)update_ratings(+compound,+list(compound),-compound) - one_or_errorinstantiation_errordomain_error(recommender,Recommender)type_error(list,Ratings)type_error(rating,Entry)type_error(atomic,Identifier)type_error(number,Rating)domain_error(finite_rating,Rating)domain_error(rating_scale(Min,Max),Rating)domain_error(catalog_item,Item)domain_error(duplicate_rating,User-Item)domain_error(positive_rating_weight,Rating)remove_ratings/3
Returns a model with requested ratings removed and query profiles rebuilt. Missing and repeated pairs are accepted; no matching ratings returns the validated original model.
staticremove_ratings(Recommender,UserItemPairs,UpdatedRecommender)remove_ratings(+compound,+list(pair),-compound) - one_or_errorinstantiation_errordomain_error(recommender,Recommender)type_error(list,UserItemPairs)type_error(pair,Entry)type_error(atomic,Identifier)domain_error(non_empty_ratings,[])domain_error(positive_rating_weight,Rating)extend_catalog/3
Returns a model with new catalog items, refitting corpus statistics and all item weights. Descriptors must match the trained representation.
staticextend_catalog(Recommender,ItemContents,UpdatedRecommender)extend_catalog(+compound,+list(pair),-compound) - one_or_errorinstantiation_errordomain_error(recommender,Recommender)type_error(list,List)type_error(pair,Entry)type_error(atomic,Item)domain_error(duplicate_item,Item)domain_error(new_catalog_item,Item)domain_error(item_content,Content)domain_error(content_representation,Content)domain_error(duplicate_feature,Feature)type_error(number,Count)domain_error(non_negative_finite_weight,Count)type_error(integer,Count)replace_content/3
Returns a model with replaced catalog descriptors, refitting corpus statistics, all item weights, and raw query profiles. Identifiers must already belong to the catalog.
staticreplace_content(Recommender,ItemContents,UpdatedRecommender)replace_content(+compound,+list(pair),-compound) - one_or_errorinstantiation_errordomain_error(recommender,Recommender)type_error(list,List)type_error(pair,Entry)type_error(atomic,Item)domain_error(duplicate_item,Item)domain_error(catalog_item,Item)domain_error(item_content,Content)domain_error(content_representation,Content)domain_error(duplicate_feature,Feature)type_error(number,Count)domain_error(non_negative_finite_weight,Count)type_error(integer,Count)remove_catalog/3
Removes catalog items and their ratings, refitting remaining corpus weights and affected profiles. Missing and repeated identifiers are accepted.
staticremove_catalog(Recommender,Items,UpdatedRecommender)remove_catalog(+compound,+list(atomic),-compound) - one_or_errorinstantiation_errordomain_error(recommender,Recommender)type_error(list,Items)type_error(atomic,Item)domain_error(non_empty_catalog,[])domain_error(non_empty_ratings,[])domain_error(positive_rating_weight,Rating)set_rating_scale/3
Changes only the stored rating scale to none or scale(Min,Max), requiring finite ordered bounds containing all ratings. Ratings and relevance scores are not rescaled.
staticset_rating_scale(Recommender,Scale,UpdatedRecommender)set_rating_scale(+compound,+term,-compound) - one_or_errorinstantiation_errordomain_error(recommender,Recommender)type_error(number,Bound)domain_error(rating_scale,Scale)domain_error(rating_scale,Min-Max)domain_error(rating_scale(Min,Max),Rating)Protected predicates
user_profile/5
Builds one raw-count query profile from the complete user history.
staticuser_profile(User,Ratings,Documents,Options,Profile)user_profile(+atomic,+list(compound),+list(pair),+list(compound),-list(pair)) - one_or_errordomain_error(positive_rating_weight,Rating)Private predicates
check_catalog_identifiers/1
Checks all catalog request identifiers before applying removals.
staticcheck_catalog_identifiers(Items)check_catalog_identifiers(+list(term)) - one_or_errorinstantiation_errortype_error(atomic,Item)check_rating_scale/2
Checks a proposed optional finite rating scale against existing ratings.
staticcheck_rating_scale(Scale,Ratings)check_rating_scale(+term,+list(compound)) - one_or_errorinstantiation_errortype_error(number,Bound)domain_error(rating_scale,Scale)domain_error(rating_scale,Min-Max)domain_error(rating_scale(Min,Max),Rating)check_scale_ratings/3
Checks stored ratings against inclusive validated scale bounds.
staticcheck_scale_ratings(Ratings,Min,Max)check_scale_ratings(+list(compound),+number,+number) - one_or_errordomain_error(rating_scale(Min,Max),Rating)check_catalog_entries/1
Checks that all supplied catalog entries are pairs before canonicalization.
staticcheck_catalog_entries(ItemContents)check_catalog_entries(+list(term)) - one_or_errorinstantiation_errortype_error(pair,Entry)check_existing_catalog_items/2
Checks that replacements use existing catalog identifiers.
staticcheck_existing_catalog_items(Replacements,Contents)check_existing_catalog_items(+list(pair),+list(pair)) - one_or_errordomain_error(catalog_item,Item)check_catalog_kind/3
Checks the canonical catalog descriptor representation against the stored representation.
staticcheck_catalog_kind(ItemContents,Kind,Diagnostics)check_catalog_kind(+list(pair),+atom,+list(compound)) - one_or_errordomain_error(content_representation,Content)check_new_catalog_items/2
Checks that additions use new catalog identifiers.
staticcheck_new_catalog_items(Additions,Contents)check_new_catalog_items(+list(pair),+list(pair)) - one_or_errordomain_error(new_catalog_item,Item)rebuild_catalog_model/6
Refits corpus statistics and all item weights using prepared raw-count profiles.
staticrebuild_catalog_model(Ratings,Contents,Profiles,Scale,Diagnostics,UpdatedRecommender)rebuild_catalog_model(+list(compound),+list(pair),+list(pair),+term,+list(compound),-compound) - one_or_errortype_error(integer,Count)rating_removal_records/3
Validates user-item pairs and collects matching stored ratings, ignoring missing pairs.
staticrating_removal_records(UserItemPairs,Ratings,Removals)rating_removal_records(+list(pair),+list(compound),-list(compound)) - one_or_errorinstantiation_errortype_error(pair,Entry)type_error(atomic,Identifier)check_rating_updates/3
Checks rating records against the catalog and stored rating scale.
staticcheck_rating_updates(Ratings,Contents,Scale)check_rating_updates(+list(compound),+list(pair),+term) - one_or_errorinstantiation_errortype_error(rating,Entry)type_error(atomic,Identifier)type_error(number,Rating)domain_error(finite_rating,Rating)domain_error(rating_scale(Min,Max),Rating)domain_error(catalog_item,Item)rebuild_feedback_model/9
Rebuilds affected raw-count profiles and diagnostics, retaining fitted corpus and item weights.
staticrebuild_feedback_model(Ratings,Contents,ItemWeights,Profiles,Corpus,Scale,Diagnostics,AffectedUsers,UpdatedRecommender)rebuild_feedback_model(+list(compound),+list(pair),+list(pair),+list(pair),+compound,+term,+list(compound),+list(atomic),-compound) - one_or_errortype_error(integer,Count)domain_error(positive_rating_weight,Rating)updated_profiles/6
Rebuilds affected users from complete history and retains unaffected raw profiles.
staticupdated_profiles(Ratings,Contents,Options,Profiles,AffectedUsers,UpdatedProfiles)updated_profiles(+list(compound),+list(pair),+list(compound),+list(pair),+list(atomic),-list(pair)) - one_or_errortype_error(integer,Count)domain_error(positive_rating_weight,Rating)check_content_kind/3
Checks that supplied content matches the stored representation.
staticcheck_content_kind(Kind,Content,Diagnostics)check_content_kind(+atom,+compound,+list(compound)) - one_or_errordomain_error(content_representation,Content)score_catalog_items/6
Validates and scores catalog identifiers in input order using validated model data.
staticscore_catalog_items(ItemWeights,Profiles,User,Items,Scores,Options)score_catalog_items(+list(pair),+list(pair),+atomic,+list(atomic),-list(pair),+list(compound)) - one_or_errorinstantiation_errortype_error(atomic,Item)domain_error(catalog_item,Item)score_query_items/4
Restores requested score order, checking identifier errors in original request order.
staticscore_query_items(ResolvedScores,Query,Items,Scores)score_query_items(+list(pair),+list(pair),+list(atomic),-list(pair)) - one_or_errorinstantiation_errortype_error(atomic,Item)domain_error(catalog_item,Item)catalog_score/6
Scores a catalog identifier using validated model data.
staticcatalog_score(ItemWeights,Profiles,User,Item,Score,Options)catalog_score(+list(pair),+list(pair),+atomic,+atomic,-float,+list(compound)) - one_or_errordomain_error(catalog_item,Item)content_documents/2
Converts canonical descriptors to raw counts and complete document lengths.
staticcontent_documents(Contents,Documents)content_documents(+list(pair),-list(pair)) - one_or_errortype_error(integer,Count)descriptor_document/2
Converts a canonical descriptor to its raw-count document.
staticdescriptor_document(Content,Document)descriptor_document(+compound,-compound) - one_or_errortype_error(integer,Count)count_length/3
Checks canonical nonzero count values and sums the document length.
staticcount_length(Counts,Length0,Length)count_length(+list(pair),+integer,-integer) - one_or_errortype_error(integer,Count)profile_weights/3
Assigns uniform or strictly positive rating weights to selected count vectors.
staticprofile_weights(Selected,Weighting,Weighted)profile_weights(+list(pair),+atom,-list(pair)) - one_or_errordomain_error(positive_rating_weight,Rating)check_finite_ratings/1
Checks that rating values are finite.
staticcheck_finite_ratings(Ratings)check_finite_ratings(+list(compound)) - one_or_errordomain_error(finite_rating,Rating)Operators
(none)