Skip to content

Commit

Permalink
fixed -_- (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
Szer committed Jul 21, 2024
1 parent d75ee67 commit 3cd64b3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
3 changes: 2 additions & 1 deletion src/VahterBanBot/DB.fs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ let getVahterStats(banInterval: TimeSpan option): Task<VahterStats> =
SELECT 'bot' AS vahter
, COUNT(*) AS killCountTotal
, COUNT(*) FILTER (WHERE bbb.banned_at > NOW() - @banInterval::INTERVAL) AS killCountInterval
FROM banned_by_bot bbb)
FROM banned_by_bot bbb
GROUP BY bbb.banned_user_id)
ORDER BY killCountTotal DESC
"""

Expand Down
18 changes: 9 additions & 9 deletions src/VahterBanBot/ML.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ type MachineLearning(
) =
let metricsToString(metrics: CalibratedBinaryClassificationMetrics) (duration: TimeSpan) =
let sb = StringBuilder()
let formattedTable = metrics.ConfusionMatrix.GetFormattedConfusionTable().Replace(".", "\\.")
let formattedTable = metrics.ConfusionMatrix.GetFormattedConfusionTable()
%sb.AppendLine($"Model trained in {duration.TotalSeconds} seconds with following metrics:")
%sb.AppendLine($"Accuracy: {metrics.Accuracy}")
%sb.AppendLine($"AreaUnderPrecisionRecallCurve: {metrics.AreaUnderPrecisionRecallCurve}")
%sb.AppendLine($"ConfusionMatrix:\n```\n{formattedTable}\n```")
%sb.AppendLine($"Entropy:{metrics.Entropy}")
%sb.AppendLine($"F1Score:{metrics.F1Score}")
%sb.AppendLine($"LogLoss:{metrics.LogLoss}")
%sb.AppendLine($"LogLossReduction:{metrics.LogLossReduction}")
%sb.AppendLine($"NegativePrecision:{metrics.NegativePrecision}")
%sb.AppendLine($"NegativeRecall:{metrics.NegativeRecall}")
%sb.AppendLine($"PositivePrecision:{metrics.PositivePrecision}")
%sb.AppendLine($"PositiveRecall:{metrics.PositiveRecall}")
%sb.AppendLine($"Entropy: {metrics.Entropy}")
%sb.AppendLine($"F1Score: {metrics.F1Score}")
%sb.AppendLine($"LogLoss: {metrics.LogLoss}")
%sb.AppendLine($"LogLossReduction: {metrics.LogLossReduction}")
%sb.AppendLine($"NegativePrecision: {metrics.NegativePrecision}")
%sb.AppendLine($"NegativeRecall: {metrics.NegativeRecall}")
%sb.AppendLine($"PositivePrecision: {metrics.PositivePrecision}")
%sb.AppendLine($"PositiveRecall: {metrics.PositiveRecall}")
sb.ToString()

let mutable predictionEngine: PredictionEngine<SpamOrHam, Prediction> option = None
Expand Down

0 comments on commit 3cd64b3

Please sign in to comment.