Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Now it is time to think back to the project you just completed and the cumulative skills you were able to apply in your work.

Now it is time to think back to the project you just completed and the cumulative skills you were able to apply in your work. Post an image of your completed 3D scene and describe what you have created. Then, address the following in your initial post:

What is something new you were able to learn or apply in your project?
What questions do you still have about computational graphics and visualizations?
How can you use or expand on these skills in your future educational or professional pathway?

 

Part I: Downloading the US Census Income Dataset

We will use one of the datasets of the UCI data repository. It contains many datasets that are used by researchers and data scientists to evaluate new data mining and machine learning methods.

Go to the US Census Income dataset page: https://archive.ics.uci.edu/ml/datasets/Census+Income (Links to an external site.)
Click on the Data Folder
Download the adult.data, adult.names and adult.test files.
name is a text file. It can be opened using sublime any text editor.
data and adult.test are csv files. They can be opened in sublime, excel, or any text editor.
The adult.name file contains a description of the dataset and its attributes. Each row contains information for one person. Each column is an attribute of a person such as age, work class, education, etc.
Each line in this dataset represents a person. Each column represents one feature for a person such as age, education, marital status, etc.

 

Part II: Creating a Bar Chart

The last column in the dataset holds the income. It is a categorical label that has the two labels "<=50K" and ">50K". These indicate whether the person's annual income is less than or greater than $50K, respectively.

Write a python script that uses the Bokeh library to draw a bar chart showing the number of people with income greater than 50K and the number of people with income less than or equal 50K.

Start by using the basic bar chart code from the bokeh documentation. https://docs.bokeh.org/en/latest/docs/gallery/bar_basic.html (Links to an external site.)
Write code to create the x and y arrays that will be passed to the vbar() function.
First, create a dictionary and use it to count the number of instances for each income label.
Create a for-loop that scans the dataset file, extracts the last column, and updates the dictionary accordingly.
Once the for-loop is done, write another for loop that copies the keys and values of the dictionary into two arrays, call them x & y. These are the arrays that will be passed to the vbar() plotting function.
 

Part III: Creating a Line Chart for Time Data

The kobe_braynt_points.csv  Download kobe_braynt_points.csvdataset contains the points scored by player Kobe Bryant over the different years/seasons.

Write a script that plots the points over the years. Use a line chart.

Start with the code for single line glyphs/plots: https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html (Links to an external site.)
Modify this adding code for reading the years and points from the dataset file. Make sure to use the comma "," as the separator in the split function.
You should read the years and points into two arrays to represent xlabels & y. That is, the x-axis labels and y values.
You will need to create a third array to hold x values. The x values should be 0,1,2,... and go as many as the number of years.
The three arrays: xlabels, x & y will by populated by the for loop that reads the data from the file.
Change the figure creation line from
p = figure(plot_width=400, plot_height=400)
    to

p = figure(plot_width=400, plot_height=400, x_range = xlabels)
   This way you are passing the xlabels to be shown on the x-axis.

Since the x-labels are too long, it is better to write them vertically rather than horizontally. You can do so by adding this line of code after creating the figure:
p.xaxis.major_label_orientation = pi/2
Finally, pass the x & y arrays to the p.line() function.
How does the curve look like? What can you say about the point scoring of Kobe Bryant from the plot?
 

Part IV: Creating a Scatter Plot

Repeat the exercise in part III using a scatter plot instead of a line chart.

The only difference is that instead of calling the p.line() function, you will call the p.circle() function. For this function, you should specify the size of the circles, color and opacity (alpha). Use the scatter markers code example at:

https://docs.bokeh.org/en/latest/docs/user_guide/plotting.html (Links to an external site.)

Try using the p.square() function instead of p.circle(). How does that change the visualization?
In your opinion, is it the line chart or the scatter plot that better represents the dat

 

add comments please (: if it is too difficult you do not have to do part 3 but it would be greatly appreciated if you do!

Obtain example code files Circle.java, Shapejava, CircleShape2.java, Sphere.java, and CircleShapeApp.java from the downloaded files in Ch8. Compile and execute the exampl and understand the polymorphism it performs. (I have copied and pasted all of these f below) Modify the application as follows:

1. Code a class called Cone inherited from class Circle. Cone will override the computeArea() and computeVolume() methods from its superclass to calculate the area and volume of a Cone object. Must apply code-reusability in the calculation formula.

2. Modify the driver code, CircleShapeApp.java, so it will also create an object of Cone

with a height of 12.5 and diameter pf 10.48. Modify the polymorphic calls to calculate

and display the result of the calculations."

3. Instead of hard-coded data, modify your application to be interactive using JOptionPane, thus it will ask user to enter proper data for different object, continue to utilize the Validator class you have developed before to validate all'wrong data entries, including negative and non-numerical data. Your program must continue to run until the user enters 'n to terminate the execution. You must also validate the user's entry so that only "y" and "n" are accepted.

Circle.java 

 

kindly answer the questions clearly.


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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

Foundations of Financial Management

Authors: Stanley Block, Geoffrey Hirt, Bartley Danielsen, Doug Short, Michael Perretta

10th Canadian edition

1259261018, 1259261015, 978-1259024979

More Books

Students also viewed these Computer Network questions

Question

Case : Karl and June Monroe

Answered: 1 week ago