RMSE Practice Problem
This data science coding problem helps you practice Evaluation Metrics, rmse, and implementation skills. Read the problem statement, write your solution, and strengthen your understanding of Evaluation Metrics.
- Problem ID: 18
- Problem key: 18-rmse
- URL: https://datacrack.app/solve/18-rmse
- Difficulty: easy
- Topic: Evaluation Metrics
- Module: Introduction to Machine Learning
Problem Statement
## 🧩 Compute Root Mean Squared Error (RMSE)
### 🎯 Goal
Compute the Root Mean Squared Error (RMSE) for a regression model.
---
### 📥 Input / 📤 Output
**Input**
- `y_true` (`list[float]`): true target values
- `y_pred` (`list[float]`): predicted values
**Output**
- `float`: the RMSE value
---
### 💻 Task Description
1. Compute the Mean Squared Error (MSE)
2. Take the square root of the result
3. Return the RMSE
RMSE has the **same units as the target variable**.
---
### 🧩 Starter Code
```python
import numpy as np
def root_mean_squared_error(y_true, y_pred):
pass
````
---
### 💡 Example
```python
y_true = [3, -1, 2]
y_pred = [2, 0, 2]
root_mean_squared_error(y_true, y_pred)
```
**Expected Output**
```
0.81649658
```
---
Starter Code
import numpy as np
def root_mean_squared_error(y_true, y_pred):
pass