public static ProjectSummaryResponse Create( Project project, Scoring scoring, ScoringApplication scoringApplication, DateTimeOffset now) { return(new ProjectSummaryResponse { Id = project.Id, ExternalId = project.ExternalId.ToString(), Name = project.Name, ImageUrl = project.ImageUrl, CountryCode = project.Country.Code, StageId = (int)project.Stage, Category = project.Category, IcoDate = project.IcoDate, Website = project.Website, WhitePaperLink = project.WhitePaperLink, Facebook = project.Facebook, Telegram = project.Telegram, Twitter = project.Twitter, IsApplicationSubmitted = scoringApplication?.IsSubmitted ?? false, Scoring = ScoringResponse.FromScoring(scoring, now), AuthorId = project.AuthorId, AuthorAddress = project.Author.Address, IsPrivate = project.IsPrivate, ScoringStartTransactionStatus = scoringApplication?.GetTransactionStatus() ?? ScoringStartTransactionStatus.NotSubmitted, ScoringStartTransactionHash = scoringApplication?.ScoringStartTransaction?.Hash }); }
/// <summary> /// Scores rate for item with the given data using the specified model. /// </summary> /// <param name="model">Model, that should perform scoring.</param> /// <param name="data">The data of the item that should be scored.</param> /// <param name="predictContributions"> /// Indicates, if service should return individual feature contributions to overall prediction. /// </param> /// <returns>Predicted score rate.</returns> public ScoringOutput Score(MLModelConfig model, Dictionary <string, object> data, bool predictContributions) { ScoringResponse response = Predict <ScoringRequest, ScoringResponse>(model.ModelInstanceUId, new List <Dictionary <string, object> > { data }, model.PredictionEndpoint, ScoreTimeoutSec, predictContributions); return(response.Outputs.FirstOrDefault()); }
/// <summary> /// Scores rates for list of items with the given data using the specified model. /// </summary> /// <param name="model">Model, that should perform scoring.</param> /// <param name="dataList">The list of data of items that should be scored.</param> /// <param name="predictContributions"> /// Indicates, if service should return individual feature contributions to overall prediction. /// </param> /// <returns>Predicted score rates.</returns> public List <ScoringOutput> Score(MLModelConfig model, IList <Dictionary <string, object> > dataList, bool predictContributions) { int count = Math.Min(1, dataList.Count); int timeout = Math.Max(ScoreTimeoutSec * count, BatchScoreTimeoutSec); ScoringResponse response = Predict <ScoringRequest, ScoringResponse>(model.ModelInstanceUId, dataList, model.PredictionEndpoint, timeout, predictContributions); return(response.Outputs); }
public async Task <ScoringResponse> GetByProjectIdAsync(long projectId) { var scoring = await _scoringService.GetByProjectIdAsync(projectId); return(ScoringResponse.FromScoring(scoring, _clock.UtcNow)); }