In machine learning and statistics, logistic regression is a tool used frequently to create models to summarize the probability of a certain class or event existing. This could be win or lose, pass or fail and many more. Logistic regression is often confused with linear regression, however, they have distinct differences. Linear regression is used to predict trends in data and create models through a “line of best fit”, also calculating sources of errors within the predictions.
I published Machine Learning article with video. Read the article here:
Linear Regression is a machine learning concept which is a form of supervised learning that uses labelled input and output data. Through linear regression, we are able to construct a model to create predictions based on a dataset and calculate sources of error in our prediction. Machine learning concepts covered in this video include the mathematics of linear regression, machine learning and regression using python and its libraries, and analyzation of datasets with python.
I published Machine Learning article with video. Read the article here:
Python is a very commonly used versatile language. It has many purposes, and one of the many applications of python includes building weather predicting software, which I am going to review the steps I took to create it.
When I type in different values for the humidity, the overall scene of my image will change. I have made this work using a python concept called if-else statements.
Along with a start function at the top to initialize my software, you can see that there are three functions below it. These are the addHeading, addBackground, and playMusic functions which I have called. These are all built-in functions that all have purposes. I have also created a variable called birdSound. The first function is called addHeading, and it essentially will add a heading. I have given it a string of “The Mountain” and a heading size of 50.
The second function is called addBackground which I have essentially created to add my background. This string over here which acts as the value was essentially the image jpg and that just added the background.
I have also created a variable called birdSound where I assigned it to an mp3 file in order to provide music to my project.
I also created a function called playMusic where I essentially give it a value of the variable birdSound, and this built-in function initializes the sound and starts it playing.
Next, I have a variable called humidity and have made a prompt where I have assigned that variable. This prompt is basically what pops up when I display this project, so it can take in a user input for this humidity.
After this I have defined a function which is what this def is representing, and have named the function addRaindrop. This is what I did to make raindrops fall.
So along with adding an addRaindrop function, I have also given it values of x y and speed, which I will later be using to actually implement my raindrops.
I have created a variable or element raindrop where I have given the image file as well as the size and have positioned the element raindrop with its respective x and y coordinates.
Finally, the function move y allows me to control how the raindrop falls down my screen. I have put an x value of 0 because I only want vertical movement down for the raindrop. The 900 represents how quickly I want the raindrop to fall down the screen, and the larger the number, the more time it will take for the raindrop to fall. I have then put here a string of infinite because I want the raindrops to fall an infinite amount of times. I’ve just given this a Boolean value of false to make sure the raindrops only go in the downward direction, because otherwise if I take this out or change it to true, the code will think you want the raindrops to move up and down.
The first line of the if statement says that if the humidity is greater than 50 and less than or equal to 100, an image of a cloud with this filename and this size should be added. Notice that it says greater than 50 and less than or equal to 100, so therefore from this we know that if we type in a number between 50 and 100 50 not included, we should get a cloud.
Now this line says Elif the humidity is less than 50, a picture of a sun with this image file and this size should appear.
Elif the humidity is equal to 50, a picture of a sun and cloud should appear demonstrating that it is partly cloudy.
And finally elif the humidity is just greater than 100, all these raindrops which I have added with this addRaindrop function should appear, with its corresponding x, y, and speed values, which is why as you can see all these raindrops are at different positions and are going at different speeds.
As usual, if you have any questions, or requests for new and interesting STEM topics, please feel free to contact me!
Coding is a concept which is used for communicating with computers, which consists of essentially writing code which acts as instructions so computers may perform certain tasks. Just as we can communicate in certain languages as humans, we are able to communicate with computers the same way using programming languages. One of the primary languages in computer coding is python, which is what today's demonstration of my coding project is based on.
Python is one of the world's most popular programming languages, as it is versatile and is used to create a variety of aspects which correlate with real life, including many popular online apps and forms of social media such as Instagram, Netflix, and Google. With the aid of python as the primary programming language for my project, I have developed it. The final result of this project when displayed is a variety of spaceships floating in a scene, and I have demonstrated all the steps I have taken in order to add my spaceships, as well as position and animate them using the python programming language. This project is a larger one, which consists of multiple files including HTML and CSS files, where other code such as keyframes and CSS are written which I will demonstrate in another STEM blog. However, in this coding blog, the primary concepts which have been covered in my demonstration include how I have specifically used python to incorporate aspects such as functions, strings, variables, and Booleans into my code.
By first calling a built-in function, and adding values in it, I was able to both adjust the size and displayed text in my project, which was added using a string. In order to change the size of my spaceships, as well as establish a position, I then created variables which I named shipSize, top, left, isEngineOn, and nameOfShip, giving all of these variables’ values. shipSize represents the size of my spaceships, top represents how many pixels from the top the spaceship will be positioned at, left represents how many pixels from the left the spaceship will be positioned at, nameOfShip is how you identify that all spaceships will be the same in terms of dimensions (given a string of arc) and finally, isEngineOn represents whether the ship will be animated or not (given a Boolean value of true).
By then creating another function to add spaceships (named addSpaceship), I added more spaceships, changing the values of top and left (to change the positioning of each spaceship), keeping all other variables constant for each spaceship added.
Although at times, this may look daunting, do not get discouraged! This is a very easy concept to learn, and there are a lot of great resources which are very helpful and useful! University of Waterloo has a great free course on python programming, which is very easy to follow along- especially for beginners who are getting into coding for the first time! This helpful resource can be found here.
Per usual, if you have any questions regarding my work, STEM topics in general, or requests for other interesting STEM topics you would like to see next, feel free to contact me at Coding For Young Minds Community Organization!
Arya Peruma is passionate about making STEM education more inclusive for the underrepresented.