Lab Exercises )

Recommended reading from Statistics, Data Mining, and Machine Learning in Astronomy ("SDMML") and Numerical Recipes ("NR"):
 
NR: 10.8


Exercise 1.

Regressing a little bit: Below is code to genrate data on the basis of a quadratic function.

      n= 10000
      x = np.random.permutation(np.linspace(0,1,n))
      a = np.array([5.0,-5.0,10.0])
      X = np.array([np.ones(n),x,x*x]).T
      Xlin = np.array([np.ones(n),x]).T    
      y = np.dot(X,a) + np.random.normal(0.0,1,n)
Plot these data points, x versus y. Then, with all points, train sklearn's "multilayer perceptron" with X and y with MLPRegressor. Find a best-fit curve in this way. Repeat with y as the target but Xlin as the input array (domain).

Exercise 2.

Minimize z=2*x0-x1, given that x0>1, x1>0, 3*x0-2*x1<7 and 2*x0+x1<10. Make a plot to illustrate your solution.