Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

DSC 4 3 0 : Python Programming Assignment 0 8 0 1 : Karate Club This assignment needs the file karate _ club _ interactions.txt

DSC 430: Python Programming
Assignment 0801: Karate Club
This assignment needs the file "karate_club_interactions.txt" on the D2L.
Load this file into a Python variable through command np.loadtxt seen in class. This will result in a binary-valued Numpy 2D array, which shows the interactions among members of a Karate club, such that if the (i,j)-th element of the 2D array is one, the the i-th and j-th members had an interaction (e.g., a fight), otherwise they did not. Note that such relationship is symmetric (the fact that the i-th member had an interaction with the j-th member readily implies that the j-th member also had an interaction with the i-th member). Verify this symmetry by means of Numpy tools (i.e., its transpose is the same as itself).
Write a function that takes an interaction matrix, extracts some information from it and prints them out. The function should first verifies symmetry of the input 2D array, and then answer the following questions. Note that the analysis should be fully based on Numpy methods and functions; no point will be given if a question is answered by any other means.
How many members did the Karate club have?
Print how many interactions each member of the club had. Interactions of the i-th member could be retrieved by means of either the i-th row or the i-th column of the loaded array. Either way would be fine for the purpose of this assignment.
What are indices of the least and most active members of the club? Did they have any interaction with them?
What is the average and STD of the number of interactions across all the members?
Record a three-minute video in which you run the code. Then, present your code. Specifically, answer the following questions:
Explain how you loaded the data and how you used Numpy to verify its symmetry.
Show how you obtained a Numpy 1D array that contains the number of interactions for each member.
Show how you took the average of the interaction numbers across the members.
Submission: Submit a single .py file containing all the code to the D2L. Do not zip or archive the file. Your code must include comments at the top including your name, date, video link, and the honor statement, "I have not given or received any unauthorized assistance on this assignment." Each function must include a docstring and be commented appropriately.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions