> For the complete documentation index, see [llms.txt](https://academy.pentaho.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://academy.pentaho.com/pdi-developer-path-sandbox/speciality-courses/machine-learning.md).

# Machine Learning

Machine learning with Pentaho Data Integration. A credit-card fraud-detection use case covering H2O AutoML, model training and scoring in R, and handling imbalanced datasets.

{% hint style="warning" icon="eye" %}
**SANDBOX — draft page.** For review only. Items marked REPLACE-ME need an owner's confirmation.
{% endhint %}

Detect credit-card fraud with Pentaho Data Integration. Discover a well-performing algorithm automatically with H2O AutoML, then put that choice into practice — train a Gradient Boosting Machine in R, score every transaction with a fraud probability, and handle the imbalanced datasets that make fraud detection hard.

{% columns %}
{% column %}

<p align="center"><i class="fa-file-lines" style="color:green;">:file-lines:</i><br><strong>5 lessons</strong><br><em>across 2 modules</em></p>
{% endcolumn %}

{% column %}

<p align="center"><i class="fa-flask" style="color:orange;">:flask:</i><br><strong>3 workshops</strong><br><em>hands-on labs</em></p>
{% endcolumn %}

{% column %}

<p align="center"><i class="fa-clock" style="color:cyan;">:clock:</i><br><strong>~1 hour</strong><br><em>55m of workshops</em></p>
{% endcolumn %}
{% endcolumns %}

{% hint style="success" icon="cloud-arrow-up" %}
Every workshop is hands-on and runs on Pentaho's hosting platform. The Lab Guide is embedded in each lab and loads automatically when you open it — nothing to install.
{% endhint %}

***

<h3 align="center">Before you start</h3>

{% columns %}
{% column %}
{% hint style="success" icon="circle-check" %}
**What you'll need**

Comfortable building transformations and jobs in Pentaho Data Integration. The labs come with Python and H2O, and R with rJava; the first workshop sets up the rest, including a Google Colab account (REPLACE-ME: confirm what is preinstalled).
{% endhint %}
{% endcolumn %}

{% column %}
{% hint style="info" icon="tag" %}
**Built against**

Pentaho Enterprise Edition **11.0.0.0-232**, the build every course on the Academy runs, with Python, H2O, R and rJava configured against the install. Setup commands are given for Ubuntu and Debian.
{% endhint %}
{% endcolumn %}
{% endcolumns %}

***

{% hint style="info" icon="trophy" %}

#### What you'll build

A working fraud scorer. One transformation blends four files into a training set and runs H2O AutoML to rank algorithms. A second trains a Gradient Boosting Machine in R and saves the model; a third loads it and scores every transaction with a fraud probability. A job runs the training and scoring transformations in order.

The scenario is a direct retailer losing money to orders paid with stolen cards — a problem organisations typically lose around 5% of annual revenue to.
{% endhint %}

<figure><img src="https://1407627559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3zO083cdmEBCaZG8U9P2%2Fuploads%2F0eys0maO3G473pRo28Fi%2Fml-course-path.svg?alt=media" alt="The use case end to end. AutoML lab: four source files, three Stream lookups and feature engineering, then tfo-H2O writes data/H2O.csv and the Python Executor step runs AutoML in h2o-env. A Colab notebook ranks five algorithms by AUC. GBM chosen leads to the Credit Card lab: train in R, gbm_fraud.rdata, predict in R, a scored CSV, with the job running training and then prediction."><figcaption><p>From four files to a scored CSV: AutoML picks the algorithm, R trains and runs it</p></figcaption></figure>

***

<h3 align="center">Skills you'll gain</h3>

<table data-view="cards"><thead><tr><th></th><th></th></tr></thead><tbody><tr><td><i class="fa-layer-group" style="color:blue;">:layer-group:</i> <strong>Blend the training set</strong></td><td>Stream lookup across four files · feature engineering with Formula · billing and shipping zip match flag</td></tr><tr><td><i class="fa-wand-magic-sparkles" style="color:blue;">:wand-magic-sparkles:</i> <strong>AutoML with H2O</strong></td><td>Python Executor step · train and rank algorithms automatically · read the leaderboard</td></tr><tr><td><i class="fa-chart-line" style="color:blue;">:chart-line:</i> <strong>Train and score in R</strong></td><td>R script executor · Gradient Boosting Machine · save and load the model · a fraud probability per transaction · orchestrated by a job</td></tr><tr><td><i class="fa-scale-unbalanced" style="color:blue;">:scale-unbalanced:</i> <strong>Imbalanced data</strong></td><td>Rare fraud against normal volume · why accuracy misleads · handling imbalanced datasets</td></tr></tbody></table>

***

<h3 align="center">Course outline</h3>

<p align="center"><i class="fa-file-lines" style="color:green;">:file-lines:</i> reading · <i class="fa-flask" style="color:orange;">:flask:</i> hands-on workshop</p>

<table data-search="false"><thead><tr><th>Module</th><th width="100" align="center">Reading</th><th width="110" align="center">Workshops</th><th width="100" align="right">Time</th></tr></thead><tbody><tr><td>Getting Started</td><td align="center">1</td><td align="center">—</td><td align="right">~5m</td></tr><tr><td>Machine Learning</td><td align="center">1</td><td align="center">3</td><td align="right">~55m</td></tr><tr><td><strong>Total</strong></td><td align="center"><strong>2</strong></td><td align="center"><strong>3</strong></td><td align="right"><strong>~1h</strong></td></tr></tbody></table>

{% stepper %}
{% step %}

### <i class="fa-rocket" style="color:blue;">:rocket:</i> Getting Started

`1 reading · ~5m`

How to get the most out of this guide, and the honest prerequisite list — Python and Jupyter or Colab, H2O for AutoML, and rJava wired against your Pentaho Data Integration install for the R-backed steps.

<details>

<summary>See the reading</summary>

<table data-search="false"><thead><tr><th width="79"></th><th>Lesson</th><th width="90">Time</th></tr></thead><tbody><tr><td><i class="fa-file-lines" style="color:green;">:file-lines:</i></td><td>Before You Start</td><td>~5m</td></tr></tbody></table>

</details>
{% endstep %}

{% step %}

### <i class="fa-brain-circuit" style="color:blue;">:brain-circuit:</i> Machine Learning

`1 reading · 3 workshops · ~55m`

Detect credit-card fraud with Pentaho Data Integration: discover models automatically with H2O AutoML, learn fraud patterns with supervised algorithms, and handle the imbalanced datasets that make fraud detection hard.

<figure><img src="https://1407627559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3zO083cdmEBCaZG8U9P2%2Fuploads%2FRrDMbry8ItS2PfLxBzEG%2Fml-runtimes.svg?alt=media" alt="Where the code runs. On your machine, inside Spoon&#x27;s Java process: the R script executor step talks through JRI to R, and the Python Executor step uses CPython in the h2o-env virtual environment; /etc/environment gives R its R_HOME. In the cloud, a Colab notebook runs on a hosted runtime. When an R step can&#x27;t start R, check libjri.so and /etc/environment."><figcaption><p>Where each part of the course runs</p></figcaption></figure>

<figure><img src="https://1407627559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3zO083cdmEBCaZG8U9P2%2Fuploads%2F50XvRy7qoizMcJ77G5Q7%2Ftrain-then-predict.svg?alt=media" alt="Top: jb_fraud_main_job.kjb, START to train_model to predict_fraud to Success, red failure hops to Abort job. Below: tr_train_model_fraud.ktr reads four CSV files, keeps eight features plus the label, and rscrpt-train_gbm saves gbm_fraud.rdata. tr_predict_fraud.ktr reads three files, keeps eight features only, rscrpt-predict loads the model, and Predict Fraud writes the scored CSV."><figcaption><p>Two transformations, one model file: training saves it, prediction loads it</p></figcaption></figure>

<details>

<summary>See all 4 lessons</summary>

<table data-search="false"><thead><tr><th width="79"></th><th>Lesson</th><th width="90">Time</th></tr></thead><tbody><tr><td><i class="fa-file-lines" style="color:green;">:file-lines:</i></td><td>Overview — the fraud-detection use case and the two approaches</td><td>—</td></tr><tr><td><i class="fa-flask" style="color:orange;">:flask:</i></td><td>Prerequisite Tasks — Colab, Python with H2O, R and rJava</td><td>~15m</td></tr><tr><td><i class="fa-flask" style="color:orange;">:flask:</i></td><td>AutoML — blend the training set and rank algorithms with H2O</td><td>~20m</td></tr><tr><td><i class="fa-flask" style="color:orange;">:flask:</i></td><td>Credit Card — train a GBM in R, then score transactions</td><td>~20m</td></tr></tbody></table>

</details>
{% endstep %}
{% endstepper %}

***

{% columns %}
{% column %}
{% hint style="warning" icon="file-certificate" %}
**Course accreditation**

REPLACE-ME — what a learner must finish to complete the course, and what they receive for it.
{% endhint %}
{% endcolumn %}

{% column %}
{% hint style="warning" icon="award" %}
**Level 3 credit**

REPLACE-ME — confirm whether this speciality counts towards the Level 3 — Certified credential.
{% endhint %}
{% endcolumn %}
{% endcolumns %}

***

<h3 align="center">How to get access</h3>

{% stepper %}
{% step %}
**Read the course outlines**

Open the level or speciality you're considering and check the modules cover the work you actually do.
{% endstep %}

{% step %}
**Talk to your Pentaho Account Executive**

Courses and subscriptions are purchased through your Pentaho Account Executive — a single seat or the whole team. They'll size it with you and get the order placed. No Account Executive yet? Email <academy@pentaho.com> and we'll connect you.
{% endstep %}

{% step %}
**Receive your voucher code**

You'll be sent a voucher code giving access to the course or courses you bought.
{% endstep %}

{% step %}
**Redeem your code and start your lab**

Redeem the code on the Pentaho training portal and your hosted lab deploys with the Lab Guide built in. Every screen is shown step by step in the voucher walkthrough.

{% embed url="<https://pentaho.selfpaced.training/access/login>" %}

<figure><img src="https://1407627559-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F3zO083cdmEBCaZG8U9P2%2Fuploads%2FPEKFCHIQlCddWOeTkw1V%2Fportal.png?alt=media&#x26;token=1552611a-6317-4746-ab5a-acd61397acca" alt="The Pentaho training portal sign-in page"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

***

<p align="center"><a href="https://academy.pentaho.com/pdi-developer-path-sandbox/speciality-courses.md" class="button secondary" data-icon="arrow-left">Back to Speciality Courses</a></p>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://academy.pentaho.com/pdi-developer-path-sandbox/speciality-courses/machine-learning.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
