formatters

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2019 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ExcludedForCause is used to describe a prediction that has been deliberately excluded from consideration.
	ExcludedForCause = iota

	// Ongoing is used to describe a prediction that hasn’t been resolved yet.
	Ongoing

	// Resolved is used to describe a prediction that can be evaluated, but cannot be classified as “called” or “missed” because it predicts something will happen at a 50% confidence interval.
	Resolved

	// CalledTruePositive is used to describe a prediction where something was predicted to happen, and that thing happened.
	CalledTruePositive

	// CalledTrueNegative is used to describe something that was predicted to not happen that did not happen.
	CalledTrueNegative

	// MissedFalsePositive is used to describe a prediction where something was predicted to happen, but didn’t.
	MissedFalsePositive

	// MissedFalseNegative is used to describe a prediction where something was predicted to not happen, but happened anyway.
	MissedFalseNegative
)

Variables

This section is empty.

Functions

func Evaluate

func Evaluate(d streams.PredictionDocument) int

Evaluate returns an int describing whether the prediction is excluded, ongoing, called, or missed.

func HTMLFromStreams

func HTMLFromStreams(w io.Writer, sts []streams.Stream) error

HTMLFromStreams generates HTML output of streams and writes it to w.

func Header(st streams.Stream) string

Header combines the title and scope of a Stream in a tolerably pleasing way.

func MarkdownFromDocument

func MarkdownFromDocument(d streams.PredictionDocument) string

MarkdownFromDocument makes a Markdown-formatted document.

Formatting:

- ongoing predictions are plain

- predictions that were called correctly are bold

- predictions that were mis-called are struck through

- excluded-for-cause predictions are italicized

Note that MarkdownFromDocument also uses HTML for the italics and the strikethrough. This may be a problem in some contexts that allow markdown but not HTML, like some forum software in some configurations.

func MarkdownFromStream

func MarkdownFromStream(st streams.Stream) string

MarkdownFromStream makes a markdown-formatted stream.

func MarkdownFromStreams

func MarkdownFromStreams(sts []streams.Stream, options ...Option) string

MarkdownFromStreams makes a Markdown-formatted version of a slice of streams.

Types

type Option

type Option func(o *formattingOptions)

Option is the type used for public-facing formatting options.

func ForPublic

func ForPublic(b bool) Option

ForPublic is an option that says whether to sanitize the output for public consumption.

type Point

type Point struct {
	X float64 `json:"x"`
	Y float64 `json:"y"`
}

A Point struct contains an x and y point. Used for Chart.js.

func (Point) MarshalJSON

func (p Point) MarshalJSON() ([]byte, error)

MarshalJSON suppresses excess precision in float64’s default marshaling behavior.

Do you want to see tooltips for points on a chart that say (0.7000000000000001, 0.7000000000000001)? Me neither.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL