Code Monkey home page Code Monkey logo

best-partition-kohonen-maf1-clus's Introduction

Best Partition Kohonen MacroF1

This code is part of my PhD research at PPG-CC/DC/UFSCar. The aim is select the best kohonen partition for multilabel classification using the Macro-F1 metric.

How to cite

@misc{Gatto2021, author = {Gatto, E. C.}, title = {Select Best Kohonen Partition with Macro-F1}, year = {2021}, publisher = {GitHub}, journal = {GitHub repository}, howpublished = {\url{https://github.com/cissagatto/Best-Partition-Kohonen-MacroF1/}}}

Scripts

This source code consists of an R project for R Studio and the following R scripts:

  1. libraries.R
  2. utils.R
  3. validation.R
  4. bestPartitions.R
  5. run.R
  6. macrof1.R

Preparing your experiment

Step-1

This code is executed in X-fold cross-validation (mandatory!). First, you have to obtain the X-fold cross-validation files using this code: https://github.com/cissagatto/CrossValidationMultiLabel (all the instructions to use the code are in the Github). After that, put the results generated in the datasets folder in this project. The folder structure generated by the code CrossValidationMultilabel is used here.

Step-2

Place a copy of this code in "C:/Users/[username]/Best-Partition-MacroF1" or "/home/[username]/Best-Partition-MacroF1. Our files are configured to obtain the paths of the folders from the root project. You can change this in the code if you want.

Step-3

A file called datasets.csv must be in the root project folder. This file is used to read information about the datasets and they are used in the code. All 74 datasets available in cometa (https://cometa.ujaen.es/) are in this file. If you want to use another dataset, please, add the following information about the dataset in the file:

Id, Name, Domain, Labels, Instances, Attributes, Inputs, Labelsets, Single, Max freq, Card, Dens, MeanIR, Scumble, TCS, AttStart, AttEnd, LabelStart, LabelEnd, xn, yn, gridn

The "Id" of the dataset is a mandatory parameter in the command line to run all code. The fields are used in a lot of internal functions. Please, make sure that this information is available before running the code. xn and yn correspond to a dimension of the quadrangular map for kohonen, and gridn is xn * yn. Example: xn = 4, yn = 4, gridn = 16.

Step-4

Confirms if the folder UTILS contains the following files: Clus.jar, R_csv_2_arff.jar, and weka.jar. Without these jars, the code not runs. Also, confirms if the folder libs is present with the jars: Clus.jar, commons-math-1.0.jar, jgap.jar and weka.jar.

Step-5

The results stored in the folder OUTPUT in the codes Generate-Partition-Kohonen, or Generate-Partition-Random1, or Generate-Partition-Random2 or Generate-Partition-Jaccard will be used here. Copy the folder with the name of the dataset in the folder PARTITIONS.

NOTE: Please, pay attention to the datasets.csv names and the names in the CSV file. They must be the same, on the contrary, an error may occur.

Folder Strucutre

Software Requirements

This code was develop in RStudio Version 1.4.1106 © 2009-2021 RStudio, PBC "Tiger Daylily" (2389bc24, 2021-02-11) for Ubuntu Bionic Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8 Chrome/69.0.3497.128 Safari/537.36. The R Language version was: R version 4.1.0 (2021-05-18) -- "Camp Pontanezen" Copyright (C) 2021 The R Foundation for Statistical Computing Platform: x86_64-pc-linux-gnu (64-bit).

Please, make sure all the dependencies are installed (verify libraries.R). This code does not provide any installation of the packages.

Hardware Requirements

This code may or may not be executed in parallel, however, it is highly recommended that you run it in parallel. The number of cores can be configured via the command line (number_cores). If number_cores = 1 the code will run sequentially. In our experiments, we used ten cores. For reproducibility, we recommend that you also use ten cores.

This code was tested with the birds dataset in the following machine:

System:

Host: bionote | Kernel: 5.8.0-53-generic | x86_64 bits: 64 | Desktop: Gnome 3.36.7 | Distro: Ubuntu 20.04.2 LTS (Focal Fossa)

CPU:

Topology: 6-Core | model: Intel Core i7-10750H | bits: 64 | type: MT MCP | L2 cache: 12.0 MiB | Speed: 800 MHz | min/max: 800/5000 MHz Core speeds (MHz): | 1: 800 | 2: 800 | 3: 800 | 4: 800 | 5: 800 | 6: 800 | 7: 800 | 8: 800 | 9: 800 | 10: 800 | 11: 800 | 12: 800 |

Then the experiment was executed in a cluster at UFSCar.

Results

The results are store in the folder RESULTS. The results stored in the folder OUTPUT here, it will be used in the next phase. The OUTPUT for a dataset must be put in the folder BESTPARTITIONS in the codes Test-Best-Partition-Clus, or Test-Best-Partition-ECC.

RUN

To run the code, open the terminal, enter /home/[username]/Best-Partition-kohonen-MacroF1/scripts/ folder, and type:

Rscript macrof1.R [number_dataset] [number_cores] [number_folds] [name_folder_results]

Where:

number_dataset is the dataset number in the datasets.csv file

number_cores is the total cores you want to use in parallel execution.

number_folds is the number of folds you want for cross-validation

_name_folders_results is the name of the folder to save the results

All parameters are mandatory. Example:

Rscript macrof1.R 17 5 10 /dev/shm/results

This will execute the code for the dataset number 17 in the dataset.csv, with 5 cores, 10 folds and the process will be store in the /dev/shm/results/. This code automatically makes a copy of the */dev/shm/results/ in the folder Results - which is in the root of the project. In this way, you can run the code using a temporary folder, like scratch and shm, to speed up the execution.

Acknowledgment

  • This study was financed in part by the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior - Brasil (CAPES) - Finance Code 001.
  • This study was financed in part by the Conselho Nacional de Desenvolvimento Científico e Tecnológico - Brasil (CNPQ) - Process number 200371/2022-3.
  • The authors also thank the Brazilian research agencies FAPESP financial support.

Contact

[email protected]

Links

| Site | Post-Graduate Program in Computer Science | Computer Department | Biomal | CNPQ | Ku Leuven | Embarcados | Read Prensa | Linkedin Company | Linkedin Profile | Instagram | Facebook | Twitter | Twitch | Youtube |

Thanks

best-partition-kohonen-maf1-clus's People

Contributors

cissagatto avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.