RentTheRunway Recommendations
This tutorial demonstrates how to configure a recommendation engine using the RentTheRunway dataset. The dataset contains 192,544 ratings from 105,508 users on 5,850 items. This example uses the local table connector; the same approach applies to other supported connectors.
CLI Setup
Install the CLI
pip install shaped
Shaped supports Python 3.8 to 3.11. See installation instructions if you need to install pip.
Initialize the CLI
shaped init --api-key <YOUR_API_KEY>
If you don't have an API key, see How to get an API key.
Data Preparation
Download the dataset
wget https://mcauleylab.ucsd.edu/public_datasets/data/renttherunway/renttherunway_final_data.json.gz --no-check-certificate
gunzip renttherunway_final_data.json.gz
The dataset contains a single JSON file (renttherunway_final_data.json) with events, users, and items combined. Convert to CSV and preprocess:
- Convert weight and height columns to numerical types
- Convert ratings (1-10 scale) to binary: values > 8 become 1, values ≤ 8 become 0
See the notebook for preprocessing code.

Save as TSV:
data.to_csv('notebook_assets/events.csv', sep='\t', index=False)
This example uses event data along with user and item information. While these are typically separate tables, this dataset combines them. The events.csv file contains events, users, and items. The engine configuration extracts each type using SQL queries.
Create the table
Define a custom table schema:
column_schema:
age: Int32
body_type: String
bust_size: String
category: String
fit: String
height: Int32
item_id: String
rating: Int32
rented_for: String
review_date: DateTime
review_summary: String
review_text: String
size: Int32
user_id: String
weight: Int32
name: rent_runway_events
schema_type: CUSTOM
Create the table and insert data:
shaped create-table --file notebook_assets/events_table_schema.yaml
shaped table-insert --table-name rent_runway_events --file notebook_assets/events.csv --type 'tsv'
Records upload in batches of 1000. Wait until all 192,544 records are uploaded.
Create the engine
This example uses events, users, and items from a single table. The engine configuration uses SQL queries to extract each type:
data:
item_table:
type: query
query: |
SELECT item_id, fit, category, size FROM rent_runway_events
user_table:
type: query
query: |
SELECT user_id, bust_size, weight, body_type, height, age FROM rent_runway_events
interaction_table:
type: query
query: |
SELECT user_id, item_id, review_date AS created_at, rating AS label, rented_for,
review_text, review_summary FROM rent_runway_events
training:
models:
- name: als
policy_type: als
Create the engine:
shaped create-engine --file notebook_assets/rent_runway_recommendations.yaml
For details on engine configuration, see Engines documentation.
Monitor engine status
Engine creation and training can take several hours, depending on data volume and attributes. Check status:
shaped list-engines
Response:
[
"engines": {
"created_at": "2023-03-18T19:17:51 UTC",
"engine_name": "rent_runway_recommendations",
"engine_uri": "https://api.shaped.ai/v2/engines/rent_runway_recommendations",
"status": "FETCHING",
}
]
The engine progresses through these stages:
SCHEDULINGFETCHINGTRAININGDEPLOYINGACTIVE
Once the status is ACTIVE, the engine is ready for queries.
Query recommendations
Query recommendations using the Query endpoint. Provide a user_id and the number of results to return.
Using the CLI:
shaped query --engine-name rent_runway_recommendations \
--query "SELECT * FROM similarity(embedding_ref='als', limit=50, encoder='precomputed_user', input_user_id='\$user_id') LIMIT 5" \
--parameters '{"user_id": "1"}'
Response:
{
"results": [
{
"id": "427010",
"score": 0.9
},
{
"id": "182094",
"score": 0.8
},
{
"id": "332874",
"score": 0.7
},
{
"id": "827918",
"score": 0.3
},
{
"id": "403528",
"score": 0.2
}
]
}
The response contains an array of result objects with item IDs and scores.
Using the REST API:
curl https://api.shaped.ai/v2/engines/rent_runway_recommendations/query \
-H "x-api-key: <API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"query": "SELECT * FROM similarity(embedding_ref=''als'', limit=50, encoder=''precomputed_user'', input_user_id=''$user_id'') LIMIT 5",
"parameters": {
"user_id": "1"
}
}'
Clean up
Delete the engine when finished:
shaped delete-engine --engine-name rent_runway_recommendations