Python 1st time in a very long time. I’m going to explain how to prepare for Data Science or Machine Learning by using my personal preference. 1st Time :- I was not that good at Maths. I used this language as my second Language. My mother taught me python by asking us all the basic python programming questions. We made each other work ( I had no idea about maths ).I don’t really know what all “Data Science =” because it is just so vague. I feel like I didn’t have any proper learning technique because I was always coding for myself. So when you call someone an AI, just because he or she was able to solve all your complex calculus problems, doesn’t mean he or she can actually do data science. Python, Numpy and Pandas are the most important tools I have learned, I am also going to show you how to develop these programs in future posts. 2nd Time :- Machine Learning & Statistics are the areas I need more exposure of. The first thing should be the basics ( Linear Regression, Logistic Regression etc.) and then it is not difficult to apply machine learning by adding some more features without much difficulty. 3rd or 4th Time :- This language will help you get better understanding of probability and stats which is necessary to take part in life. So we can talk about everything with our hands. 4th Time :- I believe if you make your mother, your self and then everyone else understand mathematics,you can become a great scientist. 5th to 6th Time :- Finally I would say the computer is still far from being perfect but you can use your knowledge to get things done. 7th time :- You are very confused, but you can do maths using all tools. 8th Time :- You are able to build a calculator with python language by yourself just by reading few lines. It can work in your laptop too. 9th to 10th Time :- Now you have to put your program on github. This is something which I started doing. There will be two parts of it. First I will try to figure out how to set up a simple script on Github. Part 1. https://github.com/akkad/python_for_data_science.git The Second Part will be a notebook. So what are you going to do? 1. Create a folder in your machine ( I’ll upload it here). 2. I’ll create a file for python code called “Data-Science”. 3. Download and install git for windows and GitHub. 4. Add your code in git repo, and start git push. Wait till the process finishes and let me test on github. 5. Run git pull, there will be a file to download and extract.I am not sure but it will be called “Python code”. 6. run git commit, ‘Python code’ is ready. 7. I will now push my python code to github and gitHub. 8. run git push command, git will check if my branch has been pushed successfully. If yes, git will send back the new branch to my machine and i will accept it. Otherwise, git will ask me why my branch has been pushed. Let’s go through this step by step. 9. push my branch to github. 10. If successful run git status to see the branches. 11. In my case, git push command has not failed in case of mine. So it only tells me as to the changes are fresh. 12. Now i need to change my github username and password, there is no sign that it will change anytime soon. Thus if we have tools that will allow us to manipulate these arrays of numbers, we can manipulate the image. The numpy library can be particularly useful here, so let’s try that out using numpy array slicing. Notice that the default behavior of the imshow function appended row and column numbers that will be helpful to us as we try to address individual or groups of pixels. First let’s load another copy of our eight, and then make it look like a zero. To make it look like a zero, we need to change the number underlying the centremost pixel to be 1. With the help of those row and column headers, at this small scale we can determine the centre pixel is in row labeled 2 and column labeled 1. Using array slicing, we can then address and assign a new value to that position. Code zero = skimage.io.imread(fname="data/eight.tif") zero[2,1]= 1.0 """ The follwing line of code creates a new figure for imshow to use in displaying our output. Without it, plt.imshow() would overwrite our previous image in the cell above """ fig, ax = plt.subplots() plt.imshow(zero) print(zero) Output [[0. 0. 0.] [0. 1. 0.] [0. 1. 0.] [0. 1. 0.] [0. 0. 0.]] Even More Colours This is all well and good at this scale, but what happens when we instead have a picture of a natural landscape that contains millions of colours. Having a one to one mapping of number to colour like this would be inefficient and make adjustments and building tools to do so very difficult. Rather than larger numbers, the solution is to have more numbers in more dimensions. Storing the numbers in a multi-dimensional matrix where each colour or property like transparency is associated with its own dimension allows for individual contributions to a pixel to be adjusted independently. This ability to manipulate properties of groups of pixels separately will be key to certain techniques explored in later chapters of this lesson. To get started let’s see an example of how different dimensions of information combine to produce a set of pixels using a 4 X 4 matrix with 3 dimensions for the colours red, green, and blue. Rather than loading it from a file, we will generate this example using numpy. For Example #set the random seed so we all get the same matrix pseudorandomizer = np.random.RandomState(2021) #create a 4 X 4 checkerboard of random colours checkerboard = pseudorandomizer.randint(0,255,size=(4,4,3) ) #restore the default map as you show the image fig, ax = plt.subplots() plt.imshow(checkerboard) #display the arrays print(checkerboard) Output [[[116 85 57] [128 109 94] [214 44 62] [219 157 21]] [[ 93 152 140] [246 198 102] [ 70 33 101] [ 7 1 110]] [[225 124 229] [154 194 176] [227 63 49] [144 178 54]] [[123 180 93] [120 5 49] [166 234 142] [ 71 85 70]]]
For those who want to read it, please comment below.