Posts

Showing posts with the label machine learning

Python Numpy Tutorial #2

Image
In our last tutorial, we talked about numpy arrays. If you have not read it, visit  here.   In this post, we will deeper into numpy and talk a bit about the various tools it provides us.  At first, we will see how arithmetic operations work in numpy arrays and the numpy universal functions, ending this tutorial with broadcasting. Array Maths: Basic element-wise addition, subtraction, multiplication, and division can be done in this way : import numpy as np x = np . array([[ 1 , 2 ],[ 3 , 4 ]]) y = np . array([[ 5 , 6 ],[ 7 , 8 ]]) print (x + y) #element-wise addition print (x - y) #element wise subtraction print (x * y) #element-wise multiplication print (x / y) #element-wise division #For all these operations, the first operand will be from x and the second operand from y The output will be an array of the operation on the two vectors. The dot product of two matrices can be calculated in the following way: import numpy as np x ...

Python Numpy Tutorial #1

Image
Numpy is the major library for scientific computing in Python.NumPy enriches the programming language Python with powerful data structures for efficient computation of multi-dimensional arrays and matrices. If you are familiar with Octave or Matlab, you will find this tutorial easy. NB: Numpy can be imported using import numpy as np  Arrays : You can create an array as follows: a = np . array([ 1 , 2 , 3 , 4 ]) #creates a 1x 4 array b = np . array([[ 1 , 2 , 3 ],[ 1 , 2 , 3 ]]) #creates 2x3 array Along with the array, some important parameters taken by np.array ()  are:    1. dtype: It helps you to pass the desired datatype of the array. The       permitted  datatypes are -> int8, int16, int32, int64, float16, float32, float64, complex64 and complex128. Int is for integers, float can store real numbers and complex can store complex numbers. The number represents the bit of data stored...

Machine Learning : Regression Analysis #1

Image
Introduction If you are aspiring to become a data scientist, regression will be the first algorithm you will learn.  It is one of the most well known and easiest algorithm in machine learning.  Learning about regression analysis would not only help you to clear job interviews but also to solve real-world problems. This article would mainly focus on Linear Regression, which is a form of regression. What is Regression? Regression is a statistical technique which is used to predict continuous dependent variable given a set of independent variables. Regression Analysis takes certain criteria(we will discuss in another post) to work properly. However, if the criteria are met, the algorithm gives splendid results. Mathematically, linear regression is a function in the form, y = a0 + a1x1 + a2x2+....aNxN   where y is the dependent variable,            x1,x2,x3...xN are the independent variable or features wit...