weka tutorials spanish

Upload: kevin-wong

Post on 14-Jul-2015

1.223 views

Category:

Documents


0 download

TRANSCRIPT

Practical Data Mining Tutorial 1: Introduction to the WEKA Explorer

Mark Hall, Eibe Frank and Ian H. Witten May 5, 2011c 2006-2012 University of Waikato

1

Getting startedEste tutorial presenta la interfaz grca de usuario a principal para acceder a las instalaciones de WEKA, llamado Explorer WEKA. Vamos a trabajar con WEKA 3.6 (aunque casi todo es lo mismo con otras versiones), y suponemos que se ha instalado en su sistema. Invocar WEKA desde el men INICIO de Winu dows (en Linux o Mac, haga doble clic en weka.jar o weka.app). Esto pone en marcha el GUI Chooser WEKA. Haga clic en el Explorer botn o para entrar en el WEKA Explorer. Slo en caso de que usted se est preguntando o a sobre el resto de botones en la GUI Chooser: Experimenter es una interfaz de usuario para comparar el rendimiento predictivo de algoritmos de aprendizaje; KnowledgeFlow es una interfaz basada en componentes que tiene una funcionalidad similar a la de Explorer; y Simple CLI se abre un comando-l nea de interfaz que emula una terminal y le permite interactuar con WEKA de esta manera.

This tutorial introduces the main graphical user interface for accessing WEKAs facilities, called the WEKA Explorer. We will work with WEKA 3.6 (although almost everything is the same with other versions), and we assume that it is installed on your system. Invoke WEKA from the Windows START menu (on Linux or the Mac, double-click weka.jar or weka.app). This starts up the WEKA GUI Chooser. Click the Explorer button to enter the WEKA Explorer. Just in case you are wondering about the other buttons in the GUI Chooser: Experimenter is a user interface for comparing the predictive performance of learning algorithms; KnowledgeFlow is a component-based interface that has a similar functionality as the Explorer; and Simple CLI opens a command-line interface that emulates a terminal and lets you interact with WEKA in this fashion.

2

The panels in the ExplorerLa interfaz de usuario de la Explorer se compone de seis paneles, invocadas por las etiquetas en la parte superior de la ventana. El panel de Preprocess es la que est abierta cuando la Explorer por a primera vez. Este tutorial le introducir a otros a dos, as Classify y Visualize. (Los otros tres : paneles se explican en tutoriales ms tarde.) He a aqu una breve descripcin de las funciones que es o tos tres grupos de realizar. Preprocess es donde puedes cargar los datos y preproceso. Una vez que un conjunto de datos se ha cargado, el panel muestra infor` macin sobre Al. El conjunto de datos puede o ser modicado, ya sea mediante la edicin o de forma manual o mediante la aplicacin de o un ltro, y la versin modicada se puede o guardar. Como alternativa a la carga de un conjunto de datos pre-existentes, una articial se pueden crear mediante el uso de un generador. Tambin es posible cargar datos e desde una URL o desde una base de datos.

The user interface to the Explorer consists of six panels, invoked by the tabs at the top of the window. The Preprocess panel is the one that is open when the Explorer is rst started. This tutorial will introduce you to two others as well: Classify and Visualize. (The remaining three panels are explained in later tutorials.) Heres a brief description of the functions that these three panels perform. Preprocess is where you to load and preprocess data. Once a dataset has been loaded, the panel displays information about it. The dataset can be modied, either by editing it manually or by applying a lter, and the modied version can be saved. As an alternative to loading a pre-existing dataset, an articial one can be created by using a generator. It is also possible to load data from a URL or from a database.

1

Classify is where you invoke the classication methods in WEKA. Several options for the classication process can be set, and the result of the classication can be viewed. The training dataset used for classication is the one loaded (or generated) in the Preprocess panel.

Classify es donde se invoca a los mtodos de clasie cacin en WEKA. Varias opciones para el o proceso de clasicacin se puede establecer, o y el resultado de la clasicacin se puede ver. o El conjunto de datos de entrenamiento utilizados para la clasicacin es la carga (o geno erada) en el panel de Preprocess.

Visualize is where you can visualize the dataset loaded in the Preprocess panel as twodimensional scatter plots. You can select the attributes for the x and y axes.

Visualize es donde se puede visualizar el conjunto de datos cargados en el panel de Preprocess como diagramas de dispersin de dos dimeno siones. Puede seleccionar los atributos de los x y y ejes.

3

The Preprocess panelPreprocess es el panel que se abre cuando el Explorer WEKA se ha iniciado.

Preprocess is the panel that opens when the WEKA Explorer is started.

3.1

Loading a datasetAntes de cambiar a cualquier otro panel, el Explorer debe tener un conjunto de datos para trabajar. Para cargar una, haga clic en el botn de o Open le... en la esquina superior izquierda del panel. Mire a su alrededor para la carpeta que contiene los conjuntos de datos y busque un archivo llamado weather.nominal.arff (este archivo est a en el carpeta de data que se suministra cuando WEKA se instala). Este contiene la versin nomio nal de la norma tiempo conjunto de datos. Abrir archivo. Ahora la pantalla se ver como la Figa ure 1.

Before changing to any other panel, the Explorer must have a dataset to work with. To load one up, click the Open le... button in the top left corner of the panel. Look around for the folder containing datasets, and locate a le named weather.nominal.arff (this le is in the data folder that is supplied when WEKA is installed). This contains the nominal version of the standard weather dataset. Open this le. Now your screen will look like Figure 1.

The weather data is a small dataset with only 14 examples for learning. Because each row is an independent example, the rows/examples are called instances. The instances of the weather dataset have 5 attributes, with names outlook, temperature, humidity, windy and play. If you click on the name of an attribute in the left sub-panel, information about the selected attribute will be shown on the right. You can see the values of the attribute and how many times an instance in the dataset has a particular value. This information is also shown in the form of a histogram.

Los datos de clima es un conjunto de datos pequeo con slo 14 ejemplos para el aprendizaje. n o Debido a que cada la es un ejemplo independiente, las las/ejemplos son llamados casos. Los casos del conjunto de datos meteorolgicos tienen o 5 atributos, con perspectivas nombres , la temperatura, humedad, jugar con mucho viento y. Si hace clic en el nombre de un atributo en el sub-panel de la izquierda, la informacin acerca o del atributo seleccionado se muestra a la derecha. Usted puede ver los valores de los atributos y las veces que una instancia del conjunto de datos tiene un valor particular. Esta informacin se muestra o tambin en la forma de un histograma. e

2

Figure 1: The Explorers Preprocess panel. All attributes in this dataset are nominal, i.e. they have a predened nite set of values. Each instance describes a weather forecast for a particular day and whether to play a certain game on that day. It is not really clear what the game is, but let us assume that it is golf. The last attribute play is the class attributeit classies the instance. Its value can be yes or no. Yes means that the weather conditions are OK for playing golf, and no means they are not OK. Todos los atributos de este conjunto de datos son nominales, es decir, tienen un conjunto nito de valores predenidos. Cada instancia se describe un pronstico del tiempo para un d en particular o a y si a jugar un cierto juego en ese d No est a. a muy claro lo que el juego es, pero supongamos que es el golf. Jugar el ultimo atributo es el atrib uto classque clasica la instancia. Su valor puede ser si o no. S signica que las condi ciones climticas estn bien para jugar al golf, y a a no signica que no estn bien. a

3.2

ExercisesPara familiarizarse con las funciones discutido hasta ahora, por favor, los dos ejercicios siguientes. Las soluciones a estos y otros ejercicios de este tutorial se dan al nal. Ex. 1: Cules son los valores que la temperatura a el atributo puede tener?

To familiarize yourself with the functions discussed so far, please do the following two exercises. The solutions to these and other exercises in this tutorial are given at the end. Ex. 1: What are the values that the attribute temperature can have?

3

Ex. 2: Load a new dataset. Press the Open le button and select the le iris.arff. How many instances does this dataset have? How many attributes? What is the range of possible values of the attribute petallength ?

Ex. 2: Carga un nuevo conjunto de datos. Pulse el botn Abrir el archivo y seleccione el o archivo iris.arff. Cuntos casos se han a esta base de datos? Cmo muchos atribuo tos? Cul es el rango de valores posibles de a petallength el atributo?

3.3

The dataset editorEs posible ver y editar un conjunto de datos desde el interior de WEKA. Para experimentar con esto, cargar el archivo weather.nominal.arff nuevo. Haga clic en el botn de Edit... de la la de o botones en la parte superior del panel de Preprocess. Esto abre una nueva ventana llamada Viewer, que enumera todas las instancias de los datos meteorolgicos (vase la Figure 2). o e

It is possible to view and edit an entire dataset from within WEKA. To experiment with this, load the le weather.nominal.arff again. Click the Edit... button from the row of buttons at the top of the Preprocess panel. This opens a new window called Viewer, which lists all instances of the weather data (see Figure 2).

3.3.1

Exercises

Ex. 3: What is the function of the rst column in the Viewer?

Ex. 3: Cul es la funcin de la primera columna a o de la Viewer?

Ex. 4: Considering the weather data, what is the class value of instance number 8?

Ex. 4: Teniendo en cuenta los datos meteorolgicos, cul es el valor de la clase de o a nmero de instancia 8? u

Ex. 5: Load the iris data and open it in the editor. How many numeric and how many nominal attributes does this dataset have?

Ex. 5: Carga los datos de iris y abrirlo en el editor. Cmo los atributos nominales muchas o numrico y el nmero de este conjunto de e u datos se tienen?

3.4

Applying a lterEn WEKA, ltros son mtodos que se pueden e utilizar para modicar bases de datos de manera sistemticaes decir, son datos del proceso prea vio herramientas. WEKA tiene varios ltros para diferentes tareas. Actualizar el weather.nominal conjunto de datos, y vamos a eliminar un atributo de ella. El ltro adecuado se llama Remove, su nombre completo es:

In WEKA, lters are methods that can be used to modify datasets in a systematic fashionthat is, they are data preprocessing tools. WEKA has several lters for dierent tasks. Reload the weather.nominal dataset, and lets remove an attribute from it. The appropriate lter is called Remove; its full name is:

weka.filters.unsupervised.attribute.Remove

4

Figure 2: The data viewer. Examine this name carefully. Filters are organized into a hierarchical structure whose root is weka. Those in the unsupervised category dont require a class attribute to be set; those in the supervised category do. Filters are further divided into ones that operate primarily on attributes/columns (the attribute category) and ones that operate primarily on instances/rows (the instance category). Examine cuidadosamente este nombre. Los ltros estn organizados en una estructura jerrquica, a a cuya ra es weka. Los que estn en la categor de z a a unsupervised no requieren un atributo de clase que se establece, los de la categor supervised a hacer. Los ltros se dividen en los que operan principalmente en los atributos/columnas (la categor a attribute) y los que operan principalmente en casos/las (la categor instance). a Si hace clic en el botn Choose en el panel de o Preprocess, se abre un editor jerrquico en el que a se selecciona un ltro, siguiendo la ruta de acceso correspondiente a su nombre completo. Utilice la ruta dada en por encima del nombre completo para seleccionar el ltro de Remove. Una vez que se selecciona, el texto Eliminar aparecer en el campo a situado junto al botn de Choose. o

If you click the Choose button in the Preprocess panel, a hierarchical editor opens in which you select a lter by following the path corresponding to its full name. Use the path given in the full name above to select the Remove lter. Once it is selected, the text Remove will appear in the eld next to the Choose button.

5

Click on the eld containing this text. A window opens called the GenericObjectEditor, which is used throughout WEKA to set parameter values for all of the tools. It contains a short explanation of the Remove lterclick More to get a fuller description. Underneath there are two elds in which the options of the lter can be set. The rst option is a list of attribute numbers. The second optionInvertSelectionis a switch. If it is false, the specied attributes are removed; if it is true, these attributes are NOT removed.

Haga clic en el campo que contiene este texto. Se abre una ventana denominada GenericObjectEditor, que se utiliza en todo WEKA para establecer valores de los parmetros de todas las hera ramientas. Contiene una breve explicacin del lo tro de Removehaga clic More para obtener una descripcin ms completa. Debajo hay dos campos o a en los que las opciones del ltro se puede establecer. La primera opcin es una lista de nmeros de o u atributo. La segunda opcinInvertSelection o es un interruptor. Si se trata de falsos, los atributos especicados se quitan, si es verdadero, estos atributos no se quitan. Ingrese 3 en el campo attributeIndices y haga clic en el botn de OK. La ventana con las opo ciones de ltro se cierra. Ahora haga clic en el botn de Apply a la derecha, es decir, los datos a o travs del ltro. El ltro elimina el atributo con el e ndice 3 del conjunto de datos, y se puede ver que el conjunto de atributos se ha reducido. Este cambio no afecta al conjunto de datos en el archivo, slo se o aplica a los datos recogidos en la memoria. El conjunto de datos modicado se puede guardar en un archivo ARFF nuevo pulsando el botn de Save... o y entrar en un nombre de archivo. La accin del lo tro se puede deshacer pulsando el botn de Undo. o Una vez ms, esto se aplica a la versin de los datos a o contenidos en la memoria. Lo que hemos descrito se muestra cmo los ltros o en WEKA se aplican a los datos. Sin embargo, en el caso particular de Remove, hay una manera ms sencilla de lograr el mismo efecto. En lua gar de invocar el Remove ltro, los atributos se pueden seleccionar con los cuadros pequeos en la n Attributes sub-panel y eliminar con el botn de o Remove que aparece en la parte inferior, debajo de la lista de atributos.

Enter 3 into the attributeIndices eld and click the OK button. The window with the lter options closes. Now click the Apply button on the right, which runs the data through the lter. The lter removes the attribute with index 3 from the dataset, and you can see that the set of attributes has been reduced. This change does not aect the dataset in the le; it only applies to the data held in memory. The changed dataset can be saved to a new ARFF le by pressing the Save... button and entering a le name. The action of the lter can be undone by pressing the Undo button. Again, this applies to the version of the data held in memory.

What we have described illustrates how lters in WEKA are applied to data. However, in the particular case of Remove, there is a simpler way of achieving the same eect. Instead of invoking the Remove lter, attributes can be selected using the small boxes in the Attributes sub-panel and removed using the Remove button that appears at the bottom, below the list of attributes.

3.4.1

Exercises

Ex. 6: Ensure that the weather.nominal Ex. dataset is loaded. Use the lter weka.unsupervised.instance.RemoveWithValues to remove all instances in which the humidity attribute has the value high. To do this, rst make the eld next to the Choose button show the text RemoveWithValues. Then click on it to get the GenericObjectEditor window and gure out how to change the lter settings appropriately.

6: Asegrese de que el weather.nominal u conjunto de datos se carga. Utilice el ltro weka.unsupervised.instance.RemoveWithValues para eliminar todos los casos en los que el atributo humedad tiene el valor alto. Para ello, en primer lugar que el campo situado junto al botn de Choose mostrar el o a texto RemoveWithValues, a continuacin, o haga clic en ella para mostrar la ventana de GenericObjectEditor y encontrar la manera de cambiar la conguracin del ltro o adecuadamente.

6

Ex. 7: Undo the change to the dataset that you just performed, and verify that the data is back in its original state.

Ex. 7: Deshacer el cambio en el conjunto de datos que acaba de realizar, y vericar que los datos vuelve a su estado original.

4

The Visualize panelAhora eche un vistazo a las instalaciones de WEKA de visualizacin de datos. Estos funcioo nan mejor con datos numricos, por lo que utilizar e los datos del iris. En primer lugar, la carga iris.arff. Estos datos contienen mediciones de ores. Cada caso se clasica como uno de tres tipos: setosa iris, iris versicolor y virginica iris. El conjunto de datos cuenta con 50 ejemplos de cada tipo: 150 casos en total. Haga clic en la cha Visualize para que aparezca el panel de visualizacin. Muestra una cuadr o cula que contiene 25 grcos de dispersin de dos dia o mensiones, con todas las combinaciones posibles de los cinco atributos de los datos del iris en los x y y ejes. Al hacer clic en la primera parcela en la segunda la se abre una ventana que muestra una trama ampliada con los ejes seleccionados. Las instancias se muestran como pequeas cruces cuyo n color depende de la clase de cruz de la instancia. El eje x muestra el atributo sepallength, y petalwidth muestra el y eje. Al hacer clic en una de las cruces se abre una ventana de Instance Info, que enumera los valores de todos los atributos de la instancia seleccionada. Cierre la ventana de Instance Info de nuevo. Los campos de seleccin en la parte superior de o la ventana que contiene el diagrama de dispersin o se puede utilizar para cambiar los atributos utilizados por los x y y ejes. Pruebe a cambiar el eje x a petalwidth y el y eje petallength. El campo muestra Color: clase (Num)se puede utilizar para cambiar el cdigo de colores. o Cada una de las parcelas de colores poco como la barra a la derecha de la ventana del grco de a dispersin representa un unico atributo. Haciendo o clic en un bar que utiliza atributos para los x eje del diagrama de dispersin. Derecho clic en un bar o hace lo mismo con los y eje. Trate de cambiar los x y y ejes de nuevo a sepallength y petalwidth utilizando estas barras.

We now take a look at WEKAs data visualization facilities. These work best with numeric data, so we use the iris data.

First, load iris.arff. This data contains ower measurements. Each instance is classied as one of three types: iris-setosa, iris-versicolor and irisvirginica. The dataset has 50 examples of each type: 150 instances in all. Click the Visualize tab to bring up the visualization panel. It shows a grid containing 25 twodimensional scatter plots, with every possible combination of the ve attributes of the iris data on the x and y axes. Clicking the rst plot in the second row opens up a window showing an enlarged plot using the selected axes. Instances are shown as little crosses whose color cross depends on the instances class. The x axis shows the sepallength attribute, and the y axis shows petalwidth.

Clicking on one of the crosses opens up an Instance Info window, which lists the values of all attributes for the selected instance. Close the Instance Info window again. The selection elds at the top of the window that contains the scatter plot can be used to change the attributes used for the x and y axes. Try changing the x axis to petalwidth and the y axis to petallength. The eld showing Colour: class (Num) can be used to change the colour coding.

Each of the colorful little bar-like plots to the right of the scatter plot window represents a single attribute. Clicking a bar uses that attribute for the x axis of the scatter plot. Right-clicking a bar does the same for the y axis. Try to change the x and y axes back to sepallength and petalwidth using these bars.

7

The Jitter slider displaces the cross for each instance randomly from its true position, and can reveal situations where instances lie on top of one another. Experiment a little by moving the slider.

El control deslizante Jitter desplaza la cruz por cada instancia al azar de su verdadera posicin, y o puede revelar las situaciones en que casos se encuentran en la parte superior de uno al otro. Experimente un poco moviendo la barra deslizante. El botn de Select Instance y Reset, Clear, y o Save los botones le permiten cambiar el conjunto de datos. Algunos casos se pueden seleccionar y eliminar los dems. Pruebe la opcin Rectangle: a o seleccionar un rea por la izquierda haciendo clic a y arrastrando el ratn. El Reset botn ahora se o o transforma en un botn de Submit. Haga clic en o l, y todos los casos fuera del rectngulo se elime a inan. Usted podr utilizar Save para guardar el a conjunto de datos modicados en un archivo, mientras que Reset restaura el conjunto de datos original.

The Select Instance button and the Reset, Clear and Save buttons let you change the dataset. Certain instances can be selected and the others removed. Try the Rectangle option: select an area by left-clicking and dragging the mouse. The Reset button now changes into a Submit button. Click it, and all instances outside the rectangle are deleted. You could use Save to save the modied dataset to a le, while Reset restores the original dataset.

5

The Classify panelAhora usted sabe cmo cargar un conjunto de o datos de un archivo y visualizarlo como parcelas de dos dimensiones. En esta seccin se aplica o un algoritmo de clasicacindenominado clasio cador en WEKAa los datos. El clasicador se basa (aprende) un modelo de clasicacin de los o datos. En WEKA, todos los esquemas para predecir el valor de un atributo unico, basado en los valores de algunos atributos de otros se llaman clasicadores, incluso si se utilizan para predecir un objetivo numricomientras que otras pere sonas a menudo describen situaciones tales como numrica prediccin o regresin. La razn es e o o o que, en el contexto de aprendizaje de mquina, a la prediccin numrica histricamente ha sido llao e o mada la clasicacin con clases continuas. o Antes de empezar, carga la informacin del o tiempo nuevo. Ir al panel de Preprocess, haga clic en el botn de Open le, y seleco cione weather.nominal.arff desde el directorio de datos. Luego cambiar a la mesa de clasicacin, o haga clic en la cha Classify en la parte superior de la ventana. El resultado se muestra en la Figura 3.

Now you know how to load a dataset from a le and visualize it as two-dimensional plots. In this section we apply a classication algorithmcalled a classier in WEKAto the data. The classier builds (learns) a classication model from the data.

In WEKA, all schemes for predicting the value of a single attribute based on the values of some other attributes are called classiers, even if they are used to predict a numeric targetwhereas other people often describe such situations as numeric prediction or regression. The reason is that, in the context of machine learning, numeric prediction has historically been called classication with continuous classes.

Before getting started, load the weather data again. Go to the Preprocess panel, click the Open le button, and select weather.nominal.arff from the data directory. Then switch to the classication panel by clicking the Classify tab at the top of the window. The result is shown in Figure 3.

8

Figure 3: The Classify panel.

5.1

Using the C4.5 classierUna mquina popular mtodo de aprendizaje para a e la miner de datos se denomina el algoritmo C4.5, a y construye rboles de decisin. En WEKA, se a o implementa en un clasicador llamado J48. Seleccione el clasicador J48 haciendo clic en el botn o de Choose en la parte superior de la cha Classier. Una ventana de dilogo aparece mostrando a los diferentes tipos de clasicadores. Haga clic en la entrada trees a revelar sus subentradas, y haga clic en J48 elegir el clasicador J48. Tenga en cuenta que los clasicadores, como los ltros, estn a organizados en una jerarqu J48 tiene el nombre a: completo weka.classifiers.trees.J48.

A popular machine learning method for data mining is called the C4.5 algorithm, and builds decision trees. In WEKA, it is implemented in a classier called J48. Choose the J48 classier by clicking the Choose button near the top of the Classier tab. A dialogue window appears showing various types of classier. Click the trees entry to reveal its subentries, and click J48 to choose the J48 classier. Note that classiers, like lters, are organized in a hierarchy: J48 has the full name weka.classifiers.trees.J48.

The classier is shown in the text box next to the Choose button: it now reads J48 C 0.25 M 2. The text after J48 gives the default parameter settings for this classier. We can ignore these, because they rarely require changing to obtain good performance from C4.5.

El clasicador se muestra en el cuadro de texto junto al botn Choose: J48 C 0.25 M 2 se o sustituir por el texto. El texto despus de J48 a e da la conguracin de los parmetros por defecto o a para este clasicador. Podemos ignorar esto, ya que rara vez se requieren cambios para obtener un buen rendimiento de C4.5.

9

Decision trees are a special type of classication model. Ideally, models should be able to predict the class values of new, previously unseen instances with high accuracy. In classication tasks, accuracy is often measured as the percentage of correctly classied instances. Once a model has been learned, we should test it to see how accurate it is when classifying instances.

Los rboles de decisin son un tipo especial de a o modelo de clasicacin. Idealmente, los modelos o deben ser capaces de predecir los valores de la clase de nuevo, no visto previamente casos con gran precisin. En las tareas de clasicacin, la precisin o o o se mide como el porcentaje de casos clasicados correctamente. Una vez que un modelo que se ha aprendido, hay que probarlo para ver cmo es exo acto es la hora de clasicar los casos. Una opcin en WEKA es evaluar el rendimiento o en el conjunto de entrenamientolos datos que se utiliz para construir el clasicador. Esto no o es generalmente una buena idea porque conduce a las estimaciones de rendimiento irrealmente optimista. Usted puede obtener el 100% de precisin o en los datos de entrenamiento por el aprendizaje de memoria sencillo, pero esto no nos dice nada sobre el rendimiento de los nuevos datos que se pueden encontrar cuando el modelo se aplica en la prctica. No obstante, a t a tulo ilustrativo es instructivo considerar el rendimiento de los datos de entrenamiento. En WEKA, los datos que se carga mediante el panel de Preprocess es el datos de entrenamiento. Para evaluar el conjunto de entrenamiento, elegir Use training set desde el panel de Test options en el panel Classify. Una vez que la estrategia de prueba se ha establecido, el clasicador se construye y se evalu con el botn o o Start. Este proceso conjunto de entrenamiento utilizando el algoritmo seleccionado aprendizaje, C4.5 en este caso. Luego se clasica a todas las instancias en los datos de entrenamientoporque esta es la opcin de evaluacin que se ha elegido o o y estad sticas de resultados de desempeo. Estos n se muestran en la Figure 4.

One option in WEKA is to evaluate performance on the training setthe data that was used to build the classier. This is NOT generally a good idea because it leads to unrealistically optimistic performance estimates. You can easily get 100% accuracy on the training data by simple rote learning, but this tells us nothing about performance on new data that might be encountered when the model is applied in practice. Nevertheless, for illustrative purposes it is instructive to consider performance on the training data.

In WEKA, the data that is loaded using the Preprocess panel is the training data. To evaluate on the training set, choose Use training set from the Test options panel in the Classify panel. Once the test strategy has been set, the classier is built and evaluated by pressing the Start button. This processes the training set using the currently selected learning algorithm, C4.5 in this case. Then it classies all the instances in the training databecause this is the evaluation option that has been chosenand outputs performance statistics. These are shown in Figure 4.

5.2

Interpreting the outputEl resultado de la formacin y la prueba aparece o en el cuadro de Classier output a la derecha. Puede desplazarse por el texto para examinarla. En primer lugar, busque en la parte que describe el rbol de decisin que se ha generado: a o

The outcome of training and testing appears in the Classier output box on the right. You can scroll through the text to examine it. First, look at the part that describes the decision tree that was generated: J48 pruned tree -----------------outlook = sunny | humidity = high: no (3.0) | humidity = normal: yes (2.0) outlook = overcast: yes (4.0) outlook = rainy | windy = TRUE: no (2.0) | windy = FALSE: yes (3.0) 10

Figure 4: Output after building and testing the classier.

Number of Leaves Size of the tree :

: 8

5

This represents the decision tree that was built, including the number of instances that fall under each leaf. The textual representation is clumsy to interpret, but WEKA can generate an equivalent graphical representation. You may have noticed that each time the Start button is pressed and a new classier is built and evaluated, a new entry appears in the Result List panel in the lower left corner of Figure 4. To see the tree, right-click on the trees.J48 entry that has just been added to the result list, and choose Visualize tree. A window pops up that shows the decision tree in the form illustrated in Figure 5. Right-click a blank spot in this window to bring up a new menu enabling you to auto-scale the view, or force the tree to t into view. You can pan around by dragging the mouse.

Esto representa el rbol de decisin que fue cona o struido, incluyendo el nmero de casos que correu sponden a cada hoja. La representacin textual es o torpe de interpretar, pero WEKA puede generar una representacin grca equivalente. Puede o a haber notado que cada vez que el botn se pulsa o Start y un clasicador de nueva construccin y se o evalu, una nueva entrada aparece en el panel de o Result List en la esquina inferior izquierda de la Figure 4. Para ver el rbol, haga clic en la entrada a trees.J48 que acaba de ser aadido a la lista de ren sultados, y elija Visualize tree. Aparece una ventana que muestra el rbol de decisin en la forma a o ilustrada en la Figure 5. Haga clic en un punto en blanco en esta ventana para que aparezca un nuevo men que le permite auto-escala de la vista, o la u fuerza del rbol para ajustarse a la vista. Puede a desplazarse por arrastrando el ratn. o

11

Figure 5: The decision tree that has been built. This tree is used to classify test instances. The rst condition is the one in the so-called root node at the top. In this case, the outlook attribute is tested at the root node and, depending on the outcome, testing continues down one of the three branches. If the value is overcast, testing ends and the predicted class is yes. The rectangular nodes are called leaf nodes, and give the class that is to be predicted. Returning to the root node, if the outlook attribute has value sunny, the humidity attribute is tested, and if outlook has value rainy, the windy attribute is tested. No paths through this particular tree have more than two tests. Now let us consider the remainder of the information in the Classier output area. The next two parts of the output report on the quality of the classication model based on the testing option we have chosen. The following states how many and what proportion of test instances have been correctly classied: Este rbol se utiliza para clasicar los casos de a prueba. La primera condicin es la de la llamada o ra del nodo en la parte superior. En este caso, z el atributo perspectivas se prueba en el nodo ra z y, dependiendo del resultado, la prueba contina u por una de las tres ramas. Si el valor es cubierto, naliza las pruebas y la clase predicha es s Los . nodos rectangulares se denominan hojas nodos, y dar la clase que se predijo. Volviendo al nodo ra si el atributo perspectivas tiene un valor z, sol, el atributo humedad se prueba, y si perspectivas tiene un valor de lluvias, el atributo viento se prueba. No hay caminos a travs de e este rbol en particular tiene ms de dos pruebas. a a Consideremos ahora el resto de la informacin en o el rea de Classier output. Las dos siguientes a partes del informe de salida en la calidad del modelo de clasicacin basado en la opcin de prueba o o que hemos elegido. Los siguientes estados cuntos y qu proporcin de a e o casos de prueba han sido correctamente clasicados: 100%

Correctly Classified Instances

14

12

This is the accuracy of the model on the data used for testing. It is completely accurate (100%), which is often the case when the training set is used for testing. There are some other performance measures in the text output area, which we wont discuss here. At the bottom of the output is the confusion matrix: === Confusion Matrix === a b