Skip to content

Similar Products Recommendation with .NET

The SimilarProducts recommendation allows you to query products that are similar to the input product. Similarity in this case is understood as any arbitrary list of data points, which are to be configured during the setup of the recommendation request.

Note that this recommendation type does not benefit from Relewise's personalization features, as the results are generated entirely on the basis of the list of comparable datakeys detailed in the request's EvaluationSettings.

Start by making an IRecommender-instance.

csharp
IRecommender recommender = new Recommender(
  new Guid("00000000-0000-0000-0000-000000000001"), 
  "your api key", 
	"server-url");

Before going any further, make sure you have read the following:

  • Read about how to authenticate against our API here.
  • Read about handling different types of users here.

Setting it up

SimilarProducts requires an input product ID (and optionally a variant ID) to function. This product is then compared to every other product in the dataset on the basis of the EvaluationSettings of the request. By default, these are set as the following.

json
{
  "$type": "Relewise.Client.Requests.Recommendations.SimilarProductsEvaluationSettings, Relewise.Client",
  "SignificanceOfSimilaritiesInDisplayName": 1.0,
  "SignificanceOfSimilarListPrice": 0.5,
  "SignificanceOfCommonImmediateParentCategories": 1.0,
  "SignificanceOfCommonParentsParentCategories": 0.5,
  "SignificanceOfCommonAncestorCategories": 0.25,
  "SignificanceOfCommonProductDataKeys": 0.0,
  "SignificanceOfIdenticalProductDataValues": 1.0,
  "SignificanceOfSimilarSalesPrice": 0.5,
  "SignificanceOfSimilarBrand": 0.5
}

EvaluationSettings Weighting

The Significance of a particular datakey is evaluated on the basis of the type of datakey it is. For ProductDataField and SignificantDataFields (for variants), each key must be provided with a Comparer, which will define how the data fields will be compared across products. For the default fields (described above), the comparer is implicit and does not need to be set.

EvaluationSettings Comparer

Equals

NumericPercentDifference

StringSimilarity

KeyExists

CollectionOverlap

Don't know us? Don't worry - you can find more information about us, by visiting our main page www.relewise.com