FastPrepPredict House Prices

Predict House Prices

Capital One logoCapital One● HardFULLTIMEOA

Problem statement

You are given preprocessed train_data, validation_data, and test_data. Use the labeled training and validation rows to predict a price for every test row.

For this deterministic practice version:

  1. Do not use house_id or price as model features.
  2. Combine the training and validation rows. Standardize each feature with that combined labeled mean and population standard deviation; ignore features whose labeled standard deviation is 0.
  3. For each test row, select the three nearest labeled rows by squared Euclidean distance, or all labeled rows when fewer than three exist. Break equal-distance ties by labeled input order.
  4. Transform neighbor prices with log(1 + price), average those transformed values, apply the inverse transform, and round the predicted price to six decimal places.

Return exactly one column named price, preserving the original test_data row order.

Table schema

Pandas

Use the same input data with any supported language. Open the Schema tab in the editor to see the generated SQL setup or Pandas DataFrames.

train_data

The labeled training split.

ColumnTypeNullableDescription
house_idPKIntegerNo—
bedroomsDecimalNo—
bathroomsDecimalNo—
sqft_livingDecimalNo—
sqft_lotDecimalNo—
floorsDecimalNo—
waterfrontIntegerNo—
ageDecimalNo—
num_viewsDecimalNo—
conditionIntegerNo—
priceDecimalYes—

validation_data

The labeled validation split.

ColumnTypeNullableDescription
house_idPKIntegerNo—
bedroomsDecimalNo—
bathroomsDecimalNo—
sqft_livingDecimalNo—
sqft_lotDecimalNo—
floorsDecimalNo—
waterfrontIntegerNo—
ageDecimalNo—
num_viewsDecimalNo—
conditionIntegerNo—
priceDecimalYes—

test_data

The unlabeled test split to predict.

ColumnTypeNullableDescription
house_idPKIntegerNo—
bedroomsDecimalNo—
bathroomsDecimalNo—
sqft_livingDecimalNo—
sqft_lotDecimalNo—
floorsDecimalNo—
waterfrontIntegerNo—
ageDecimalNo—
num_viewsDecimalNo—
conditionIntegerNo—
priceDecimalYes—

Expected result

Your query or function must return these columns.

ColumnTypeNullableDescription
priceDecimalNo—

Row order: must match exactly. Numeric tolerance: 0.000001.

Constraints

  • Every input table is non-empty.
  • Training and validation prices are non-null and nonnegative.
  • Test prices are null and must not be used.
  • Every feature value is finite.
  • All three tables have the same feature columns.
  • The output has exactly one row per test row.

Source note: Original Capital One data-science assessment task (carousel slide 3).

More Capital One problems

See Capital One hiring insights