I’m starting my journey to learn about machine learning and with that I’m learning a new language. Python is one of the primary programming languages used for machine learning, which is part of the reason I chose it. Python is also a very popular programming language in general. Since I’m still fresh in my programming journey, I think it’s good first language to learn by myself outside of school.
Speaking of lists, I also worked on the basics of lists, which are called arrays in the programming languages, and tuples in Python. Most everything about the lists are similar to how arrays behave in other programming languages, but Python does have some cool attributes, which help me to understand why it’s the language of choice for most data scientist. You can “slice and dice” — my choice of words — arrays without using special functions. You can use a colon to select pieces of the array that you want; array[3:6] will return the values in the array from the 3rd index to the 6th index, non-inclusive of the 6th index, assuming the array has all of those indexes. Similarly, you can do array[:3] or array[3:], and you’ll get the values in the array from the beginning to the third index and the third index index to the last value respectively, inclusive of all values. Tuples are like a combination arrays and variable assignment but not really. Tuples are a collection of data which is ordered and unchangeable, written with parenthesis. For example, (x_values, y_values) = ([1,2,3],[-1,-2,-3]); the x_values equals the positive integers and y_values equals the negative integers.
You can use indexing to get the specific values in the x or y values, which can then be used to plot points on a graph using x and y coordinates from the values.
Now that I had a solid understanding of object and data types in Python, it was time to move to functions, conditionals, and loops. Functions are also similar to how they operate in ruby, so you can declare them with a “def” and function name follow by arguments in parenthesis if it takes any, then use a colon to close out defining the function name, press enter and then put what the function does. You hit enter again and the function is defined. You don’t have to type “end” to end the function, it just knows based on the empty space. The same is true for conditionals, they behave the same in ruby, but you end the conditional with a colon. Loops are similar but they’re slightly cooler, because you can just do for “i” in a range or list and it’ll loop through it. You see that here in for and while loops:
The last of the basics that I practiced with is modules, which behave similar to components in React. You just import the module you need and use the functions or import specific functions from the whole module. For example, the math module comes with a lot of math functions, such as power and square root. The modules will play a crucial part in my learning and using machine learning.
With the basics of python out of the way, I can know move on to the some of the more complicated pieces of machine learning.