SCC / README.md
tuanthanh150498's picture
Update README.md
6cca614 verified
metadata
license: apache-2.0
language:
  - en
tags:
  - movies

sample_mflix.embedded_movies

This data set contains details on movies with genres of Western, Action, or Fantasy. Each document contains a single movie, and information such as its title, release year, and cast.

In addition, documents in this collection include a plot_embedding field that contains embeddings created using OpenAI's text-embedding-ada-002 embedding model that you can use with the Atlas Search vector search feature.

Overview

This dataset offers a comprehensive collection of data on various movies. It includes details such as plot summaries, genres, runtime, ratings, cast, and more. This dataset is ideal for movie recommendation systems, film analysis, and educational purposes in film studies.

Dataset Structure

Each record in the dataset represents a movie and includes the following fields:

  • _id: A unique identifier for the movie.
  • plot: A brief summary of the movie's plot.
  • genres: A list of genres associated with the movie.
  • runtime: The runtime of the movie in minutes.
  • rated: The MPAA rating of the movie.
  • cast: A list of main actors in the movie.
  • num_mflix_comments: The number of comments on the movie in the mflix platform.
  • poster: A URL to the movie's poster image.
  • title: The title of the movie.
  • lastupdated: The last date and time when the movie information was updated.
  • languages: The languages available in the movie.
  • directors: A list of directors of the movie.
  • writers: A list of writers of the movie.
  • awards: Information about awards won and nominations.
  • imdb: IMDb rating, votes, and ID.
  • countries: A list of countries where the movie was produced.
  • type: The type of record, in this case, movie.
  • tomatoes: Ratings and reviews from Rotten Tomatoes.
  • plot_embedding: An array of numerical values representing the plot embedding.

Field Details

Awards Object

  • wins: The number of awards won.
  • nominations: The number of awards the movie was nominated for.
  • text: A text summary of the awards and nominations.

IMDb Object

  • rating: The IMDb rating.
  • votes: The number of votes on IMDb.
  • id: The IMDb ID of the movie.

Tomatoes Object

  • Contains viewer and critic ratings, reviews count, DVD release date, and production details.

Plot Embedding

  • An array representing a numerical embedding of the movie's plot. Useful for machine learning applications, like content-based filtering in recommendation systems.

Usage

The dataset is suited for a range of applications, including:

  • Analyzing trends in film genres and ratings over time.
  • Building movie recommendation engines using plot embeddings and genres.
  • Studying the correlation between cast/directors and movie success.
  • Educational purposes in film studies and data analysis courses.

Notes

  • The data is provided as-is and intended for informational and educational purposes.
  • Users should verify the accuracy of the information for any critical use-cases.

Sample Document

{
  "_id": {
    "$oid": "573a1396f29313caabce582d"
  },
  "plot": "A young swordsman comes to Paris and faces villains, romance, adventure and intrigue with three Musketeer friends.",
  "genres": ["Action", "Adventure", "Comedy"],
  "runtime": {
    "$numberInt": "106"
  },
  "rated": "PG",
  "cast": ["Oliver Reed", "Raquel Welch", "Richard Chamberlain", "Michael York"],
  "num_mflix_comments": {
    "$numberInt": "0"
  },
  "poster": "https://m.media-amazon.com/images/M/MV5BODQwNmI0MDctYzA5Yy00NmJkLWIxNGMtYzgyMDBjMTU0N2IyXkEyXkFqcGdeQXVyMjI4MjA5MzA@._V1_SY1000_SX677_AL_.jpg",
  "title": "The Three Musketeers",
  "lastupdated": "2015-09-16 06:21:07.210000000",
  "languages": ["English"],
  "directors": ["Richard Lester"],
  "writers": ["George MacDonald Fraser (screenplay)", "Alexandre Dumas père (novel)"],
  "awards": {
    "wins": {
      "$numberInt": "4"
    },
    "nominations": {
      "$numberInt": "7"
    },
    "text": "Won 1 Golden Globe. Another 3 wins & 7 nominations."
  },
  "imdb": {
    "rating": {
      "$numberDouble": "7.3"
    },
    "votes": {
      "$numberInt": "11502"
    },
    "id": {
      "$numberInt": "72281"
    }
  },
  "countries": ["Spain", "USA", "Panama", "UK"],
  "type": "movie",
  "tomatoes": {
    "viewer": {
      "rating": {
        "$numberDouble": "3.5"
      },
      "numReviews": {
        "$numberInt": "9600"
      },
      "meter": {
        "$numberInt": "78"
      }
    },
    "dvd": {
      "$date": {
        "$numberLong": "982022400000"
      }
    },
    "critic": {
      "rating": {
        "$numberDouble": "7.1"
      },
      "numReviews": {
        "$numberInt": "11"
      },
      "meter": {
        "$numberInt": "82"
      }
    },
    "lastUpdated": {
      "$date": {
        "$numberLong": "1441307415000"
      }
    },
    "rotten": {
      "$numberInt": "2"
    },
    "production": "Live Home Video",
    "fresh": {
      "$numberInt": "9"
    }
  },
  "plot_embedding": [
    -0.004237316,
    -0.022958077,
    -0.005921211,
    -0.020323543,
    0.010051459
  ]
}

Ingest Data

The small script ingest.py can be used to load the data into your MongoDB Atlas cluster.

pip install pymongo
pip install datasets
## export MONGODB_ATLAS_URI=<your atlas uri>

The ingest.py:

import os
from pymongo import MongoClient
import datasets
from datasets import load_dataset
from bson import json_util


uri = os.environ.get('MONGODB_ATLAS_URI')
client = MongoClient(uri)
db_name = 'sample_mflix'
collection_name = 'embedded_movies'

embedded_movies_collection = client[db_name][collection_name]

dataset = load_dataset("MongoDB/embedded_movies")

insert_data = []

for movie in dataset['train']:
    doc_movie = json_util.loads(json_util.dumps(movie))
    insert_data.append(doc_movie)

    if len(insert_data) == 1000:
        embedded_movies_collection.insert_many(insert_data)
        print("1000 records ingested")
        insert_data = []

if len(insert_data) > 0:
    embedded_movies_collection.insert_many(insert_data)
    insert_data = []

print("Data Ingested")