This repository contains a suite of R scripts and a Shiny web application for analyzing wax samples using Visible-Near Infrared (Vis-NIR) spectroscopy. These tools include preprocessing, classification, clustering, and dimensionality reduction methods tailored to study the effects of hydroprocessing on waxes.
-
Spectra_VisNIRS_Waxes_Type.R
- Prepares Vis-NIR spectral data for analysis using smoothing, normalization, and scatter correction.
-
Gaussian_SVM_VisNIRS_Waxes_HT.R
- Implements Gaussian Support Vector Machine (SVM) models to classify hydroprocessing grades.
-
RF_VisNIRS_Waxes_HT.R
- Applies Random Forest classification to determine wax hydroprocessing levels.
-
HCA_VisNIRS_Waxes_HIFI.R
- Performs Hierarchical Cluster Analysis (HCA) with dendrogram visualizations to group wax samples.
-
PCA_VisNIRS_Waxes_HIFI.R
- Conducts Principal Component Analysis (PCA) and visualizes eigenvalues, scores, and loadings.
-
app.R
- A Shiny application for uploading, preprocessing, visualizing, and classifying wax data.
- R version 4.4.0 (2024-04-24, "Puppy Cup")
- RStudio (optional but recommended)
Task | Package | Version |
---|---|---|
Spectral preprocessing | prospectr |
0.2.7 |
Clustering (HCA) | stats |
4.4.0 |
Dendrogram visualization | factoextra |
1.0.7 |
PCA | stats |
4.4.0 |
PCA visualization | factoextra |
1.0.7 |
Machine learning (SVM, RF) | caret |
6.0-94 |
Random Forest models | ranger |
0.17.0 |
Data manipulation | dplyr , data.table , stringr |
1.1.4, 1.16.2, 1.5.1 |
Radar charts | ggplot2 , ggiraphExtra |
3.5.1, 0.3.0 |
Visualization | ggplot2 , viridis , egg |
3.5.1, 0.6.5, 0.4.5 |
Web application | shiny |
1.9.1 |
Web themes | shinythemes |
1.2.0 |
- Open the R script in RStudio.
- Update file paths and parameters as needed.
- Run the script to analyze wax data.
- Place
app.R
,weighted_rf.rds
, andtest_data.xlsx
in the same folder. - In your R console, run:
shiny::runApp("app.R")
- Use the web interface to:
- 📁 Upload
.csv
or.xlsx
data files. - 🛠️ Preprocess data using advanced filtering techniques.
- 🤖 Predict hydroprocessing grades with AI.
A sample dataset (test_data.xlsx
) is included for demonstration purposes. It contains Vis-NIR spectral readings and hydroprocessing grades for various wax samples.
- Preprocessing: Savitzky–Golay smoothing and scatter correction.
- Clustering: HCA with dendrogram visualization.
- Dimensionality Reduction: PCA with eigenvalues, score, and loading plots.
- Machine Learning: SVM and Random Forest models for hydroprocessing classification.
- Web Application: Intuitive Shiny interface for non-technical users.
- Nebux Cloud, S.L.
- Experts in AI-driven data analysis solutions.
- University of Cádiz (AGR-291 Research Group)
- Specializing in hydrocarbon characterization and spectroscopy.
This project is licensed under the GNU GENERAL PUBLIC License. See LICENSE
for details.