Exemplo n.º 1
0
        private Task <SessionResponse> CreateSessionInternal(string path, ModelSessionDetail data,
                                                             Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer, CancellationToken cancellationToken, bool isEstimate)
        {
            data.IsEstimate = isEstimate;

            return(apiConnection.Post <SessionResponse>(path, null, data, httpMessageTransformer, cancellationToken));
        }
Exemplo n.º 2
0
        public Task EstimateTrainModel(ModelSessionDetail data,
                                       Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer, CancellationToken cancellationToken)
        {
            Argument.IsNotNull(data, nameof(data));
            Argument.IsNotNullOrEmpty(data.DataSourceName, "data.DataSetName");

            return(CreateSessionInternal("sessions/model", data, httpMessageTransformer, cancellationToken, true));
        }
Exemplo n.º 3
0
        public Task EstimateTrainModel(string dataSourceName, string targetColumn, PredictionDomain predictionDomain, string statusCallbackUrl,
                                       Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer, CancellationToken cancellationToken)
        {
            Argument.IsNotNullOrEmpty(dataSourceName, nameof(dataSourceName));
            Argument.IsNotNullOrEmpty(targetColumn, nameof(targetColumn));

            var data = new ModelSessionDetail
            {
                DataSourceName = dataSourceName,
                Columns        = new Dictionary <string, ColumnMetadata>()
                {
                    { targetColumn, new ColumnMetadata {
                          Role = ColumnRole.Target
                      } }
                },
                PredictionDomain = predictionDomain,
                CallbackUrl      = statusCallbackUrl,
            };

            return(EstimateTrainModel(data, httpMessageTransformer, cancellationToken));
        }
Exemplo n.º 4
0
        public async Task ModelStartsNewSession()
        {
            var dataSetName = $"testDataSet-{DateTime.Now:s}";
            var dataSet     = DataSetGenerator.Run(90, 10, "instances");
            await fixture.Client.DataSets.Create(dataSetName, dataSet);

            var sessionRequest = new ModelSessionDetail()
            {
                DataSourceName   = dataSetName,
                PredictionDomain = PredictionDomain.Regression,
                Columns          = new Dictionary <string, ColumnMetadata>
                {
                    ["instances"] = new ColumnMetadata {
                        DataType = ColumnType.Numeric, Role = ColumnRole.Target
                    }
                }
            };

            var actual = await fixture.Client.Sessions.TrainModel(sessionRequest);

            Assert.NotNull(actual.SessionId);
            await fixture.Client.DataSets.Remove(dataSetName, DataSetDeleteOptions.CascadeAll);
        }
Exemplo n.º 5
0
 public Task EstimateTrainModel(ModelSessionDetail data,
                                Action <HttpRequestMessage, HttpResponseMessage> httpMessageTransformer)
 {
     return(EstimateTrainModel(data, httpMessageTransformer, CancellationToken.None));
 }
Exemplo n.º 6
0
 public Task EstimateTrainModel(ModelSessionDetail data)
 {
     return(EstimateTrainModel(data, null));
 }
Exemplo n.º 7
0
 public Task <SessionResponse> TrainModel(ModelSessionDetail data)
 {
     return(TrainModel(data, null));
 }