Machine Learning on OCI for League of Legends- Data Extraction

Machine Learning on OCI for League of Legends- Data Extraction

Introduction

The speaker introduces the workshop and provides information on how to access the lab guide.

Workshop Introduction

  • Tara Vancleave, a marketing event manager for the developer initiative at Oracle, introduces the workshop.
  • The workshop will cover machine learning on OCI for League of Legends data extraction.
  • A special promotion with extra credits is available for those who do not have an Oracle Cloud account.
  • The session will be recorded and sent via email after the workshop concludes.
  • Ignacio Martinez, a data scientist advocate, and Victor Martin, a technology product strategy director, will present the workshop.

Lab Guide Access

The speaker provides information on how to access the lab guide and ask questions during the workshop.

Lab Guide Access

  • Participants can access the lab guide by following a link provided in Slack.
  • Questions can be asked in Slack using hashtag #labLeagueofLegends.

Setting Up an Oracle Cloud Account

Victor Martin walks through steps to sign up for an Oracle Cloud free tier account.

Signing Up for an Oracle Cloud Free Tier Account

  • Victor Martin explains that participants need to sign up for an Oracle Cloud free tier account to follow along with the lab steps.
  • Participants can use always-free cloud services such as autonomous databases and virtual machines. They also get 30 days trial with three credits to use in other services from analytics to kubernetes.
  • Participants should use their registration email address when signing up. No credit card is required.
  • Participants need to provide their country, name, email, and a strong password. They also need to fill in the company name and select a unique cloud account name.
  • Participants need to confirm their email address and complete an easy challenge to verify that they are human.
  • Participants need to select a home region where they are more likely to deploy resources. The free trial only supports one region.
  • After filling in the address information and accepting the agreement, Oracle Cloud starts provisioning the account. It takes about one or two minutes.

Exploring Oracle Cloud Services

Victor Martin shows how to explore Oracle Cloud services after signing up for an account.

Exploring Oracle Cloud Services

  • After signing up for an account, participants can explore Oracle Cloud services by going to the menu or using the search bar.
  • When Oracle Cloud fully provisions the account, participants will receive an email notification.

Oracle Cloud Account Setup

This section covers the setup process for an Oracle Cloud account.

Setting up an Oracle Cloud Account

  • The right side of the screen shows the region selected during sign-up.
  • The cloud cell icon provides a free Linux instance with pre-installed tools like OCI CLI and languages such as Java, Node, Python, etc.
  • The announcements icon provides updates from Morocco Cloud.
  • The help icon contains documentation links, chat support, forums to post questions and create support requests.
  • The profile icon displays user information and allows users to change their language settings.

Introduction to Machine Learning and Gaming

This section introduces machine learning in gaming using League of Legends as an example.

Getting Started with League of Legends

  • Join the lab guide 0928 through the bitly link provided in the chat.
  • A three-minute video explains all concepts related to League of Legends gameplay.
  • There are five players on each team who choose different characters with unique abilities and classes.
  • Destroying enemy Nexus is the main objective of the game.
  • Turrets attack enemies that go underneath them and give gold when destroyed.
  • Inhibitors spawn super minions that can win games if ignored.
  • There are three lanes (top, middle, bot) where minions repeatedly spawn giving gold when killed.
  • Junglers obtain gold and XP by killing monsters in neutral territory.

Introduction to Machine Learning Project

This section introduces a machine learning project developed for League of Legends gameplay.

Introducing a Machine Learning Project for League of Legends

  • The project aims to develop something that helps players while playing League of Legends.
  • It is intended as a basic introduction to machine learning.
  • The project is developed by Nacho Martinez and his team.
  • Participants need a free tier account to go through the lab guide.

Understanding League of Legends Concepts

This section provides an overview of League of Legends concepts.

Understanding League of Legends Gameplay

  • A three-minute video explains all concepts related to League of Legends gameplay.
  • There are five players on each team who choose different characters with unique abilities and classes.
  • Destroying enemy Nexus is the main objective of the game.
  • Turrets attack enemies that go underneath them and give gold when destroyed.
  • Inhibitors spawn super minions that can win games if ignored.
  • There are three lanes (top, middle, bot) where minions repeatedly spawn giving gold when killed.
  • Junglers obtain gold and XP by killing monsters in neutral territory.

This section repeats information from the previous section but provides more detail on understanding gameplay concepts.

Conclusion

This section concludes the video.

Conclusion

  • Participants need a free tier account to go through the lab guide.
  • The project aims to develop something that helps players while playing League of Legends.
  • It is intended as a basic introduction to machine learning.
  • The project is developed by Nacho Martinez and his team.

General Concepts

This section provides an overview of the general concepts of League of Legends.

How to Win Games

  • The objective is to kill minions and enemy champions to earn gold, which can be used to buy items that increase your stats.
  • Winning is about gaining an advantage over the enemy team by killing more minions and champions.
  • Human errors and factors make the game complex, so filtering for the best players is necessary when working with data.

Creating a Machine Learning Model

This section discusses creating a machine learning model for predicting game outcomes.

Two Models

  • Two models will be created: one for helping during matches and another trained on historical data from professional players.
  • Region selection does not matter much, but Phoenix in US West is recommended.
  • Data Science OCI, Cloud Shell, OCI Compute, and Autonomous JSON Database will be used.

Data Sets

  • Offline and online data sets will be generated. A robust data set downloaded from Riot Games API will also be provided.

Conclusion

This section concludes the video by discussing infrastructure deployment time and what's next.

Infrastructure Deployment Time

  • Infrastructure deployment takes about 10 minutes after finishing this part of the video.

What's Next?

  • After infrastructure deployment, the video will go through infrastructure setup.

Introduction to the Lab

In this section, the instructor introduces the lab and explains that they will be using Terraform and Ansible to deploy cloud resources automatically. They also explain that they will be using a Cloud Shell instance to configure everything.

Key Points:

  • The lab will use Terraform and Ansible to deploy cloud resources automatically.
  • A Cloud Shell instance will be used to configure everything.

Downloading Source Code

In this section, the instructor explains how to download the source code for the lab. They show how to navigate into the dev directory where there are two directories: terraform and ansible.

Key Points:

  • The first step is to download the source code which contains all of the necessary files for deploying infrastructure.
  • Navigate into the dev directory where there are two directories: terraform and ansible.

Populating Terraform Variables File

In this section, the instructor explains how to populate a terraform variables file with all of the necessary information for successfully deploying infrastructure. They show how to edit this file using a command-line tool called "nano".

Key Points:

  • To successfully deploy infrastructure, we need to populate a terraform variables file with all of our information.
  • We can edit this file using a command-line tool called "nano".
  • The region, tenancy OCID, compartment OCID (if applicable), Riot Games API key, and SSH key must all be included in this file.

Generating an SSH Key

In this section, the instructor shows how to generate an SSH key which will allow us to connect to our compute instance.

Key Points:

  • An SSH key is necessary in order for us to connect to our compute instance.
  • We can generate an SSH key using the command "ssh-keygen -t RSA".
  • The generated private and public keys will be stored in the ~/.ssh directory.

Deploying with OCI

In this section, the speaker explains how to deploy a project using OCI.

Modifying and deploying the file

  • Modify the file and set all variables.
  • Execute start.sh file to deploy everything automatically.
  • Deployment takes 7 to 10 minutes depending on traffic.

Extracting API key

  • Go to developer.riotgames.com and sign up for League of Legends.
  • Verify your email address to get an API key.
  • The API key is required for deployment.

Getting Started with League of Legends API

In this section, the speaker explains how to get started with League of Legends API.

Registering for League of Legends

  • Follow the steps at your own pace on task1.getstarted page.
  • Register for League of Legends account if you haven't already done so.

Obtaining Riot Games Developer Website Link

  • Go to developer.riotgames.com link provided in task1.getstarted page.
  • Sign up if you don't have an account yet.

Obtaining API Key

  • After signing in, verify your email address before obtaining an API key.
  • Regenerate another one if necessary as expired keys won't work.

Infrastructure and Project Details

In this section, the speaker talks about infrastructure and project details.

Benefits of Using OCI

  • OCI is good for small projects as well as big ones because it allows working with infrastructure cheaply.
  • It's eight to ten times cheaper than other cloud competitors when comparing price performance.

Deployed Infrastructure

  • A simple infrastructure has been deployed using OCI which includes compute instance, autonomous JSON database, and data science notebooks.

Accessing Data

  • Data can be accessed live through data science notebooks.

Introduction to Terraform and Data Mining

In this section, the speaker introduces the idea of generating a dataset using Terraform and working with it. They also explain how Terraform works by generating configuration files that tell you anything deployed in your account.

Generating a Dataset with Terraform

  • The speaker introduces the idea of generating a dataset using Terraform.
  • They mention that they are an IDC main and talk about League of Legends.
  • The speaker explains how Terraform works by generating configuration files that tell you anything deployed in your account.
  • They explain that after creating the resources, Terraform tells you all the resources needed to create a database password, wallet password for your database, virtual Cloud Network (VCN), and all connectivity things needed.

Deploying Data Science Environment

  • After creating the resources, Terraform provides a data science notebook session URL to access the deployed data science environment automatically.
  • The speaker mentions that GitOps or DevOps is currently the most efficient way to work on similar projects as it eliminates manual copying and pasting of code every time.
  • They mention that after deploying everything, Ansible connects to the machine, installs Python, installs all wallets, uninstalls source code and completes deployment in 9 minutes 51 seconds.

Extracting Data Using Data Mining Library

  • The speaker recommends using cloud shell to connect to this machine from now on.
  • They explain that we need SRC file because with this SRC file we can go to this Optimizer part which has a lot of data ways from which we can extract data.
  • The speaker explains that the API key from Riot games expires every 24 hours, so if you plan on running this for more than 24 hours in the future, consider that after a day your code is going to break because you don't have a valid API key.

Overview of League of Legends Ranking System

In this section, the speaker provides an overview of the ranking system in League of Legends and explains how players are ranked based on their performance.

Ranking System in League of Legends

  • The top 200 Challenger players in each region are considered the best players.
  • Grand Master players are ranked below Challenger tier.
  • Players below Masters tier are not considered the best.
  • For data analysis purposes, only Challenger to Master players will be considered.

Extracting Player Data

In this section, the speaker explains how player data is extracted from League of Legends using APIs and stored in a database for further analysis.

Storing Player Data

  • Player data is automatically stored in a non-relational database after being extracted from APIs.
  • Players' games will be used to train machine learning models.

Sorting by Role

  • It is possible to sort player data by role (e.g. bottom lane, mid lane, jungle, etc.) if needed.
  • The source code on GitHub provides more information on how to achieve this.

Extracting Match Data

In this section, the speaker explains how match data is extracted from League of Legends using APIs and stored in a database for further analysis.

Downloading Matches

  • The latest 1000 matches for each player are downloaded using APIs.
  • This process iterates through all players in the database until all matches have been downloaded.

Downloading Match Details

  • Match details can be downloaded using a command that retrieves a large JSON file containing all events that occurred during the game (e.g. kills, assists, items purchased).
  • This JSON file can be processed into a pipeline that converts it into something usable by machine learning models.

Introduction

The speaker introduces themselves and provides an overview of the lab.

Lab Overview

  • Diane greets the audience and provides instructions for changing directories in the Infrastructure Cloud Shell.
  • The speaker answers questions from the audience, including whether the labs are possible without an Oracle account and how much data is ingested into the ADJ instance.

Ingesting Data

The speaker discusses how data is ingested into the ADJ instance.

Amount of Data Ingested

  • The speaker explains that a large amount of data is ingested into the ADJ instance, with execution stopping after a couple hundred lines.
  • The speaker shows how to access database passwords and demonstrates how to view the amount of data being inserted into the database.
  • The speaker explains that Json databases are useful because they allow for collections to be created even if they didn't exist before.

Player Information

The speaker discusses player information stored in Json files.

Player Information Stored in Json Files

  • The speaker describes player information stored in Json files, including identifiers, ranks, hot streaks, activity status, number of wins in a season, etc.
  • More detailed information about players can be accessed through their unique identifier.

Connecting with Other Oracle Products

The speaker discusses connecting ADJ with other Oracle products.

Connecting with Other Oracle Products

  • The speaker explains that ADJ can be connected with other Oracle products, such as Oracle Analytics Cloud, to create visualizations over player data.

Finding the Number of Elements in Collections

The speaker discusses how to find the number of elements in collections.

Finding the Number of Elements in Collections

  • The speaker explains that by executing fine counts in Python locally on your computer, you can find the number of elements or documents that you have in each one of the collections.

Creating a Model

The speaker discusses creating a model using the data science environment.

Setting Up Python Environment

  • To create a model, you need to access the data science environment and set up your python environment.
  • You also need to download notebooks and datasets provided by us.

Getting Started with the Notebook

In this section, we learn how to get started with the notebook and install all necessary dependencies.

Downloading and Opening the Notebook

  • To get started, SSH into the compute node created for you.
  • Download the notebook called "Hall one offline analysis.ipymb" from inside the League of Legends Optimizer and Notebook folder.
  • Open the notebook in Jupyter.

Installing Dependencies

  • Install all necessary Python dependencies before running any code.
  • The required libraries include NumPy, Pandas, and JSON.
  • Use read_csv to read in two datasets: matchups.csv and 1v1.csv.
  • Wait for these large files to load.

Understanding Data Structure

  • Learn about the data structure that will be used throughout upcoming workshops.
  • The data includes information such as total gold, kills, assists, deaths, champion played, and lane played in (top lane, mid lane, bottom lane/jungle/support).
  • This data will be transformed using machine learning techniques.

Skipping Ahead to Lab Four

In this section we learn that it is possible to skip ahead to lab four if task four in lab two has already been completed.

Skipping Ahead

  • If task four in lab two has already been completed successfully then it is possible to skip ahead directly to lab four without any issues.

Understanding Machine Learning Concepts

In this section we learn about some of the main concepts behind machine learning models.

Main Concepts

  • Import all necessary dependencies for our project including NumPy,Pandas,and JSON
  • Transform data into a simple format of wins/losses based on champions played by each player
  • Each match identifier is assigned an ever-increasing number
  • If champ one wins, there is a 1 in the win column
  • If champ two wins, there is a 0 in the win column
  • Learn about scaling and other techniques that will be used throughout upcoming workshops.

Introduction to Machine Learning

In this section, the instructor introduces the basic concepts of machine learning and explains how null values can be difficult to deal with in most cases.

Basic Concepts of Machine Learning

  • The best machine learning model aims to teach you the basic concepts.
  • Decision trees are especially good for dealing with missing or null values.
  • Before anything, we need to decide what to do with null values through data manipulation or processing.

Data Preparation

  • Identifying columns have the highest cardinality possible and are not useful for machine learning models.
  • Splitting data into train and test sets is a technique used to divide your dataset into percentages for training and validation purposes.
  • Most people use an 80/20 split for training and testing respectively.

Variable Splitting

  • We need to tell the model which variable we want to predict. In this case, we want to predict if team one wins or not.
  • This model has about 51% accuracy due to the large number of rows in our dataset.

Categorical Variables

In this section, the instructor explains what categorical variables are and why they are important in machine learning models.

Understanding Categorical Variables

  • A categorical variable is defined as a variable that's not a number.
  • Machine learning models learn from numbers, so it's important to convert categorical variables into numerical ones before using them in a model.

Label Encoding and Scaling

In this section, the speaker explains label encoding and scaling. They describe how to use label encoding to assign a unique number to each string in a dataset, and how to scale numerical data so that it is consistent across different ranges.

Label Encoding

  • Label encoding assigns a unique number to each string in a dataset.
  • This creates an identifying variable for each word or string.
  • One-hot encoding is similar but uses binary representation instead of numbers.
  • The label encoder needs to be fitted to the list of all possible values in the dataset.

Scaling

  • Scaling ensures that numerical data is consistent across different ranges.
  • Standard scaling subtracts the average value from each data point and divides by the standard deviation of the column.
  • All variables need to be transformed into numbers before training the model.

Model Inference

In this section, the speaker discusses how to test a model by exporting and importing it again. They also explain how to create new data and pass it to the model for testing.

Testing the Model

  • To test a model, export it and import it again.
  • Create new data and pass it to the model for testing.
  • The computer doesn't understand the dataset, so we need to perform all of the encoding and scaling that was done before.

Encoding and Scaling

  • Reuse objects like label encoders to perform encoding of new values automatically.
  • Scale all numbers into perspective before passing them through the model.
  • If values are not scaled, predictions will be inaccurate.

Working with Time Series Data

In this section, the speaker talks about working with time series data in League of Legends matches. They discuss how performance early on in a match can affect its outcome.

Time Series Data in League of Legends Matches

  • Performance early on in a match can affect its outcome.
  • Additional calculations apart from probabilities can add robustness to a model.
  • Consider five players against five players when making predictions.
  • Making five different predictions for each lane can increase prediction accuracy.
Video description

League of Legends is one of the most played videogames in the entire world. In this workshop, we'll leverage the power of AI for League of Legends in a unique and innovative way. We'll dive deep into extractable data (accessible through the game's API), how to structure this data, and how to use it to train our own Machine Learning model to generate real-time predictions about any match. Workshop resources: - Access the lab guide: https://bit.ly/lab-guide-0928 -Create your cloud account: https://bit.ly/cloudoffer-0928 -Get your questions answered: https://bit.ly/odevrel_slack. Join the channel lab-league-of-legends to continue the conversation and ask our experts your questions! Attend an upcoming live event: https://bit.ly/more-events-0928 Find developer resources: https://bit.ly/oracle-devrel