NFT Recommendations

Configuring your entities and interactions

Let's imagine you want to set up an NFT recommendation engine for your NFT marketplace. Let's first consider the different types of entities or metadata that you may have:

  • Individual NFTs

  • NFT collections

  • Creators (e.g., NFT authors)

  • Tags or genres

  • NFT attributes

  • URL to image

In addition, your users are also entities, and may have the following associated data:

  • Country

  • Games or interests

  • Owned NFTs

  • Past clicks, views, bids

  • Wallet size

Note that you don't need to create all of these entities yourself! You can just create the basics and supply metadata. Lucid will read your metadata and generate entities for you.

This tutorial will walk through how to configure this information into the Lucid recommender system to quickly generate user-specific NFT recommendations.

Entity data models

The most straightforward way to start is to create entity tables for both your NFTs and your users. The NFT entity table may look something like this:

entity_typeentity_namemetadata

nft

Bored Ape Yacht Club #2836

{ "creator": "BoredApeYachtClub", "nft-collection": "Bored Ape Yacht Club", "Background": "Aquamarine", "Mouth": "Bored", ... }

nft

Bored Ape Yacht Club #7673

{ "creator": "BoredApeYachtClub", "nft-collection": "Bored Ape Yacht Club", "Background": "Army Green", "Mouth": "Discomfort", ... }

nft

Fidenza #369

{ "creator": "tylerxhobbs", "nft-collection": "Fidenza", "Spiral": "No", "Turbulence": "None", ... }

nft

Fidenza #202

{ "creator": "tylerxhobbs", "nft-collection": "Fidenza", "Spiral": "No", "Turbulence": "Med", ... }

In addition, your user entity table may look like:

entity_typeentity_namemetadata

user

user_0001

{ "country": "Canada" }

user

user_0002

{ "country": "United States" }

user

user_0003

{ "country": "Mexico" }

Interaction model

Once you have your entities listed, you can connect them with a simple interaction table:

source_entityinteraction_typetarget_entity

user_0001

owns

Bored Ape Yacht Club #2836

user_0001

clicked

Fidenza #369

user_0002

bid

Bored Ape Yacht Club #7673

user_0003

clicked

Bored Ape Yacht Club #2836

user_0003

bid

Fidenza #202

Adding NFT images

In order to maximize the effectiveness of the Lucid recommender, you'll also want to add visual information directly. By adding URL links to the NFT images, Lucid's engine can scan and index them visually to understand the content types different users are interested in.

To do this, just add a media_url for each of the NFT entities, where the URL points to the NFT image. Lucid will then download the images and ingest them for processing.

Note that Lucid's engine also can process free text in a similar manner. If your NFTs have free text descriptions, add them as metadata. Lucid will use Natural Language Processing (NLP) tools to analyze the text looking for patterns.

Below is an image from Lucid's backend examining close matches found in an example NFT database for the image of Fidenza #202. Even without manually specifying NFT attributes, Lucid is able to use the images themselves to find similar matches, which can then base used by the recommendation system to learn patterns.

Note that Lucid does not automatically recommend similar images. Instead, the similar images are used as input to the neural network, which will decide if the similarities are likely to drive conversions. If so, then they may appear as recommendations.

Training the model

Once the entity and interaction tables are created, they can be uploaded to the API through the data_batch endpoint. Be sure to add a tag to the datasets, such as nft-data to differentiate it from other recommender projects you may start. You can upload as many entity and interaction tables as needed prior to training the model.

When the data is in place, trigger a training run:

POST <your-endpoint>/v1/recommend/train

You can optionally include parameters to filter the datasets or to only use interactions from the last 30 or 90 days. A typical training run will take several minutes, and a callback can be used to get an indication of completion.

Rolling it out

Once you have trained your model, you can query for recommendations. For example, you may want to find the following:

  • Recommended NFTs for a user

  • Recommended NFT collections for a user

  • Recommended similar NFTs to another NFT

All of these recommendations can easily be generated through a series of queries to our API. To get NFT recommendations for all users in one batch, use the following parameters:

{
    "model_id": "<your model id>",
    "entity_type": "user",
    "target_entity_type": "nft",
    "max_recommendations": 100,
    "output_format": "csv"
}

To instead get NFT collection recommendations, you can use:

{
    "model_id": "<your model id>",
    "entity_type": "user",
    "target_entity_type": "nft-collection",
    "max_recommendations": 20,
    "output_format": "csv"
}

Finally, if you want to find similar NFTs to a target one, try the following query:

{
    "model_id": "<your model id>",
    "entity_id": "Fidenza #202",
    "target_entity_type": "nft",
    "max_recommendations": 20,
    "output_format": "json"
}

Last updated