ExpectedRiskValue

No algorithm description given

This class defines the expected rate value based of a risk. We use the next formula: E(R) = [(p(P))] - [(1-p)(L)] The expectative consist of certain probabilities of win or loss and the amount of the factors that you win or loss. If the rate of return if is > 0, We can win depending of the risk. E(R) is calculated in term of each individual game. p = probability of win. 1-p = probability of loss. P = win factor. L = loss factor. Examples: 1.- I am going to flipping a coin, if the coin gets head I win $10, else I loss $10. Will I take the risk? E(R) = (0.5*10) - (1-0.5)(10) = 0 So I wont. because the rate of return is 0, there is no money!! INPUT: [0.5, 1, 1] 2.- If I win I get $2, else I loss $1. I have 60% probability to loss and 40% of win. E(R) = (0.4*2) - (1-0.4)(1) = 0.2 So the average rate of return is $0.20 each game. Maybe I will. INPUT: [0.4, 2, 1] 3.- I win $2 if the thin wrestler win, else $1 if fat wrestler win. If thin wrestler has 30% probability to win. Will I take the risk for this wrestling? E(R) = (0.3*2) - (1-0.3)(1) = 0.6 - 0.7 = -0.1 So I wont. I loss -0.1 each game, so If I play 100 times -> 100-0.1=10. I could loss $10 INPUT: [0.3, 2, 1]

Tags
(no tags)

Cost Breakdown

0 cr
royalty per call
1 cr
usage per second
avg duration

Cost Calculator

API call duration (sec)
×
API calls
=
Estimated cost
per calls
for large volume discounts
For additional details on how pricing works, see Algorithmia pricing.

No permissions required

This algorithm does not require any special permissions.


To understand more about how algorithm permissions work, see the permissions documentation.

1. Type your input

2. See the result

Running algorithm...

3. Use this algorithm

curl -X POST -d '{{input | formatInput:"curl"}}' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY' https://api.algorithmia.com/v1/algo/laishidua/ExpectedRiskValue/0.1.4
View cURL Docs
algo auth
# Enter API Key: YOUR_API_KEY
algo run algo://laishidua/ExpectedRiskValue/0.1.4 -d '{{input | formatInput:"cli"}}'
View CLI Docs
import com.algorithmia.*;
import com.algorithmia.algo.*;

String input = "{{input | formatInput:"java"}}";
AlgorithmiaClient client = Algorithmia.client("YOUR_API_KEY");
Algorithm algo = client.algo("algo://laishidua/ExpectedRiskValue/0.1.4");
AlgoResponse result = algo.pipeJson(input);
System.out.println(result.asJsonString());
View Java Docs
import com.algorithmia._
import com.algorithmia.algo._

val input = {{input | formatInput:"scala"}}
val client = Algorithmia.client("YOUR_API_KEY")
val algo = client.algo("algo://laishidua/ExpectedRiskValue/0.1.4")
val result = algo.pipeJson(input)
System.out.println(result.asJsonString)
View Scala Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://laishidua/ExpectedRiskValue/0.1.4")
           .pipe(input)
           .then(function(output) {
             console.log(output);
           });
View Javascript Docs
var input = {{input | formatInput:"javascript"}};
Algorithmia.client("YOUR_API_KEY")
           .algo("algo://laishidua/ExpectedRiskValue/0.1.4")
           .pipe(input)
           .then(function(response) {
             console.log(response.get());
           });
View NodeJS Docs
import Algorithmia

input = {{input | formatInput:"python"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('laishidua/ExpectedRiskValue/0.1.4')
print algo.pipe(input)
View Python Docs
library(algorithmia)

input <- {{input | formatInput:"r"}}
client <- getAlgorithmiaClient("YOUR_API_KEY")
algo <- client$algo("laishidua/ExpectedRiskValue/0.1.4")
result <- algo$pipe(input)$result
print(result)
View R Docs
require 'algorithmia'

input = {{input | formatInput:"ruby"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('laishidua/ExpectedRiskValue/0.1.4')
puts algo.pipe(input).result
View Ruby Docs
use algorithmia::*;

let input = {{input | formatInput:"rust"}};
let client = Algorithmia::client("YOUR_API_KEY");
let algo = client.algo('laishidua/ExpectedRiskValue/0.1.4');
let response = algo.pipe(input);
View Rust Docs
Discussion
  • {{comment.username}}