Public
Edited
May 17, 2024
1 fork
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Plot.plot({
width: width,
marginLeft: 200,
marks: [
Plot.barX(data, {
y: "lang",
x: "score",
fill: "type",
tip: true,
sort: { y: "-x" }
})
]
})
Insert cell
Insert cell
Insert cell
languages
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
classifier = {
const classifier = new NaiveBayes();
languages.forEach(({ f, text }) => classifier.train(text, f));
return classifier;
}
Insert cell
detectLanguage = (text) =>
languages.find((l) => l.f === classifier.predict(text)?.[0])?.n
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more