This file contains 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
object MeasureEntropy extends App { | |
val s = "measure measure here measure measure measure" | |
def entropyValue(s: String) = { | |
val m = s.split(" ").toList.groupBy((word: String) => word).mapValues(_.length.toDouble) | |
var result: Double = 0.0; | |
val len = s.split(" ").length; |
This file contains 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
# Colab: https://colab.research.google.com/drive/1rpP7Du4up36DIcELXohoUi_Q_xKbDUeA?usp=sharing | |
# gist: https://gist.github.com/aronayne/c014fc1140d0ca43ed4fcd17bd3d522e | |
def epsilon_greedy_2(epsilon, state_string, q_table_df_xo, player_name, train=False): | |
a = ArgMax(q_table_df_xo) | |
""" | |
@param Q Q values state x action -> value | |
@param epsilon for exploration |
This file contains 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
%reset -f | |
import numpy as np | |
import scipy.stats as stats | |
import math | |
np.random.seed(10) | |
realtime_prices = [10435.8, 10422.42, 10422.43, 10422.41, 10422.42, 10422.42, 10467.1, 10467.1, 10414.75, 10422.42, 10422.42, 10422.42, 10422.4, 10422.41, 10422.4, 10512.84, 10422.39, 10422.4, 10422.4, 10422.4, 10422.4, 10422.38, 10422.38, 10422.38, 10422.39, 10432.54, 10432.96, 10432.94, 10422.37, 10512.84, 10432.53, 10428.46, 10428.84, 10422.71, 10424.35, 10422.38, 10422.38, 10422.38, 10422.37, 10422.73, 10432.53, 10422.36, 10432.54, 10422.36, 10438.4, 10422.36, 10438.76, 10422.35, 10422.94, 10379.83, 10513.09, 10422.36, 10422.36, 10422.36, 10422.34, 10422.34, 10422.34, 10422.35, 10422.33, 10513.09, 10435.8, 10435.8, 10422.34, 10422.34, 10422.34, 10422.32, 10422.32, 10422.32, 10432.53, 10422.33, 10422.32, 10432.53, 10422.31, 10433.44, 10432.8, 10433.44, 10432.78, 10382.81, 10422.32, 10513.09, 10422.32, 10513.09, 10467.1, 10422.32, 10422.32, 10422.32, 10422.3, 10422.3, 10467.08, 10422.3, 10422.31, 10422.29, 10432.8, 10 |
This file contains 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
import Control.Monad (void) | |
import qualified Data.ByteString.Char8 as C | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx | |
import Language.PlutusTx.Prelude hiding (pure, (<$>)) | |
import Ledger (Address, Validator, ValidatorCtx, Value, scriptAddress, pubKeyHash) | |
import qualified Ledger.Constraints as Constraints | |
import qualified Ledger.Typed.Scripts as Scripts | |
import Playground.Contract | |
import qualified Prelude |
This file contains 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
import Control.Monad (void) | |
import qualified Data.ByteString.Char8 as C | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx | |
import Language.PlutusTx.Prelude hiding (pure, (<$>)) | |
import Ledger (Address, Validator, ValidatorCtx, Value, scriptAddress, pubKeyHash) | |
import qualified Ledger.Constraints as Constraints | |
import qualified Ledger.Typed.Scripts as Scripts | |
import Playground.Contract | |
import qualified Prelude |
This file contains 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
import Control.Monad (void) | |
import Data.Aeson (FromJSON, ToJSON) | |
import qualified Data.Text as T | |
import GHC.Generics (Generic) | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx | |
import Language.PlutusTx.Prelude | |
import Ledger | |
import qualified Ledger.Ada as Ada | |
import qualified Ledger.Constraints as Constraints |
This file contains 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
import Control.Monad (void) | |
import Data.Aeson (FromJSON, ToJSON) | |
import qualified Data.Text as T | |
import GHC.Generics (Generic) | |
import Language.Plutus.Contract | |
import qualified Language.PlutusTx as PlutusTx | |
import Language.PlutusTx.Prelude | |
import Ledger | |
import qualified Ledger.Ada as Ada | |
import qualified Ledger.Constraints as Constraints |