안녕하세요,
JSL 코드를 사용하여 XGBoost 보고서에서 일부 통계를 추출하려고합니다 (오른쪽 클릭> 데이터 테이블로 만들기 대신). 다른 플랫폼 (예 : 부스트 트리 및 부트 스트랩 포리스트)에서 문제없이이 작업을 수행하지만 어떤 이유로 XGBoost에서 작동하는 데 어려움을 겪고 있습니다.
다른 플랫폼에서는 기본적으로 내가 실행하는 테이블에 튜닝 테이블을 사용하는 스크립트가 있지만 한 번에 하나씩 맞추고 진행되는 통계를 추출합니다. 그러나 XGBoost와 함께 작동하도록 유사한 접근 방식을 수정하는 것은 작동하지 않습니다. XGBoost 보고서에 이것을 막을 수있는 것이 있습니까?
예를 들어 부트 스트랩 포리스트 모델링의 경우 다음과 같은 작업을 수행 할 수 있습니다.
Names Default To Here( 1 );
dt = Data Table( " " ); //this would be your data table used to train the model
dt_pars = Data Table( " " ); //this would be your tuning table with the parameters in it.
dt_results = dt_pars << Subset( All rows, Selected columns only( 0 ) ); //this basically duplicates the previous table for writing stats values
dt_results << New Column("Stat 1"); //for recording whichever stat you're interested in, e.g. Training R^2
dt_results << New Column("Stat 2"); //for recording whichever stat you're interested in, e.g. Validation R^2
//and so on with however many stats you want to get.
//This For Loop will run each row of the tuning table iteratively. This is really helpful for platforms that use a lot of RAM.
For( i = 1, i <= N Row( dt_pars ), i++,
NumTrees = dt_pars:Number Trees[i];
NumTerms = dt_pars:Number Terms[i];
PortBoot = dt_pars:Portion Bootstrap[i];
MinSplpTr = dt_pars:Minimum Splits per Tree[i];
MaxSplpTr = dt_pars:Maximum Splits per Tree[i];
MinSplSz = dt_pars:Minimum Size Split[i];
str = Eval Insert(
"report = (dt << Bootstrap Forest(
Y( :Y1 ), //whatever your response column is
X( :X1, :X2, :X3), //this is the list of all the x-factors
Minimum Size Split( ^MinSplSz^ ),
Validation Portion( 0.2 ),
Set Random Seed( ),
Method( \!"Bootstrap Forest\!" ),
Minimum Splits per Tree( ^MinSplpTr^ ),
Maximum Splits per Tree( ^MaxSplpTr^ ),
Portion Bootstrap( ^PortBoot^ ),
Number Terms( ^NumTerms^ ),
Number Trees( ^NumTrees^ ),
Early Stopping( 0 ),
Go,
invisible
)) << Report;"
);
Eval( Parse( str ) );
Stat_1 = report["Overall Statistics"][Number Col Box( 1 )] << Get; <U><STRONG>//this is where it doesn't work for the XGBoost report</STRONG></U>
//and so on for any other stats of interest
report << Close Window;
dt_results:Name("Stat 1")[i]=Stat_1[1];//saves the first in the list of Stat_1
dt_results:Name("Stat 2")[i]=Stat_1[2];//saves the second in the list of Stat_1
//continue on until you've recorded all the stats of interest in the dt_results data table.
);위의 방법은 RAM을 너무 많이 사용하지 않고 많은 부트 스트랩 포리스트 실행을 실행하려는 경우에 정말 잘 작동합니다. "전체 통계"개요 상자에서 RSquare, RASE, N 등을 쉽게 기록 할 수 있습니다.
비슷한 스크립트 (아래)를 실행하면 report [ "Outline Box"] [Number Col Box (1)] << Get line에서 오류가 발생합니다.
Names Default To Here( 1 );
dt = Data Table( " " ); //training data table
dt_pars = Data Table( " " ); //tuning parameter table
dt_results = dt_pars << Subset( All rows, Selected columns only( 0 ) ); //makes duplicate for writing output values to
//creates columns for the statistics to save in the results data table.
dt_results << New Column( "Stat1" );
dt_results << New Column( "Stat2" );
dt_results << New Column( "Stat3" );
dt_results << New Column( "Stat4" );
dt_results << New Column( "Stat5" );
dt_results << New Column( "Stat6 );
//this is the For Loop to run each row in the dt_pars tuning table one at a time.
For( i = 1, i <= N Row( dt_pars ), i++,
maxd = dt_pars:max_depth[i];
subsam = dt_pars:subsample[i];
colsambytree = dt_pars:colsample_bytree[i];
minchweight = dt_pars:min_child_weight[i];
al = dt_pars:alpha[i];
lam = dt_pars:lambda[i];
learnr = dt_pars:learning_rate[i];
iter = dt_pars:iterations[i];
str = Eval Insert(
"report = (dt << XGBoost(
Y( :Y1 ), //Response column
X( :X1, :X2, :X3, :X4),
Validation( :Validation), //validation column of choice
Fit(
max_depth( ^maxd^ ),
subsample( ^subsam^ ),
colsample_bytree( ^colsambytree^ ),
min_child_weight( ^minchweight^ ),
alpha( ^al^ ),
lambda( ^lam^ ),
learning_rate( ^learnr^ ),
iterations( ^iter^ )
),
SendToReport(
Dispatch( {}, \!"Launch\!", OutlineBox, {Close( 1 )} ),
Dispatch(
{\!"Launch\!", \!"Advanced Options\!"},
\!"\!",
TextEditBox,
{Fixed Size( 1, 72, 19 )}
),
Dispatch(
{\!"Launch\!", \!"Advanced Options\!"},
\!"\!",
Text Edit Box( 2 ),
{Fixed Size( 1, 72, 19 )}
),
Dispatch(
{\!"Launch\!", \!"Advanced Options\!"},
\!"\!",
Text Edit Box( 3 ),
{Fixed Size( 1, 72, 19 )}
),
Dispatch( {\!"Launch\!"}, \!"\!", PictureBox, {Set Summary Behavior( \!"Collapse\!" )} ),
Dispatch( {}, \!"Model 1\!", OutlineBox, {Close( 1 )} ),
Go,
invisible
)) << Report;"
);
Eval( Parse( str ) );
Stat_1= report["Compare"][Number Col Box(1)] << Get;
//and so on for the other stats to be saved
report << Close Window;
dt_results:Name( "Stat1" )[i] = Stat_1;//saves the value to the data table dt_results
//and so on for the other stats to record in the results data table.
); Train RSquare 등과 같이 "비교"[Table Box (1)]에 나오는 각 적합에 대한 통계를 얻으려고하는데 Number Col Box에 대한 참조가 작동하지 않는 것 같습니다. () 1, 2, 3, 4 등에 어떤 값이 있는지는 중요하지 않습니다. 그들은 모두 같은 오류를 던집니다. 각 적합 후에 훈련 및 검증을 위해 RSqaure, Corr 및 RMSE 값을 저장하고 싶습니다. "모델 1"개요 상자, 하위 "예측 된 실제"아래에서 시도하고 훈련 결과 및 검증 결과에 대해 Number Col Box () (예 : (12 또는 13))를 찾아서 시도해도 거기에서 값을 추출하기 위해 로그 파일에 오류가 발생합니다.
내가 얻는 오류는 다음과 같습니다.
'report [ "Compare"] [Number Col Box (1)]', report [ "Compare"] [/ * ### * / Number Col Box (1)]의 액세스 또는 평가에서 개체를 구독 할 수 없습니다.
다음 스크립트에서 / * ### * /로 표시된 오류
Stat_1 = report [ "Compare"] [/ * ### * / Number Col Box (1)] << Get
괄호 나 "접착제"가 빠진 것이 아니라는 것을 알고 있습니다. 스크립트에서.
다른 보고서에서 값을 추출 할 수있는 이유를 이해하지 못하지만 XGBoost 보고서에서는이를 수행 할 수없는 것 같습니다. JSL 코드에 빠진 것이 있습니까?
핫 버튼으로 수정하지 않는 한 "비교"개요 상자가 항상 Corr 및 RMSE 값을 표시하지 않기 때문에 "모델 1"개요 상자에서 숫자를 얻는 것이 더 나을 것이라고 생각합니다.
이것에 대한 모든 생각 / 제안은 대단히 감사합니다.
미리 감사드립니다.
DS
안녕하세요 @DS , XGBoost 출력 개체 및 해당 보고서는 아직 직접 스크립팅 할 수 없습니다. 현재 출력 번호를 추출 할 수있는 유일한 방법은 출력 창을 직접 참조하는 것입니다. 예를 들어 assign w = window ( ""), 여기서 <title>은 JMP가 XGBoost 출력에 할당하는 창 이름입니다. 그런 다음 w를 보고서로 처리하여 디스플레이 트리의 모든 항목에 액세스 할 수 있습니다. 전체 디스플레이 트리를 표시하려면 상단 XGBoost 펼침 삼각형> 편집> 트리 구조 표시를 마우스 오른쪽 버튼으로 클릭합니다.