generated from adrienaury/go-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Description
This feature allows to get the explained variance of records used to fit the model.
Request
Method
GET
URL
/variance/{job_id}
Request Parameters
| Parameter | Description | Required | Example |
|---|---|---|---|
| job_id | avatarization or privacy job id used to fit the model | yes | 0123456789abcdef0123456789abcdef |
Request Body
(none)
Result
Result parameters
(none)
Result Body
type ExplainedVariance struct {
Raw []float64 `json:"raw"`
Ratio []float64 `json:"ratio"`
}Example Curl Request
Request
curl -X GET "http://localhost:8080/variance/0123456789abcdef0123456789abcdef"Curl Response
{
"raw": [
0.9999999999999999,
0.9999999999999999,
0.9999999999999999,
0.9999999999999999,
0.9999999999999999
],
"ratio": [
0.9999999999999999,
0.9999999999999999,
0.9999999999999999,
0.9999999999999999,
0.9999999999999999
]
}Go server
Struct
type explainedVarianceResponse struct {
Raw []float64 `json:"raw"`
Ratio []float64 `json:"ratio"`
}Handler
func (s *server) getExplainedVariance(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
jobID := mux.Vars(r)["jobID"]
ev, err := s.db.GetExplainedVariance(ctx, jobID)
if err != nil {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
if err := json.NewEncoder(w).Encode(explainedVarianceResponse{
Raw: ev.Raw,
Ratio: ev.Ratio,
}); err != nil {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
return
}
}Links
Automated Issue Details
Dear visitor,
This issue has been automatically generated from the Octopize project avatar-python to make SIGO compatible. Please vote with a thumbs up or thumbs down to assess the quality of the automatic generation.
Best regards,
The SIGO Team
Reactions are currently unavailable