Use Cases

Watson Analytics Use Case: The Iris Data Set

Blog Home > Watson Analytics Use Case: The Iris Data Set

Watson Analytics Use Case: The Iris Data Set

The Iris flower data set is a classic, well-known data set example for data mining and data exploration. The data set contains 150 records of three different types (classes) of iris flowers with numeric values for petal length and width and sepal length and width.

This data set is traditionally used for classification and prediction – to see which features of an iris can identify the flower as a certain type of iris. The values for length and width can be used to classify an iris into one of three iris types: Iris setosa, Iris versicolor, or Iris virginica. Visually exploring this data also lets you see the grouping (clustering) of the records into these three different types of irises.

I used IBM Watson Analytics to explore this classic data set by employing the different features available in Explore, Predict, and Assemble.

You can find a copy of the data set here:
https://archive.ics.uci.edu/ml/datasets/Iris

Preparing and uploading the data set

I downloaded a copy of the data set, converted it to .csv format, and uploaded it to Watson Analytics. I used the following steps.

    1. Download the “data” file and rename it to “iris-data.csv”.
    2. Open the file in a text editor and add the following five column titles, separated by commas, as the first line in the file.

sepal-length,sepal-width,petal-length, petal-width,class

New-01-Example.png

  1. Save the file.
  2. Upload the file to Watson Analytics.
    On the Welcome page, tap Add, then browse and select the file from your local computer.

My new data set was added to the Welcome page.

New-02-Data-Set.png

Refine

I used the Refine feature to view the new data set. Refine enables you to format and re-encode the data if needed. If you make any changes, you can save the new version as a separate refined data set.

In my case, on the Welcome page, I tapped the new data set and then tapped Refine.

You can also use Refine as a way to browse and inspect your uploaded data. View the columns and data values in the data set, view a quality score for each column, and view thumbnail visualizations of the data value distributions for each column.

In this case, the data set was ready to go as-is, so I didn’t need to make any changes. I closed the Refine page and return to the Welcome page.

New-O3-Refine.png

Explore

I used Explore to visualize the relationship between petal length, petal width and class.

On the Welcome page, I tapped the data set to see a set of starting points. Right away, Watson Analytics suggested a number of things based on the key attributes of length and width compared to class.

New-04-Explore.png

I tapped one of the starting points to visualize and explore the relationship between length, width and class.

When I chose petal-length by class, Watson Analytics provided a visualization of how each class has a different average petal length.

New-05-Average-Length.png

When I chose “What is the relationship between petal-length and petal-width by class,” I saw how average petal length and width group the flowers into the three distinct classes of setosa, versicolor, and virginica. I could have used the Columns > Size by option to display another feature of the data, such as sepal-length or sepal-width, in the same visualization.

02-Petal-Length.png

Predict

What type of iris is that? Setosa? Versicolor? Virginica? I used Predict to see how petal length and width are predictors of iris type (class) by following these steps.

  1. On the Welcome page, tap the data set and then tap Predict.
  2. Enter a name for the new Prediction.
  3. Set the prediction target to “class.” (Remove any other fields as target)
  4. Tap Create Prediction.

New-06-Name-Analysis.png

I hovered over the spiral diagram to see which fields are strong predictors of the target class. Petal-width (88.0%) and petal-length (84.7%) turned out to be the top predictors of how to classify an iris into one of the three types.

03-Predict-Class.png

To get more details about the prediction, I tapped the main insight to see a distribution of iris class compared to petal width.

04-Predict-Strength.png

Assemble

I used Assemble to create a multimedia infographic about the data set. I combined text, images, videos and shapes with different visualizations of the data and:

  • Created an interactive word cloud of the iris names. Assign a data value, such as petal-width, to set the text size of the iris names in the word cloud.
  • Added a scatter plot of petal-width and petal-length colored by type of iris (class).
  • Added a grid to display a summary of the numeric values from the data set.
  • Added images of iris flowers showing the petal and sepal width and length.

Any visualizations I added to the view were automatically linked together and updated when I interacted with the data points.

New-Assemble.png

When I selected a word in the word cloud, it updated the other visualizations and highlighted the related records.

New-07-Word.png

When I selected an individual data point in the scatter plot, it highlighted just that record and updatd the grid with the numeric values for that point.

New-08-Highlight.png

So there you go. The classic iris data set: explored and visualized in Watson Analytics. Try it out with the iris data or upload your own data to explore and visualize.

If you haven’t used Watson Analytics yet, now’s a great time sign up for free at www.watsonanalytics.com.

Data set reference:

Lichman, M. (2013). UCI Machine Learning Repository [http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.

Iris flower data set, https://en.wikipedia.org/wiki/Iris_flower_data_set

 

 

More Use Cases Stories

Explore

Who Gets Angriest About Airline Delays? The Answer Might Surprise You.

When looking at the recent blog on network diagram visualizations in the Watson Analytics community.   I was interested to see how a network diagram can show relationships even in dense datasets. Looking at the dataset in more detail, I was curious as to which origin cities had more delayed or cancelled flights and it got me thinking about people’s reactions to the flight delays. To find out, I compared delayed flights from November 2015 through January 2016 and sentiment on flight delays for the same time period found within Social Media. For the analysis, I chose larger cities. Using the Refine feature, I selected flights that were at least 30 minutes delayed or longer for the departure time and selected the major cities. The major city that had the most occurrences of flight delays was found to be Chicago, which may not be a surprise since it is a major hub and weather in this timeframe is not ideal. As you can see, many hubs saw flight delays, including Atlanta, Denver and Los Angeles. If there was a delay over 30 minutes, the average delay time was 84 minutes for Chicago, but it was not the highest. The lowest average delays times were in Baltimore, Las Vegas and Los Angeles. Now let’s compare this to volume of social conversations about flight delays for the cities. I created a social media project, which captures conversations about flight delays (in English) as shown in the following diagram. I also created Themes for major cities to get a sense of what cities people are referencing when talking about delayed flights. After running the analysis on social media, I am able to see that Los Angeles, New York and Chicago have the largest conversation volume for the same time period. Let's focus on sentiment using a network diagram. The network diagram works well for showing how negative conversations are, which is expected as we are evaluating flight delay conversations. More importantly, you can select any of the nodes in the diagram to highlight the relationship as we see below. By clicking Los Angeles, I see Los Angeles is predominantly negative; this is surprising considering the occurrences happen more for Chicago. I can also look at the cities by the number of mentions and filter that based on negative sentiment as shown in the next visualization, which shows that Los Angeles is much more negative than the other major cities. Next I want to see all of the visualizations in a single view. By pinning each of these visualizations to the collection, Watson Analytics makes easy for me to create dashboard with key elements from both datasets. From this dashboard, it is easy to decide that the Los Angeles audience is much less tolerant about flight delays. If you were working in the airline industry, you may want to pay particular attention to the Los Angeles market when dealing with delayed flights. While I have combined social data with non-social data in the past, I have not done it with this much ease. I strongly recommend that you use analytics with social data together with your transactional data. The observations that you can derive with social and non-social data can be very interesting. You will be able to vet the data and insights better than with a single data set.   Try it out yourself!

Use Cases

#GoGreenGo: Using Watson Analytics for Social Media on St. Patrick's Day

If you are Irish or just support the St. Patrick’s Day rally cry, find out what is top of mind with your compatriots. I happen to know university campuses are all a buzz with the green spirit because I drove by some this morning and saw a good amount of green hats milling about. But what are the topics that are capturing the interest of the leprechauns of this day? I did a quick peek at Watson Analytics topic suggestions to find out what people are chattering about. Below you will see some interesting Topic Suggestions from Watson Analytics for Social Media for St. Patrick’s Day. After a quick analysis, the demographics show a close, almost a 1:1 ratio, for males and females but there were slightly more females talking about St. Patrick’s Day. That is interesting. I was not expecting this demographic. Here is a breakdown of the things people were talking about. I am a little surprised that “luck” is in the top three conversation themes. I was expecting beer, wear green or parade to be up on this list. I guess you don’t know what you don’t know until you do the analysis. I am going to stop here and put on my green cap, shamrock and paint the town green.  I encourage you to discover your own “Pot ‘o Gold” with Watson Analytics! Let me know what you find with your comments on the community forum!  It’s fun, easy and insightful  If you are not already using Watson Analytics, sign up for free here!

Explore

Visualizing network data to illustrate airline delays

Watson Analytics has recently been expanded with a new set of visualizations that can help you find more informative answers to your data questions quickly. In this blog post, I highlight these capabilities in the Freemium version of Watson Analytics which (among others) help users better visualize network data. Network data is a very common, but an underused data type. Network data conceptually consists of a collection of items and a collection of connections between a pair of items. Items, in this case, could be people on a social network site and a connection could exist if person A has friended person B. Or, items could be warehouse locations and a connection means there is a direct supply route between both locations. Many real world problems can be modeled as networks, and should be presented back to the user as visual network as well. However, typical business intelligence tools don’t typically support querying or visualizing network data. To illustrate how Watson Analytics can help, I’ll use a dataset obtained from the US Bureau of Transportation Statistics that describes airline departure and arrival delays for all US domestic flights, which can be downloaded for free here.  This dataset has, for each US departing flight, the flight carrier, flight origin and destination, as well as amount and reason of delay. In this case we’ll use part of the data for December 2014, which consists of a little more than 500 thousand rows. Since the dataset contains departure and arrival locations in separate columns, I should be able to extract a visual route map of each airline by treating a single flight as a connection between an origin and a destination city. Loading up the data in Watson Analytics and starting a new data exploration quickly gets me to the following screen. Rather than having to shape the data into a network or loading the data up in an external network visualization tool, I can ask Watson Analytics for the connections between each origin and destination city in the data. Clicking the most relevant suggestion shows me all connections between all domestic US airlines origins and destinations. In passing, Watson Analytics has also detected that destination state forms a hierarchy with destination city and has auto included state names for each city to help disambiguate them. Each city (called a node) is indicated with a blue dot, and a line (also called an edge) is drawn between two cities if the dataset contained a flight connecting both of them. The size of each dot is proportional to the number of in and outbound connections, so hubs tend to have a larger size. The visual weight of each edge is proportional to the number of rows, but we could easily change this to the total incurred minutes of delay by changing the line weight mapping. Althouh this network diagram is not very readable because there is a very dense cluster of major cities in the center, I can already see Alaskan cities on the periphery of the large central blob. This means that airports like Wrangell, AK, are at least 4 stops away from any other airport in the US. However, a good way to break apart a complex diagram like this is to filter the data down by carrier. In the graphic below I’ve extracted route information for three airlines by simply using the filter capabilities at the bottom of the user interface. You can clearly see the differences in carriers size of network, hubs and geographic region. In this case I’ve used a network visualization to show connections between cities where the data contained both origin city and destination city fields. In the same way, you could use Watson Analytics to show a diagram of connections between friends in a social network, or if that interests you, connections between genes in a genetic network. A different but also useful case for network visualization is where you have two different sets of items, and you want to show how one type of item such as a customer relates to another type of item such as a product. These types of networks are technically called bipartite networks because their set of nodes falls into two sets and you only see connections between items in different sets, not among items in the same set. In this case, I can choose to map carriers and destination cities, to highlight geographic differences between carriers. I can easily modify my visualization by dragging the “Destination City” attribute to the ‘From’ slot in the visualization and dragging “Carrier” to the ‘To’ slot. One group of nodes (green) represents the carriers, the other (blue) represents cities. This visualization clearly shows geographical differences between airlines. State based airlines like Alaska or Hawaiian are obviously catering to these remote states. SkyWest caters to most small airports in the northwestern states, while American Eagle and ExpressJet operate in smaller airports in the south east. Bipartite graphs are useful if you want to see how different data items associate with other types of data items. These could be age groups and products, tweets and locations or stores and products. Computing layouts for network diagrams is very computationally expensive, but if there are at most a few thousand items, the network diagram can be applicable to almost all datasets. We also deployed two other visualizations that help users quickly determine the most salient items in a set. The wordcloud is a well known visualization type that uses a compact arrangement of words to show the most salient terms in a larger set. Individual words can be colored by a different attribute if needed. In this case we can use the wordcloud to show the carriers with the highest average arrival delay: The packed bubble is a highly scalable visualization that compactly represents data items as circles, where the radius of the circle represents a value of interest. Here we show the largest arrival delays for all 300 departure cities. The below visualization shows the average departure delay in Macon, GA, for December 2014 was 67 (!) minutes. I hope I have shown you how to get more out of your data using these new visualization types. They’re freely available to try for everyone, so please let us know what you think of them. Frank Van Ham Master Inventor. Information Visualization and Visual Interaction Expert. IBM Watson Analytics Architect