1.In this problem and the next one, we’re going to make a very simple spam checker program by just looking
...
ooking at how likely a given email is to be spam based on the words it contains. In particular, in this problem we’re going to count how often words are present in spam emails within some set of training data (which here means a set of emails that have already been marked as spam or not spam manually).
We have already started to write a function spam_score(spam_file, not_file, word), which takes in two filenames, along with a target word (a lowercase string). Both filenames refer to text files which must be in the same directory as hw07.py (we’ve provided several such files in hw07files.zip). The text files contain one email per line (really just the subject line to keep things simple) - you can assume that these emails will be a series of words separated by spaces with no punctuation. The first file contains emails that have been identified as spam, the second contains emails that have been identified as not spam.
Since you haven’t learned File I/O yet, we’ve provided code that opens the two files and puts the data into two lists of strings (where each element is one line - that is, one email). You then must complete the function, so that it returns the spam score for the target word. The spam score is an integer representing the total number of times the target word occurs across all the spam emails, minus the total number of times the word occurs in not-spam emails. Convert all words to lowercase before counting, to ensure capitalization does not throw off the count.
View More
3.dehydrated cobalt (ii) chloride
Be sure to include subheadings (see bold text below) formulas, and units.
Chemical Equation: Write a generic
...
units.
Chemical Equation: Write a generic chemical equation for the dehydration of cobalt (II) chloride ∙ x hydrate (include the state symbols of the reactant and two products). [T2]
Mass of Reactants and Products:
a) Calculate the initial mass of the hydrated cobalt (II) chloride. [T1]
b) Calculate the final mass of the anhydrous cobalt (II) chloride remaining in the cruiio8icible. [T1]
c) Calculate the mass of water given off by the sample of hydrated cobalt (II) chloride. [T1]
Moles of Products:
a) Calculate the moles of anhydrous cobalt (II) chloride remaining in the crucible. [T1]
b) Calculate the moles of water released from the hydrate. {T1]
4. Mole Ratio
a) Create an experimental mole ratio between the b) and a). [T1]
5. Formula of Hydrate: State the chemical formula you have determined for this hydrate.
Round the formula to the closest whole number value for x. [T1]
Discussion/Conclusion Questions: [T6]
Based on the chemical formula of the hydrate, calculate the percentage composition (percent by mass) of the hydrated cobalt (II) chloride. Remember to determine the percentage of each element (Co, Cl, H, and O). [T2]
A possible source of systematic error in this experiment is insufficient heating. Suppose that the hydrate was not completely converted to the anhydrous form. Describe how this would affect: the calculated percent by mass of water and the experimental molecular formula (i.e. would x be higher, lower or the same).
Suppose a student spilled some of the hydrated cobalt (II) chloride. Describe how this would affect the calculated percent by mass of water (would it be higher, lower or the same) and the experimental chemical formula of the hydrate. [T2]
View More
4.Weight loss: In a study to determine whether counseling could help people lose weight, a sample of people experienced a
...
eople experienced a group-based behavioral intervention, which involved weekly meetings with a trained interventionist for a period of six months. The following data are the numbers of pounds lost for 14 people, based on means and standard deviations given in the article. Assume the population is approximately normal. Perform a hypothesis test to determine whether the mean weight loss is greater than 20 pounds. Use the =α0.10 level of significance and the critical value method.
22.5 28.5 7.6 24.1 21.5 12.9 17.3
21.2 37.6 33.8 12.1 36.3 24.1 19.4
View More
5.You and your classmates decide to sell sweatshirts and T-shirts to raise money for a school trip. You decide that
...
u decide that you should sell at least thirty items, but do not want to exceed 120 items. Based on a small survey of students, you also decide that the number of T-shirts should be at least twice the number of sweatshirts.
A. Assign variables to the unknown quantities and write a system of inequalities that model the given restrictions.
B. Graph the system, indicating an appropriate window and scale and shading the feasible region.
C. Determine the vertices of the polygonal feasible region.
D. Assume the profit on each sweatshirt is $5 and the profit on each T-shirt is $2. What is the maximum profit you can obtain?
E. How many sweatshirts and how many T-shirts should you sell to maximize your profit?
View More
6.You are given a set of five and a set of seven contiguous boxes as shown in the figures above.
...
task is to move all the reds from the left to the right and all the blacks from the right to the left. The middlebox is empty to allow moves.
The moves follow strict rules.
Rule # 1: the reds can only move to the right and the blacks can only move to the left. No backward moves are allowed
Rule # 2: Equally applicable to the black and the reds, each dot can only move one step forward in the box in front of it is empty, and can skip the contiguous box is occupied by a different colored dot to the following box if empty.
While moving your pieces, carefully record all the moves you made. Start first with the 5-boxes set, then the 7-boxes set
Try the same rules for a 9-boxes set and then for an 11-boxes set. Record all your moves on paper
Examine all four cases and find a pattern that relates the number of moves to the number of dots. Explain how you arrived at this conclusion
Create a general formula that will give the number of moves based on the number of dots regardless of how many dots you have.
View More
8.Professor Maya was interested in maximizing student learning in all her classes. She decided the best way to do that
...
t way to do that would be to investigate her students’ test performance in a number of ways.
The first thing she did was separate her students’ test scores based on the time of day she held her lectures (morning vs evening). Next she recorded the type of test students were writing (multiple choice vs short answer). She selected a random sample of students from her morning (n = 6) and evening (n = 7) classes (total of 13) and recorded scores from two of their tests as shown below.
Morning
Evening
Multiple Choice
Short Answer
Multiple Choice
Short Answer
66
74
70
45
64
55
80
55
72
77
78
55
70
57
84
60
61
58
64
70
67
69
84
60
70
63
DATA Set 1:
Good morning sunshine. Is Time of Day important?
1. Prof. Maya recently read an article that concluded students retained more information when attending classes in the morning. Based on this finding she thought students in her morning class might have performed differently on their Short Answer test scores when compared to students in her evening class. Does the data support her hypothesis? [15 points]
Multiple Guess! Does Exam Type matter?
2. Prof. Maya also knew that students often did better on multiple-choice tests because they only have to recognize the information (rather than recall it). Given this, she thought students attending the morning class might perform differently on the Multiple-Choice test when compared to the Short Answer test. Does the data support her hypothesis? [15 points]
DATA Set 2:
We’ll try anything once. Does the new Tutorial Plan work?
3. Combining all of her students (and ignoring time of day), Prof. Maya asked her TAs to try a new – and very expensive - tutorial study plan. She then chose a random sample of 20 students to receive the new study plan and another sample of 30 to continue using the old study plan. Following an in-class quiz, she divided the students into 3 levels of achievement (below average, average, and above average), and then created the frequency table below. Does the new expensive tutorial study plan improve student performance? [15 points]
Below average
Average
Above Average
New plan
7
7
6
Old plan
6
15
9
DATA Set 3:
How are YOU doing?
4. Finally, Prof. Maya thinks that her 2018 class is doing better than her 2017 class did. She decided to collect a sample of test scores from the students in her course this year (combining all of the groups) and compare the average with her previous year’s class average. Does the data support her hypothesis? [15 points]
The 2017 class average = 63%
The 2018 sample size = 25
The 2018 sample standard deviation = 11
The 2018 sample average = use your actual midterm mark (yes, you the student reading this :)
Bonus: What does it all mean?
5. Bonus: IF Prof. Maya had complete control of how and when she ran her course in 2018, considering all the info you just found in the 3 data sets, write a brief statement of how you would recommend she set-up the course next year – and explain why. [5 points]
View More
9.Professor Maya was interested in maximizing student learning in all her classes. She decided the best way to do that
...
t way to do that would be to investigate her students’ test performance in a number of ways.
The first thing she did was separate her students’ test scores based on the time of day she held her lectures (morning vs evening). Next she recorded the type of test students were writing (multiple choice vs short answer). She selected a random sample of students from her morning (n = 6) and evening (n = 7) classes (total of 13) and recorded scores from two of their tests as shown below.
DATA Set 1:
Good morning sunshine. Is Time of Day important?
1. Prof. Maya recently read an article that concluded students retained more information when attending classes in the morning. Based on this finding she thought students in her morning class might have performed differently on their Short Answer test scores when compared to students in her evening class. Does the data support her hypothesis? [15 points]
Multiple Guess! Does Exam Type matter?
2. Prof. Maya also knew that students often did better on multiple-choice tests because they only have to recognize the information (rather than recall it). Given this, she thought students attending the morning class might perform differently on the Multiple-Choice test when compared to the Short Answer test. Does the data support her hypothesis? [15 points]
DATA Set 2:
We’ll try anything once. Does the new Tutorial Plan work?
3. Combining all of her students (and ignoring time of day), Prof. Maya asked her TAs to try a new – and very expensive - tutorial study plan. She then chose a random sample of 20 students to receive the new study plan and another sample of 30 to continue using the old study plan. Following an in-class quiz, she divided the students into 3 levels of achievement (below average, average, and above average), and then created the frequency table below. Does the new expensive tutorial study plan improve student performance? [15 points]
Below average
Average
Above Average
New plan
7
7
6
Old plan
6
15
9
DATA Set 3:
How are YOU doing?
4. Finally, Prof. Maya thinks that her 2018 class is doing better than her 2017 class did. She decided to collect a sample of test scores from the students in her course this year (combining all of the groups) and compare the average with her previous year’s class average. Does the data support her hypothesis? [15 points]
The 2017 class average = 63%
The 2018 sample size = 25
The 2018 sample standard deviation = 11
The 2018 sample average = use your actual midterm mark (yes, you the student reading this :)
Bonus: What does it all mean?
5. Bonus: IF Prof. Maya had complete control of how and when she ran her course in 2018, considering all the info you just found in the 3 data sets, write a brief statement of how you would recommend she set-up the course next year – and explain why. [5 points]
View More
10.Draw an Epicycloid graph based on the given integer values of s, a, b, and n, where b cannot be
...
onnect a line between every two consecutive points (xi, yi) and (xi+1, yi+1), where 0 <= i <= n.
xi = s * ((a + b) * cos (i * PI) - b * cos ((a + b) / b * i * PI))
yi = s * ((a + b) * sin (i * PI) - b * sin ((a + b) / b * i * PI))
Verify with s = 10, a = 19, b = 5, n = 1000 to get this displayed result.
Note that the sin and cos trigonometry functions accept a radiant value not angle. For example, 30 degree should be replaced with PI/180*30 instead. Moreover, the divisions inside the functions need to be kept in double not int precision in order to render a correct result.
View More