2017-03-21 8 views
-1

私はEnterprise Minerで働いていて、this video from SASを見ました。彼は簡単にSVMモデルの束を実行するためのSASコードノードを示しています。SASコードで多くのSVMモデルを実行するには?

彼はすべてを表示していませんでしたが、これをどうやって行うのか不思議に思っていました。ここで私は、これまで取得することができたものです。

%macro hpsvm (run=1,runLabel=,penalty=10,method=activeSet,kernel=TBF); 

    proc hpsvm data=&em_import_data maxiter=25 metho = &method. tolerance=0.000001 c = &penalty.; 
     input %em_internal_input/level = interval; 
     target %em_target/level = binary ; 
     lernel &kernel.; 
     partition fraction (validate=.3 seed=12345); 
     ods output fitStatistics=fitStats&run.; 
    run; 

    data firStats&run.; 
     length method $ 10; 
     length kernel $ 10; 
     length runLabel $ 64; 
     set fitStats&run.; 
     run = &run; 
     runLabel = "&runLabel"; 
     method="&method."; 
     kernel="&kernel."; 
     penalty=&penalty.; 
    run; 

    proc print data=fitStats&run.; 
    run; 

    proc append base=fitStats data=firStats&run.; 

%mend hpsvm; 

%hpsvm(run=1,runLabel=RBF c=1, method=activeSet, kernel=RBF,penalty=1); 
%hpsvm(run=2,runLabel=RBF c=5, method=activeSet, kernel=RBF,penalty=5); 
%hpsvm(run=3,runLabel=RBF c=10, method=activeSet, kernel=RBF,penalty=10); 
%hpsvm(run=4,runLabel=RBF c=15, method=activeSet, kernel=RBF,penalty=15); 
%hpsvm(run=5,runLabel=RBF c=20, method=activeSet, kernel=RBF,penalty=20); 

%hpsvm(run=6,runLabel=Linear c=1, method=ipoint, kernel=linear,penalty=1); 
%hpsvm(run=7,runLabel=Linear c=5, method=ipoint, kernel=linear,penalty=5); 
%hpsvm(run=8,runLabel=Linear c=10, method=ipoint, kernel=linear,penalty=10); 
%hpsvm(run=9,runLabel=Linear c=15, method=ipoint, kernel=linear,penalty=15); 
%hpsvm(run=10,runLabel=Linear c=20, method=ipoint, kernel=linear,penalty=20); 

%hpsvm(run=11,runLabel=Polynomial c=1, method=ipoint, kernel=POLYNOM,penalty=1); 
%hpsvm(run=12,runLabel=Polynomial c=5, method=ipoint, kernel=POLYNOM,penalty=5); 
%hpsvm(run=13,runLabel=Polynomial c=10, method=ipoint, kernel=POLYNOM,penalty=10); 
%hpsvm(run=14,runLabel=Polynomial c=15, method=ipoint, kernel=POLYNOM,penalty=15); 
%hpsvm(run=15,runLabel=Polynomial c=20, method=ipoint, kernel=POLYNOM,penalty=20); 

%hpsvm(run=16,runLabel=Sigmoid c=1, method=activeSet, kernel=SIGMOID,penalty=1); 
%hpsvm(run=17,runLabel=Sigmoid c=5, method=activeSet, kernel=SIGMOID,penalty=5); 
%hpsvm(run=18,runLabel=Sigmoid c=10, method=activeSet, kernel=SIGMOID,penalty=10); 
%hpsvm(run=19,runLabel=Sigmoid c=15, method=activeSet, kernel=SIGMOID,penalty=15); 
%hpsvm(run=20,runLabel=Sigmoid c=20, method=activeSet, kernel=SIGMOID,penalty=20); 

data fitStats; 
    retain run runLabel method kernal penalty; 
    set fitStats; 
run; 

%em_register(type=Data,key=fitStats); 

data &em_user_fitStats; 
    retain Penalty; 
    set fitStats; 
run; 

%em_report(viewType=data,key=fitStats,autodisplay=y,description=Fit Statistics by Run); 

%em_register(type=Data,key=Error); 

これについて注意すべきいくつかのこと:

  • は、私はUCI からMillionSongDatasetを使用して(しかし、私はどのように出力データに知らせていますこれは私が作ることができる唯一のエラーは引用符や半を持っていない程度のものである前のノード(データパーティション)
  • からのデータを使用して実行する必要があります良いSOためのフォーマット、と私はここにいくつかを追加します)
  • 右の肋骨の結腸SASのコーディング経験はほとんどありません。
  • 残りの1/5のコードは表示されませんでした。

多くのSVMモデルを実行して最適なモデルを見つけるためのさまざまなオプションを試してみたいと思っています。

+0

今のところ、これはSOの質問として実際には管理できません。それは大きすぎて細部があまりにも小さい。特定のエラーを指定する必要があります。もう一つは、試してみる前にもう少し学習をする必要があるように思えます。これは簡単なことではなく、基本的にSASコーディング経験がなければ、今はもっと問題だと思います。 – Joe

+0

@Joeあなたが話していることは分かりません。 Enterprise Managerを数週間使用してみると、同じことが起こります。 –

+0

@TravisHeeter Enterprise Minerを意味しますか?またはModel Manager? SAS EMは使いにくいですが、Joeの発言とはまったく関係がありません。私はあなたの尋ねるものが何であるかも分かりません。上記のコードは動作しませんか?マクロを構築する前に、作業コードを用意し、マクロ変数を段階的に追加する必要があります。あなたのコードにはいくつかの間違いがありますが、最後に欠けていることが最も明白ですが、必ずしも致命的なエラーではありません。あなたはエラーのあるログを投稿していません.... – Reeza

答えて

0

SASは実際に私にコードをメールしました!

%macro hpsvm (run=1,runLabel=,penalty=10,method=activeSet,kernel=RBF); 


    proc hpsvm data=&em_import_data maxiter=25 method = &method. tolerance=0.000001 c = &Penalty.; 
    input %em_interval_input/level = interval; 
    target %em_target/level = binary ; 
    kernel &kernel.; 
    partition fraction (validate=.3 seed=12345); 
    ods output fitStatistics=fitStats&run.; 
    run; 

    data fitStats&run.; 
    length method $ 10; 
    length kernel $ 10; 
    length runLabel $ 64; 
    set fitStats&run.; 
    run = &run; 
    runLabel = "&runLabel"; 
    method="&method."; 
    kernel="&kernel."; 
    penalty=&penalty.; 
    run; 

    proc print data=fitStats&run.; 
    run; 

    proc append base=fitStats data=fitStats&run.; 
    run; 

%mend hpsvm; 

%hpsvm(run=1,runLabel=RBF c=1,method=activeSet,kernel=RBF,penalty=1); 
%hpsvm(run=2,runLabel=RBF c=5,method=activeSet,kernel=RBF,penalty=5); 
%hpsvm(run=3,runLabel=RBF c=10,method=activeSet,kernel=RBF,penalty=10); 
%hpsvm(run=4,runLabel=RBF c=15,method=activeSet,kernel=RBF,penalty=15); 
%hpsvm(run=5,runLabel=RBF c=20,method=activeSet,kernel=RBF,penalty=20); 

%hpsvm(run=6,runLabel=Linear c=1,method=ipoint,kernel=linear,penalty=1); 
%hpsvm(run=7,runLabel=Linear c=5,method=ipoint,kernel=linear,penalty=5); 
%hpsvm(run=8,runLabel=Linear c=10,method=ipoint,kernel=linear,penalty=10); 
%hpsvm(run=9,runLabel=Linear c=15,method=ipoint,kernel=linear,penalty=15); 
%hpsvm(run=10,runLabel=Linear c=20,method=ipoint,kernel=linear,penalty=20); 

%hpsvm(run=11,runLabel=RBF c=1,method=ipoint,kernel=POLYNOM,penalty=1); 
%hpsvm(run=12,runLabel=RBF c=5,method=ipoint,kernel=POLYNOM,penalty=5); 
%hpsvm(run=13,runLabel=RBF c=10,method=ipoint,kernel=POLYNOM,penalty=10); 
%hpsvm(run=14,runLabel=RBF c=15,method=ipoint,kernel=POLYNOM,penalty=15); 
%hpsvm(run=15,runLabel=RBF c=20,method=ipoint,kernel=POLYNOM,penalty=20); 

%hpsvm(run=16,runLabel=Linear c=1,method=activeSet,kernel=SIGMOID,penalty=1); 
%hpsvm(run=17,runLabel=Linear c=5,method=activeSet,kernel=SIGMOID,penalty=5); 
%hpsvm(run=18,runLabel=Linear c=10,method=activeSet,kernel=SIGMOID,penalty=10); 
%hpsvm(run=19,runLabel=Linear c=15,method=activeSet,kernel=SIGMOID,penalty=15); 
%hpsvm(run=20,runLabel=Linear c=20,method=activeSet,kernel=SIGMOID,penalty=20); 


data fitStats; 
    retain run runLabel method kernel penalty; 
    set fitStats; 
run; 


proc print data=fitStats; 
run; 


%em_register(type=Data,key=fitStats); 

data &em_user_fitStats; 
    retain Penalty; 
    set fitStats; 
run; 

%em_report(viewType=data,key=fitStats,autodisplay=y,description=Fit Statistics by Run); 

%em_register(type=Data,key=Error); 

data &em_user_Error; 
    set fitStats; 
    if statistic = 'Error'; 
run; 

%em_report(viewType=lineplot,key=Error,x=penalty,y=validation,group=kernel,description=Classification Error by penalty,autodisplay=y); 


%em_register(type=Data,key=Sensitivity); 

data &em_user_Sensitivity; 
    set fitStats; 
    if statistic = 'Sensitivity'; 
run; 

%em_report(viewType=lineplot,key=Sensitivity,x=penalty,y=validation,group=kernel,description=Sensitivity by penalty,autodisplay=y); 


%em_register(type=Data,key=Specificity); 

data &em_user_Specificity; 
    set fitStats; 
    if statistic = 'Specificity'; 
run; 

%em_report(viewType=lineplot,key=Specificity,x=penalty,y=validation,group=kernel,description=Specificity by penalty,autodisplay=y); 
関連する問題