Learning curve (model evaluation)
Line graphs are visual representations of data points connected by line segments. They effectively showcase trends and changes over time or across different categories. Ideal for displaying continuous data, line graphs highlight patterns and correlations, making complex information easily digestible. Creating effective line graphs involves careful consideration of axis labels, scales, and legends. Clear and concise titles are essential for quick understanding. Multiple datasets can be compared on a single graph, enhancing visual analysis and facilitating insightful conclusions.
<html>
<head>
<!-- Include the CanvasXpress library in your HTML file -->
<link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/>
<script src="https://www.canvasxpress.org/dist/canvasXpress.min.js"></script>
</head>
<body>
<!-- Create a canvas element for the chart with the desired dimensions -->
<div>
<canvas id="canvasId" width="600" height="600"></canvas>
</div>
<!-- Create a script to initialize the chart -->
<script>
// Use a data frame (2D-array) for the graph
var data =
// Create the configuration for the graph
var config = {
"graphType" : "Line",
"title" : "Learning curve — training vs validation",
"smpTitle" : "Training set size",
"yAxisTitle" : "Score",
"showLegend" : true,
"showTransition" : false
}
// Event used to create graph (optional)
var events = false
// Call the CanvasXpress function to create the graph
var cX = new CanvasXpress("canvasId", data, config, events);
</script>
</body>
</html>
<html>
<head>
<!-- Include the CanvasXpress library in your HTML file -->
<link rel="stylesheet" href="https://www.canvasxpress.org/dist/canvasXpress.css" type="text/css"/>
<script src="https://www.canvasxpress.org/dist/canvasXpress.min.js"></script>
</head>
<body>
<!-- Create a canvas element for the chart with the desired dimensions -->
<div>
<canvas id="canvasId" width="600" height="600"></canvas>
</div>
<!-- Create a script to initialize the chart -->
<script>
// Create the data for the graph
var data = {
"y" : {
"vars" : [
"Training score",
"Validation score"
],
"smps" : [
"50",
"100",
"250",
"500",
"1000",
"2500",
"5000"
],
"data" : [
[
0.98,
0.97,
0.955,
0.95,
0.945,
0.942,
0.94
],
[
0.82,
0.86,
0.89,
0.905,
0.915,
0.92,
0.922
]
]
}
}
// Create the configuration for the graph
var config = {
"graphType" : "Line",
"title" : "Learning curve — training vs validation",
"smpTitle" : "Training set size",
"yAxisTitle" : "Score",
"showLegend" : true,
"showTransition" : false
}
// Event used to create graph (optional)
var events = false
// Call the CanvasXpress function to create the graph
var cX = new CanvasXpress("canvasId", data, config, events);
</script>
</body>
</html>
library(canvasXpress)
y=read.table("https://www.canvasxpress.org/data/r/cX-line9-dat.txt", header=TRUE, sep="\t", quote="", row.names=1, fill=TRUE, check.names=FALSE, stringsAsFactors=FALSE)
canvasXpress(
data=y,
graphType="Line",
showLegend=TRUE,
showTransition=FALSE,
smpTitle="Training set size",
title="Learning curve — training vs validation",
yAxisTitle="Score"
)
from canvasxpress.canvas import CanvasXpress
from canvasxpress.plot import show_in_browser
if __name__ == "__main__":
# Define the chart with its data and configuration
chart: CanvasXpress = CanvasXpress(
render_to = "line9",
data = {
"y": {
"vars": ["Training score", "Validation score"],
"smps": ["50", "100", "250", "500", "1000", "2500", "5000"],
"data": [
[0.98, 0.97, 0.955, 0.95, 0.945, 0.942, 0.94],
[0.82, 0.86, 0.89, 0.905, 0.915, 0.92, 0.922]
]
}
},
config = {
"graphType": "Line",
"title": "Learning curve — training vs validation",
"smpTitle": "Training set size",
"yAxisTitle": "Score",
"showLegend": True,
"showTransition": False
},
width = 600,
height = 600
)
# Display the chart in its own Web page
show_in_browser(chart)
from canvasxpress.canvas import CanvasXpress
from canvasxpress.plot import graph
graph(
CanvasXpress(
render_to = "line9",
data = {
"y": {
"vars": ["Training score", "Validation score"],
"smps": ["50", "100", "250", "500", "1000", "2500", "5000"],
"data": [
[0.98, 0.97, 0.955, 0.95, 0.945, 0.942, 0.94],
[0.82, 0.86, 0.89, 0.905, 0.915, 0.92, 0.922]
]
}
},
config = {
"graphType": "Line",
"title": "Learning curve — training vs validation",
"smpTitle": "Training set size",
"yAxisTitle": "Score",
"showLegend": True,
"showTransition": False
},
width = 600,
height = 600
)
)
using CanvasXpress
canvasxpress(Dict(
"y" => Dict(
"vars" => ["Training score", "Validation score"],
"smps" => ["50", "100", "250", "500", "1000", "2500", "5000"],
"data" => [
[0.98, 0.97, 0.955, 0.95, 0.945, 0.942, 0.94],
[0.82, 0.86, 0.89, 0.905, 0.915, 0.92, 0.922]
]
)
);
graphType = "Line",
title = "Learning curve — training vs validation",
smpTitle = "Training set size",
yAxisTitle = "Score",
showLegend = true,
showTransition = false
)








