public double[] Query(double[,] xInputs) { //QUERY NEURAL NETWORK xInputs = NormalizeInput(xInputs); double[,] inputs = Transpose(xInputs); //CALCULATE SIGNALS INTO HIDDEN LAYER double[,] hiddenInputs = Multiply(weightInput, inputs); if (hiddenInputs == null) { UniMsg.Show("Error Matrix Dimensions...", "Matrix must have the same size", MessageBoxButtons.OK); return(null); } double[,] hiddenOutputs = ExpitFunction(hiddenInputs); //CALCULATE SIGNALS INTO FINAL OUTPUT LAYER double[,] finalInputs = Multiply(weightOutput, hiddenOutputs); double[,] finalOutputs = ExpitFunction(finalInputs); AnswerArray = finalOutputs.Cast <double>().ToArray(); Answer = Array.IndexOf(AnswerArray, AnswerArray.Max()); return(AnswerArray); }
public async Task Execute(IJobExecutionContext context) { try { var jobConfigFileName = context.JobDetail.JobDataMap["FileName"] as string; var storagePath = context.JobDetail.JobDataMap["StoragePath"] as string; var interval = context.JobDetail.JobDataMap["Interval"] as int?; var cfg = await _configurationService.GetJobConfigAsync(jobConfigFileName); var added = await _fileService.GetAsync <List <Gem> >(PathTo.Added(DexType.UNISWAP, storagePath)); var deleted = await _fileService.GetAsync <List <Gem> >(PathTo.Deleted(DexType.UNISWAP, storagePath)); if (added.AnyAndNotNull()) { Logger.Info($"V2|SUMMARY|ADDED|{added.Count}"); var newestAdded = added .Where( g => g.Recently == TokenActionType.ADDED && (DateTime.UtcNow - g.DateTime).TotalMinutes < interval) .OrderByDescending(g => g.DateTime) .ToList(); Logger.Info($"V2|SUMMARY|ADDED|NEWEST|{newestAdded.Count}"); if (newestAdded.AnyAndNotNull()) { var msg = UniMsg.ForTwitterSummary(newestAdded, TokenActionType.ADDED, interval.Value); var sent = await _twitterService.SendMessageAsync(msg); if (sent.Success) { Logger.Info($"V2|SUMMARY|ADDED|NEWEST|SENT"); } else { Logger.Error($"{sent.Message}"); } } } if (deleted.AnyAndNotNull()) { Logger.Info($"V2|SUMMARY|DELETED|NEWEST|{deleted.Count}"); var newestDeleted = deleted .Where( g => g.Recently == TokenActionType.DELETED && (DateTime.Now - g.DateTime).TotalMinutes < interval) .OrderByDescending(g => g.DateTime) .ToList(); Logger.Info($"V2|SUMMARY|DELETED|NEWEST|{newestDeleted.Count}"); if (newestDeleted.AnyAndNotNull()) { var msg = UniMsg.ForTwitterSummary(newestDeleted, TokenActionType.DELETED, interval.Value); var sent = await _twitterService.SendMessageAsync(msg); if (sent.Success) { Logger.Info($"V2|SUMMARY|DELETED|NEWEST|SENT"); } else { Logger.Error($"{sent.Message}"); } } } if (cfg.Success) { Logger.Info($"Job: {cfg.JobConfig.Label} - DONE"); } } catch (Exception e) { Logger.Fatal($"{e.GetFullMessage()}"); } }