public static void predict(PredictedValueClass pro, TextBox txtRegression) { string apiKey = "xY7y2pEuEEuC15hNAVsWyOgLb17wfTSYXeVrCZ/ItnWTSLOtBxR8o897nctz3SAk4wtCfGebpz10iMC8YpZCng=="; string url = "https://ussouthcentral.services.azureml.net/workspaces/8ac8e85e1193499f96198bb430b8dfcf/services/cc0caa25467f4741b3e441e2e569013d/execute?api-version=2.0&details=true"; predict(pro, apiKey, url, txtRegression); }
public static void classify(PredictedValueClass pro, TextBox txtBox1) { string apiKey = "uT/tI1EzmRF15RVzGcPpgnwEXyUivx5ucb0LCePwpK+6aN5DNVDh4zFcej1qysS/ELfK/Ww3CMgLkC4tnwssuw=="; string url = "https://ussouthcentral.services.azureml.net/workspaces/8ac8e85e1193499f96198bb430b8dfcf/services/dd23d43566cc4514aea0bde2bd1d7c2c/execute?api-version=2.0&details=true"; calculate(apiKey, url, txtBox1, pro); }
public static void classify(PredictedValueClass pro, TextBox txtBox1) { string apiKey = "FtV6rX/k/I/ivZ4n/Hk0mkaiAy0GGmUrxCdNw72RbigP4pLvNZ2S0Rt0PUqxTT794yw4qyjfLwMr+/mDSUoe6A=="; string url = "https://ussouthcentral.services.azureml.net/workspaces/8ac8e85e1193499f96198bb430b8dfcf/services/b7b5380abffe43d09185aaea5a5a4f77/execute?api-version=2.0&details=true"; //string dateTime = pro.date_value; //DateTime dt = Convert.ToDateTime(dateTime); //pro.Month_value = dt.Month.ToString(); //pro.DayOfWeek_value = dictionary[dt.DayOfWeek.ToString()]; calculate(apiKey, url, txtBox1, pro); }
protected void Page_Load(object sender, EventArgs e) { PredictedValueClass pricepredication = new PredictedValueClass(); pricepredication.CarrierName = txtBoxcarrierName.Text; pricepredication.destination_value = txtBoxDestination.Text; pricepredication.origin_value = txtBoxOrigin.Text; pricepredication.Monthvalue = txtDropBoxHour.Text; FlightPricePrediction.classify(pricepredication, predictflight); //Classification.classify(predicted, txtclassification); }
protected void do_Prediction(object sender, EventArgs e) { PredictedValueClass predicted = new PredictedValueClass(); predicted.destination_value = txtBoxDest.Text; predicted.origin_value = txtBoxOrigin.Text; predicted.date_value = txtBoxDate.Text; predicted.hour_value = txtDropBoxHour.Text; predicted.flightNum_value = txtFlightNum.Text; predicted.temp_value = txtTemperature.Text; predicted.seaLevelPressure_value = txtSeaLevelPressure.Text; predicted.visibility_value = txtVisiblity.Text; Classification.classify(predicted, txtclassification); }
public static void calculate(string api, string uri, TextBox txtBox, PredictedValueClass pro) { using (var client = new HttpClient()) { var scoreRequest = new { Inputs = new Dictionary <string, StringTablePred>() { { "input1", new StringTablePred() { ColumnNames = new string[] { "FlightNum", "Hour", "TemperatureF", "Sea_Level_PressureIn", "VisibilityMPH", }, Values = new string[, ] { { pro.flightNum_value, pro.hour_value, pro.temp_value, pro.seaLevelPressure_value, pro.visibility_value }, } } }, }, GlobalParameters = new Dictionary <string, string>() { } }; string apiKey = api; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey); client.BaseAddress = new Uri(uri); HttpResponseMessage response = client.PostAsJsonAsync("", scoreRequest).Result; if (response.IsSuccessStatusCode) { string Jsonresponse = response.Content.ReadAsStringAsync().Result; var responseBody = JsonConvert.DeserializeObject <RRSResponseObject>(Jsonresponse); if (responseBody.Results.output1.value.Values[0][5].Equals("1", StringComparison.Ordinal)) { txtBox.Text = "Cancelled"; } else { txtBox.Text = "Not Cancelled"; } } } }
protected void do_Prediction(object sender, EventArgs e) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); InitializeDictionary(dictionary); PredictedValueClass predicted = new PredictedValueClass(); predicted.date_value = txtBoxDate.Text; predicted.hour_value = txtDropBoxHour.Text; predicted.arrivalTime_value = txtArrivalTime.Text; predicted.departureDelay_value = txtDepartureDelay.Text; predicted.flightNum_value = txtFlightNum.Text; predicted.visibility_value = txtVisibility.Text; string dateTime = predicted.date_value; DateTime dt = Convert.ToDateTime(dateTime); predicted.day_value = dt.Day.ToString(); predicted.dayofweek_value = dictionary[dt.DayOfWeek.ToString()]; Prediction.predict(predicted, txtRegression); }
public static void calculate(string api, string uri, TextBox txtBox, PredictedValueClass pro) { using (var client = new HttpClient()) { var scoreRequest = new { Inputs = new Dictionary <string, StringTablepricepred>() { { "input1", new StringTablepricepred() { ColumnNames = new string[] { "Month", "UniqueCarrier", "Origin", "Dest", }, Values = new string[, ] { { pro.Monthvalue, pro.CarrierName, pro.origin_value, pro.destination_value }, } } }, }, GlobalParameters = new Dictionary <string, string>() { } }; string apiKey = api; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey); client.BaseAddress = new Uri(uri); HttpResponseMessage response = client.PostAsJsonAsync("", scoreRequest).Result; if (response.IsSuccessStatusCode) { string Jsonresponse = response.Content.ReadAsStringAsync().Result; var responseBody = JsonConvert.DeserializeObject <RRSResponseObject>(Jsonresponse); txtBox.Text = responseBody.Results.output1.value.Values[0][4]; } } }
public static void predict(PredictedValueClass pro, string api, string uri, TextBox txtBox) { using (var client = new HttpClient()) { var scoreRequest = new { Inputs = new Dictionary <string, StringTablePred>() { { "input1", new StringTablePred() { ColumnNames = new string[] { "DayofMonth", "DayOfWeek", "ArrTime", "FlightNum", "DepDelay", "Hour", "VisibilityMPH", }, Values = new string[, ] { { pro.day_value, pro.dayofweek_value, pro.arrivalTime_value, pro.flightNum_value, pro.departureDelay_value, pro.hour_value, pro.visibility_value }, } } }, }, GlobalParameters = new Dictionary <string, string>() { } }; string apiKey = api; client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey); client.BaseAddress = new Uri(uri); HttpResponseMessage response = client.PostAsJsonAsync("", scoreRequest).Result; if (response.IsSuccessStatusCode) { string Jsonresponse = response.Content.ReadAsStringAsync().Result; var responseBody = JsonConvert.DeserializeObject <RRSResponseObject>(Jsonresponse); txtBox.Text = responseBody.Results.output1.value.Values[0][7]; } } }