This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| apiInterface=ApiClient.getApiClient().create(ApiInterface.class); | |
| Call<Pojo> call = apiInterface.getAPIResponse(vizdata); | |
| call.enqueue(new Callback<Pojo>() { | |
| @Override | |
| public void onResponse(@NonNull Call<Pojo> call, @NonNull Response<Pojo> response) { | |
| Pojo pojo=response.body(); | |
| AlertDialog alertDialog = new AlertDialog.Builder(MainActivity.this).create(); | |
| alertDialog.setTitle("Heart Prediction"); | |
| alertDialog.setMessage("Predicted Result is "+pojo.getIsHeart()); | |
| alertDialog.setButton(AlertDialog.BUTTON_NEUTRAL, "OK", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.infinitemakerz.heartdiseaseprediction; | |
| import com.google.gson.annotations.SerializedName; | |
| public class Pojo { | |
| @SerializedName("isHeart") | |
| private String isHeart; | |
| @SerializedName("CHECK") | |
| private String CHECK; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.infinitemakerz.heartdiseaseprediction; | |
| import java.util.List; | |
| import retrofit2.Call; | |
| import retrofit2.http.GET; | |
| import retrofit2.http.Query; | |
| public interface ApiInterface | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.infinitemakerz.heartdiseaseprediction; | |
| import retrofit2.Retrofit; | |
| import retrofit2.converter.gson.GsonConverterFactory; | |
| public class ApiClient | |
| { | |
| private static final String BASE_URL="https://heart-prediction.herokuapp.com"; | |
| private static Retrofit retrofit; | |
| public static Retrofit getApiClient() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Retrofit retrofit = new Retrofit.Builder() | |
| .baseUrl(“https://api.github.com/") | |
| .build(); | |
| Demo service = retrofit.create(Demo.class); | |
| Call<List<Movie>> movie = service.listMovie(“Gino Osahon”); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public interface Demo { | |
| @GET("users/{user}/repos") | |
| Call<List<Movie>> listMovie(@Path("user") String user); | |
| @GET("group/{id}/users") | |
| Call<List<User>> groupList(@Path("id") int groupId); | |
| } | |
| // Query parameters can also be added to a method. | |
| @GET(“group/{id}/users”) | |
| Call<List<User>> groupList(@Path(“id”) int groupId, @Query(“sort”) String sort); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| recomendations = model.transform(single_user) | |
| recomendations.orderBy('prediction',ascending=False).show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| single_user = test.filter(test['userId']==11).select(['movieId','userId']) | |
| # User had 10 ratings in the test data set | |
| # Realistically this should be some sort of hold out set! | |
| single_user.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from pyspark.ml.evaluation import RegressionEvaluator | |
| evaluator = RegressionEvaluator(metricName="rmse", labelCol="rating",predictionCol="prediction") | |
| rmse = evaluator.evaluate(predictions) | |
| print("Root-mean-square error = " + str(rmse)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| predictions = model.transform(test) | |
| predictions.show() |
NewerOlder