Nombre sin resolver: el nombre de la columna no se resolverá cuando lo especifique como valor en una listaEstoy intentando calcular el AUC para cada columna de una tabla de datos. Estoy recopilando todos los nombres de las columnas en una lista "colNamesList" y recuperando cada nombre de columna en Ajustar modelo dentro de un bucle For incrementando el subíndice de la lista. Sin embargo, la llamada a la matriz no se resuelve dentro de la llamada Ajustar modelo.Si incluyo show(colNamesList[i]) en una línea separada, se resuelve bien, pero no dentro de la llamada Fit Model. Estoy usando un script de una publicación anterior en este foro y sospecho que mi versión anterior de JMP (versión 9.0.0) solo necesita una sintaxis ligeramente diferente. Cualquier idea sería apreciada.
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;
);
El error en el registro es el siguiente:
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;
);Automatización y secuencias de comandosventanasRe: Nombre sin resolver: El nombre de la columna no se resolverá cuando lo especifico como valor en una lista- La razón por la que el nombre no estaba resuelto es porque usted llamó a la lista, colNamesList, y hizo referencia a ella como colNameLise.
- El valor AUC debe colocarse en una fila definida, por lo tanto, debe agregar el índice a 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: Nombre sin resolver: El nombre de la columna no se resolverá cuando lo especifico como valor en una listaSí, fue un error tipográfico y arreglarlo fue parte de la solución, así que gracias por verlo. Todavía recibía el error "No se pudo encontrar la columna {1}", y se resolvió haciendo referencia a la tabla de datos al especificar la columna: Columna (dt, colNamesList[i]) en lugar de Columna (colNamesList[i]). Luego recibí el error "La respuesta tampoco debería ser un factor, ^1caso", así que agregué una declaración IF para ignorar la columna de respuesta.Esto se ejecutó si agregué el subíndice a AUC.
Aquí está mi primer script jsl. Toda una experiencia de aprendizaje. ¡Gracias a txnelson por tu ayuda!
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: Nombre sin resolver: El nombre de la columna no se resolverá cuando lo especifico como valor en una lista¡Gran trabajo!
Puede evitar la respuesta de error cambiando la línea a
try(Report( theLog ) << close window);
También puede acortar y hacer que JSL se ejecute de manera más eficiente eliminando las asignaciones duplicadas a una sola declaración.
colName = dtOutput:var_name[i] = colNamesList[i];