IT & BUSINESS INTELLIGENCE DATA MINING ON WEKA SATYAM KHATRI (10BM60081) MBA, VGSOM IIT KHARAGPUR
WEKAWEKA is a collection of open source many data mining and machine learning algorithms. It was createdby researchers at the University of Waikato in New Zealand, it is a Java based, open source tool. WEKAis used for pre-processing on data, Classification, clustering and association rule extractionIt’s main features are as follows 49 data preprocessing tools 76 classification/regression algorithms 8 clustering algorithms 15 attribute/subset evaluators + 10 search algorithms for feature selection. 3 algorithms for finding association rules 3 graphical user interfaces “The Explorer” (exploratory data analysis) “The Experimenter” (experimental environment) “The Knowledge Flow” (new process model inspired interface)WEKA FUNCTIONS AND TOOLS Preprocessing Filters Attribute selection Classification/Regression Clustering Association discovery VisualizationDOWNLOAD INSTRUCTIONS Download Weka (the stable version) from http://www.cs.waikato.ac.nz/ml/weka/ Choose a self-extracting executable (including Java VM) If you are interested in modifying/extending weka there is a developer version that includes the source codeWEKA DATA FORMATSData can be imported from a file in various format such as ARFF, CSV, C4.5. Data can also be read froma URL or from an SQL database (using JDBC)
CLUSTERINGA cluster, by definition, is a group of similar objects. There could be clusters of people, brands or otherobjects. If clusters are formed of customers similar to one another, then cluster analysis can helpmarketers identify segments (clusters).If clusters of brands are formed, this can be used to gain insightsinto brands that are perceived as similar to each other on a set of attributes. Cluster analysis is henceused for customer segmentation. Cluster analysis is best performed when the variables are interval orratio-scaledThere are two major classes of cluster analysis techniques hierarchical non-hierarchicalHIERARCHICAL CLUSTERINGSome measure of distance is used to identify distances between all pairs of objects to be clustered. Oneof the popular distance measures used is Euclidean Distance. Another is the Squared EuclideanDistance. We begin with all objects in separate clusters. Say, we have ten objects in separate clusters.Two closest objects are joined to form a cluster. The remaining 8 objects would remain separate. This isstage 1 of hierarchical clustering.NON HIERARCHICAL CLUSTERINGThey are also known as k-means clustering methods, we need to specify the number of clusters we wantthe objects to be clustered into. This can be done if we have a hypothesis that the objects will group into acertain number of clusters. Alternatively, we can first do a hierarchical clustering on the data, find theapproximate number of clusters, and then perform a k-means clusteringIMPLEMENTATION METHODS k - Means EM Cobweb X-means Farthest First
CLUSTERING ON WEKAPROBLEM CASEAn Asset Management company (AMC) wants to launch a new Mutual Fund Scheme, AMC wants tosegment the target market, so that it can raise funds easily by different marketing strategies for differentsegments of target market.AMC segments the target market on the basis of following parameters 1. Investor’s Age 2. Marital status 3. Investor’s Monthly income 4. Region of Residence 5. Investment in Derivatives 6. Investment in Equities 7. Investment in Fixed deposits 8. Investment in Gold 9. Existing number of Mutual fund schemes 10. Existing loansData is collected from the public base on the above parameters and clustering function is performed on itWEKA Explorer interface
Processing on parameter Investment in GoldProcessing on parameter Existing Number of Mutual fund schemes
Processing on parameter Existing LoansProcessing on parameter “Age of Investor “
Processing on parameter Investment in Fixed depositsProcessing on parameter Investor’s marital status
Processing on parameter “Investor’s region of residence”Processing on parameter “Investor’s monthly income”
Processing on parameter Investment in derivativesVisualization of the entire dataset
To perform clustering, select the "Cluster" tab in the Explorer and click on the "Choose" button. Thisresults in a drop down list of available clustering algorithms. In this case we select "Simple K Means".Next, click on the text box to the right of the "Choose" button to get the pop-up window shown k-meansclustering is done by dividing the data into 4 cluster group.The WEKA Simple K Means algorithm uses Euclidean distance measure to compute distances betweeninstances and clusters. In the pop-up window we enter 6 as the number of clusters (instead of the defaultvalues of 2) and we leave the value of "seed" as is. The seed value is used in generating a randomnumber which is, in turn, used for making the initial assignment of instances to clusters. Note that, ingeneral, K-means is quite sensitive to how clusters are initially assigned. Thus, it is often necessary to trydifferent values and evaluate the resultsOnce the options have been specified, we can run the clustering algorithm. Here we make sure that in the"Cluster Mode" panel, the "Use training set" option is selected, and we click "Start". We can right click theresult set in the "Result list" panel and view the results of clustering in a separate window.
Clusters can be visualize as shown belowCLUSTER 1It consist of people with average age of 44 yrs, mostly male, that stay in town, have average monthlyincome of 30000, mostly single and invest in equities, fixed deposits, gold, do not invest in derivatives andhave existing loans.CLUSTER 2It consist of people with average age of 49 yrs, mostly male, that stay in town, have average monthlyincome of 39000, mostly married and invest in equities, fixed deposits, gold, do not invest in derivativesand have existing loans.CLUSTER 3It consist of people with average age of 39 yrs, mostly male, that stay in cities, have average monthlyincome of 24000, mostly married and invest in gold, derivatives, do not invest in equities and fixeddeposits, and have existing loans.CLUSTER 4It consist of people with average age of 40 yrs, mostly female, that stay in cities, have average monthlyincome of 25000, mostly married and invest in equities, fixed deposits, do not invest in derivatives, goldand have existing loans.
CLASSIFICATION VIA DECISION TREES IN WEKAPROBLEM CASEA market research firm wants to model the investment decisions by people in various types of securitieson the basis of following parameters Investor’s Age, Marital status, Investor’s Monthly income, Region ofResidence, Investment in Derivatives, ,Investment in Equities, Investment in Fixed deposits, Investment inGold, Investment in Mutual funds, Existing loans. Based on this model, an investment decision by anentity in a particular type of security can be predicted if other parameters about that entity are mentionedData is collected from the public on the above parameters and classification is doneNext, we select the "Classify" tab and click the "Choose" button to select the J48 classifier, Note that J48(implementation of C4.5 algorithm does not require discretization of numeric attributes, in contrast to theID3 algorithm from which C4.5 has evolved. Now, we can specify the various parameters. These can bespecified by clicking in the text box to the right of the "Choose" button, In this example we accept thedefault values. The default version does perform some pruning (using the sub tree raising approach), butdoes not perform error pruning.
Under the "Test options" in the main panel we select 10-fold cross-validation as our evaluation approach.Since we do not have separate evaluation data set, this is necessary to get a reasonable idea of accuracyof the generated model. We now click "Start" to generate the model. The ASCII version of the tree as wellas evaluation statistics will appear in the eight panel when the model construction is completed We canview this information in a separate window by right clicking the last result set (inside the "Result list" panelon the left) and selecting "View in separate window" from the pop-up menu.
We can also use our model to classify the new instances. In the main panel, under "Test options" click the"Supplied test set" radio button, and then click the "Set..." button. This will pop up a window which allowsyou to open the file containing test instances.
This, once again generates the models from our training data, but this time it applies the model to the newunclassified instances in order to predict the value of an attribute. Note that the summary of the results inthe right panel does not show any statistics.WEKA also lets us view a graphical rendition of the classification tree. This can be done by right clickingthe last result set (as before) and selecting "Visualize tree" from the pop-up menu.Note that by resizing the window and selecting various menu items from inside the tree view (using theright mouse button), we can adjust the tree view to make it more readable.