Answered step by step
Verified Expert Solution
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 : Python Programming
Assignment : Karate Club
This assignment needs the file "karateclubinteractions.txt on the DL
Load this file into a Python variable through command nploadtxt seen in class. This will result in a binaryvalued Numpy D array, which shows the interactions among members of a Karate club, such that if the th element of the D array is one, the the th and th members had an interaction eg a fight otherwise they did not. Note that such relationship is symmetric the fact that the th member had an interaction with the th member readily implies that the th member also had an interaction with the ith member Verify this symmetry by means of Numpy tools ie 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 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 ith member could be retrieved by means of either the ith row or the ith 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 threeminute 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 D 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 DL 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started