Day 4 - Linear Regression Numpy code and Python course

Linear Regression Numpy code 

 We finished coding generating data for the numpy version of Linear regression.
We didn't use data from an excel sheet or a Kaggle dataset and hence we had to create our own data. For this, we created random integer data for our X and betas. Then we created a noise, as real data always has noise, using this we created Y data.

the code for the same was as follows:

import numpy as np
samplesize=1000
num_attrs= 3
step = 0.1

x_inputs = np.random.rand(samplesize,num_attrs-1)
x0 = np.ones((samplesize,1))
x_data = np.concatenate((x0, x_inputs), axis=1)

noise = np.random.randn(len(x_inputs),1) 

betas = np.random.rand(num_attrs,1)

y_true = x_data.dot(betas) + noise  #understand this
y_true.reshape(1000,1)

Python course

 We started an Udemy course on Python.
The concepts we covered today were:
  1. Pros and Cons of Dynamic Typing
  2. String Indexing and Slicing
  3. Various String Methods
  4. String Interpolation: 
          a) format()
          b) Float formatting
          c) Formatting with String literals
          d) Alignment, padding, and precision with format()

Comments

Popular posts from this blog

Day 1 - Numpy Revision

Week 18 (29/10/2018 - 02/11/2018)

Week 22 (26/11/18 - 30/11/18)