Exemple #1
0
func resultHandler(w http.ResponseWriter, r *http.Request) {
	//Create appengine context
	c := appengine.NewContext(r)

	//Set dates
	layout := "02/01/2006"
	beginning, _ := time.Parse(layout, r.FormValue("startdate"))
	ending, _ := time.Parse(layout, r.FormValue("enddate"))

	//Set iteration
	iteration, _ := strconv.ParseInt((r.FormValue("iteration")), 10, 32)

	//Run prediction
	var predict predictor.Predictor
	predict.SetInputDates(beginning, ending)
	predict.SetDatasetPercentage(80, 20)
	predict.SetIteration(int(iteration))
	prediction := predict.RunPrediction(w, c)

	//Show prediction result on result page
	err := resultTemplate.Execute(w, template.HTML(prediction))
	if err != nil {
		http.Error(w, err.Error(), http.StatusInternalServerError)
	}
}
Exemple #2
0
func oldresultHandler(w http.ResponseWriter, r *http.Request) {
	fmt.Fprintln(w, "Reta Server | Prediction Result\n")

	layout := "02/01/2006"
	beginning, _ := time.Parse(layout, "17/02/2014")
	ending, _ := time.Parse(layout, "28/02/2014")

	fmt.Fprintln(w, "Model Generation\n")
	fmt.Fprintln(w, "From 17/02/2014 to 28/02/2014")
	fmt.Fprintln(w, "Training - Test Dataset Percentage: 80% - 20%")
	fmt.Fprintln(w, "Method: Logistic Regression")
	fmt.Fprintln(w, "Technique: Iteratively Reweighted Least Squares | Newton-Raphson")
	fmt.Fprintln(w, "Iteration: 20 times")

	c := appengine.NewContext(r)

	var predict predictor.Predictor
	predict.SetInputDates(beginning, ending)
	predict.SetDatasetPercentage(80, 20)
	predict.SetIteration(20)
	predict.RunPrediction(w, c)
}