Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE USE PYTHON Now we'll create some artificial data to practice on. We're generating the data by adding noise to the usual square root function.

PLEASE USE PYTHON image text in transcribed

Now we'll create some artificial data to practice on. We're generating the data by adding noise to the usual square root function. The noise is sampled from a normal distribution. import numpy as np import matplotlib.pyplot as plt x = np.linspace( 0,50,50) ## The domain N 30 ## 30 sample points np. random . seed(22) # so we get the same random stuff shuff np.random.permutation(len(x)) x-pts-sorted (x(shuff][:N]) ## Pick N polnts at random from the domain f-np.sqrt #The target function (no noise yet) sigma 1/2 noise-np. randon . randn (N) *sigma ## Noise sampled from the normal distribution with sd-sigma f-noisy f(x-pts) noise Noisy data - + plt.plot(x,f(x),label-"target",c-'blue' plt.plot (x-pts,f-noisy, 'o', label-"noisy target ",alpha#0.8,c-'orange') plt.legend) plt.show) Now we'll create some artificial data to practice on. We're generating the data by adding noise to the usual square root function. The noise is sampled from a normal distribution. import numpy as np import matplotlib.pyplot as plt x = np.linspace( 0,50,50) ## The domain N 30 ## 30 sample points np. random . seed(22) # so we get the same random stuff shuff np.random.permutation(len(x)) x-pts-sorted (x(shuff][:N]) ## Pick N polnts at random from the domain f-np.sqrt #The target function (no noise yet) sigma 1/2 noise-np. randon . randn (N) *sigma ## Noise sampled from the normal distribution with sd-sigma f-noisy f(x-pts) noise Noisy data - + plt.plot(x,f(x),label-"target",c-'blue' plt.plot (x-pts,f-noisy, 'o', label-"noisy target ",alpha#0.8,c-'orange') plt.legend) plt.show)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

LO14.3 Organize and gather content for a preview, view, and review.

Answered: 1 week ago