Sale!

CPSC 6430 Project 1 solution

Original price was: $35.00.Current price is: $30.00. $25.50

Category:

Description

5/5 - (6 votes)

 Basic plotting in Python with matplotlib.pyplot

Data File

The first line of IrisData.txt contains two integers. The first represents how many lines of data
are in the file. The second how many features are associated with each line.

Each line after that
contains four floating point values representing the sepal length, sepal width, petal length, and
petal width of a type of iris flower, followed by the name of the iris type: either setosa,
versicolor, or virginica. Values are tab separated.

Python Program

Write a Python program that will print out a two-dimensional plot of any two features for all
three varieties of iris flowers in the plot area of Spyder using the features of
matplotlib.pyplot.Your program should begin by asking for the name of the input file. For
example (blue is user response):

Enter the name of your data file: Irisdata.txt
Then the program should prompt the user for two features to plot. For example, it could say:
You can do a plot of any two features of the Iris Data set

CPSC 6430 Project 1

The feature codes are:

0 = sepal length
1 = sepal width
2 = petal length
3 = petal width
Enter feature code for the horizontal axis: 0
Enter feature code for the vertical axis: 1
Once the program does a plot it should ask the user if they want to another plot. For example:
Would you like to do another plot? (y/n) y

If the answer is y, then the user should be prompted for new features to plot on the horizontal
and vertical axes as before and a new plot generated. N should end the program.

Plots should be labelled with a title, axes should be labelled, there should be a legend and all
three varieties should be color coded and have different symbols. An example is shown below.

You are required to submit a project report, including:

• At least 3 plots with different x and y labels combination.
• Briefly discuss which feature combination is the best for classify the iris data
• Full screenshot of your python console.
• A copy of your code

Your report should be named yourlastname_yourfirstname_P1.docx or .doc or .pdf. Your
Python program should be named yourlastname_yourfirstname_P1.py, then zipped together
with your project report and uploaded to Canvas

CPSC 6430 Project 1