Skip to main content

KNeighborsClassifier

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

14 recorded job(s); 14 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
LoadBreastCancer-TrainTestSplit-SimpleImputer-FunctionTransformer / KNeighborsClassifierwhole runcompletedResult recordedrun-0632
LoadBreastCancer-TrainTestSplit-SimpleImputer-KBinsDiscretizer / KNeighborsClassifierwhole runcompletedResult recordedrun-0640
LoadBreastCancer-TrainTestSplit-SimpleImputer-QuantileTransformer / KNeighborsClassifierwhole runcompletedResult recordedrun-0648
LoadBreastCancer-TrainTestSplit-SimpleImputer-StandardScaler / KNeighborsClassifierwhole runcompletedResult recordedrun-0656
LoadBreastCancer-TrainTestSplit-SimpleImputer-normalize / KNeighborsClassifierwhole runcompletedResult recordedrun-0664
LoadWine-TrainTestSplit-SimpleImputer-FunctionTransformer / KNeighborsClassifierwhole runcompletedResult recordedrun-0696
LoadWine-TrainTestSplit-SimpleImputer-KBinsDiscretizer / KNeighborsClassifierwhole runcompletedResult recordedrun-0704
LoadWine-TrainTestSplit-SimpleImputer-QuantileTransformer / KNeighborsClassifierwhole runcompletedResult recordedrun-0712
LoadWine-TrainTestSplit-SimpleImputer-StandardScaler / KNeighborsClassifierwhole runcompletedResult recordedrun-0720
LoadWine-TrainTestSplit-SimpleImputer-normalize / KNeighborsClassifierwhole runcompletedResult recordedrun-0728
MakeClassification-TrainTestSplit-SimpleImputer-KBinsDiscretizer / KNeighborsClassifierwhole runcompletedResult recordedrun-0736
MakeClassification-TrainTestSplit-SimpleImputer-QuantileTransformer / KNeighborsClassifierwhole runcompletedResult recordedrun-0744
MakeClassification-TrainTestSplit-SimpleImputer-StandardScaler / KNeighborsClassifierwhole runcompletedResult recordedrun-0752
MakeClassification-TrainTestSplit-SimpleImputer-normalize / KNeighborsClassifierwhole runcompletedResult recordedrun-0760

Representative execution​

Scenario: LoadBreastCancer-TrainTestSplit-SimpleImputer-FunctionTransformer / KNeighborsClassifier; partition: whole run; observed status: completed. run-0632 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 "KNeighborsClassifier" or "KNeighborsTransformer" or "LocalOutlierFactor"
bool requiresTarget = neighborsAlgorithm is "KNeighborsClassifier" or "KNeighborsRegressor"
"KNeighborsClassifier" => await SendTypedAsync(new KNeighborsClassifierJobSendRequestModel
ClassifierType = "KNeighborsClassifier",

Request​

{
"input": {
"train_blob_id": "6cd0072c-cacf-f966-963c-7dc144f9db7c",
"test_blob_id": "608f8ac2-dcb0-3eb6-7fa1-4c76b6136d96",
"classifier_type": "KNeighborsClassifier",
"classifier_params": {
"n_neighbors": 5,
"weights": "distance"
},
"feature_columns": [
"mean radius",
"mean texture",
"mean perimeter",
"mean area",
"mean smoothness",
"mean compactness",
"mean concavity",
"mean concave points",
"mean symmetry",
"mean fractal dimension",
"radius error",
"texture error",
"perimeter error",
"area error",
"smoothness error",
"compactness error",
"concavity error",
"concave points error",
"symmetry error",
"fractal dimension error",
"worst radius",
"worst texture",
"worst perimeter",
"worst area",
"worst smoothness",
"worst compactness",
"worst concavity",
"worst concave points",
"worst symmetry",
"worst fractal dimension"
],
"file_format": "csv",
"target_column": "target",
"generate_graphs": true
},
"output": {
"name": "LoadBreastCancer-TrainTestSplit-SimpleImputer-FunctionTransformer-KNeighborsClassifier.zip",
"description": "Neighbors integration test using cached numerical preprocessing outputs",
"record_type": "Generic",
"access_tier": "Hot",
"tags": [
"neighbors",
"LoadBreastCancer",
"FunctionTransformer",
"KNeighborsClassifier"
],
"artifact_contract_version": "2.0"
},
"request_timeout_seconds": 300
}

Send response​

{
"start_time": "2026-11-30T22:12:31.9968161+00:00",
"end_time": "2026-11-30T22:12:32.076136+00:00",
"elapsed_milliseconds": 79.32,
"status": "published",
"job_id": "97774625-1535-333b-48a5-eddff6fe4d86",
"topic": "pm.topic.ml.neighbors",
"subscription": "cpu.0p5c.1gi",
"send_request_model": {
"job_id": "97774625-1535-333b-48a5-eddff6fe4d86",
"json": {
"job_id": "97774625-1535-333b-48a5-eddff6fe4d86",
"model_id": "0092e982-80d0-a014-f4e5-efd5ad4b95a8",
"input": {
"train_blob_id": "6cd0072c-cacf-f966-963c-7dc144f9db7c",
"train_encryption_key": "[REDACTED]",
"test_blob_id": "608f8ac2-dcb0-3eb6-7fa1-4c76b6136d96",
"test_encryption_key": "[REDACTED]",
"classifier_type": "KNeighborsClassifier",
"classifier_params": {
"n_neighbors": 5,
"weights": "distance"
},
"feature_columns": [
"mean radius",
"mean texture",
"mean perimeter",
"mean area",
"mean smoothness",
"mean compactness",
"mean concavity",
"mean concave points",
"mean symmetry",
"mean fractal dimension",
"radius error",
"texture error",
"perimeter error",
"area error",
"smoothness error",
"compactness error",
"concavity error",
"concave points error",
"symmetry error",
"fractal dimension error",
"worst radius",
"worst texture",
"worst perimeter",
"worst area",
"worst smoothness",
"worst compactness",
"worst concavity",
"worst concave points",
"worst symmetry",
"worst fractal dimension"
],
"file_format": "csv"
},
"request_timeout_seconds": 300,
"output": {
"name": "LoadBreastCancer-TrainTestSplit-SimpleImputer-FunctionTransformer-KNeighborsClassifier.zip",
"description": "Neighbors integration test using cached numerical preprocessing outputs",
"record_type": "Generic",
"access_tier": "Hot",
"tags": [
"neighbors",
"LoadBreastCancer",
"FunctionTransformer",
"KNeighborsClassifier"
],
"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-30T22:13:32.6138421+00:00",
"end_time": "2026-11-30T22:13:33.2040897+00:00",
"elapsed_milliseconds": 590.24,
"job_id": "97774625-1535-333b-48a5-eddff6fe4d86",
"status": "completed",
"topic": "pm.topic.ml.neighbors",
"subscription": "cpu.0p5c.1gi"
}

Result response​

{
"schema_version": "2.0",
"job_id": "97774625-1535-333b-48a5-eddff6fe4d86",
"model_id": "0092e982-80d0-a014-f4e5-efd5ad4b95a8",
"status": "succeeded",
"worker": {
"name": "neighbors",
"task_family": "classification",
"algorithm": "KNeighborsClassifier"
},
"input": {
"mode": "prepared_train_test",
"partitions": {
"train": {
"blob_id": "6cd0072c-cacf-f966-963c-7dc144f9db7c",
"row_count": 426
},
"test": {
"blob_id": "608f8ac2-dcb0-3eb6-7fa1-4c76b6136d96",
"row_count": 143
}
},
"feature_columns": [
"mean radius",
"mean texture",
"mean perimeter",
"mean area",
"mean smoothness",
"mean compactness",
"mean concavity",
"mean concave points",
"mean symmetry",
"mean fractal dimension",
"radius error",
"texture error",
"perimeter error",
"area error",
"smoothness error",
"compactness error",
"concavity error",
"concave points error",
"symmetry error",
"fractal dimension error",
"worst radius",
"worst texture",
"worst perimeter",
"worst area",
"worst smoothness",
"worst compactness",
"worst concavity",
"worst concave points",
"worst symmetry",
"worst fractal dimension"
],
"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": 143,
"accuracy": 0.965034965034965,
"f1_weighted": 0.9648123641438936,
"classes": [
0,
1
],
"confusion_matrix": [
[
49,
4
],
[
1,
89
]
]
}
},
"artifact_files": [
"model/model.joblib",
"predictions/predictions.csv",
"graphs/performance.png",
"graphs/performance.svg",
"graphs/confusion_matrix.png",
"graphs/confusion_matrix.svg",
"graphs/prediction_distribution.png",
"graphs/prediction_distribution.svg",
"result.json"
],
"extras": {
"algorithm": {
"learned": {
"n_features_in": 30,
"n_samples_fit": 426,
"effective_metric": "euclidean",
"effective_metric_params": {},
"classes": [
0,
1
],
"centroids": null,
"class_prior": null,
"components": null,
"n_iter": null,
"bandwidth": null,
"n_neighbors": null,
"offset": null
},
"warnings": [],
"data": {
"row_count": 569,
"column_count": 33,
"feature_count": 30,
"file_format": "csv",
"prediction_scope": "all_input_rows",
"training_row_indices": null
},
"runtime": {
"captured_at_utc": "2026-11-30T22:13:07.369691+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-30T22:13:54.9168817+00:00",
"end_time": "2026-11-30T22:13:56.1086038+00:00",
"elapsed_milliseconds": 1191.71,
"status": "uploaded",
"model_id": "0092e982-80d0-a014-f4e5-efd5ad4b95a8",
"source_blob_id": "1dc68a63-2a54-dbde-ff54-cbfe5f748aa5",
"uploaded_blob_id": "5df4962a-de3c-af1d-5903-a39f3f6be10a",
"filename": "bda24ab3-248d-0cf4-eafc-88073233c00d.json",
"source_path": "result.json",
"source_format": "json",
"size_bytes": 4150,
"upload_status_code": 200
}

Logs​

The trace includes the saved log response (57 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.