{ "cells": [ { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "from fastai import * # Quick access to most common functionality\n", "from fastai.collab import * # Quick access to collab filtering functionality" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Collaborative filtering example" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "`collab` models use data in a `DataFrame` of user, items, and ratings." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "PosixPath('/data1/jhoward/git/fastai/fastai/../data/movie_lens_sample')" ] }, "execution_count": null, "metadata": {}, "output_type": "execute_result" } ], "source": [ "path = untar_data(URLs.ML_SAMPLE)\n", "path" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | userId | \n", "movieId | \n", "rating | \n", "timestamp | \n", "
|---|---|---|---|---|
| 0 | \n", "73 | \n", "1097 | \n", "4.0 | \n", "1255504951 | \n", "
| 1 | \n", "561 | \n", "924 | \n", "3.5 | \n", "1172695223 | \n", "
| 2 | \n", "157 | \n", "260 | \n", "3.5 | \n", "1291598691 | \n", "
| 3 | \n", "358 | \n", "1210 | \n", "5.0 | \n", "957481884 | \n", "
| 4 | \n", "130 | \n", "316 | \n", "2.0 | \n", "1138999234 | \n", "