Re: Co-occurrence matrix

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Co-occurrence matrix

Eibe Frank-3
It is possible to calculate the co-occurrence matrix in WEKA assuming you have binary data. (If the data is not binary, you will have to use the MathExpression filter to binarise the data first.)

The idea is to first take the transpose of the data matrix and then apply the KernelFilter with a dot product kernel (the default), turning preprocessing in the kernel filter off.

Here is an example input dataset in CSV format:

product1,product2,product3
0,1,1
1,1,0
0,0,1

Assuming this data is stored in a file called test.csv in the current directory, the co-occurrence matrix can then be computed by using the following command-line if your operating system supports piping with the "|" character:

   java weka.Run .Transpose -i test.csv | java weka.Run .PartitionedMultiFilter -R 2-last -F ".KernelFilter -P .AllFilter"

This gives the following output:

@relation 'test-weka.filters.unsupervised.attribute.Transpose-weka.filters.unsupervised.attribute.PartitionedMultiFilter-Fweka.filters.unsupervised.attribute.KernelFilter -K \"weka.classifiers.functions.supportVector.PolyKernel -E 1.0 -C 250007\" -kernel-factor 1 -P \"weka.filters.AllFilter \"-R2-last'

@attribute 'filtered-0-Kernel 0' numeric
@attribute 'filtered-0-Kernel 1' numeric
@attribute 'filtered-0-Kernel 2' numeric
@attribute unfiltered-Identifier string

@data

1,1,0,product1
1,2,1,product2
0,1,2,product3

The same operations can also be performed in WEKA's GUIs, e.g., the Explorer.

Cheers,
Eibe

On Mon, Nov 19, 2018 at 8:05 PM eldisa122 <[hidden email]> wrote:
Hi weka team,


I'm new to machine learning, can someone help me to build this o-occurrence
matrix.

<http://weka.8497.n7.nabble.com/file/t6706/Screen_Shot_2018-11-19_at_08.png>


Thank you in advice.
Best regards





--
Sent from: http://weka.8497.n7.nabble.com/
_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html

_______________________________________________
Wekalist mailing list
Send posts to: [hidden email]
To subscribe, unsubscribe, etc., visit https://list.waikato.ac.nz/mailman/listinfo/wekalist
List etiquette: http://www.cs.waikato.ac.nz/~ml/weka/mailinglist_etiquette.html