Posts

Showing posts from May, 2022

Introduction to Python!

  We all have used calculators at university for math calculations, used GPS when we are located in an unknown place, asked our phone assistance to play some music from youtube, etc. But, do you know how all these wonderful things were created? Thanks to programming! Today, having knowledge of programming is very valuable no matter the background you have. It helps you better understand our today's technological world. There are several programming languages such as JavaScript, C++, Matlab, Python, and so on. All these languages use a similar syntax in terms of coding. If you have never heard about what programming is, or have heard about it, but never used any programming language before, I strongly recommend you to start with Python. Its simplicity will make you feel very comfortable and you will love coding.  On this page, I will show you some interesting and useful applications in Python. In case you have no knowledge of programming, I suggest you to go through the beginner'

Python Machine Learning: Linear Regression (II)

Image
 In the previous tutorial, you have learned how to build a linear regression using matrix multiplication (please go to  Python Machine Learning: Linear Regression (I) ). Now, in this tutorial, a Machine Learning Python library called scikit-learn will be used for this purpose.  Once we have imported the data from the text file, let's set our x- and y-values.  #Importing libraries import numpy as np #Importing text file data = np.loadtxt('points.txt', skiprows=(2), dtype=float) print(data) #Setting x values x = data[:,0] print(x) #Setting y values y = data[:,1] print(y) From the figure above (an extract of the whole data), we can notice that x and y are 1D array . If we want to work with the  scikit-learn  Machine Learning Python library, it is necessary to convert our 1D arrays into 2D. For this, the function reshape(-1,1) . #Reshaping the array into a vector-column x2 = data[:,0].reshape(-1,1) print(x2) #Reshaping the array into a vector-column y2 = data[:,1].reshape(-1,

Python Machine Learning: Linear Regression (I)

Image
Have you ever felt your phone hears your conversation? For example, you and your friend are talking about new shoes, and then when you pick your phone up, you get a bunch of ads about it? Or, when you watch a movie or series on Netflix, the next time you get recommendations of your taste?  Well, this all is possible thanks to Machine Learning! If you have not heard about it, let me explain it to you. Machine Learning is a very popular topic nowadays. It is a method to analyze data in analytical performance. Machine Learning helps humans with very complicated topics, such as forecasting bitcoin price. In machine learning, the AI model learns from data, analyzes it, and, then, establishes patterns to make future decisions. In this and in the following tutorials, you will learn the basics of Machine Learning using Python. In this tutorial, linear regression will be explained. Before we start coding, what is linear regression? Well, linear regression is an algorithm where the predicted val