← Machine Learning Academy

Machine Learning Academy · 3 / 5

Handle missing features deliberately

Drop rows without priority rather than inventing an arbitrary numeric value.

YOUR TASK

Make this happen

3 steps
  1. Add the require-priority normalization stage loading scripts/normalize.lua. Drop missing priority rows; return quantity and priority for accepted rows.

  2. Keep the working capabilities from the previous lesson and connect the new pieces to the same solution.

  3. Check the complete solution, then inspect any unmet requirements.

This step starts with the earlier solution and one new challenge. Each lesson keeps its own draft.

Read the starter files

main.cococo

ml_model_document "main" {
  format = "1"
  name = "job-quantity"
  backend = "xgboost"
  spec = {
    tabular = ml_model_tabular.quantity
  }
  dataQuerySQL = file("queries/training.sql")
}

model.cococo

ml_model_tabular "quantity" {
  task = "REGRESSION"
  targetColumn = "quantity"
  featureColumns = [ml_model_feature.priority]
}

features.cococo

ml_model_feature "priority" {
  column = "priority"
}

queries/training.sql

SELECT quantity, priority FROM jobs WHERE quantity IS NOT NULL LIMIT 1000

normalize.cococo

ml_model_normalization_stage "clean" {
  name = "require-priority"
  # Source file supplied for this field: scripts/normalize.lua
  # TODO: attach it with source = file(...).
}

scripts/normalize.lua

-- input is one training row.
-- TODO: reject missing priority; return only the target and feature fields.
return input
Supplied supporting files

Reference: machine-learning · authoring