Using the training and testing partitions created in question 3, create a decision tree model on your training data to predict the ”Outcome” variable using the rpart function. In your console, print the decision tree model just made and explain how to read the output and what each value means.

Decision Trees: A survey was sent to the employees of a large company to ask them the following questions:

  • Do you work in the data analytics department? (Y or N)
  • Are you above the age of 30? (Y or N)
  • Have you spent more than 5 years in this company? (Y or N)
  • Is your current gross income more than USD 50,000 per year? (Y or N)

The following table summarizes the responses to the survey. For each entry, “Number of Instances” represents the number of respondents having the corresponding values for the attributes Analytics

Department, Age>30, and Tenure>5.

Analytics Deparment Age>30 Tenure>5 Number of Instances of

  • Income > 50K
  • Number of Instances of
  • Income ≤ 50K
  • Y Y Y 25 0
  • N Y Y 15 0
  • Y N Y 10 5
  • Y Y N 0 0
  • N N Y 0 0
  • N Y N 25 15
  • Y N N 0 10
  • N N N 0 20

Given the data above, answer the following questions:

(a) Find support and confidence for the rule: if Analytics Department = Y Then Income > 50K

(b) Find support and confidence for the rule:

if Analytics Department = Y and Tenure > 5 Then Income > 50K

(c) Using the 1-rule method discussed in class, find the relevant sets of classification rules for the target variable by testing each of the input attributes Analytics Department, Age > 30, and Tenure > 5.

Which of these three sets of rules has the lowest misclassification rate?

(d) Considering Income>50K as the target variable, which of the attributes would you select as the root in a decision tree that is constructed using the information gain impurity measure?

(e) Use the Gini index impurity measure and construct the full decision tree for this data set.

2Exploratory Data Analysis: This exercise relates to the household income and expense dataset available on Blackboard as “Inc Exp Data.csv”. The data was taken from Kaggle and has 7 variables related to the income and expense details of households The following table defines the variables in the data: Variable Name Description

  • Mthly HH Income Monthly household income
  • Mthly HH Expense Monthly household expenses
  • No of Fly Members Number of family members
  • Emi or Rent Amt Rent or mortgage installment amount
  • Annual HH Income Annual household income
  • Highest Qualified Member Academic qualification of highest qualified family member
  • No of Earning Members Number of earning family members

Load the dataset into R and answer the following questions:

(a) How many rows and columns are in the dataset?

(b) Convert the variable “Highest Qualified Member” to a factor variable. Print the summary of dataset and explain the key points of the summary for “Mthly HH Income” and “Highest Qualified Member”.

(c) Calculate the mean and standard deviation of all numeric columns.

Hint: Use dplyr package to filter only numeric columns using the is.numeric filter and then generate summary statistics.

(d) Calculate disposable income of households as the difference between monthly income and expenses.

Plot a histogram of disposable income with 10 breaks.

Hint: Use the hist function and look at the help file for the “breaks” argument

(e) Construct a boxplot for monthly household income against the highest qualified member in a household. Your boxplots should be in the sequence illiterate, undergraduate, professional, graduate, post-graduate.

Hint: You may need to redefine the levels of the factor variable “Highest Qualified Member”. Use the levels argument in the factor command. Use the boxplot function. You should get 5 box plots in the same chart.

(f) For families with no more than 4 family members, calculate average monthly household income by highest qualified member using dplyr. Then, create a bar chart using ggplot2 demonstrating the same information.

Hint: Use chaining for dplyr filter, group by and summarize and pass it to the ggplot function.

3Logistic Regression This exercise relates to the diabetes dataset available on Blackboard as diabetes.csv.

It contains demographic and medical data for 768 females over the age of 21. The variables are defined below:

  • Variable Name Description
  • Pregnancies Number of times pregnant
  • Glucose Plasma glucose concentration a 2 hours in an oral glucose tolerance test
  • BloodPressure Diastolic blood pressure (mm Hg)
  • SkinThickness Triceps skin fold thickness (mm)
  • Insulin 2-Hour serum insulin (mu U/ml)
  • BMI Body mass index ((Weight (in kg))/(Height (in 𝑚2)))
  • DiabetesPedigreeFunction Diabetes pedigree function
  • Age Age (in years)
  • Outcome Class variable (0 if no diabetes, 1 if individual has diabetes)

Answer the following questions:

(a) Load the data into R. Print the structure of the dataset and explain the output.

Hint: Use the read.csv and str commands. This can be done in 2 lines of code.

(b) Convert the variable Outcome into a factor variable. Print the frequency distribution of the Outcome variable using the table command and explain what it means.

Hint: Use the as.factor and table commands. You only need two lines of code for this.

(c) Create your training set with a random selection of 70% of the rows in the dataset and your testing set with the other 30%. Use seed value 123 for this randomization. Print the frequency distribution of the outcome variable in both train and test data. Are the two datasets similar in terms of the distribution of the outcome variable? Explain.

Hint: You can use the sample command for the split. You will also need the set.seed command.

(d) Train a logistic regression model on the training dataset. How many of the variables are significant?

Hint: Use the glm and summary commands to for this part.

(e) Generate predictions on the testing dataset using the model produced through logistic regression in step 5. Report the confusion matrix of your logistic regression model on the train set when the threshold is set to 0.25. Compute the accuracy, true positive rate, and false positive rate for the model.

Hint: You can use predict function for generating testing predictions, an ifelse command to create binary predictions, and table to create a confusion matrix. This should take only 3 lines of code.

(f) Generate ROC plots and precision recall plots for both, the training and the testing dataset. Report the area under the curve and also attach the plots in your final submission. Provide brief explanations of what each curve and their respective AUCs represent.

Hint: Use the ROCR library.

(g) An individual displays the following traits: pregnancies = 1, glucose = 130, blood pressure = 80, skin thickness = 22, insulin = 100, BMI = 25, diabetes pedigree function = 0.5, age = 50. According to your final model, what is the probability that the individual has diabetes? Show your working.

Note: This is a manual calculation. Do not do this part with R. You can round the coefficient estimates to 2 decimal places for ease of work.

 

Decision Trees: Following the steps defined below, create a decision tree model to predict whether an individual has diabetes:

(a) Using the training and testing partitions created in question 3, create a decision tree model on your training data to predict the ”Outcome” variable using the rpart function. In your console, print the decision tree model just made and explain how to read the output and what each value means.

You don’t have to explain every node. Just a few terminal nodes to show you understand how to interpret the output.

Hint: Use the rpart library for this part.

(b) There are some parameters that control how the decision tree model works. These can be accessed in the help file of rpart. Create a decision tree model where every terminal node has at least 25 observations. Do you notice any difference between this model and the model created in part (6) above? Explain.

Hint: Type ”?rpart” to bring up the help file and scroll down to controls. You will see a hyperlink titled ”rpart.control”. Click on the hyperlink and read the help file.

(c) Plot the decision tree model obtained in part (b) of this question using rpart.plot.

(d) Predict the probability of having diabetes for each observation in both training and test data. Create the ROC plot and precision recall curves and report the area under the curve for all curves.

Hint: You can use the predict function and ROCR library as in Q2.

(e) Compare the output of part (d) of this question to part (f) of question 3. Which model is better? Why?

(f) An individual displays the following traits: pregnancies = 1, glucose = 130, blood pressure = 80, skin thickness = 22, insulin = 100, BMI = 25, diabetes pedigree function = 0.5, age = 50. According to your final model from part (4) above, what is the probability that the individual has diabetes? Explain.

What is the difference between maskable and nonmaskable interrupts? Write an assembly language instruction to set the Global Interrupt Enable (GIE) bit. When more than one maskable interrupt occurs simultaneously, how does the MSP430 decide the order in which the interrupts will be serviced?

  1. Interfacing the MSP430 to an LED.

You wish to interface a white LED to the MSP430. The data sheet indicates that the LED has a forward voltage drop VF = 2.4V and a forward current IF = 20mA. Draw the circuit diagram such that the LED is illuminated when P1.0 of the MSP430 outputs a logic-0. Calculate the value of the current-limiting resistor.

  1. Polling a Push-button

The following C code polls an active-low push-button to determine when it is pressed, then toggles and LED, and finally polls the button again to determine when it is released. Rewrite this code in assembly language for the MSP430. Do not debounce the button. void poll_button()

{ while (P1IN & BIT1); P1OUT ^= BIT0; whilie (!(P1IN & BIT1)); }

ECE 447 – Single-chip Microcomputers page 2 of 11 Dr. Craig Lorie

Example Midterm Problems Fall 2016

  1. MSP430 Addressing Modes

For each assembly language instruction given below, identify the source operand addressing mode and the destination operand addressing mode. Assume that symbols and memory have been properly defined/allocated elsewhere in the code.

Addressing modes:

  • R = Register, IX = Indexed, S = Symbolic, A = Absolute,
  • IN = Indirect, INA = Indirect Autoincrement, IM = Immediate

The first entry in the table is provided as an example.

Instruction opS opD amS amD Function

mov #55, R12 IM R R12 ← #55

mov 2(R10), 16(R12)

add #25, 8(R9)

mov @R10, R11

mov R11, dest

mov R11, &dest

sub R13, R14

bic #0x81, R5

and @R6, R7

and R6, R7

addc R8, &dest

ECE 447 – Single-chip Microcomputers page 3 of 11 Dr. Craig Lorie

Example Midterm Problems Fall 2016

  1. Complete the tables, below, for the given mov instructions

(a) mov R6, 4(R5)

Registers: Before: Registers: After:

R5 0x3456 R5

R6 0x789A R6

Memory: Before: Memory: After:

0x3456 0x15EE 0x3456

0x3458 0xC0C0 0x3458

0x345A 0xD15C 0x345A

0x789A 0x1ABA 0x789A

0x789C 0xDABA 0x789C

0x789E 0xD000 0x789E

(b) mov @R5+, R6

Registers: Before: Registers: After:

R5 0x3456 R5

R6 0x789A R6

Memory: Before: Memory: After:

0x3456 0x15EE 0x3456

0x3458 0xC0C0 0x3458

0x345A 0xD15C 0x345A

0x789A 0x1ABA 0x789A

0x789C 0xDABA 0x789C

0x789E 0xD000 0x789E

ECE 447 – Single-chip Microcomputers page 4 of 11 Dr. Craig Lorie

Example Midterm Problems Fall 2016

  1. Key Debouncing

The voltage curve for an active-low push-button is given in the figure below. Please modify

the figure as follows:

(a) Indicate at which point(s) in time the button bounces by adding at the appropriate place(s) in the figure.

(b) You want to use a Port interrupt to detect button presses and a Timer to wait for the button to stop bouncing. Indicate, using arrows, the time(s) at which the Port will generate interrupts and the time(s) at which the Timer will generate interrupts. Identify the interrupt source associated with each arrow, and number the arrows sequentially.

(c) Describe for each arrow, the primary function that must be performed by the associated interrupt service routine (e.g. start timer, decode, key, etc.)

ECE 447 – Single-chip Microcomputers page 5 of 11 Dr. Craig Lorie

bouncing

period

key released key pressed key released

Example Midterm Problems Fall 2016

  1. Timer_A Compare Mode

Write a C program that configures Timer_A to output the signals to control two active-high

LED’s according to the following specifications:

  • LED1 should blink at a frequency of 2 Hz, with a duty cycle of 50%.
  • LED2 should blink at the same frequency, but with a duty cycle determined by the value

read from PORT3. The value should be interpreted as an unsigned number, and any value greater than 100 should be treated as 100 (i.e. the maximum value is 100).

  • As soon as the value on PORT3 changes the duty cycle for LED2 should be adjusted.

Interrupts must be used to detect a change on PORT3.

Note: P1.1, P1.2, and P1.3, can be used to output TACCR0, TACCR1, and TACCR2, respectfully. The most elegant solution will have the LEDs controlled directly by the timer.

ECE 447 – Single-chip Microcomputers page 6 of 11 Dr. Craig Lorie Example Midterm Problems Fall 2016

  1. Multiplexing General Purpose I/O Ports

The MSP430 on the $13 MSP Launchpad has 8 pins on PORT1 (P1.0 – P1.7), but only 6 pins on PORT2 (P2.0 – P2.5). Despite this, you would like to connect four 7-Segment displays (each with 8 LEDs and a common anode (+) ) and one 16-button keypad.

Below is a list of parts that you may use in your design. Draw the circuit diagram.

74HCT245 Octal buffer, bidirectional i.e. if direction DIR=0, A=B; if DIR=1, B=A

74HCT244 Dual Quad buffers with a separate OE for each Quad buffer, unidirectional

74HCT373 Octal Latches, if latch enable LE=1, Q=D; if LE=0, Q=Q0

74HCT374 Octal Flip-Flops (i.e. 8-bit register). FFs trigger on rising clock edge.

All devices have active-low output enable (OE). When inactive, the outputs of the devices are in the high-impedance state.

ECE 447 – Single-chip Microcomputers page 7 of 11 Dr. Craig Lorie

Example Midterm Problems Fall 2016

  1. Timer_A Capture Mode

You wish to interface an inexpensive ultrasound sensor to the MSP430 to measure distance. The sensor has a single output pin, and produces a pulse of length proportional to the distance measured. It’s behavior is linear. It can measure distances from 1 foot to 50 feet, and outputs a pulse length of 1 ms per foot (e.g. it outputs a pulse length of 18 ms for a distance of 18 ft).

Write a C program that uses the ultrasound sensor to measure the distance. Store the value for the measured distance in a variable named distance.

Note: P1.1, P1.2, and P1.3 are connected to CCI0A, CCI1A, and CCI2A, respectfully.

In addition to writing the C program, please answer the following questions:

(a) Which clock are you using for Timer_A?

(b) What is the maximum pulse-length that can be measured by Timer_A? When answering this question, ignore the “50 feet” maximum distance specification given above.

(c) What is the resolution (or precision) of the measurement using this clock?

ECE 447 – Single-chip Microcomputers page 8 of 11 Dr. Craig Lorie

Example Midterm Problems Fall 2016

  1. Write a C program to transfer 64 bytes of data from the top (i.e. lowest address) of Information Memory – Info B to the block of RAM starting at address 0x1C00. For more information about the memory map, see the MSP430FR6989 data sheet, section 6.13.
  1. Write a C program that updates a 4-bit output each time the push-button is pressed.

The following are the specifications for the program:

  • Configure bits 4 – 7 of P1 as outputs.
  • Configure bit 0 of P1 as an input.
  • Configure the internal resistor on P1.0 to be a “pull-up” resistor.
  • Assume that the push-button is connected to P1.0.
  • The push-button causes an interrupt to the processor when it is pressed (falling edge).
  • Initialize the output on P1.4 – P1.7 to 0000.
  • The value output on P1.4 – P1.7 should be incremented on each button press.
  • The output value should roll-over from 1111 to 0000.
  • Use interrupts and an interrupt service routine.
  • Put the MSP430 in the appropriate low-power mode when waiting for a button press.
  • Button debouncing is not necessary in this code.

ECE 447 – Single-chip Microcomputers page 9 of 11 Dr. Craig Lorie

Example Midterm Problems Fall 2016

  1. Write a C program to compute the pulse width of an input signal. That is, measure the time between the rising-edge and falling-edge of the input signal.Use TimerA0. Assume that the input is connected to input CCI1A.
  1. Write a C program to use the MSP430 to scan a 4×4 keypad. Given below are the specifications for the hardware and the software.
  • Use Port P1.
  • Put the MSP430 in the proper low-power mode.
  • Use interrupts to detect a key press.
  • Write an interrupt service routine (ISR) to

◦ scan the keypad to determine which key was pressed

◦ store the value of the pressed key in a global variable

◦ set a “data ready” flag to indicate that a new key has been pressed.

  • Ignore key debouncing.

ECE 447 – Single-chip Microcomputers page 10 of 11 Dr. Craig Lorie

Example Midterm Problems Fall 2016

  1. How wide is the MSP430 data bus?
  2. How wide is the MSP430 address bus?
  3. How many address bits are needed to access 128 KBytes of memory?
  4. How much memory can be accessed using a 16-bit address bus?
  5. (a) What is the addressable memory space of the MSP430 (in bytes)?

(b) What is the addressable memory space of the MSP430X (in bytes)?

(c) How many bits are in a data word on the MSP430?

  1. (a) How many registers are included in the MSP430 Register Set? How many of these are special-purpose registers?

(b) What is the function of the PC, SP, and SR?

(c) Briefly define each bit in the Status Register (SR).

  1. What is the difference between maskable and nonmaskable interrupts?
  2. Write an assembly language instruction to set the Global Interrupt Enable (GIE) bit.
  3. When more than one maskable interrupt occurs simultaneously, how does the MSP430 decide the order in which the interrupts will be serviced?

 

Which nursing role do you plan to pursue as a result of completing the program? Are the two provisions you chose in NURS 300 the same as you would choose now? If so, why? If not, please explain.

Employment Law

This assignment is a reflection on how you feel you have grown as a nursing professional. In NURS 300, you created a professional mission statement. An excerpt of that assignment has been provided as a guide.

For this assignment, provide a short essay paper that addresses the following:

  1. Which nursing role do you plan to pursue as a result of completing the program?
  2. Are the two provisions you chose in NURS 300 the same as you would choose now? If so, why? If not, please explain.
  3. Have you integrated the four professional traits from the American Nurses Association (ANA) Code of Ethics that you stated that you would bring to an interdisciplinary team of healthcare professionals? If so, how? If not, how do you plan to do this in the future?
  4. How has your perspective changed as a result of completing this program?

This paper should be no longer than 2 pages not counting the title page and reference page. Integrate two scholarly sources in your submission.

 

Write MIPS code that generates a sequence.

MIPS code

Write MIPS code that generates a sequence according to the following rule:

  1. The first two numbers of the sequence are 0 and 0.
  2. The third number of the sequence should be 803.
  3. The fourth and subsequent numbers of the sequence should be sum of previous three numbers.
  4. The last number in the sequence should be less than 10e6 (10 million). In other words, the next higher number in series will become greater than 10e6.

 

How did the intellectual history of the Han dynasty reflect the political fortunes of the dynasty? Your answer should show familiarity with intellectual developments during the reign of Han Wudi as well as the arguments in Michael Loewe’s article.

Intellectual history of the Han dynasty

Requirements:
How did the intellectual history of the Han dynasty reflect the political fortunes of the dynasty? Your answer should show familiarity with intellectual developments during the reign of Han Wudi as well as the arguments in Michael Loewe’s article. (file attached below)

Writing instructions:
A: These essays are a pleasure to read. They brighten an otherwise dreary chore.
1. Such answers are long enough to demonstrate more than a general knowledge of the material (generally 4 blue book pages in a normal, single-spaced hand, which would translate to approximately 400 words). They address most of the issues relevant to the question.
2. They are also characterized by specificity, providing concrete examples (with names, dates, concepts, etc.) from the readings and lectures that clearly support the points being made.
3. The essay contains a clear argument in a form that answers the question. It is also laid out in a logical fashion.
4. Finally, such answers are well-written. Grammatical structures are clear, and vocabulary demonstrates a thorough absorption of the material presented in the class.

How noise in rna sequencing data effects the ranking features that are used to detect the driver genes using machine learning methodologies.

Systematic review

The paper should conduct a systematic review of the different types of noise in RNA sequencing data. How noise in rna sequencing data effects the ranking features that are used to detect the driver genes using machine learning methodologies.

 

 

Identify two critics and outline their arguments against photography as an art form. Name two 19th century defenders of photography as an art form and outline their arguments in favor of photography as an art form.

Nineteenth Century Critics and Defenders of Photography

There were prominent 19th century critics of photography as an art form, among them Lady Eastlake and Charles Baudelaire. There were also prominent 19th century defenders of photography as an art form, among them Oliver Wendell Holmes and Nathanial Hawthorne.

-Identify two critics and outline their arguments against photography as an art form.
-Name two 19th century defenders of photography as an art form and outline their arguments in favor of photography as an art form.
-Describe and interpret a specific 19th century image in support of each side of this debate (i.e. describe two images total).

Put your image examples in chronological order.

Describe your academic and career goals in the broad field of engineering. What and/or who has influenced you either inside or outside the classroom that contributed to these goals?

Academic and career goals

Describe your academic and career goals in the broad field of engineering (including computer science, industrial distribution, and engineering technology). What and/or who has influenced you either inside or outside the classroom that contributed to these goals? It is important to spend time addressing this question as it will be considered as part of engineering review process.

Provide a comparative analysis of Hard Coastal Adaptation against Coastal Inundation along the Suva-Lami corridor, Fiji

Comparative Analysis

Provide a comparative analysis of Hard Coastal Adaptation against Coastal Inundation along the Suva-Lami corridor, Fiji

Provide a research on 5D BIM adoption level among quantity surveyors as estimation tool in construction project Singapore.

Research on 5D BIM Adoption Level

Provide a research on 5D BIM adoption level among quantity surveyors as estimation tool in construction project Singapore.