public static void log(string text, LogPrior lp, DateTime dt) { Lib.Performance.setWatch("log", true); if ((int)_forceLogPrior > (int)lp) return; if (dt < Lib.Const.NULL_DATE) dt = DateTime.Now; if (_withDate) text = dt.ToString("dd.MM.yyyy HH:mm:ss") + " " + text; if (!text.EndsWith("\r\n")) text += "\r\n"; if (MainForm.df != null) { switch (lp) { case LogPrior.Debug: MainForm.df.logDebug(text); break; case LogPrior.Info: MainForm.df.logInfo(text); break; case LogPrior.Warning: MainForm.df.logWarning(text); break; case LogPrior.Error: MainForm.df.logError(text); break; case LogPrior.Importand: MainForm.df.logImportand(text); break; case LogPrior.Trader: MainForm.df.logTrader(text); break; } } //writeToLogFile(text, filename); //writeToLogFile(prefix + " " + text, "log_All.txt"); addToBuffer(lp, text); Lib.Performance.setWatch("log", false); }
public SGDMinimizer(LogPrior prior, int numPasses, int batchSize, int tuningSamples) { if (LogPrior.LogPriorType.Quadratic == prior.GetType()) { sigma = prior.GetSigma(); } else { throw new Exception("Unsupported prior type " + prior.GetType()); } if (numPasses >= 0) { this.numPasses = numPasses; } else { this.numPasses = DefaultNumPasses; Sayln(" SGDMinimizer: numPasses=" + numPasses + ", defaulting to " + this.numPasses); } this.bSize = batchSize; if (tuningSamples > 0) { this.tuningSamples = tuningSamples; } else { this.tuningSamples = DefaultTuningSamples; Sayln(" SGDMinimizer: tuneSampleSize=" + tuningSamples + ", defaulting to " + this.tuningSamples); } }
/// <summary> /// Logs an <see cref="Exception"/> to the logfile /// </summary> /// <param name="exception"></param> /// <param name="priority"></param> public static void WriteToLog(Exception exception, LogPrior priority = LogPrior.ERROR) { if (_instance != null) { _instance._logwriter.WriteToLog(exception, priority); } else { ExceptionHandler.WriteToCommandLine(new LoggerNotInitializedException()); } }
/// <summary> /// Logs a message to the logfile. /// </summary> /// <param name="message"></param> /// <param name="priority"></param> public static void WriteToLog(string message, LogPrior priority = LogPrior.INFO) { if (_instance != null) { _instance._logwriter.WriteToLog(message, priority); } else { ExceptionHandler.WriteToCommandLine(new LoggerNotInitializedException()); } }
/// <summary> /// Log the exception. /// </summary> /// <param name="ex">Exception</param> /// <param name="priority">Severity of the exception.</param> /// <param name="commandLine">True if you want to write the exception on the commandline.</param> /// <param name="dialog">True if you want to display a dialog with the exception message(s).</param> public static void ProcessException(this Exception ex, LogPrior priority, bool commandLine = false, bool dialog = false) { Logger.WriteToLog(ex, priority); if (commandLine) { WriteToCommandLine(ex); } if (dialog) { ShowDialog(ex); } }
private static void addToBuffer(LogPrior lp, string text) { Lib.Performance.setWatch("addlogbuffer", true); if(!logBuffer.ContainsKey(LogPrior.All)) logBuffer.Add(LogPrior.All, new StringBuilder()); if (!logBuffer.ContainsKey(lp)) logBuffer.Add(lp, new StringBuilder()); string prefix = lp.ToString(); if (prefix.Length > 0) prefix = prefix.Substring(0, 2); logBuffer[lp].Append(text); logBuffer[LogPrior.All].Append(prefix + " " + text); if (logBufferAge.AddSeconds(5) < DateTime.Now) { emptyBuffer(); } Lib.Performance.setWatch("addlogbuffer", false); }
public BiasedLogConditionalObjectiveFunction(int numFeatures, int numClasses, int[][] data, int[] labels, double[][] confusionMatrix, LogPrior prior) { this.numFeatures = numFeatures; this.numClasses = numClasses; this.data = data; this.labels = labels; this.prior = prior; this.confusionMatrix = confusionMatrix; }
public BiasedLogConditionalObjectiveFunction(GeneralDataset dataset, double[][] confusionMatrix, LogPrior prior) : this(dataset.NumFeatures(), dataset.NumClasses(), dataset.GetDataArray(), dataset.GetLabelsArray(), confusionMatrix, prior) { }
public virtual void SetPrior(LogPrior prior) { this.prior = prior; }
public static void setForceLogPrior(LogPrior lp) { _forceLogPrior = lp; MainForm.df.stopUpdate(); }
public static void releaseForceLogPrior() { _forceLogPrior = LogPrior.Debug; MainForm.df.stopUpdate(); }
public static void log(string text, LogPrior lp) { log(text, lp, DateTime.MinValue); }
/// <summary> /// Log, display dialog, and write in commandline. /// </summary> /// <param name="ex">Exception</param> /// <param name="priority">Severity of the exception.</param> public static void ProcessException(this Exception ex, LogPrior priority = LogPrior.ERROR) { ProcessException(ex, priority, true, true); }