Skip to main content

Nearest Neighbors

Original integration-test class: Neighbors in 6.8.ML.Neighbors.cs. This is a direct SDK operation, not a PipelineClient workflow.

160 recorded job or prediction directories matched by module and scenario path. 160 have completed/success status and a saved result. These are API execution records, not confirmed xUnit pass counts. Partition jobs are counted separately.

Prerequisites​

Use the original SDK test project, its xUnit dependencies, helper classes and any upstream cache entries referenced in the source. See configuration.

Required environment variable names referenced in the source: PARALLELMODEL_MODEL_ID, PARALLELMODEL_COMPUTE_SIZE, PARALLELMODEL_ENCRYPTION_KEY_1, PARALLELMODEL_REGION, PARALLELMODEL_CLIENT_ID, PARALLELMODEL_CLIENT_SECRET.

SDK calls used​

ClientMethods in the source
NeighborsClientDownloadBytesAsync, ExtractAsync, LogAsync, ResultAsync, SendAsync, StatusAsync
PreprocessingClientDownloadBytesAsync

Execution workflow​

  1. Initialise the client and output paths.
  2. Resolve transformed train/test blobs and their shared input columns.
  3. Save and send the concrete request once.
  4. Save each status response until the job reaches a terminal state.
  5. Retrieve logs once after terminal success.
  6. Retrieve the original result.
  7. Extract and download the result and all declared artifacts.
  8. Replace this case atomically after all downloads succeed.

Recorded operation examples​

OperationRecorded jobsResult recorded
KNeighborsClassifier1414
KNeighborsRegressor88
KNeighborsTransformer2222
KernelDensity2222
LocalOutlierFactor2222
NearestCentroid1414
NeighborhoodComponentsAnalysis1414
RadiusNeighborsClassifier1414
RadiusNeighborsRegressor88
RadiusNeighborsTransformer2222

Run the original integration test​

This filter selects the class and its parameterized scenarios; it does not select only a single recorded job.

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

Full C# source​

The supplied test logic is preserved. The method signature is:

Run(string dataset, string modelselection, string impute, string preprocessing, string neighborsAlgorithm)
using ParallelModel.Sdk.Authentication;
using ParallelModel.Sdk.Exceptions;
using ParallelModel.Sdk.ML.Neighbors.Models.Requests;
using ParallelModel.Sdk.UnitTests.Attributes;
using ParallelModel.Sdk.UnitTests.Cache;
using ParallelModel.Sdk.UnitTests.Helpers;
using System.Text.Json;
using static ParallelModel.Sdk.UnitTests.Helpers.MLNeighborsHelper;

namespace ParallelModel.Sdk.UnitTests
{
[Collection("Neighbors")]
public sealed class Neighbors
{
private static readonly TimeSpan ApiTimeout = TimeSpan.FromSeconds(300);
private static readonly SharedSendThrottle SendThrottle = new(TimeSpan.FromSeconds(12));
private static readonly string[] Algorithms =
[
"KNeighborsClassifier", "KNeighborsRegressor", "KNeighborsTransformer", "KernelDensity",
"LocalOutlierFactor", "NearestCentroid", "NeighborhoodComponentsAnalysis",
"RadiusNeighborsClassifier", "RadiusNeighborsRegressor", "RadiusNeighborsTransformer"
];

public static TheoryData<string, string, string, string, string> NeighborsRequests =>
PreprocessingAttribute.GetRequests(typeof(Neighbors), nameof(Run), AlgorithmsFor);

private static string[] AlgorithmsFor(string dataset, string preprocessing) => (dataset, preprocessing) switch
{
(_, "label_binarize") => [],
("LoadDiabetes" or "MakeRegression", _) => Algorithms.Where(algorithm => algorithm is
"KernelDensity" or "KNeighborsRegressor" or "KNeighborsTransformer" or "LocalOutlierFactor"
or "RadiusNeighborsRegressor" or "RadiusNeighborsTransformer").ToArray(),
("LoadBreastCancer" or "LoadWine" or "MakeClassification", _) => Algorithms.Where(algorithm => algorithm is
"KernelDensity" or "KNeighborsClassifier" or "KNeighborsTransformer" or "LocalOutlierFactor"
or "NearestCentroid" or "NeighborhoodComponentsAnalysis" or "RadiusNeighborsClassifier"
or "RadiusNeighborsTransformer").ToArray(),
_ => []
};

[Theory]
[MemberData(nameof(NeighborsRequests))]
[Trait("Category", "Integration")]
[Preprocessing(dataset: "LoadDiabetes", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "StandardScaler")]
[Preprocessing(dataset: "LoadDiabetes", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "KBinsDiscretizer")]
[Preprocessing(dataset: "LoadDiabetes", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "normalize")]
[Preprocessing(dataset: "LoadDiabetes", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "QuantileTransformer")]
[Preprocessing(dataset: "MakeRegression", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "StandardScaler")]
[Preprocessing(dataset: "MakeRegression", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "KBinsDiscretizer")]
[Preprocessing(dataset: "MakeRegression", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "normalize")]
[Preprocessing(dataset: "MakeRegression", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "QuantileTransformer")]
[Preprocessing(dataset: "LoadBreastCancer", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "StandardScaler")]
[Preprocessing(dataset: "LoadBreastCancer", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "FunctionTransformer")]
[Preprocessing(dataset: "LoadBreastCancer", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "KBinsDiscretizer")]
[Preprocessing(dataset: "LoadBreastCancer", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "normalize")]
[Preprocessing(dataset: "LoadBreastCancer", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "QuantileTransformer")]
[Preprocessing(dataset: "LoadWine", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "StandardScaler")]
[Preprocessing(dataset: "LoadWine", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "FunctionTransformer")]
[Preprocessing(dataset: "LoadWine", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "KBinsDiscretizer")]
[Preprocessing(dataset: "LoadWine", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "normalize")]
[Preprocessing(dataset: "LoadWine", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "QuantileTransformer")]
[Preprocessing(dataset: "MakeClassification", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "StandardScaler")]
[Preprocessing(dataset: "MakeClassification", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "KBinsDiscretizer")]
[Preprocessing(dataset: "MakeClassification", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "normalize")]
[Preprocessing(dataset: "MakeClassification", modelselection: "TrainTestSplit", impute: "SimpleImputer", preprocessing: "QuantileTransformer")]
public async Task Run(string dataset, string modelselection, string impute, string preprocessing,
string neighborsAlgorithm)
{
// 1. Initialise the client and output paths.
SharedEnvironmentHelper.LoadEnvIfAvailable();
CancellationToken cancellationToken = TestContext.Current.CancellationToken;
Guid modelId = SharedEnvironmentHelper.RequiredGuid("PARALLELMODEL_MODEL_ID");
string computeSize = SharedEnvironmentHelper.Required("PARALLELMODEL_COMPUTE_SIZE");
string encryptionKey = SharedEnvironmentHelper.Required("PARALLELMODEL_ENCRYPTION_KEY_1");
TimeSpan pollingInterval = TimeSpan.FromSeconds(30);
ParallelModelClient parallelModelClient = new(new DefaultParallelModelAuthenticationOptions
{
Region = SharedEnvironmentHelper.Required("PARALLELMODEL_REGION"),
ClientId = SharedEnvironmentHelper.Required("PARALLELMODEL_CLIENT_ID"),
ClientSecret = SharedEnvironmentHelper.Required("PARALLELMODEL_CLIENT_SECRET"),
Timeout = ApiTimeout,
AutoRefreshToken = true,
RefreshBeforeExpiry = TimeSpan.FromMinutes(2),
RetryOnUnauthorized = true,
MaxRetries = 3
});

string outputRoot = SharedEnvironmentHelper.OutputDirectory;
string runId = Guid.NewGuid().ToString("N");
string outputDirectory = Path.Combine(outputRoot, "neighbors",
$"{dataset}-{modelselection}-{impute}-{preprocessing}", neighborsAlgorithm, runId);
string cacheDirectory = SharedEnvironmentHelper.CacheDirectory;
Directory.CreateDirectory(Path.Combine(outputDirectory, "artifacts"));
int responseFileNumber = 0;

// 2. Resolve transformed train/test blobs and their shared input columns.
(TransformedInput train, TransformedInput test) = await LoadInputsAsync(
cacheDirectory, dataset, modelselection, impute, preprocessing, cancellationToken);
async Task<string[]> ReadColumnsAsync(TransformedInput entry)
{
byte[] bytes = await RequestAsync($"read-{entry.Partition}", () =>
parallelModelClient.PreprocessingClient.DownloadBytesAsync(modelId: modelId, jobId: entry.JobId,
blobId: entry.BlobId, computeSize: computeSize, inputEncryptionKey: encryptionKey,
timeout: ApiTimeout, cancellationToken: cancellationToken),
maximumAttempts: 5, saveJson: false);
return ReadHeader(bytes, entry.Partition);
}
bool requiresTarget = neighborsAlgorithm is "KNeighborsClassifier" or "KNeighborsRegressor"
or "NearestCentroid" or "NeighborhoodComponentsAnalysis"
or "RadiusNeighborsClassifier" or "RadiusNeighborsRegressor";
(string[] features, string? target) = ResolveColumns(await ReadColumnsAsync(train),
await ReadColumnsAsync(test), requiresTarget);

// 3. Save and send the concrete request once.
await SendThrottle.WaitForSendSlotAsync(cancellationToken);
string requestFileName = $"{++responseFileNumber:000}-request.json";
JsonElement sent = await RequestAsync("send", () => SendNeighborsAsync(parallelModelClient, modelId,
computeSize, encryptionKey, train.BlobId, test.BlobId, features, target, dataset,
$"{dataset}-{modelselection}-{impute}-{preprocessing}-{neighborsAlgorithm}.zip",
preprocessing, neighborsAlgorithm, outputDirectory, requestFileName, cancellationToken));
Guid jobId = RequiredProperty(sent, "jobId", "job_id").GetGuid();

// 4. Save each status response until the job reaches a terminal state.
DateTimeOffset statusDeadline = DateTimeOffset.UtcNow.AddMinutes(10);
for (int attempt = 1; ; attempt++)
{
JsonElement statusResponse = await RequestAsync($"status-{attempt:000}", () =>
parallelModelClient.NeighborsClient.StatusAsync(
modelId, jobId, computeSize, ApiTimeout, cancellationToken),
maximumAttempts: 5, retryDeadline: statusDeadline);
JsonElement statusValue = RequiredProperty(statusResponse, "status");
string? jobStatus = statusValue.ValueKind == JsonValueKind.String ? statusValue.GetString() : null;
switch (jobStatus?.ToLowerInvariant())
{
case "success" or "succeeded" or "completed":
break;
case null or "error" or "failed" or "cancelled" or "canceled" or "deadletter"
or "dead-lettered" or "deadlettered" or "dead_letter" or "dead-letter":
try
{
await RequestAsync("logs", GetLogsAsync);
}
catch (Exception) when (!cancellationToken.IsCancellationRequested)
{
// RequestAsync has already attempted to save the log error.
}

throw new InvalidOperationException(
$"Job {jobId} returned a status error or ended with status '{jobStatus}'. See saved responses.");
default:
if (DateTimeOffset.UtcNow >= statusDeadline)
throw new TimeoutException($"Status polling expired for job {jobId}.");
await Task.Delay(pollingInterval, cancellationToken);
continue;
}

break;
}

// 5. Retrieve logs once after terminal success.
try
{
await RequestAsync("logs", GetLogsAsync);
}
catch (Exception exception) when (!cancellationToken.IsCancellationRequested && (exception switch
{
ParallelModelApiException error => (int)error.StatusCode is 408 or 409 or 429 or >= 500 ||
((int)error.StatusCode == 404 && error.Detail?.Contains("job failed", StringComparison.OrdinalIgnoreCase) != true),
HttpRequestException or TimeoutException or TaskCanceledException => true,
_ => false
}))
{ /* The optional log request error was saved. */
}

// 6. Retrieve the original result.
JsonElement result = await RequestAsync("result", () => parallelModelClient.NeighborsClient.ResultAsync(
modelId, jobId, computeSize, encryptionKey, timeout: ApiTimeout, cancellationToken: cancellationToken),
maximumAttempts: int.MaxValue, retryDeadline: DateTimeOffset.UtcNow.AddMinutes(5));

// 7. Extract and download the result and all declared artifacts.
string[] paths = ArtifactPaths(result).Distinct(StringComparer.Ordinal).ToArray();
// The original Neighbors test explicitly extracts these two artifacts.
// Prefer the actual result's declared list whenever it is supplied.
if (paths.Length == 0)
paths = ["model.joblib", "result.json"];
List<NeighborsCacheEntry> outputs = new();
for (int index = 0; index < paths.Length; index++)
{
string path = paths[index];
JsonElement extracted = await RequestAsync("extract", () => parallelModelClient.NeighborsClient.ExtractAsync(
modelId, jobId, path, computeSize, encryptionKey, encryptionKey, timeout: ApiTimeout,
cancellationToken: cancellationToken), maximumAttempts: 5);
Guid blobId = RequiredProperty(extracted, "uploadedBlobId", "uploaded_blob_id").GetGuid();
byte[] bytes = await RequestAsync("download", () => parallelModelClient.NeighborsClient.DownloadBytesAsync(
modelId, jobId, blobId, computeSize, encryptionKey, ApiTimeout, cancellationToken),
maximumAttempts: 5, saveJson: false);
await SharedArtifactHelper.SaveAsync(outputDirectory, index + 1, path, bytes, cancellationToken);
foreach (TransformedInput input in new[] { train, test })
outputs.Add(new(dataset, modelselection, impute, preprocessing, neighborsAlgorithm,
input.Partition, blobId, path, input.BlobId, input.BlobId, input.ImputedBlobId,
train.BlobId, test.BlobId, jobId, runId));
}

// 8. Replace this case atomically after all downloads succeed.
await SharedCacheHelper.UpdateAsync<List<NeighborsCacheEntry>>(cacheDirectory, NeighborsCacheEntry.FileName, current =>
{
current ??= new();
current.RemoveAll(entry => entry.Matches(dataset, modelselection, impute, preprocessing, neighborsAlgorithm));
current.AddRange(outputs);
return current.OrderBy(entry => entry.Dataset, StringComparer.Ordinal)
.ThenBy(entry => entry.Modelselection, StringComparer.Ordinal)
.ThenBy(entry => entry.Impute, StringComparer.Ordinal)
.ThenBy(entry => entry.Preprocessing, StringComparer.Ordinal)
.ThenBy(entry => entry.Neighborsalgo, StringComparer.Ordinal)
.ThenBy(entry => entry.Partition, StringComparer.Ordinal)
.ThenBy(entry => entry.ArtifactPath, StringComparer.Ordinal).ToList();
}, cancellationToken);

Task<JsonElement> GetLogsAsync() => parallelModelClient.NeighborsClient.LogAsync(
modelId, jobId, computeSize, TimeSpan.FromSeconds(30), cancellationToken);

async Task<T> RequestAsync<T>(string stage, Func<Task<T>> request,
int maximumAttempts = 1, bool saveJson = true, DateTimeOffset? retryDeadline = null)
{
for (int attempt = 1; ; attempt++)
{
cancellationToken.ThrowIfCancellationRequested();
T response;
try
{
response = await request();
}
catch (Exception exception) when (!cancellationToken.IsCancellationRequested)
{
await SharedResponseHelper.SaveExceptionAsync(outputDirectory,
$"{++responseFileNumber:000}-{stage}-attempt-{attempt:000}-error.txt",
exception, cancellationToken);
bool transient = exception switch
{
ParallelModelApiException error => (int)error.StatusCode is 408 or 409 or 429 or >= 500 ||
((int)error.StatusCode == 404 && error.Detail?.Contains("job failed", StringComparison.OrdinalIgnoreCase) != true),
HttpRequestException or TimeoutException or TaskCanceledException => true,
_ => false
};
if (attempt >= maximumAttempts || !transient ||
(retryDeadline.HasValue && DateTimeOffset.UtcNow + pollingInterval >= retryDeadline.Value))
throw;
await Task.Delay(pollingInterval, cancellationToken);
continue;
}

if (saveJson)
await SharedResponseHelper.SaveAsync(outputDirectory,
$"{++responseFileNumber:000}-{stage}.json", response, cancellationToken);
return response;
}
}
}

private static async Task<JsonElement> SendNeighborsAsync(ParallelModelClient parallelModelClient, Guid modelId,
string computeSize, string encryptionKey, Guid trainBlobId, Guid testBlobId, string[] featureColumns,
string? trainTarget, string dataset, string outputName, string preprocessing, string neighborsAlgorithm,
string outputDirectory, string requestFileName, CancellationToken cancellationToken)
{
ParallelModelNeighborsOutputModel parallelModelNeighborsOutputModel = new()
{
Name = outputName,
Description = "Neighbors integration test using cached numerical preprocessing outputs",
RecordType = "Generic",
AccessTier = "Hot",
Tags = ["neighbors", dataset, preprocessing, neighborsAlgorithm]
};

async Task<JsonElement> SendTypedAsync<TRequest>(TRequest neighborsJobSendRequestModel)
where TRequest : class, IParallelModelNeighborsSendRequest
{
await SharedResponseHelper.SaveAsync(outputDirectory, requestFileName, neighborsJobSendRequestModel, cancellationToken);
return await parallelModelClient.NeighborsClient.SendAsync(modelId, neighborsJobSendRequestModel,
computeSize, encryptionKey, encryptionKey, encryptionKey, ApiTimeout, cancellationToken);
}

return neighborsAlgorithm switch
{
"KNeighborsClassifier" => await SendTypedAsync(new KNeighborsClassifierJobSendRequestModel
{
Input = new KNeighborsClassifierJobSendRequestModel.KNeighborsClassifierInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "KNeighborsClassifier",
ClassifierParams = new KNeighborsClassifierJobSendRequestModel.KNeighborsClassifierParamsModel
{
NNeighbors = 5,
Weights = "distance"
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
TargetColumn = trainTarget!,
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"KNeighborsRegressor" => await SendTypedAsync(new KNeighborsRegressorJobSendRequestModel
{
Input = new KNeighborsRegressorJobSendRequestModel.KNeighborsRegressorInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "KNeighborsRegressor",
ClassifierParams = new KNeighborsRegressorJobSendRequestModel.KNeighborsRegressorParamsModel
{
NNeighbors = 5,
Weights = "distance"
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
TargetColumn = trainTarget!,
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"KNeighborsTransformer" => await SendTypedAsync(new KNeighborsTransformerJobSendRequestModel
{
Input = new KNeighborsTransformerJobSendRequestModel.KNeighborsTransformerInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "KNeighborsTransformer",
ClassifierParams = new KNeighborsTransformerJobSendRequestModel.KNeighborsTransformerParamsModel
{
NNeighbors = 5,
Mode = "distance"
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"KernelDensity" => await SendTypedAsync(new KernelDensityJobSendRequestModel
{
Input = new KernelDensityJobSendRequestModel.KernelDensityInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "KernelDensity",
ClassifierParams = new KernelDensityJobSendRequestModel.KernelDensityParamsModel
{
Bandwidth = 1.0
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"LocalOutlierFactor" => await SendTypedAsync(new LocalOutlierFactorJobSendRequestModel
{
Input = new LocalOutlierFactorJobSendRequestModel.LocalOutlierFactorInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "LocalOutlierFactor",
ClassifierParams = new LocalOutlierFactorJobSendRequestModel.LocalOutlierFactorParamsModel
{
NNeighbors = 20,
Novelty = true
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"NearestCentroid" => await SendTypedAsync(new NearestCentroidJobSendRequestModel
{
Input = new NearestCentroidJobSendRequestModel.NearestCentroidInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "NearestCentroid",
ClassifierParams = new NearestCentroidJobSendRequestModel.NearestCentroidParamsModel(),
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
TargetColumn = trainTarget!,
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"NeighborhoodComponentsAnalysis" => await SendTypedAsync(new NeighborhoodComponentsAnalysisJobSendRequestModel
{
Input = new NeighborhoodComponentsAnalysisJobSendRequestModel.NeighborhoodComponentsAnalysisInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "NeighborhoodComponentsAnalysis",
ClassifierParams = new NeighborhoodComponentsAnalysisJobSendRequestModel.NeighborhoodComponentsAnalysisParamsModel
{
NComponents = Math.Min(2, featureColumns.Length),
MaxIter = 50,
RandomState = 42
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
TargetColumn = trainTarget!,
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"RadiusNeighborsClassifier" => await SendTypedAsync(new RadiusNeighborsClassifierJobSendRequestModel
{
Input = new RadiusNeighborsClassifierJobSendRequestModel.RadiusNeighborsClassifierInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "RadiusNeighborsClassifier",
ClassifierParams = new RadiusNeighborsClassifierJobSendRequestModel.RadiusNeighborsClassifierParamsModel
{
Radius = 100.0,
OutlierLabel = "most_frequent"
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
TargetColumn = trainTarget!,
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"RadiusNeighborsRegressor" => await SendTypedAsync(new RadiusNeighborsRegressorJobSendRequestModel
{
Input = new RadiusNeighborsRegressorJobSendRequestModel.RadiusNeighborsRegressorInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "RadiusNeighborsRegressor",
ClassifierParams = new RadiusNeighborsRegressorJobSendRequestModel.RadiusNeighborsRegressorParamsModel
{
Radius = 100.0
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
TargetColumn = trainTarget!,
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
"RadiusNeighborsTransformer" => await SendTypedAsync(new RadiusNeighborsTransformerJobSendRequestModel
{
Input = new RadiusNeighborsTransformerJobSendRequestModel.RadiusNeighborsTransformerInputModel
{
TrainBlobId = trainBlobId,
TestBlobId = testBlobId,
ClassifierType = "RadiusNeighborsTransformer",
ClassifierParams = new RadiusNeighborsTransformerJobSendRequestModel.RadiusNeighborsTransformerParamsModel
{
Radius = 1.0,
Mode = "distance"
},
FeatureColumns = featureColumns.ToList(),
FileFormat = "csv",
GenerateGraphs = true
},
Output = parallelModelNeighborsOutputModel,
RequestTimeoutSeconds = 300
}),
_ => throw new NotSupportedException(neighborsAlgorithm)
};
}
}
}