Skip to content
CampusEduX

Problem 2: Predict New Values

Easypython
Learn the Concept: Linear Regression

Problem Description

Write a Python program that trains a Linear Regression model and then uses it to predict the output for 3 new, unseen input values.

Input

Training data (X, y), and 3 new input values to predict.

Output

The predicted values for the 3 new inputs.

Constraints

  • None specific.

Example Input

text
X = [[1],[2],[3],[4]], y = [3,5,7,9], new_values = [[5],[6],[7]]

Example Output

text
Predictions: [11. 13. 15.]

Concepts Covered

.predict().

Related Problems

  • Problem 1: Fit a Simple Linear Regression Model
    Easy · python
    Solve Problem
  • Problem 3: Evaluate Model Fit with R² Score
    Easy · python
    Solve Problem
  • Problem 4: Visualize the Regression Line
    Easy · python
    Solve Problem

Input (stdin)

Output

Run your code to see output here...