Plant Growth NN Regression Model

0.0(0)
studied byStudied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/24

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 1:04 PM on 2/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai

No analytics yet

Send a link to your students to track their progress

25 Terms

1
New cards

The line of code np.random.seed(42) ensures that the sequence of pseudo-random numbers generated is the same every time the code is run.

What does the number 42 represent?

A seed value for the random number generator.

2
New cards

The function np.linspace(0,40,500) is used to generate the independent variable in this code.

What does this function specifically do?

Generates 500 evenly spaced numbers over the closed interval [0, 40].

3
New cards

In the line growth = -0.1 * (temp - 25) ** 2 + 50 + np.random.normal(0,5, size=temp.shape),

what does the term np.random.normal(0,5, size=temp.shape) add to the simulated data?

Random noise following a normal distribution with a mean of 0 and standard deviation of 5.

4
New cards

The operation temp = temp.reshape(-1,1) is a critical step before fitting the scikit-learn model.

What is the primary purpose of this reshaping?

To convert the 1D array into a 2D array with one column, as scikit-learn expects features in this format for a single feature.

5
New cards

The object model = LinearRegression() is instantiated from the sklearn.linear_model module.

What method of this object is called to train the model on the provided data?

model.fit()

6
New cards

After the model is trained, model.predict(temp) is used.

What does this method return?

The predicted growth values for each input temp value, based on the fitted linear model.

7
New cards

The metric calculated as the average of the absolute differences between the actual and predicted values is defined as:

Mean Absolute Error (MAE).

8
New cards

The metric mean_squared_error(growth, growth_pred) calculates the average of the squared differences.

Which of the following metrics is derived by taking the square root of this value to return to the original units of the target variable?

RMSE

9
New cards

The r2_score(growth, growth_pred) calculates a statistical measure that represents:

The proportion of the variance in the dependent variable that is predictable from the independent variable.

10
New cards

In the visualization block, plt.scatter(temp, growth, label='Actual Growth', alpha=0.6) creates a scatter plot. What does the alpha=0.6 parameter control?

The transparency (opacity) of the points.

11
New cards

The command plt.plot(temp, growth_pred, color='red', label='Predicted Growth (Linear Regression)') is used to add the regression line to the plot. What is the key characteristic of this line?

It is the line that minimizes the sum of squared vertical distances (errors) from all data points.

12
New cards

True or False:

The underlying true relationship between temp and growth in the data generation step is linear.

False

13
New cards

True or False:

The LinearRegression model from sklearn.linear_model is used to fit a straight line to the data.

True

14
New cards

True or False:

The code calculates four distinct error/performance metrics: MAE, MSE, RMSE, and R² Score.

True

15
New cards

True or False:

The r2_score can range from -1 to 1.

False

16
New cards

True or False:

In the plotting commands, plt.xlabel('Temperature') and plt.ylabel('Growth') set the labels for the Y-axis and X-axis, respectively.

True

17
New cards

True or False:

The model.fit() function takes the dependent variable (growth) as its first argument and the independent variable (temp) as its second argument.

False

18
New cards

True or False:

The RMSE value will always be greater than or equal to the MAE value for the same set of predictions.

True

19
New cards

True or False:

The command plt.grid(True) adds a horizontal and vertical grid to the plot for easier reading.

True

20
New cards

The library imported as np that provides support for arrays and numerical operations is __.

NumPy

21
New cards

The library imported as plt that is used for creating visualizations is __.

Matplotlib

22
New cards

The specific class imported from sklearn.linear_model to perform the regression is __.

LinearRegression

23
New cards

From sklearn.metrics, the three specific functions imported to calculate error metrics are mean_absolute_error, r2_score, and __.

meansquarederror

24
New cards

The mathematical operation used to calculate rmse from mse in the code is the __.

square root

25
New cards

The figure size for the plot is set to a width of 8 inches and a height of __ inches using plt.figure(figsize=(8, 6)).

6