Python Numpy Random Array

preview_player
Показать описание


This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.





RANDOM ARRAY

In this video let me show you some examples of how to create random matrices in python.

We import numpy as np and random

If we want to change the value range, we can multiply by twice the value desired and then subtract the value desired from the end

So if we want entries between -5 and 5 we multiply by 10 and minus 5.

So if you think about it this way, the max number it could be is 10 - 5 = 5 and the min number it could be is 0 - 5 = -5

So if we want entries between -100 and 100 we multiply by 200 and minus 100.

So if you think about it this way, the max number it could be is 200 - 100 = 100 and the min number it could be is 0 - 100 = -100

There you have it, that is how you create random arrays in python

#PythonMarathon #LearnPython #PythonTutorial
Рекомендации по теме
Комментарии
Автор

This playlist is gold!! Understanding numpy is a key thing for machine learning in my opinion.

imdadood
Автор

Love you, but you could explain more generally by saying for an interval [a, b] as the range
(a-b)*np.random.random((nrows, ncolumns)) - b
So if we want the range from -3 to 13 we can say 13-(-3)= 16
16*np.random.random((nr, nc))-3

mustafaameen
Автор

good tutorial but the mic is bothersome

PiggyTeam_Real