이름이 확인되지 않음: 목록에서 값으로 지정하면 열 이름이 확인되지 않습니다.데이터 테이블의 각 열에 대한 AUC를 계산하려고 합니다. 모든 열 이름을 "colNamesList" 목록으로 수집하고 목록 아래 첨자를 증가시켜 For 루프 내에서 Fit Model의 각 열 이름을 검색합니다. 그러나 배열에 대한 호출은 Fit Model 호출 내에서 확인되지 않습니다.별도의 줄에 show(colNamesList[i])를 포함하면 Fit Model 호출 내부가 아닌 문제가 해결됩니다. 이 포럼의 이전 게시물에 있는 스크립트를 사용하고 있는데 이전 버전의 JMP(버전 9.0.0)에는 약간 다른 구문이 필요한 것 같습니다. 어떤 아이디어라도 감사하겠습니다.
Names Default To Here( 1 );
// Open and example data table
dt = Open( "sample.jmp" );
// Get the columns to be analyzed
colNamesList = dt << get column names( string );
// Create a data table to save the results to
dtOutput = New Table( "Results", New Column( "var_name", character ), New Column( "AUC", character ) );
// Loop across all of the columns to be analyzed and retrieve the AUC
For( i = 1, i <= N Items( colNamesList ), i++,
// Add a new row to the output data table
dtOutput << Add Rows( 1 );
// Add the active variable name to the current row in the data table
dtOutput:var_name[i] = colNamesList[i];
// Run the Logistic Regression
theLog = dt << Fit Model(invisible, Y( :case ),Effects( column (colNameList[i]) ),Personality( Nominal Logistic ),Run(Positive Level( "1" ),Likelihood Ratio Tests( 1 ),ROC Curve( 1 ),));
// Add the AUC to the data table by grabbing it from the display report output
dtOutput:AUC = (Report( theLog )["Receiver Operating Characteristic"][numberbox(1)] << get text);
// Close the report window
Report( theLog ) << close window;
);
로그의 오류는 다음과 같습니다.
Name Unresolved: colNameList{1}
in access or evaluation of 'colNameList' , colNameList
Exception in platform launch{1}
in access or evaluation of 'Fit Model' , Fit Model(
invisible,
Y( :case ),
Effects( Column( colNameList[i] ) ),
Personality( Nominal Logistic ),
Run( Positive Level( "1" ), Likelihood Ratio Tests( 1 ), ROC Curve( 1 ) )
)
In the following script, error marked by /*###*/
Fit Model(
invisible,
Y( :case ),
Effects( Column( colNameList/*###*/[i] ) ),
Personality( Nominal Logistic ),
Run( Positive Level( "1" ), Likelihood Ratio Tests( 1 ), ROC Curve( 1 ) )
)
Cannot subscript Display Box{1}
in access or evaluation of 'Subscript' , Report( theLog )["Receiver Operating Characteristic"]
In the following script, error marked by /*###*/
Names Default To Here( 1 );
dt = Open( "sample.jmp" );
colNamesList = dt << get column names( string );
dtOutput = New Table( "Results",
New Column( "var_name", character ),
New Column( "AUC", character )
);
For( i = 1, i <= N Items( colNamesList ), i++,
dtOutput << Add Rows( 1 );
dtOutput:var_name[i] = colNamesList[i];
theLog = dt << Fit Model(/*###*/invisible,
Y( :case ),
Effects( Column( colNameList[i] ) ),
Personality( Nominal Logistic ),
Run( Positive Level( "1" ), Likelihood Ratio Tests( 1 ), ROC Curve( 1 ) )
);
dtOutput:AUC = Report( theLog )[/*###*/"Receiver Operating Characteristic"][
numberbox( 1 )] << get text;
Report( theLog ) << close window;
);자동화 및 스크립팅윈도우Re: 이름이 확인되지 않았습니다. 목록에서 값으로 지정하면 열 이름이 확인되지 않습니다.- 이름이 확인되지 않은 이유는 목록 colNamesList를 호출하고 이를 colNameLise로 참조했기 때문입니다.
- AUC 값은 정의된 행에 배치되어야 하므로 dtOutput:AUC에 아래 첨자를 추가해야 합니다.
Names Default To Here( 1 );
// Open and example data table
dt = Open( "sample.jmp" );
// Get the columns to be analyzed
colNamesList = dt << get column names( string );
// Create a data table to save the results to
dtOutput = New Table( "Results", New Column( "var_name", character ), New Column( "AUC", character ) );
// Loop across all of the columns to be analyzed and retrieve the AUC
For( i = 1, i <= N Items( colNamesList ), i++,
// Add a new row to the output data table
dtOutput << Add Rows( 1 );
// Add the active variable name to the current row in the data table
dtOutput:var_name[i] = colNamesList[i];
// Run the Logistic Regression
theLog = dt << Fit Model(
invisible,
Y( :case ),
Effects( Column( colNamesList[i] ) ),
Personality( Nominal Logistic ),
Run( Positive Level( "1" ), Likelihood Ratio Tests( 1 ), ROC Curve( 1 ) )
);
// Add the AUC to the data table by grabbing it from the display report output
dtOutput:AUC[i] = (Report( theLog )["Receiver Operating Characteristic"][numberbox( 1 )] << get text);
// Close the report window
Report( theLog ) << close window;
);
Re: 이름이 확인되지 않았습니다. 목록의 값으로 지정하면 열 이름이 확인되지 않습니다.네, 그건 오타였고 그것을 고치는 것이 해결책의 일부였으니 봐주셔서 감사합니다. 여전히 "열{1}을 찾을 수 없습니다" 오류가 발생했으며 열을 지정할 때 Column(colNamesList[i]) 대신 Column(dt, colNamesList[i]) 데이터 테이블을 참조하여 문제가 해결되었습니다. 그런 다음 "응답도 요인이 아니어야 합니다. ^1case"라는 오류가 발생하여 응답 열을 무시하는 IF 문을 추가했습니다.이것은 AUC에 아래 첨자를 추가했는지 여부에 따라 실행되었습니다.
여기 내 첫 번째 jsl 스크립트가 있습니다. 꽤 학습 경험이었습니다. 도움을 주신 txnelson에게 감사드립니다!
Names Default To Here( 1 );
// Open and example data table
dt = Open( "sample.jmp" );
// Get the columns to be analyzed
colNamesList = dt << get column names( string );
// Create a data table to save the results to
dtOutput = New Table( "Results", New Column( "var_name", character ), New Column( "AUC", character ) );
// Loop across all of the columns to be analyzed and retrieve the AUC
For( i = 1, i <= N Items( colNamesList ), i++,
// Add a new row to the output data table
dtOutput << Add Rows( 1 );
// Add the active variable name to the current row in the data table
dtOutput:var_name[i] = colNamesList[i];
//Get the next column name
colName = colNamesList[i];
// If the column is "case", leave AUC blank, otherwise run the Logistic Regression
if(colName=="case", AUC=.,
theLog = dt << Fit Model(
invisible,
Y(:case),
Effects(column(dt,colName)),
Personality( Nominal Logistic ),
Run(
Positive Level( "1" ),
Likelihood Ratio Tests( 1 ),
ROC Curve( 1 ),
)
);
// Add the AUC to the data table by grabbing it from the display report output
dtOutput:AUC[i] = (Report( theLog )["Receiver Operating Characteristic"][numberbox(1)] << get text);
);
// Close the report window
Report( theLog ) << close window;
);Re: 이름이 확인되지 않았습니다. 목록의 값으로 지정하면 열 이름이 확인되지 않습니다.잘 했어!
줄을 다음으로 변경하면 오류 응답을 피할 수 있습니다.
try(Report( theLog ) << close window);
또한 단일 명령문에 대한 중복 할당을 제거하여 JSL을 더 효율적으로 실행하고 단축할 수 있습니다.
colName = dtOutput:var_name[i] = colNamesList[i];