Pattern : 7 Qs ( SQL+Python )
A healthcare research team wants to predict the quantitative measure of disease progression values in diabetes patients using baseline medical variables. Use the Diabetes dataset available in scikit-learn to build and evaluate a Linear Regression model.
Dataset:
Use:
from sklearn.datasets import load_diabetes
The dataset contains ten baseline variables, including age, sex, body mass index, blood pressure, and blood serum measurements.
Task:
Write a Python program that performs the following steps:
Load the Diabetes dataset using load_diabetes().
Separate the dataset into:
Feature matrix X
Target vector y
Read one integer random_state from standard input.
Split the dataset into training and testing sets using:
test_size=0.2
random_state equal to the input value
Train a LinearRegression model using the training data.
Predict disease progression values for the test set.
Calculate the Mean Squared Error between actual and predicted values.
Print the Mean Squared Error rounded to exactly six decimal places.
Constraints:
0 <= random_state <= 10000
Note: Do not print any extra text or labels
Input Format:
A single integer random_state
Output Format: Print one floating-point value: the Mean Squared Error rounded to six decimal places.
Sample Input:
42
Sample Output:
2900.193628
BNY • Pending