Code of the proyect "Clustering of Accusatory Comments from SOCE"
Jupyter Notebook
0
26 commits
updated May 15, 2026
This repository is intended to store the necessary files for the execution, replication, and analysis of the "Recognition of Accusatory Comments in Ecuadorian Public Procurement Processes Using a Hybrid Approach: Unsupervised and Supervised Learning" project.
First, we will explain the structure and characteristics of the files, as this will help in understanding the tasks to be performed with the repository’s contents.
This repostitory contains the next file extensions:
For this point, we only center on .py files. We have three types of files:
This files are developed for a support reason. This project only have 2 tool files:
It coud say that this files are user defined libraries. In this files you can find all the functions that I developed to work in this project. There are a few util files:
This files are python script to do some concrete action. This scripts use the utils files and other general purpose libraries. There are a few train files in this project:
To make this example useful, we follow a full example of training (a complete pipeline). All the commands on this point are bash scripts:
python3 tool_create_base_paths.py --file_path "path_routes.txt"
python3 tool_val_gpu_usage.py
python3 train_word_embeddings.py --cud_device "1" --process "TR" --llm_algo "W2" --tipo "UN" --default_llm_algo "S" --obs "Fine Tune example"
This command generate a W2V fine tune model, with the unsupervised dataset of the project, taking as a reference the "S" default model and putting on logs the observation value "Fine tune example".
python3 train_word_embeddings.py --cud_device "1" --process "EM" --llm_algo "W2" --tipo "UN" --default_llm_algo "S" --obs "Embeddings example"
This command generate a CSV file with the original dataframe added new columns with 1000 text embedding columns. It's important that the fine tune dataset was written on the ./language_models/llms_models.csv. The name of the out file will be:
The "X" value will be an integer that increments constantly. If the last execution save "df_supervised_3", the actual execution will save "df_supervised_4". We can recognize a particular execution based on the log_files.
python3 train_models.py --dea_alg_multi "1" --max_clust "15" --algorithm "gmm" --clst_param1 "diag" --clst_param2 "500" --llm_algo_train "W2V_BASE" --dataset "df_unsupervised_w2v_6.csv" --scaler "1"
This command executes a GMM clustering, with a diag covariance and max 15 clusters with the csv "df_unsupervised_w2v_6.csv". The embeddings will be recognized automatically.
python3 train_clas_model.py --dea_alg_multi "1" --k_clust "5" --algo_clas "R_Forest" --algo_clst "GMM" --algo_vec_phrase "w2v" --dataset "df_supervised_w2v_1.csv" --dis_smote "0" --dis_clus_filter "0" --obs "Observation for training"
This command execute a Random Forest Classifier with the "df_supervised_w2v_1.csv" dataset applying a GMM model of 5 clusters. Then find the most accusatory cluster and make classification about this. Aditionally, the execution will use smote and make a cluster filter (over most accusatory).
Code of the proyect "Clustering of Accusatory Comments from SOCE"
Jupyter Notebook
0
26 commits
updated May 15, 2026
This repository is intended to store the necessary files for the execution, replication, and analysis of the "Recognition of Accusatory Comments in Ecuadorian Public Procurement Processes Using a Hybrid Approach: Unsupervised and Supervised Learning" project.
First, we will explain the structure and characteristics of the files, as this will help in understanding the tasks to be performed with the repository’s contents.
This repostitory contains the next file extensions:
For this point, we only center on .py files. We have three types of files:
This files are developed for a support reason. This project only have 2 tool files:
It coud say that this files are user defined libraries. In this files you can find all the functions that I developed to work in this project. There are a few util files:
This files are python script to do some concrete action. This scripts use the utils files and other general purpose libraries. There are a few train files in this project:
To make this example useful, we follow a full example of training (a complete pipeline). All the commands on this point are bash scripts:
python3 tool_create_base_paths.py --file_path "path_routes.txt"
python3 tool_val_gpu_usage.py
python3 train_word_embeddings.py --cud_device "1" --process "TR" --llm_algo "W2" --tipo "UN" --default_llm_algo "S" --obs "Fine Tune example"
This command generate a W2V fine tune model, with the unsupervised dataset of the project, taking as a reference the "S" default model and putting on logs the observation value "Fine tune example".
python3 train_word_embeddings.py --cud_device "1" --process "EM" --llm_algo "W2" --tipo "UN" --default_llm_algo "S" --obs "Embeddings example"
This command generate a CSV file with the original dataframe added new columns with 1000 text embedding columns. It's important that the fine tune dataset was written on the ./language_models/llms_models.csv. The name of the out file will be:
The "X" value will be an integer that increments constantly. If the last execution save "df_supervised_3", the actual execution will save "df_supervised_4". We can recognize a particular execution based on the log_files.
python3 train_models.py --dea_alg_multi "1" --max_clust "15" --algorithm "gmm" --clst_param1 "diag" --clst_param2 "500" --llm_algo_train "W2V_BASE" --dataset "df_unsupervised_w2v_6.csv" --scaler "1"
This command executes a GMM clustering, with a diag covariance and max 15 clusters with the csv "df_unsupervised_w2v_6.csv". The embeddings will be recognized automatically.
python3 train_clas_model.py --dea_alg_multi "1" --k_clust "5" --algo_clas "R_Forest" --algo_clst "GMM" --algo_vec_phrase "w2v" --dataset "df_supervised_w2v_1.csv" --dis_smote "0" --dis_clus_filter "0" --obs "Observation for training"
This command execute a Random Forest Classifier with the "df_supervised_w2v_1.csv" dataset applying a GMM model of 5 clusters. Then find the most accusatory cluster and make classification about this. Aditionally, the execution will use smote and make a cluster filter (over most accusatory).