Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

You can build and score a regression model inside Oracle Database with Oracle Machine Learning for SQL (OML4SQL), then compare its predictions with a generalized linear model (GLM) using RMSE and MAE. Oracle’s Boston housing example supplies the data-preparation and evaluation workflow, but it does not publish a neural-network score for this dataset. Treat the Boston data as an illustrative exercise—not a current housing sample or a production valuation tool—and run both models on the same held-out rows before comparing them.

What this workflow does—and what it does not establish

OML4SQL provides machine-learning algorithms through Oracle Database, where model building and scoring can use database processing rather than requiring you to export the data to a separate modeling environment. Oracle’s regression use case frames the task as estimating median owner-occupied home values in Boston. Its walkthrough uses GLM; Oracle also lists Neural Network as a supported regression algorithm.

The neural-network option makes this a neural-network regression example, but the available documentation does not specify a layer count, optimizer, or a measured Boston-dataset result. Do not call it a particular deep architecture or report a metric as an Oracle-published benchmark. Record your Oracle Database and OML4SQL release, algorithm settings, split, and results so another user can reproduce the run.

The walkthrough is documented under OML4SQL 21; the related examples material spans OML4SQL 23 documentation and a 26ai sample script. Syntax, settings, and interfaces can vary by release. Check the documentation for the release actually installed before running a model-building block.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Understand the Boston dataset and its target

Oracle’s customized dataset contains 506 rows and 13 attributes. It excludes one original dimension and adds HID, a case identifier for joining predictions back to rows. MEDV is the target: median value of owner-occupied homes, measured in thousands of dollars in the dataset. The remaining columns are predictors.

Column Meaning
HID Added case identifier.
CRIM Per-capita crime rate by town.
ZN Proportion of residential land zoned for lots over 25,000 square feet.
INDUS Proportion of non-retail business acres per town.
CHAS Charles River indicator: 1 if the tract bounds the river; otherwise 0.
NOX Nitric-oxides concentration, in parts per 10 million.
RM Average rooms per dwelling.
AGE Proportion of owner-occupied units built before 1940.
DIS Weighted distance to five Boston employment centers.
RAD Index of accessibility to radial highways.
TAX Full-value property-tax rate per $10,000.
PTRATIO Pupil-teacher ratio by town.
LSTAT Percentage of lower-status population.
MEDV Prediction target: median home value in thousands of dollars.

Oracle’s 2021 walkthrough reports 471 records with CHAS=0, 35 with CHAS=1, and zero rows returned by its illustrated NULL check. Those counts describe the documented dataset, not a guarantee about every downloaded or transformed copy. The source labels the dataset illustrative; its target and observations should not be interpreted as current Boston market values.

Load the CSV into Oracle

Prepare a stable case identifier

  1. Obtain the Boston CSV used by Oracle’s OML4SQL regression use case.
  2. Remove the original dimension row as the walkthrough specifies.
  3. Add sequential HID values so each record can be tracked through the split and scoring steps.

Keep a copy of the prepared CSV and document how HID was assigned. If you regenerate the identifier differently, the joins may still work within a run, but individual rows will no longer correspond to the same cases across runs.

Rank #2
Sale
Oracle PL / SQL For Dummies
  • Used Book in Good Condition

Create the input table

Oracle’s example table is named BOSTON_HOUSING. Use numeric columns for the measurements and target, and a character column for CHAS as in the documented schema.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
CREATE TABLE BOSTON_HOUSING (
  HID     NUMBER NOT NULL,
  CRIM    NUMBER,
  ZN      NUMBER,
  INDUS   NUMBER,
  CHAS    VARCHAR2(32),
  NOX     NUMBER,
  RM      NUMBER,
  AGE     NUMBER,
  DIS     NUMBER,
  RAD     NUMBER,
  TAX     NUMBER,
  PTRATIO NUMBER,
  LSTAT   NUMBER,
  MEDV    NUMBER
);

Import the prepared file

In Autonomous Database, Oracle’s workflow places the CSV in OCI Object Storage, creates a database credential with DBMS_CLOUD.CREATE_CREDENTIAL, and loads rows with DBMS_CLOUD.COPY_DATA. Supply your own authorized Object Storage location and credential details using the instructions for your database release; never put passwords, tokens, or other live credentials in shared SQL, notebooks, or published examples. For an on-premises database, the documented alternative is importing the CSV through Oracle SQL Developer.

Check data quality before fitting a model

Verify the loaded records and column types before creating a supervised model. In particular, confirm that the target is numeric, the case identifier is present and unique, and the categorical indicator has the expected values.

Rank #3
Sale
Mastering Oracle SQL, 2nd Edition
  • Used Book in Good Condition
  • Count the loaded rows and compare them with the expected 506-row input.
  • Check for nulls in the predictors and target, and inspect the values returned for CHAS.
  • Review descriptive statistics and interquartile ranges (IQRs) to spot unexpected values or possible outliers.
  • Investigate discrepancies rather than silently changing records. Oracle says OML algorithms can handle NULL values automatically; if you choose manual replacement, Oracle identifies NVL as one SQL option. Record the treatment you used.

The documented example’s null check returns no rows, but that does not remove the need to validate your own import. A missing value introduced during loading or editing changes the input being modeled.

Make one reproducible training and test split

Do not evaluate a supervised model on the same rows used to fit it. Create training and test sets first, leaving known MEDV values in the test rows so you can compare predictions with actuals. Oracle’s walkthrough uses an 80/20 sample split. For repeatable membership based on the stable identifier, the following views use a seeded hash split that assigns roughly 80 percent of hash buckets to training and the remainder to testing:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
CREATE OR REPLACE VIEW BOSTON_TRAIN AS
SELECT *
FROM BOSTON_HOUSING
WHERE ORA_HASH(HID, 99, 42) < 80;

CREATE OR REPLACE VIEW BOSTON_TEST AS
SELECT *
FROM BOSTON_HOUSING
WHERE ORA_HASH(HID, 99, 42) >= 80;

The seed and rule make the row assignment repeatable for a fixed input and Oracle behavior, but the resulting row counts need not be exactly 80/20. Check them explicitly. If you use Oracle’s documented sampling approach instead, record the split method and seed supported by your release. Do not create separately randomized training and test samples without checking for overlap or omissions.

Fit the GLM baseline and neural-network model

Use GLM as the interpretable reference

GLM gives you a transparent baseline for a numeric target: Oracle describes it as a simple model that fits a linear relationship, and its coefficients and diagnostics can help explain how the fitted model behaves. It is a useful comparison, not proof that the relationship in the data is truly linear.

OML4SQL model creation uses DBMS_DATA_MINING.CREATE_MODEL or CREATE_MODEL2, with a regression mining function and algorithm settings. This release-oriented skeleton shows the legacy procedure pattern; use the argument form and supported settings documented for your installed release. The settings table must contain the GLM algorithm setting specified by that release.

BEGIN
  DBMS_DATA_MINING.CREATE_MODEL(
    model_name          => 'BOSTON_GLM',
    mining_function     => DBMS_DATA_MINING.REGRESSION,
    data_table_name     => 'BOSTON_TRAIN',
    case_id_column_name => 'HID',
    target_column_name  => 'MEDV',
    settings_table_name => 'BOSTON_GLM_SETTINGS'
  );
END;
/

Create and populate BOSTON_GLM_SETTINGS with the release’s documented generalized-linear-model algorithm setting before running this block. Model settings, automatic preparation, and transformations affect what is learned; include them in your run notes rather than treating the model name alone as a full specification.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Fit Neural Network with the same input rows

For the comparison model, use the Oracle Neural Network algorithm for the regression mining function. Create a second settings table using the Neural Network algorithm setting supported by the installed release, and build a separate model from the same BOSTON_TRAIN view. Do not invent an architecture or imply that Oracle’s example specifies a particular number of layers or optimizer: those details are not established by the documented Boston walkthrough.

Keep preparation decisions consistent where possible. If the two algorithms require or use different preparation behavior, document that difference; otherwise an error difference may reflect the preparation pipeline as well as the algorithm. Capture the database and OML4SQL release, settings, split rule, and any explicit transformations alongside the result.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Score held-out rows and calculate RMSE and MAE

OML4SQL exposes scoring through SQL’s PREDICTION function. Score each model against the same test view, retain HID to associate the prediction with its case, and compare predicted values with the actual MEDV. This query illustrates the evaluation pattern for the GLM; substitute the neural-network model name and run it against the identical test rows for the second result.

WITH scored AS (
  SELECT
    HID,
    MEDV AS actual_medv,
    PREDICTION(BOSTON_GLM USING *) AS predicted_medv
  FROM BOSTON_TEST
)
SELECT
  SQRT(AVG(POWER(predicted_medv - actual_medv, 2))) AS rmse,
  AVG(ABS(predicted_medv - actual_medv))             AS mae
FROM scored;

RMSE is the square root of the mean squared prediction error; MAE is the mean absolute prediction error. Lower values indicate smaller errors on the evaluated rows, while RMSE responds more strongly to large individual misses because it squares errors before averaging. Both metrics are expressed in the target’s units—in this dataset, thousands of dollars. The values describe this held-out split, not guaranteed performance on new data.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To make a fair comparison, calculate both metrics for each model on the same test cases and verify the scored row count. A changed split, target scale, or set of evaluated records makes the numbers non-comparable. Oracle provides the SQL approach for calculating RMSE and MAE, but does not publish a Boston Neural Network result in the cited walkthrough; report only metrics produced by your own specified run.

Choose between the models based on the run, not the label

Decision axis GLM Neural Network
Predictive error Measure RMSE and MAE on the held-out rows. Measure RMSE and MAE on those same rows; no Oracle-published Boston result is stated.
Interpretability Coefficients and diagnostics offer a more transparent account of the fitted relationship. Less directly interpretable; do not infer feature effects solely from a lower error score.
Preparation Record automatic preparation and any explicit transformations used. Record automatic preparation and any explicit transformations used; confirm the release-specific behavior.
Operations Model building and scoring occur through OML4SQL in the database, subject to database privileges and runtime. Uses the same in-database operating context; actual runtime depends on the run and configuration.

If prediction error is similar, interpretability and operational simplicity may favor GLM. If the neural network improves both metrics meaningfully on a stable, properly held-out evaluation, that is evidence for this run—not a general guarantee. For either model, a single split is a limited estimate; document the exact settings and release before using the result to guide a decision.

Quick Recap

Bestseller No. 1
SaleBestseller No. 2
Oracle PL / SQL For Dummies
Oracle PL / SQL For Dummies
Used Book in Good Condition
$15.95
SaleBestseller No. 3
Mastering Oracle SQL, 2nd Edition
Mastering Oracle SQL, 2nd Edition
Used Book in Good Condition
$20.80

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.