Making the value approaches to 0 as K increases.

1 回表示 (過去 30 日間)
Aftab Ahmed Khan
Aftab Ahmed Khan 2014 年 10 月 8 日
編集済み: Aftab Ahmed Khan 2014 年 10 月 8 日
Hi, I have this one line in my code for the value of Epsilon (Epsilon Greedy Algorithm) which i want to approach to zero as k increases (1.2.3......10000), but by doing so as in the following line, it gets below 1 even when k = 2, so i want the epsilon value to approach to 0 but a little bit slowly. Thank you so much.
epsilon = 1/k;

採用された回答

Geoff Hayes
Geoff Hayes 2014 年 10 月 8 日
Aftab - If you want to slow down epsilon's approach to zero as k increases, then you could do something like the following
% create an array of linearly spaced numbers
epsilonVector = fliplr(linspace(eps,1,10000));
So the linspace function will create a vector of 10000 numbers that are linearly spaced between eps and 1. We then flip the vector from right to left so that epsilonVector(1) is 1, and epsilonVector(10000) is eps. If you want different lower and upper bounds on epsilon, then you can change the inputs to linspace.
I'm not sure how you want to use epsilon in your algorithm; perhaps an alternative approach is needed if you don't want linearly spaced points.
  1 件のコメント
Aftab Ahmed Khan
Aftab Ahmed Khan 2014 年 10 月 8 日
Hi Geoff, I think your approach will work for me, i will test it tomorrow morning. I think it is according to my requirement. i will let you know tomorrow.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDialog Boxes についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by