{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Homework Assignment #4 (Individual)\n", "## Graph theory and Regression models" ] }, { "cell_type": "markdown", "metadata": {},...

1 answer below »
(parts 1 & 2 of the assignment can be skipped, MLA referencing not needed)


{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Homework Assignment #4 (Individual)\n", "## Graph theory and Regression models" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "###


✅ Put your name here.

\n", "###


✅ Put your _GitHub username_ here.

" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\\n", "\n", "### Goal for this homework assignment\n", "By now, you have learned a bit about graph theory and regression models. In this assignment, you will practice:\n", "\n", "* Building and analyzing a directed graph\n", "* Performing linear regression\n", "* Performing multiple regression\n", "* Exploring the nature of overfitting data\n", "\n", "**This assignment is due roughly two weeks from now at 11:59 pm on Friday, November 12.** It should be uploaded into the \"Homework Assignments\" submission folder for Homework #4. Submission instructions can be found at the end of the notebook. **There are 57 standard points possible in this assignment with 8 additional bonus points possible. The distribution of points can be found in the section headers**.\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "## Part 1: Add to your Git repository to track your progress on your assignment (2 points)\n", "\n", "As usual, for this assignment, you're going to add it to the `cmse202-f21-turnin` repository you created in class so that you can track your progress on the assignment and preserve the final version that you turn in. In order to do this you need to\n", "\n", "**✅ Do the following**:\n", "\n", "1. Navigate to your `cmse202-f21-turnin` repository and create a new directory called `hw-04`.\n", "2. Move this notebook into that **new directory** in your repository, then **add it and commit it to your repository**.\n", "3. Finally, to test that everything is working, \"git push\" the file so that it ends up in your GitHub repository.\n", "\n", "**Important**: Make sure you've added your Professor and your TA as collaborators to your \"turnin\" respository with \"Read\" access so that we can see your assignment (you should have done this in the previous homework assignment)\n", "\n", "**Also important**: Make sure that the version of this notebook that you are working on is the same one that you just added to your repository! If you are working on a different copy of the noteobok, **none of your changes will be tracked**!\n", "\n", "If everything went as intended, the file should now show up on your GitHub account in the \"`cmse202-f21-turnin`\" repository inside the `hw-04` directory that you just created. Periodically, **you'll be asked to commit your changes to the repository and push them to the remote GitHub location**. Of course, you can always commit your changes more often than that, if you wish. It can be good to get into a habit of committing your changes any time you make a significant modification, or when you stop working on the project for a bit.\n", "\n", "✅ **Do this**: Before you move on, put the command that your instructor should run to clone your repository in the markdown cell below." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "``` bash\n", "# Put the command for cloning your repository here!\n", "\n", "```" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "## Part 2: Add a README file to your repository (2 points)\n", "\n", "If you've been keeping up with this class, your `cmse202-f21-turnin` repository should now have a lot of files. Repositories with a large number of files can be confusing to anyone who happens to stumble across it. As such, many GitHub repositories have README files which give a summary of the repository's content. \n", "\n", "✅ **Do this**: Create a new file called `README.md` in the main `cmse202-f21-turnin` directory. Edit the `README.md` file with information describing this repository and what files are currently in it (including this notebook). Add `README.md` to your git repository. When you go to your GitHub repository on the web, you should see this README markdown file rendered on the \"home page\" of your repository." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "### 🛑 STOP\n", "**Pause to commit your changes to your Git repository!**\n", "\n", "Take a moment to save your notebook, commit the changes to your Git repository using the commit message \"Part 2 complete\", and push the changes to GitHub.\n", "\n", "---" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "---\n", "## Part 3: Graph theory for Sports (24 points)\n", "\n", "In this part of the homework, we will look at data from all NCAA football games between teams in Division I-A during the first nine weeks of the 2021 season. We will model this as a directed graph where each team is a node, and for every game we will put a directed edge from the winning team to the losing team. \n", "\n", "*Technical notes*: For purposes of this homework problem, we are ignoring all games in which one or both teams are in divisions below I-A. We are also ignoring any games that happen after this homework was released. Also, `\"Hawaii\"` has played and beaten `\"New Mexico St.\"` twice this season, but this shouldn't drastically affect any of what you'll need to do in this problem." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "✅ **Question 3.1 (3 points)**: For convenience, you are provided with a file called `NCAA_Football_Scores_2021.csv`, which you can download from here: \n", "\n", "`https://raw.githubusercontent.com/msu-cmse-courses/cmse202-F21-data/main/data/NCAA_Football_Scores_2021.csv`\n", "\n", "Each row contains the final score from one game. The first and third columns contain the names of the \"away team\" and the \"home team\" respectively. The second and fourth columns contain the number of points that the \"away team\" and the \"home team\" scored respectively. \n", "\n", "**Do This:** Load the data in this file into a `Pandas` dataframe, and **give the columns appropriate titles**. Display the first few and last few rows of the dataframe. You may also display the 429th row (0-indexed) if it makes you happy, but this is optional." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Put your code for Question 3.1 here:\n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "✅ **Question 3.2 (5 points)**: Next, you will represent this data by creating a `DiGraph` object from the `networkx` package. For each row, add a directed edge from the node corresponding to the team with the larger score to the node corresponding to the team with the smaller score. " ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# Put your code for Question 3.2 here: \n" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "This graph has over 100 nodes, so it will be hard to look at the entire graph at once. But you can display a subgraph of the entire directed graph by running the cell below this one (**note**: you'll need to replace the \"`G`\" variable with whatever you called your `DiGraph` obejct). You should get an output that is similar to this. \n", "\n", "\" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "# DO NOT EDIT THIS CELL except for replacing the variable \"G\" with whatever you called your DiGraph object\n", "BigTen = {\"Illinois\":(0.97,0.22),\"Indiana\":(0.78,0.62),\"Iowa\":(0.43,0.90),\"Maryland\":(0.00,1.00),\"Michigan\":(-0.43,0.90),\n", " \"Michigan St.\":(-0.78,0.62),\"Minnesota\":(-0.97,0.23),\"Nebraska\":(-0.98,-0
Answered 1 days AfterNov 10, 2021

Answer To: { "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Homework Assignment #4...

Prasun Kumar answered on Nov 12 2021
114 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here