問題タブ [snow]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
r - ランダム フォレスト ブートストラップ トレーニングとフォレスト生成
ランダム フォレスト (dim: 47600811*9) の膨大なトレーニング データがあります。複数の (1000 としましょう) 次元 10000*9 のブートストラップ サンプル (実行ごとに 9000 のネガティブ クラスと 1000 のポジティブ クラスのデータポイントを取得) を取得し、それらすべてのツリーを繰り返し生成してから、それらすべてのツリーを 1 つのフォレストに結合します。必要なコードの大まかなアイデアを以下に示します。実際のtrainDataから置換を使用してランダムサンプルを生成し、それらのツリーを最適に繰り返し生成する方法を教えてもらえますか? とても助かります。ありがとう
実際のtrainDataからサブセットを何度も(1000回)生成する最適な方法であるかどうかはわかりません。
r - Snow Cluster で RcppZiggurat RNG-Generator を初期化する
雪のクラスターでパッケージ RcppZiggurat の RNG を使用しようとしています。各ノードで RNG をシードするには、clusterSetupRNG に組み込まれている L'Ecuyer のアルゴリズムを使用します。ただし、乱数のシーケンスは各ノードで同じであることが判明しました。clusterSetupRNG コマンドなしで実行しても、コードの結果はまったく同じままです。
これが私が試したことです:
どうすればこれを機能させることができるか考えている人はいますか? もちろん、いつでも標準の RNG rnorm に頼ることができますが、クラスタでも RcppZiggurat の速度が得られると便利です。
助けてくれてどうもありがとう!
r - R、dplyr、snow: dplyr を使用する関数を並列化する方法
myfunction
の各行に並行して適用したいとしますmyDataFrame
。otherDataFrame
が 2 つの列を持つデータフレームであるとします:でCOLUNM1_odf
何らかのCOLUMN2_odf
理由で使用されmyfunction
ます。したがって、次のようなコードを使用して記述したいと思いparApply
ます。
ここでの問題は、R が認識しないCOLUMN1_odf
ことCOLUMN2_odf
ですclusterExport
。どうすればこの問題を解決できますか? snow
それぞれを列挙しないために必要なすべてのオブジェクトを「エクスポート」する方法はありますか?
otherDataFrame
編集 1:が内部的に作成されることを指定するために、(上記のコードに) コメントを追加しましたmyfunction
。
編集2:一般化するためにいくつかの擬似コードを追加しましたmyfunction
:グローバルデータフレーム(aGlobalDataFrame
および別の関数otherFunction
)を使用するようになりました
r - R snow の stopCluster フリーズ
と を使用してクラスター コンピューターでモンテカルロ シミュレーションを実行していましsnow
たR
。R
のラインに達するまで、すべてがうまくいきstopCluster
、R
そこでフリーズし、最終的に壁の時間を超えました。の問題がわかりませんstopCluster
。
以下は、簡略化されたバージョンの私のR
スクリプトです。
上記のスクリプトはtest_stack.R
、ディレクトリの下に保存されましたmonte-carlo/R
。サーバーに送信したpbs
スクリプトは次のとおりです。
ファイルの一部をRout
以下にリストしました。で止まりstopCluster()
ます。
r - Calling external program in parallel using foreach and doSNOW: How to import results?
I'm using R to call an external program in parallel on a cluster with multiple nodes and multiple cores. The external program requires three input data files and produces one output file (all files are stored in the same subfolder).
To run the program in parallel (or rather call it in a parallel fashion) I've initially used the foreach
function together with the doParallel
library. This works fine as long as I'm just using multiple cores on a single node.
However, I wanted to use multiple nodes with multiple cores. Therefore I modified my code accordingly to use the doSNOW
library in conjunction with foreach
(I tried Rmpi
and doMPI
, but I did not manage to run the code on multiple nodes with those libraries).
This works fine, i. e. the external program is now indeed run on multiple nodes (with multiple cores) and the cluster logfile shows, that it produces the required results. The problem I'm facing now, however, is that the external program no longer stores the results/output files on the master node/in the specified subfolder of the working directory (it did so, when I was using doParallel
). This makes it impossible for me to import the results into R.
Indeed, if I check the content of the relevant folder it does not contain any output files, despite the logfile clearly showing that the external program ran successfully. I guess they are stored on the different nodes (?).
What modifications do I have to make to either my foreach
function or the way I set up my cluster, to get those files saved on the master node/in the specified subfolder in my working directory?
Here some example R code, to showcase, what I'm doing:
My pbs script for the cluster looks something like this:
r - r ループで Snow を使用して並列化する方法
時間がかかりすぎる大きなループがあります (~100 日)。Snow ライブラリで高速化したいと思っていますが、apply ステートメントは苦手です。これはループの一部にすぎませんが、この部分を理解できれば、残りは簡単です。たくさんの適用ステートメントまたはループで問題ありませんが、関数を使用してオブジェクト 'p' を取得する 1 つの適用ステートメントが理想的です。
元データ
オリジナルループ
r - as.formula、SE dplyr、およびlapplyを使用する場合、foreachパッケージはR環境をどのようにスコープしますか?
複数の数式を文字列として動的に作成し、それらを で数式にキャストする関数がありますas.formula
。doSNOW
次に、 とを使用して並列プロセスでその関数を呼び出し、 でforeach
これらの式を使用しdplyr::mutate_
ます。
使用すると、ローカルで実行すると正常に動作しますが、並列で実行するとlapply(formula_list, as.formula)
エラーが発生します。could not find function *custom_function*
ただし、使用するlapply(formula_list, function(x) as.formula(x)
と、並行してローカルで動作します。
なんで?ここで環境を理解する正しい方法と、それをコーディングする「正しい」方法は何ですか?
次のような警告が表示されます。In e$fun(obj, substitute(ex), parent.frame(), e$data) : already exporting variable(s): *custom_func*
最小限の再現可能な例を以下に示します。
編集: 元の投稿のタイトルで、nse を使用していると書きましたが、本当は標準評価を使用するつもりでした。おっと。それに応じてこれを変更しました。