Skip to content

Instantly share code, notes, and snippets.

@aficionado
Last active January 4, 2016 04:58
Show Gist options
  • Save aficionado/8571581 to your computer and use it in GitHub Desktop.
Save aficionado/8571581 to your computer and use it in GitHub Desktop.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>BigML Prediction Test</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<script src="http://code.jquery.com/jquery-1.7.1.js" type="text/javascript"></script>
</head>
<body>
<h1>Post Prediction</h1>
<div id="prediction">Predicting...</div>
<script type="text/javascript">
jQuery(document).ready(function() {
var data = {
model: "model/52df744428eb3e6d8900017e",
input_data: {
"000003": 3
}
};
jQuery.ajax({
url: "https://bigml.io/prediction?username=martinfree&api_key=9c4a261fdea6461607d6fc443f06b5d953157332",
type: "POST",
//crossDomain: true,
contentType: "application/json",
dataType: "json",
xhrFields: {
withCredentials: false
},
data: JSON.stringify(data),
success: function(prediction) {
console.log(prediction);
$('#prediction').html(
JSON.stringify(prediction.prediction) +
'<br/>' +
JSON.stringify(prediction.confidence));
},
error: function(error) {
console.log(error);
$('#prediction').html(error.statusText);
}
});
});
</script>
</body>
</html>
@osroca
Copy link

osroca commented Jan 23, 2014

If updated my gist and now it creates a model and then predicts using the new model https://gist.github.com/osroca/8569355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment