Highlights
1) Using numpy sample 200 numbers from a uniform distribution and store it into variable x. Generate y data using x and injecting noise from the gaussian distribution (i.e. y = 12x-4 + noise). Using matplotlib plot the data samples, configuring axis so all samples are clearly visible. Split the data into training (80%) and testing (20%) sets using scikit-learn
Note:
- Ensure to set the random seed to reproduce same random number during different execution times.
- The randn() function in numpy can be used to sample from the gaussian distribution. While rand() function samples from the uniform distribution
1) Similar to part one, generate 200 data samples but this time adjust values of x to be in the range of -3 to 3. Plot the data and split into training and testing
2) Use Linear Regression on the generated data and plot the results. Discuss your findings.
3) Combine polynomial features of the generated data using scikit-learn’s Polynomial Features and fit combined features to a linear regression using the training dataset. Generate 100 samples between -3 to 3 with uniform interval that will be used to generate predictions from the fitted model (note: numpy.linespace can be used to generate evenly spaced numbers). Compare the model’s prediction with the ground truth by plotting the prediction as a line and the ground truth as data points on the same graph.
This Computer Science Assignment has been solved by our Computer Science experts at My Uni Paper. Our Assignment Writing Experts are efficient to provide a fresh solution to this question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing style.
Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered. You may continue to expect the same or even better quality with the used and new assignment solution files respectively. There’s one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turnitin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinctio.
© Copyright 2026 My Uni Papers – Student Hustle Made Hassle Free. All rights reserved.