Skip to main content

KNeighborsRegressor

Nearest Neighbors standalone SDK operation. Source: 6.8.ML.Neighbors.cs. Read the complete C# integration test and setup.

8 recorded job(s); 8 have a success/completed status and a saved result. These are API records rather than independently verified test passes.

Recorded scenarios​

Recorded scenarioPartitionLast statusEvidenceJSON trace
LoadDiabetes-TrainTestSplit-SimpleImputer-KBinsDiscretizer / KNeighborsRegressorwhole runcompletedResult recordedrun-0672
LoadDiabetes-TrainTestSplit-SimpleImputer-QuantileTransformer / KNeighborsRegressorwhole runcompletedResult recordedrun-0678
LoadDiabetes-TrainTestSplit-SimpleImputer-StandardScaler / KNeighborsRegressorwhole runcompletedResult recordedrun-0684
LoadDiabetes-TrainTestSplit-SimpleImputer-normalize / KNeighborsRegressorwhole runcompletedResult recordedrun-0690
MakeRegression-TrainTestSplit-SimpleImputer-KBinsDiscretizer / KNeighborsRegressorwhole runcompletedResult recordedrun-0768
MakeRegression-TrainTestSplit-SimpleImputer-QuantileTransformer / KNeighborsRegressorwhole runcompletedResult recordedrun-0774
MakeRegression-TrainTestSplit-SimpleImputer-StandardScaler / KNeighborsRegressorwhole runcompletedResult recordedrun-0780
MakeRegression-TrainTestSplit-SimpleImputer-normalize / KNeighborsRegressorwhole runcompletedResult recordedrun-0786

Representative execution​

Scenario: LoadDiabetes-TrainTestSplit-SimpleImputer-KBinsDiscretizer / KNeighborsRegressor; partition: whole run; observed status: completed. run-0672 contains all recorded numbered JSON events for this job.

Operation selection in the C# test​

These are matching lines from the parameterized test, not a separate runnable program. See the full source for context.

"KNeighborsClassifier", "KNeighborsRegressor", "KNeighborsTransformer", "KernelDensity",
"KernelDensity" or "KNeighborsRegressor" or "KNeighborsTransformer" or "LocalOutlierFactor"
bool requiresTarget = neighborsAlgorithm is "KNeighborsClassifier" or "KNeighborsRegressor"
"KNeighborsRegressor" => await SendTypedAsync(new KNeighborsRegressorJobSendRequestModel
ClassifierType = "KNeighborsRegressor",

Request​

{
"input": {
"train_blob_id": "d2f69bb1-53a6-d4db-3c1c-9d30bf53b443",
"test_blob_id": "2b8a06ec-5d7e-b2c4-bea7-13cdf2a9acd2",
"classifier_type": "KNeighborsRegressor",
"classifier_params": {
"n_neighbors": 5,
"weights": "distance"
},
"feature_columns": [
"age_0.0",
"age_1.0",
"age_2.0",
"sex_0.0",
"bmi_0.0",
"bmi_1.0",
"bmi_2.0",
"bp_0.0",
"bp_1.0",
"bp_2.0",
"s1_0.0",
"s1_1.0",
"s1_2.0",
"s2_0.0",
"s2_1.0",
"s2_2.0",
"s3_0.0",
"s3_1.0",
"s3_2.0",
"s4_0.0",
"s4_1.0",
"s4_2.0",
"s5_0.0",
"s5_1.0",
"s5_2.0",
"s6_0.0",
"s6_1.0",
"s6_2.0"
],
"file_format": "csv",
"target_column": "target",
"generate_graphs": true
},
"output": {
"name": "LoadDiabetes-TrainTestSplit-SimpleImputer-KBinsDiscretizer-KNeighborsRegressor.zip",
"description": "Neighbors integration test using cached numerical preprocessing outputs",
"record_type": "Generic",
"access_tier": "Hot",
"tags": [
"neighbors",
"LoadDiabetes",
"KBinsDiscretizer",
"KNeighborsRegressor"
],
"artifact_contract_version": "2.0"
},
"request_timeout_seconds": 300
}

Send response​

{
"start_time": "2026-11-30T23:30:36.9230146+00:00",
"end_time": "2026-11-30T23:30:37.0262149+00:00",
"elapsed_milliseconds": 103.2,
"status": "published",
"job_id": "f149dba3-65e9-007f-ea5e-1b00ff96fb00",
"topic": "pm.topic.ml.neighbors",
"subscription": "cpu.0p5c.1gi",
"send_request_model": {
"job_id": "f149dba3-65e9-007f-ea5e-1b00ff96fb00",
"json": {
"job_id": "f149dba3-65e9-007f-ea5e-1b00ff96fb00",
"model_id": "0092e982-80d0-a014-f4e5-efd5ad4b95a8",
"input": {
"train_blob_id": "d2f69bb1-53a6-d4db-3c1c-9d30bf53b443",
"train_encryption_key": "[REDACTED]",
"test_blob_id": "2b8a06ec-5d7e-b2c4-bea7-13cdf2a9acd2",
"test_encryption_key": "[REDACTED]",
"classifier_type": "KNeighborsRegressor",
"classifier_params": {
"n_neighbors": 5,
"weights": "distance"
},
"feature_columns": [
"age_0.0",
"age_1.0",
"age_2.0",
"sex_0.0",
"bmi_0.0",
"bmi_1.0",
"bmi_2.0",
"bp_0.0",
"bp_1.0",
"bp_2.0",
"s1_0.0",
"s1_1.0",
"s1_2.0",
"s2_0.0",
"s2_1.0",
"s2_2.0",
"s3_0.0",
"s3_1.0",
"s3_2.0",
"s4_0.0",
"s4_1.0",
"s4_2.0",
"s5_0.0",
"s5_1.0",
"s5_2.0",
"s6_0.0",
"s6_1.0",
"s6_2.0"
],
"file_format": "csv"
},
"request_timeout_seconds": 300,
"output": {
"name": "LoadDiabetes-TrainTestSplit-SimpleImputer-KBinsDiscretizer-KNeighborsRegressor.zip",
"description": "Neighbors integration test using cached numerical preprocessing outputs",
"record_type": "Generic",
"access_tier": "Hot",
"tags": [
"neighbors",
"LoadDiabetes",
"KBinsDiscretizer",
"KNeighborsRegressor"
],
"encryption_key": "[REDACTED]",
"artifact_contract_version": "2.0"
},
"target_column": "target",
"evaluation": null,
"generate_graphs": true
},
"topic": "pm.topic.ml.neighbors",
"subscription": "cpu.0p5c.1gi"
}
}

Final recorded status​

{
"start_time": "2026-11-30T23:31:37.2935833+00:00",
"end_time": "2026-11-30T23:31:37.8208068+00:00",
"elapsed_milliseconds": 527.22,
"job_id": "f149dba3-65e9-007f-ea5e-1b00ff96fb00",
"status": "completed",
"topic": "pm.topic.ml.neighbors",
"subscription": "cpu.0p5c.1gi"
}

Result response​

{
"schema_version": "2.0",
"job_id": "f149dba3-65e9-007f-ea5e-1b00ff96fb00",
"model_id": "0092e982-80d0-a014-f4e5-efd5ad4b95a8",
"status": "succeeded",
"worker": {
"name": "neighbors",
"task_family": "regression",
"algorithm": "KNeighborsRegressor"
},
"input": {
"mode": "prepared_train_test",
"partitions": {
"train": {
"blob_id": "d2f69bb1-53a6-d4db-3c1c-9d30bf53b443",
"row_count": 331
},
"test": {
"blob_id": "2b8a06ec-5d7e-b2c4-bea7-13cdf2a9acd2",
"row_count": 111
}
},
"feature_columns": [
"age_0.0",
"age_1.0",
"age_2.0",
"sex_0.0",
"bmi_0.0",
"bmi_1.0",
"bmi_2.0",
"bp_0.0",
"bp_1.0",
"bp_2.0",
"s1_0.0",
"s1_1.0",
"s1_2.0",
"s2_0.0",
"s2_1.0",
"s2_2.0",
"s3_0.0",
"s3_1.0",
"s3_2.0",
"s4_0.0",
"s4_1.0",
"s4_2.0",
"s5_0.0",
"s5_1.0",
"s5_2.0",
"s6_0.0",
"s6_1.0",
"s6_2.0"
],
"target_columns": [
"target"
]
},
"training": {
"effective_params": {
"algorithm": "auto",
"leaf_size": 30,
"metric": "minkowski",
"metric_params": null,
"n_jobs": null,
"n_neighbors": 5,
"p": 2.0,
"weights": "distance"
},
"metrics": {}
},
"evaluation": {
"partition": "test",
"metrics": {
"scope": "holdout",
"sample_count": 111,
"predicted_sample_count": 111,
"no_prediction_count": 0,
"mean_absolute_error": 51.67578763366991,
"mean_squared_error": 4348.265519783439,
"root_mean_squared_error": 65.9413794197804,
"r2": 0.21365109460027154
}
},
"artifact_files": [
"model/model.joblib",
"predictions/predictions.csv",
"graphs/actual_vs_predicted.png",
"graphs/actual_vs_predicted.svg",
"graphs/residuals.png",
"graphs/residuals.svg",
"graphs/prediction_distribution.png",
"graphs/prediction_distribution.svg",
"result.json"
],
"extras": {
"algorithm": {
"learned": {
"n_features_in": 28,
"n_samples_fit": 331,
"effective_metric": "euclidean",
"effective_metric_params": {},
"classes": null,
"centroids": null,
"class_prior": null,
"components": null,
"n_iter": null,
"bandwidth": null,
"n_neighbors": null,
"offset": null
},
"warnings": [],
"data": {
"row_count": 442,
"column_count": 31,
"feature_count": 28,
"file_format": "csv",
"prediction_scope": "all_input_rows",
"training_row_indices": null
},
"runtime": {
"captured_at_utc": "2026-11-30T23:31:22.047391+00:00",
"python": {
"version": "3.12.16",
"implementation": "CPython"
},
"packages": {
"scikit-learn": "1.9.1",
"numpy": "2.5.4",
"pandas": "3.0.6",
"scipy": "1.18.1",
"pydantic": "2.14.1",
"joblib": "1.6.0",
"matplotlib": "3.11.2",
"azure-servicebus": "7.14.3",
"parallelmodel": "1.0.0"
},
"environment": {
"os": "Linux",
"os_release": "6.6.159.1-2.azl3",
"architecture": "x86_64",
"region": "uk1"
}
},
"execution": {
"executionName": "[REDACTED]",
"jobName": "[REDACTED]",
"container": {
"hostname": "[REDACTED]",
"replicaName": "[REDACTED]",
"processId": 1
}
}
},
"build": {
"built_at_utc": null,
"source": "unavailable",
"image_tag": null
}
}
}

First extract response​

{
"start_time": "2026-11-30T23:31:52.2146997+00:00",
"end_time": "2026-11-30T23:31:52.979262+00:00",
"elapsed_milliseconds": 764.55,
"status": "uploaded",
"model_id": "0092e982-80d0-a014-f4e5-efd5ad4b95a8",
"source_blob_id": "0deff188-0b07-a052-ed21-d6968319ac37",
"uploaded_blob_id": "9b43d99f-472b-2afa-1a70-de394ec2f8d3",
"filename": "860cd551-afeb-289d-64f9-a8b8a0c00b12.json",
"source_path": "result.json",
"source_format": "json",
"size_bytes": 3806,
"upload_status_code": 200
}

Logs​

The trace includes the saved log response (55 entries).

Reproduce the operation​

dotnet test --filter "FullyQualifiedName~ParallelModel.Sdk.UnitTests.Neighbors.Run"

The filter runs the class theory; use the recorded scenario values above to identify the corresponding parameter set. For partitioned operations, one theory can submit multiple jobs. The redacted payload identifiers are not usable live credentials or blob IDs.