Bayesian Score - PHP Online
Form of PHP Sandbox
Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php
in the places where the PHP script should be executed.
Result of php executing
Full code of Bayesian Score.php
- <?php
- $avg_num_reviews = 20.166666666667;
- $avg_rating = 4.7162534435262;
- $provider_1_reviews = 1;
- $provider_1_score = 4.3333333333333;
- $provider_2_reviews = 80;
- $provider_2_score = 4.6791666666667;
- function ba_score($avg_num_votes, $avg_rating, $this_num_votes, $this_rating) {
- $bayesian_rating =
- ( ($avg_num_votes * $avg_rating) + ($this_num_votes * $this_rating) )
- /
- ($avg_num_votes + $this_num_votes)
- ;
- return $bayesian_rating;
- }
- echo "Provider 1: " . ba_score($avg_num_reviews, $avg_rating, $provider_1_reviews, $provider_1_score);
- echo '<br>';
- echo "Provider 2: " . ba_score($avg_num_reviews, $avg_rating, $provider_2_reviews, $provider_2_score);
File Description
- Bayesian Score
- PHP Code
- 23 Nov-2020
- 700 Bytes
You can Share it:
Latest PHP Pastes