np.arange and np.linspace difference
# np.arrange allows you to define the stepsize >>> np.arange(0,1,0.1) #--> 0.1 is the stepsize or interval array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]) # np.linspace allows you to define how many values you get including the specified min and max value >>> np.linspace(0,1,11) #--> 11 no of values you need array([0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ])
Here is what the above code is Doing:
1. We are creating a numpy array of values from 0 to 1 with a stepsize of 0.1.
2. We are creating a numpy array of values from 0 to 1 with 11 values including 0 and 1.