rk.business.mining: Predictive Analytics and Classification for RKWard

A Zero-Code GUI Wrapper for Data Mining and Machine Learning bringing Business Analytics to RKWard

rk.business.mining bridges the gap between complex machine learning algorithms and practical Business Analytics. Designed with modern data science workflows in mind (aligning with leading business analytics textbooks), this plugin provides a seamless, point-and-click interface to partition data, train Decision Trees, run K-NN or Naive Bayes classifiers, and evaluate business KPIs (like Accuracy, Sensitivity, and AUC via ROC curves)—all without writing a single line of R code.


🌟 Key Features


What's New in Version 0.0.1


⚙️ Prerequisites

You must have RKWard installed along with the following R packages. The plugin will automatically attempt to load them when required:

install.packages(c("rpart", "rpart.plot", "caret", "e1071", "pROC"))

🚀 Installation

You can install this plugin directly from GitHub using remotes or devtools inside your RKWard console:

# Install the plugin
library("remotes")
# install_github("AlfCano/rk.business.mining")
install.packages("rk.business.mining", repos = c('https://alfcano.r-universe.dev', 'https://cloud.r-project.org'))

Once installed, restart RKWard to ensure the new menu entries and translations appear correctly.


🛠️ Usage Workflow

This plugin adds a comprehensive modeling suite under the Analysis > Predictive Analytics menu in RKWard:

1. Data Partitioning (Train / Test Split)

The critical first step for any Predictive Analytics project. Securely split your dataset into training (e.g., 70%) and testing (e.g., 30%) sets using stratified sampling to ensure your target classes are well-represented in both sets.

2. Decision Trees (Classification)

Highly interpretable models perfect for business presentations. Select your training data, target variable, and predictors. Tweak hyperparameters (Complexity Parameter, Max Depth), choose a beautiful color palette, and let the plugin generate the tree rules and visual nodes.

3. Other Classifiers (KNN & Naive Bayes)

Alternative algorithms for benchmark comparisons. Train non-parametric models. The GUI intelligently reminds you to standardize your numeric data when selecting distance-based models like KNN.

4. Model Evaluation (Metrics & ROC)

The Acid Test: Expose your models to the Testing Data. Pass your trained models and the untainted testing dataset to this tool. Generate comprehensive Confusion Matrices, extract KPIs, and plot pristine ROC Curves to evaluate the true predictive power (AUC) of your models.


📊 Real-World Case Study: Predicting Outcomes

To see the true power of rk.business.mining in a Business Analytics context (such as the methodologies taught in Jaggia's Business Analytics textbook), let's predict a categorical outcome.

While textbooks often use customer churn or loan defaults, we will use a classic dataset pre-loaded in R: kyphosis (predicting whether a patient will develop a spinal deformity after surgery).

Step 1: Load the Data & Partition

  1. Open the R Console (bottom panel in RKWard) and run: data(kyphosis, package="rpart")
  2. Go to the top menu: Analysis > Predictive Analytics > Data Partitioning (Train/Test).
  3. Select kyphosis as your Dataset and Kyphosis (the first column) as your Target.
  4. Leave the training percentage at 70% and click Submit. 👉 You will see a clean summary indicating that data_train and data_test have been securely created in your workspace.

Step 2: Generate the Decision Tree (The Core Model)

  1. Go to Analysis > Predictive Analytics > Decision Trees (Classification).
  2. Use data_train as your Training Data.
  3. Select Kyphosis (the categorical absent/present variable) as the Target Variable.
  4. Leave the Predictors box blank (this tells the algorithm to automatically use all remaining columns, just like in real-world data mining).
  5. In the Plot Options tab, select the "Red-Yellow-Green (Business)" palette.
  6. Click Submit. 👉 The plugin will output a beautiful tree plot and save the mathematical model as tree_model.

Step 3: Explore an Alternative Model (K-NN)

Sometimes a director wants to compare scenarios. What if we measure "distances" between patients using K-NN instead of logical rules?

  1. Go to Analysis > Predictive Analytics > Other Classifiers (KNN & Naive Bayes).
  2. Training Data: Select data_train.
  3. Target Variable: Select Kyphosis. (Leave Predictors blank).
  4. Classifier Algorithm: Select "K-Nearest Neighbors (KNN)".
  5. Leave "Standardize (Scale) numeric data?" checked (Vital for K-NN because age and number of vertebrae are measured on completely different scales!).
  6. Save Model as: Change it to knn_model (so we don't overwrite our tree).
  7. Click Submit.

Step 4: The Acid Test (Model Evaluation)

Here we test our brand-new models using the test data we sliced off at the beginning—data the algorithm has never seen before.

  1. Go to Analysis > Predictive Analytics > Model Evaluation (Metrics & ROC).
  2. Model Object Name: Type tree_model (the one we saved in Step 2).
  3. Testing Dataset: Select data_test (the pure, untainted database).
  4. Actual Target Variable: Choose Kyphosis (ensure you select it from the columns of data_test).
  5. Ensure the Confusion Matrix and ROC Curve checkboxes are selected.
  6. Click Submit.

🗣️ Communicating with Numbers (Translating Output to Business)

True to the Jaggia philosophy, we don't hand management a report full of "p-values" and raw R code. We use the tables generated by RKWard to speak in terms of operations and profitability.

Here is how you "pitch" the clean HTML reports RKWard just gave you:

1. Interpreting the Confusion Matrix & Accuracy: Look at the Business Metrics section. If the Overall Accuracy is 79%, you tell the Medical Director (or CEO):

"Out of every 100 surgeries (or customers), our model correctly predicts the outcome for 79 of them. This allows us to surgically target our preventive resources and budget rather than guessing."

2. Interpreting Sensitivity (True Positive Rate): Look at the Sensitivity row.

"The model successfully flagged the vast majority of patients who were actually at risk. While our sensitivity indicates we didn't catch every single one, we will still be able to cut post-operative complications by more than half."

3. Interpreting the ROC Curve (AUC): Look at the generated ROC plot and the Area Under the Curve (AUC) number.

"Our model has an AUC of 0.75. Considering that flipping a coin gives us 0.50, our system has real predictive power. With this, the hospital can confidently decide to allocate preventive physical therapy specifically to patients who fall into the 'red node' of our decision tree, optimizing the budget."


🌍 Internationalization (i18n)

The graphical interface automatically adapts to your RKWard language settings. Currently supported languages:


📝 License and Author

Author: Alfonso Cano (@AlfCano)
Email: alfonso.cano@correo.buap.mx

This project is licensed under the GPL (>= 3) License.