Code Along
/module-1We’ll take this part easily!
Our aim: What relates to whether a Pokemon is legendary – one that is “incredibly rare and often very powerful Pokémon”?
| Column | Type | Description | Example Values |
|---|---|---|---|
| name | Character | The official name of the Pokémon. | Pikachu, Bulbasaur |
| type_1 | Categorical | The primary elemental type. Determines many battle strengths/weaknesses. | Water, Fire, Grass, Electric |
| type_2 | Categorical | The secondary elemental type, if applicable (often missing/NA for single-type Pokémon). | Flying, Poison, NA |
| hp | Numeric | Base “Health Points” indicating how much damage a Pokémon can take before fainting. | 35, 60, 100 |
| attack | Numeric | Base Attack stat. Affects damage dealt by Physical moves. | 55, 82, 134 |
| defense | Numeric | Base Defense stat. Affects damage received from Physical moves. | 40, 80, 95 |
| sp_atk | Numeric | Base Special Attack stat. Affects damage dealt by Special moves (e.g., Flamethrower). | 50, 90, 120 |
| sp_def | Numeric | Base Special Defense stat. Affects damage received from Special moves. | 50, 85, 125 |
| speed | Numeric | Base Speed stat, determining which Pokémon moves first in battle. | 35, 100, 130 |
| generation | Integer or Factor | Numerical indicator of the game generation the Pokémon was introduced (1, 2, 3, etc.). | 1, 2, 3 |
| legendary | Boolean | Indicates if the Pokémon is Legendary (TRUE/FALSE, 1/0). | FALSE, TRUE |
| total | Numeric | Sum of all base stats (HP + Attack + Defense + Sp. Atk + Sp. Def + Speed). | 320, 540, 680 |
| height | Numeric | Pokémon’s approximate height (units vary by dataset, often meters). | 0.4, 1.7, 2.0 |
| weight | Numeric | Pokémon’s approximate weight (units vary by dataset, often kilograms). | 6.0, 90.5, 210.0 |
| early_gen | Numeric | Whether or not a Pokemon is 1st or 2nd gen | 1, 0 |
Loading, setting up
Fit model – we’ll just use three variables to begin with a very simple model - how do several variables relate to a Pokemon being 1st or 2nd gen relative to 3rd-6th
Interpret fit statistics, coefficients and standard errors, and p-values
Our aim: How well can we predict whether a Pokemon is legendary – one that is “incredibly rare and often very powerful Pokémon”?
Engineer features and specify recipe
Set model and workflow
Loading, setting up
Split data
Define and train model