Docsity

Come usare il software KNIME, Schemi e mappe concettuali di Machine learning

Toggle sidebar
bg1
Esercitazione n.ro 1
1. Basics
a. Knime Basic Nodes
i. CVS Reader
ii. Exel Reader (XSL) (deprecated)
iii. CVS Writer (deprecated)
iv. PMML Writer (deprecated)
NB. Quando si ha un triangolino nero si tratta di dati, quando si ha un quadratino blu
è un modello di predizione.
>> Reads CSV files. (dalla descrizione sulla
destra)
O si trascina il file in formato .csv sopra
oppure si seleziona la sua posizione precisa
da “Cofigure” (tasto destro).
Per visualizzare ad esempio “iris.csv” si
preme poi su “Execute” e infine “File Table”.
>> This node reads a spread sheet and
provides it at its output port.
Il comportamento è simile a quello del
nodo precedente. Non c’è nel pacchetto
“Dataset” un file .xsl.
>> This node writes out the input data table into
a file or to a remote location denoted by an URL.
Per poter eseguire il nodo è necessario mettere
in ingresso dei dati, ad esempio l’input può
essere l’ouput di {1.a.i}.
Si è quindi generato il file "C:\Users\feffe\knime-
workspace\Dataset\prova_csv_writer.csv".
>> This nodes writes a PMML model from a PMML
model port into a PMML v4.0 compliant file or to
a remote location denoted by an URL.
Un modello PMML (Predictive Model Markup
Language) è un modo standardizzato di
rappresentare modelli predittivi, consentendo
l'importazione e l'esportazione senza perdita di
informazioni tra diversi ambienti software.
pf3
pf4
pf5
pf8
pf9
pfa

Anteprima parziale del testo

Scarica Come usare il software KNIME e più Schemi e mappe concettuali in PDF di Machine learning solo su Docsity!

Esercitazione n.ro 1

1. Basics

a. Knime Basic Nodes i. CVS Reader ii. Exel Reader (XSL) (deprecated) iii. CVS Writer (deprecated) iv. PMML Writer (deprecated) NB. Quando si ha un triangolino nero si tratta di dati, quando si ha un quadratino blu è un modello di predizione. >> Reads CSV files. (dalla descrizione sulla destra) O si trascina il file in formato .csv sopra oppure si seleziona la sua posizione precisa da “Cofigure” (tasto destro). Per visualizzare ad esempio “iris.csv” si preme poi su “Execute” e infine “File Table”. >> This node reads a spread sheet and provides it at its output port. Il comportamento è simile a quello del nodo precedente. Non c’è nel pacchetto “Dataset” un file .xsl. >> This node writes out the input data table into a file or to a remote location denoted by an URL. Per poter eseguire il nodo è necessario mettere in ingresso dei dati, ad esempio l’input può essere l’ouput di {1.a.i}. Si è quindi generato il file "C:\Users\feffe\knime- workspace\Dataset\prova_csv_writer.csv". >> This nodes writes a PMML model from a PMML model port into a PMML v4.0 compliant file or to a remote location denoted by an URL. Un modello PMML (Predictive Model Markup Language) è un modo standardizzato di rappresentare modelli predittivi, consentendo l'importazione e l'esportazione senza perdita di informazioni tra diversi ambienti software.

v. Filter Apply vi. Normalizer vii. Decision Tree Learner viii. Decision Tree Predictor b. Weka Basic Nodes i. ARFF Reader >> This node filters the input according to the filter definitions which are either given in the input table itself or optional as an additional model input. Nota i due diversi ingressi e la sola uscita. >> This node normalizes the values of all (numeric) columns. In the dialog, you can choose the columns you want to work on. [Various] normalization methods are available in the dialog. >> This node induces a classification decision tree in main memory... >>This node uses an existing decision tree (passed in through the model port) to predict the class value for new patterns. >> This node reads in ARFF data from an URL. In the configuration dialog specify a valid URL and set an optional row prefix. Trascinare il file non funziona, bisogna selezionarlo da “Configure” e poi si preme “Execute” e “Data from ARFF”.

c. First Example (Read, Visualize and Save) i. Color Manager ii. Size Manager >> Colors can be assigned for either nominal (possible values have to be available) or numeric columns (with lower and upper bounds. Osserva i colori in “Table with Color Informations”. >> Assigns sizes corresponding to the values of the selected numeric column. The higher the value the higher the size.

iii. Shape Manager iv. Scatter Plot (legacy) v. Scatter Matrix (legacy) >> Assigns (different) shapes for each attribute value of one nominal column, i.e. for each possible value. >> Creates a scatterplot of two selectable attributes. Then each datapoint is displayed as a dot at its corresponding place, dependent on its values of the selected attributes. The dots are displayed in the color defined by the Color Manager, the size defined by the Size Manager, and the shape defined by the Shape Manager. Seleziona “View: Scatter Plot”. >> In a scatter matrix each matrix element Eij is a scatterplot of the columns i and j, where the values of the i-th column are displayed at the x axis and the values of the j-th column at the y axis while the coordinates are displayed alternating on all sides of the plot.

b. MultiClass Classification Metrics c. Regression Metrics i. Numeric Scorer (deprecated)

3. X-Validation

a. Error in Validation: L’esempio è stato già discusso al punto {2.a}. >> This node computes certain statistics between the a numeric column's values (r (^) i ) and predicted (p (^) i ) values. It computes R² =1-SS (^) res /SS (^) tot =1-Σ(p (^) i - r (^) i )²/Σ(r (^) i - 1/nΣr (^) i )² (can be negative!), mean absolute error (1/nΣ|p i - r i |), mean squared error (1/nΣ(p (^) i - r (^) i )²), root mean squared error (sqrt(1/nΣ(p (^) i - r (^) i )²)), and mean signed difference (1/n*Σ(p (^) i - r (^) i )). The computed values can be inspected in the node's view and/or further processed using the output table.

b. Hold Out i. Partitioning Il risultato è migliore di prima! >> The input table is split into two partitions (i.e. row- wise), e.g. train and test data. The two partitions are available at the two output ports. The following options are available in the dialog: Absolute: Specify the absolute number of rows in the first partition. If there are less rows than specified here, all rows are entered into the first table, while the second table contains no rows. Relative: The percentage of the number of rows in the input table that are in the first partition. It must be between 0 and 100, inclusively. Take from top: This mode puts the top-most rows into the first output table and the remainder in the second table. Linear sampling: This mode always includes the first and the last row and selects the remaining rows linearly over the whole table (e.g. every third row). This is useful to downsample a sorted column while maintaining minimum and maximum value. Draw randomly: Random sampling of all rows, you may optionally specify a fixed seed. Stratified sampling: Check this button if you want stratified sampling, i.e. the distribution of values in the selected column is (approximately) retained in the output tables. You may optionally specify a fixed seed.

d. Error in Apply Nomalization i. Shuffle: It shuffles the rows of the input tables such that they are in random order.

ii. Normalized NB. Non è corretto normalizzare i dati di training insieme a quelli di testing! e. Apply Normalization (Correct!!!) i. Normalized (Apply): This node normalizes the input data according to the normalization parameters as given in the model input (typically coming from the Normalizer node). It will apply an affine transformation to all columns in the input data that are contained in the model input. This node is typically used when test data shall be normalized the same way the training data has been normalized (using the "Normalizer" node). >> This node normalizes the values of all (numeric) columns. In the dialog, you can choose the columns you want to work on. The following normalization methods are available in the dialog. Min-max normalization: Linear transformation of all values such that the minimum and maximum in each column are as given. Z-score normalization (Gaussian): Linear transformation such that the values in each column are Gaussian-(0,1)-distributed, i.e. mean is 0.0 and standard deviation is 1.0. Normalization by decimal scaling: The maximum value in a column (both positive and negative) is divided j-times by 10 until its absolute value is smaller or equal to 1. All values in the column are then divided by 10 to the power of j. Nota la “Normalized table”!