722件ヒット
[701-722件を表示]
(0.147秒)
別のキーワード
ライブラリ
- ビルトイン (202)
-
cgi
/ html (48) - etc (96)
-
net
/ ftp (10) -
net
/ imap (12) - openssl (240)
- pathname (24)
- pp (12)
- prettyprint (12)
- shell (6)
-
shell
/ command-processor (6) -
shell
/ filter (6) -
webrick
/ httpauth / htgroup (48)
クラス
-
Etc
:: Group (96) - File (12)
- MatchData (34)
-
Net
:: FTP :: MLSxEntry (10) -
Net
:: IMAP :: Address (12) -
OpenSSL
:: PKey :: EC (24) -
OpenSSL
:: PKey :: EC :: Group (204) -
OpenSSL
:: PKey :: EC :: Point (12) - PP (12)
- Pathname (24)
- PrettyPrint (12)
- Shell (6)
-
Shell
:: CommandProcessor (6) -
Shell
:: Filter (6) - Thread (12)
- ThreadGroup (48)
-
WEBrick
:: HTTPAuth :: Htgroup (48)
モジュール
-
CGI
:: HtmlExtension (48) - Enumerable (96)
キーワード
- == (12)
- add (24)
-
asn1
_ flag (12) -
asn1
_ flag= (12) - bytebegin (2)
- byteend (2)
- byteoffset (6)
-
checkbox
_ group (24) - chown (42)
- cofactor (12)
-
curve
_ name (12) - degree (12)
- enclose (12)
- enclosed? (12)
- eql? (12)
- facts (10)
- flush (12)
- generator (12)
- gid (12)
- gid= (12)
- grep (24)
- group= (12)
-
group
_ by (24) - lchown (12)
- list (12)
- mailbox (12)
-
max
_ by (48) - mem (12)
- mem= (12)
- members (12)
- name (12)
- name= (12)
-
object
_ group (12) - offset (24)
- order (12)
- passwd (12)
- passwd= (12)
-
point
_ conversion _ form (12) -
point
_ conversion _ form= (12) -
radio
_ group (24) - reload (12)
- seed (12)
- seed= (12)
-
set
_ generator (12) -
to
_ der (12) -
to
_ pem (12) -
to
_ text (12)
検索結果
-
Enumerable
# max _ by(n) -> Enumerator (13.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...{
a = %w(albatross dog horse)
a.max_by # => #<Enumerator: ["albatross", "dog", "horse"]:max_by>
a.max_by { |x| x.length } # => "albatross"
//}
//emlist[例][ruby]{
a = %w[albatross dog horse]
a.max_by(2) # => #<Enumerator: ["albatross", "dog", "horse"]:max_by(2)......{|x| x.length } # => ["albatross", "horse"]
//}
//emlist[例: enum.max_by(n)は、重み付きランダムサンプリングを実装するために使用できます。次の実装例は、Enumerable#wsampleを使用します。][ruby]{
module Enumerable
# weighted random sampling.
#
#......Pavlos S. Efraimidis, Paul G. Spirakis
# Weighted random sampling with a reservoir
# Information Processing Letters
# Volume 97, Issue 5 (16 March 2006)
def wsample(n)
self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x... -
Enumerable
# max _ by(n) {|item| . . . } -> Array (13.0) -
各要素を順番にブロックに渡して実行し、 その評価結果を <=> で比較して、 最大であった値に対応する元の要素、もしくは最大の n 要素が降順で入った配列を返します。
...{
a = %w(albatross dog horse)
a.max_by # => #<Enumerator: ["albatross", "dog", "horse"]:max_by>
a.max_by { |x| x.length } # => "albatross"
//}
//emlist[例][ruby]{
a = %w[albatross dog horse]
a.max_by(2) # => #<Enumerator: ["albatross", "dog", "horse"]:max_by(2)......{|x| x.length } # => ["albatross", "horse"]
//}
//emlist[例: enum.max_by(n)は、重み付きランダムサンプリングを実装するために使用できます。次の実装例は、Enumerable#wsampleを使用します。][ruby]{
module Enumerable
# weighted random sampling.
#
#......Pavlos S. Efraimidis, Paul G. Spirakis
# Weighted random sampling with a reservoir
# Information Processing Letters
# Volume 97, Issue 5 (16 March 2006)
def wsample(n)
self.max_by(n) {|v| rand ** (1.0/yield(v)) }
end
end
e = (-20..20).to_a*10000
a = e.wsample(20000) {|x|
Math.exp(-(x...